/* 
Panel controller for persistent Sliding Login Panel (slide.js)
*/
$(document).ready(function() {
// if there's no session cookie, then hide panel
if ($.cookie('panelflag') == null)
	{
		$.cookie('panelflag', 0, {path: '/'});
		$("div#panel").hide();
	}
// test cookie and show or hide panel
if ($.cookie('panelflag') == 1) 	
	{
		$("div#panel").show();
	}
	else 
	{
		$("div#panel").hide()
	}
	
	// Expand Panel
	$(".open").click(function(){
		$("div#panel").slideDown("slow");
		$.cookie('panelflag', 1, {path: '/'});
//		alert('panelflag = open') //diag
	});	
	
	// Collapse Panel
	$(".close").click(function(){
		$("div#panel").slideUp("slow");	
		$.cookie('panelflag', 0, {path: '/'});
//		alert('panelflag = closed') //diag
	});		
	
	// Switch buttons from "Log In | Register" to "Close Panel" on click
	$("#toggle a").click(function () {
		$("#toggle a").toggle();
	});		
		
});