//menu sub navigation
$(document).ready(function(){
						   
	$("#menu ul li h6").hover(function() { //When trigger is clicked...
		
		//Following events are applied to the subnav itself (moving subnav up and down)
		$(this).parent().find("ul.subnav").slideDown('fast').show(); //Drop down the subnav on click

		$(this).parent().hover(function() {
		}, function(){	
			$(this).parent().find("ul.subnav").slideUp('slow'); //When the mouse hovers out of the subnav, move it back up
		});

		//Following events are applied to the trigger (Hover events for the trigger)
		}).hover(function() { 
			$(this).addClass("subhover"); //On hover over, add class "subhover"
		}, function(){	//On Hover Out
			$(this).removeClass("subhover"); //On hover out, remove class "subhover"
	});

});

// hide boxes on full width page
$(document).ready(function(){
 jQuery('a[href*=#]').click(function() {
 if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
 && location.hostname == this.hostname) {
   var jQuerytarget = jQuery(this.hash);
   jQuerytarget = jQuerytarget.length && jQuerytarget
   || jQuery('[name=' + this.hash.slice(1) +']');
   if (jQuerytarget.length) {
  var targetOffset = jQuerytarget.offset().top;
  jQuery('html,body')
  .animate({scrollTop: targetOffset}, 1000);
    return false;
   }
 }
  });
$('.close').click(function() {
  $(this).parent('.box').fadeOut('slow');
});

});

//show and hide left menu
$(document).ready(function(){
$('.show_left_div').click(function() { 
  $(this).toggleClass("right_arrow").toggleClass("left_arrow");
  $(".hidden_left_div").animate({width: ['toggle', 'swing']}, 'medium');

	});

});

//change background
if($.cookie("css")) {
	$("#bg").attr("href",$.cookie("css"));
}
$(document).ready(function() { 
	$("#nav li a").click(function() { 
		$("#bg").attr("href",$(this).attr('rel'));
		$.cookie("css",$(this).attr('rel'), {expires: 365, path: '/'});
		return false;
	});
});
