$(document).ready(function() {	

	var current_category = getCookie("current_category");
	if(current_category!=null) {		
		$("#link"+current_category).prev().prev(".headimg").attr("src","/images/cms/ufw/02.gif");
		expires = new Date();
		expires.setTime(expires.getTime() - (1000 * 86400 * 365)); // вычисляем срок хранения cookie
		set_cookie("current_category", "", expires);
	} else {
		//$("#link1").prev().prev(".headimg").attr("src","/images/cms/ufw/02.gif");
	}
	$(".readmore").click(function() {
		var head = $(this).parent().next().children(".question").html();
		var answer = $(this).parent().next().children(".answer").html();
	
		$("#block_head").html(head);
		$("#block_answer").html(answer);
		$("#window_answer").show("blind");	//,{percent: 100},500,callback);	
		destination = jQuery("#body").offset().top+50;
		jQuery("html:not(:animated),body:not(:animated)").animate({scrollTop: destination}, 1100);		
		return false;
	});
	
	$("#window_answer_close").click(function(){		        
		$("#window_answer").hide("blind");//,{percent: 100},500,function(){}); 
        return false;
    });
		
	function callback() {
	
	}	
	
	$(".zadat_vopros").click(function(){
		$("#sendQuestion").show("slow");//,{percent: 100},500,callback);
		destination = jQuery("#body").offset().top;
		jQuery("html:not(:animated),body:not(:animated)").animate({scrollTop: destination}, 1100);
		return false;
	});
	
	$("#closeSendQuestion").click(function(){		
        $("#sendQuestion").hide("slow");//,{percent: 100},500,function(){}); 
        return false;
    });
	
	$(".link_category").click(function(){
		var v = $(this).next(":input").attr("value");		
		expires = new Date();
		expires.setTime(expires.getTime() + (1000 * 86400 * 365)); // вычисляем срок хранения cookie
		set_cookie("current_category", v, expires);		
	});

});

function close_callback() {
	$("#block_head").html("");
	$("#block_answer").html("");
}
