$(document).ready(function() {   

	$("#jqPanel").hide();
	
	//var a = $("<a>toggle header</a>").attr('href','#').addClass("btn-slide");	
	//$('#jqWrapper').before(a);
	
	$(".btn-slide").click(function(){
		if ($("#jqPanel").is(":hidden")) {
			$("#jqPanel").slideDown("slow");
			$(this).addClass("active");
			$.cookie('showTop', 'collapsed');
			return false;
		} else {
			$("#jqPanel").slideUp("slow");
			$(this).removeClass("active");
			$.cookie('showTop', 'expanded');
			return false;
		}	
   });
	
	// COOKIES
    // Header State
    var showTop = $.cookie('showTop');
    // Set the user's selection for the Header State
    if (showTop == 'collapsed') {
		$("#jqPanel").show();
		$(".btn-slide").addClass("active");
	};
	
});