/*
 * A jQuery slider on cookies
 * powered by jQuery (http://www.jquery.com)
 * 
 * Based on original code written by Bram Van der Sype (http://www.bramme.net/).
 * 
 * For more info visit http://www.bramme.net/2008/09/a-jquery-slider-on-cookies/
 *
*/

$(document).ready(function(){
	// the div that will be hidden/shown
	var panel = $("div.showhide");
	//the button that will toggle the panel
	var button = $("#show_un");
	// do you want the panel to start off collapsed or expanded?
	var initialState = "collapsed"; // "expanded" OR "collapsed"
	// the class added when the panel is hidden
	var activeClass = "hid";
	// the text of the button when the panel's expanded
	var visibleText = "Click Here";
	// the text of the button when the panel's collapsed
	var hiddenText = "Click Here";
	//---------------------------
	// don't edit below this line,
	// unless you really know what you're doing
	//---------------------------
	if($.cookie("panelState") == undefined){
		$.cookie("panelState", initialState);
	}
	var state = $.cookie("panelState");
	if(state == "collapsed") {
		panel.hide();
		button.text(hiddenText);
		button.addClass(activeClass);
	}
	button.click(function(){
		if($.cookie("panelState") == "expanded"){
			$.cookie("panelState", "collapsed");
			button.text(hiddenText);
			button.addClass(activeClass);
		} else {
			$.cookie("panelState", "expanded");
			button.text(visibleText);
			button.removeClass(activeClass);
		}
		panel.slideToggle("slow");
		return false;
	});
});

