$(document).ready(function(){
	if ($('#home_slideshow').length !== 0){
		$('#home_slideshow').cycle({
			fx: 'fade',
			speed: 1000,
			random: true,
			cleartype: true,
			timeout: 6000,
			next:   '#next', 
   			prev:   '#prev'
		});
	}	
	
    //removes divider from the last element of the nav
	$('#nav ul.nav1>li:last-child a').css({
	    'border-right' : 'none'
	});
	    	  
	// dropdown nav
    $('.nav1>li>ul').hide();
    $('.nav1 li').mouseenter(function() {
		$(this).children('ul').stop(true, true).slideDown(300);
	});
		$('.nav1 li').mouseleave(function() {
			$(this).children('ul').stop(true, true).slideUp(100);        
    });
    
    //removes border and correctly positions the first dropdown
    $('.nav1 li>ul:first').css({
    	'border-left' : 'none',
    	'margin-left' : 0
    	});
			
	// removes margin from last news event
	$('#latest_news_inner .news_event:last-child ').css('margin-bottom' , 0);
	
	//removes the subnav if it isn't present
	if ($("#subnav ul li.on").children("ul").length == 0) {
	    $("#subnav_area").remove();
	}
	
	//changes the page width on pages w/o a subnav area
	if ($("#subnav_area").children().size() == 0) {					
	    $("#main_content").css({
			"width": "auto",
	    	"padding-left": "40px",
	    	"padding-right": "40px",
	    	"float": "none"
	    });
	}

	//removes divider from the first element of the subnav
	$('#subnav ul.nav2>li:first-child a').css('border-top', 'none');

});
