// Garvan Kuskey
// www.simpletwistmedia.com
// Learn and copy the code all you want! 



$( function () {


/* ---------------------------- Define Some Funcitons ----------------------------------- */

function slideShow() {
	

	setTimeout( function(){ 
			$("#ss_3").fadeOut("slow");
			$("#ss_1").fadeIn("slow"); }, 5000 );

	setTimeout( function(){ 
			$("#ss_1").fadeOut("slow");
			$("#ss_2").fadeIn("slow"); }, 10000 );

	setTimeout( function(){ 
			$("#ss_2").fadeOut("slow");
			$("#ss_3").fadeIn("slow"); }, 15000 );

	setTimeout( function() { slideShow(); } , 15010 );

}


function openSlide() {
		$("#theslider").slideUp("slow", function(){
		
			//$("#ppicker").css({'background' : 'url(/images/open.jpg)' });			
			$.cookie('slideisup', null);
			$.cookie('slideisup', 'true', { path: '/' });
		});
	
}

function closeSlide() {
		$("#theslider").slideDown("slow", function(){
		
			//$("#ppicker").css({'background' : 'url(/images/close.jpg)' });	
			$.cookie('slideisup', null);
			$.cookie('slideisup', 'false', { path: '/' });
		});
}


/* --------------------------------------- Main ----------------------------------------- */

$.cookie('slideisup', 'true', { path: '/' });
var slide = $.cookie('slideisup');

/*
if ( slide )  // Reads the cookie to see if the slider should be up or down
{
	switch ( slide )
	{
	case "true":
	$("#theslider").css({'display' : 'none' });
	break;

	case "false":
	$("#theslider").css({'display' : 'inline-block' });
	break;
	}
}
//else { $.cookie('slideisup', 'true', { path: '/' }); }

*/

slideShow(); // Runs the slideshow

/* ----------------------------------- Click Events ------------------------------------- */


$("#ppicker").click( function() {

	slide = $.cookie('slideisup');

	if ( slide == "true" )
	{
		closeSlide();
	}
	else
	{
		openSlide();
	}



});




/* ----------------------------------- Hover Events ------------------------------------- */

$('.nav').hover(
	function() { $(this).css('background', 'url(/images/nav_hover.png)' ); },
	function() { $(this).css('background', 'transparent'); }
			);

$('#about').hover( 
			function() { $('#dropdown').css('display', 'block'); },
			function() { $('#dropdown').css('display', 'none'); }
);

$('#contact').hover( 
			function() { $('#dropdown2').css('display', 'block'); },
			function() { $('#dropdown2').css('display', 'none'); }
);



}); // Closes the entire function
