// JavaScript Document
$(document).ready(function(){
	
	var answer_type = $("#answer_type").val();
	var articles_type = $("#articles_type").val();
	var cat_id = $("#cat_id").val();
	var path = getRootPath();
	var question_file_path = path+'_question_block.php?type='+answer_type+'&cat_id='+cat_id;
	var article_file_path = path+'_article_block.php?type='+articles_type+'&cat_id='+cat_id;
	$("#answer_hot").addClass("on");
	
	if(answer_type){
		$("#answer").load(question_file_path+" #hot");
	}
	
	$("#answer_hot").click(function(){
		$("#answer_hot").addClass("on");
		$("#answer_latest").removeClass("on");
		if(answer_type){
			$("#answer").load(question_file_path+" #hot");
		}
	});
	
	$("#answer_latest").click(function(){
		$("#answer_latest").addClass("on");
		$("#answer_hot").removeClass("on");
		if(answer_type){
			$("#answer").load(question_file_path+" #latest");
		}
	});
		
	$("#tutorials_hot").addClass("on");
	if(articles_type){
		$("#tutorials").load(article_file_path+" #hot");
	}
	
	$("#tutorials_hot").click(function(){
		$("#tutorials_hot").addClass("on");
		$("#tutorials_latest").removeClass("on");
		if(articles_type){
			$("#tutorials").load(article_file_path+" #hot");
		}
	});
	
	$("#tutorials_latest").click(function(){
		$("#tutorials_latest").addClass("on");
		$("#tutorials_hot").removeClass("on");
		if(articles_type){
			$("#tutorials").load(article_file_path+" #latest");
		}
	});
	
});
