$(document).ready(function(){

//==============================
// Main Navigation Dropdowns
//==============================

$('#pages').superfish({ 
delay:       100,                             // one millasecond delay on mouseout 
animation:   {opacity:'show',height:'show'},  // fade-in and slide-down animation 
speed:       'fast',                          // faster animation speed 
autoArrows:  false,                           // disable generation of arrow mark-up 
dropShadows: false                            // disable drop shadows 
});
	
	if (!$.browser.msie) {
		$("ul.subnav li").fadeTo("fast", 0.80);
		$("ul.subnav li").mouseover(function () {
			$(this).animate({ opacity: 0.90 }, 0 );	  // Change opacity to 90%	
		}).mouseout(function(){
			$(this).animate({ opacity: 0.80}, 0 );	  // Change opacity back to 80%
		});
	}
	
//==============================
// Quick Links Dropdown
//==============================
	
	$("#top-quick-links select").change(function() {
		var link = $(this).val();
		window.location = link;
	});
	
	
//==============================
// iPhone UX Tweeks
//==============================

	if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i))) {
		$('.left').hide();
		$('.right').hide();	
		$('#top-search input').val('Search');
	}

//==============================
// Content Draw
//==============================

$("#content-drawer").css('width', '1px');
$("#content-drawer .draw").hide();


$(".close").click( function() {
	$("#content-drawer .draw").fadeOut('slow');
	$("#content-drawer").animate( { width:"0px"}, 1000 );
	$("#content-drawer .close").fadeOut('fast');
	$("#content-drawer .open").fadeIn('fast');
});

$(".open").click( function() {
	$("#content-drawer").animate( { width:"600px"}, 1000 );
	$("#content-drawer .draw").fadeIn('slow');
	$("#content-drawer .draw").fadeIn('slow');
	$("#content-drawer .open").fadeOut('fast');
	$("#content-drawer .close").fadeIn('fast');
	});

setTimeout(function(){
	$("#content-drawer").animate( { width:"600px"}, 1000 );
	$("#content-drawer .draw").fadeIn('slow');
	$("#content-drawer .draw").fadeIn('slow');
	$("#content-drawer .open").fadeOut('fast');
	$("#content-drawer .close").fadeIn('fast');	
}, 3000);

//==============================
// Search Box Tweeks
//==============================

	$('.right').click( function() {
		$('#top-search').submit();
	})
	
	$('.right').css('cursor', 'pointer');
	
//==============================
// Blog Tweeks
//==============================

	$("select[name^='wpmm'] option:first-child").prepend("Select ");

});