$(document).ready(function(){
	
	$(document).pngFix(); 
	
	var cookieStatus = $.cookie('searchThing');
	if (cookieStatus == 'open') {
		$("#search").css("margin-top","0");
		$("#trigger").html('Close');
	} 
	
	$("#trigger").toggle(
      function () {
	  if (cookieStatus == null) {	  
        	$("#search").animate({
			  "marginTop": "0"
			}, "slow", "bounceout");
			$("#trigger").html('Close');
			$.cookie('searchThing','open');
	  } else {
		    $("#search").animate({
			  "marginTop": "-103"
			}, "slow", "easeout");
			$("#trigger").html('Search');
			$.cookie('searchThing',null);  
	  }
      },
      function () {
	  if (cookieStatus == null) {	  		  
        	$("#search").animate({
			  "marginTop": "-103"
			}, "slow", "easeout");
			$("#trigger").html('Search');
			$.cookie('searchThing',null);
	  } else {
		  	$("#search").animate({
			  "marginTop": "0"
			}, "slow", "bounceout");
			$("#trigger").html('Close');
			$.cookie('searchThing','open');
	  }
	  }
    ); 
	

	
	$('#slideshow').cycle({ 
		fx:     'fade', 
		speed:   2000, 
		timeout: 4000
	 });


	var howMany = $('#features ul li').size();
	if (howMany > 0) {
		var value = (90/940)*100;
		var startWidth = 100;
		var width = ((startWidth/howMany)-value);
		$('#features').addClass('last');
		$('#features ul li').css("width", width + '%');
	} else {
		$('#features').hide();	
	}
	
	$('#footerLinks a:last').addClass('last');
	
	
	/*-----------------------------------------------------------*/

	// Figure out the location based on the browser URL
	var path = location.pathname;
	// Set your homepage here, eg. /index.php or /
	var home = "/index.htm";
	// Check the home link against the path and set the navigation accordingly. 
	if (path == home || path == "/") {
		// Note that the jQuery selector matches *only* the home link
		var $nav = $('#subMenu ul li a[@href="' + home + '"]');
	} else {
		var $nav = $('#subMenu ul li a[@href$="' + path + '"]');
	}
	// Hide all subnavigation
	$('#subMenu ul li ul').hide();
	// Add the active class to the current path and activate it's subnavigation
	$nav.siblings("ul").slideDown();
	// If the active class has subnavigation, show it
	$nav.parents("ul").fadeIn();


	/*---------------------------------------------------------------------------*/
	
	$('#mainMenu ul li:first').css('background-image','none');
	$("#main").lavaLamp({
                fx: "backout",
                speed: 700
    });
	
	
	/*
	bounceout
	elasinout
	elasout
	backin
	backinout
	backout
	*/
	
	
	/*----------------------------------------------------------------------------*/
	
	

}); //Close document.ready
$(window).bind('load', function() {



});






