$(document).ready(function(){
	if ($().cycle){
		
		$('#head_slideshow').cycle({
			fx: 'fade',
			speed: 1000,
			random: true,
			cleartype: true,
			timeout: 6000
		});
		
		$('#home_slideshow').cycle({
			fx: 'fade',
			speed: 1000,
			pause: true,
			cleartype: true,
			timeout: 6000,
			next:   '#next', 
   			prev:   '#prev'
		});
	}	
	
 	
 	//fundraisers accordion
 	
 	if($('.main').height() > 625){
 		$('#fundraisers').css('min-height' , $('.main').height() -10 + 'px');
 	}	
 	
 	lastBlock = $("#a1");
	maxHeight = 270;
	minHeight = 80;
	
	$('ul.vert_accordion li .text').css('opacity', 0);
	$('ul.vert_accordion li #a1 .text').css('opacity', 1);	
	
	$("ul li div.trigger").hover(
	function(){
		$(lastBlock).animate(
			{height: minHeight+"px"},
			{queue:false, duration:400, complete:
				function(){
					$(this).children(".text.").animate(
					{opacity: 0},
					{queue:false, duration: 200});							
				}
			}		
		);
		
		$(this).animate(
			{height: maxHeight+"px"},
			{queue:false, duration:400, complete:
				function(){
					$(this).children(".text").animate(
					{opacity: 1},
					{queue:false, duration: 200});							
				}
			}
		);
		currentBlock = this;
		lastBlock = this;
		}
	);
 
 	
 	//removes divider from the last element of the nav
	$('#nav ul.nav1>li:last-child').css({
	    'background-image': 'none',
	    'padding-right' : 0
	});
	    	  
	// Sub same height as Main
	$('.sub').css('min-height' , $('.main').height() -10 + 'px');
	
	//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",
	    	"float": "none"
	    });
	}

});
