$(document).ready(function() {

	$('#header_slideshow').cycle({
		fx: 'fade',
		random: true,
		speed: 1500,
		timeout: 4000
	});

	
	if ($('#slideshow').length != 0) {
		$('#slideshow').cycle({
			fx: 'fade',
			speed: 500,
			timeout: 16000,
			pause: true,
			cleartype: true,
			pager: '#slideshow_pager'
		});
	}
	
	
		//removes divider from the last element of the nav
		$('#nav ul.nav1>li:last-child').css('background-image', 'none');
				
		//cernter the nav
		var Margin = (980 - $('#nav ul.nav1').width())/2
		
		$('#nav ul.nav1').css('margin-right', Margin);
			
		
		/*
		//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": "20px",
				"padding-right": "20px",
				"float": "none"
			});
		}
		*/

	$('ul.nav1 > li > a').click(function(e) {
		if ($(this).siblings().length > 0){
			var url = ( $(this).siblings('ul').find('a:first').attr('href') );
			$(location).attr('href',url);
			e.preventDefault();
		}	
	});		


});

