$(document).ready(function(){
	//resizePic();
	$('.contribute-instructions').hide();
	
	$('.photo-wrapper').draggable();
	
	$('UL.nav LI').hover(function(){
		$(this).children('.submenu').stop(true, true).slideDown(100).children('li').show();
	},function(){
		$(this).children('.submenu').children('li').hide().end().stop(true, true).slideUp(300);
	});
	
	$('UL.nav UL LI').hover(function(){
		$(this).children('UL').stop(true, true).slideToggle(250);								 
	});
	
	$('.photo[rel="1"]').cycle({
		fx: 'fade',
		timeout: 15000,
		speed: 1500,
		delay: -10000
	});
	
	$('.photo[rel="2"]').cycle({
		fx: 'fade',
		timeout: 15000,
		speed: 1500,
		delay: -5000
	});
	
	$('.photo[rel="3"]').cycle({
		fx: 'fade',
		timeout: 15000,
		speed: 1500,
		delay: 0
	});
	
	$('#staff-list LI A').click(function(e){
		href = $(this).attr('href');
		if (!(href.indexOf('http') > 0)){
			e.preventDefault();
			$('#description').load(href);
			img = 'images/staff/'+$(this).attr('rel')+'.png';
			$('#staff-image img').attr('src', img);
		}
						
	});
	
	$('#counselor-list LI A').click(function(e){
		href = $(this).attr('href');
		if (!(href.indexOf('http') > 0)){
			e.preventDefault();
			$('#description').load(href);
			img = 'images/counselors/'+$(this).attr('rel')+'.png';
			$('#counselor-image img').attr('src', img);
		}
						
	});

	$('.photo-wrapper').mousedown(function(){$('.photo-wrapper').css('z-index','2');$(this).css('z-index','3');});
	
	$('#kidsonly').hover(function(){
		$el = $(this);
		$left = $el.css('left');
		$left = parseFloat($left);	
		$el.animate({ left: $left-10 },10).animate({ left: $left+0 },50).animate({ left: $left+10 },10).animate({ left: $left+0 },50).animate({ left: $left-10 },10).animate({ left: $left+0 },50).animate({ left: $left+10 },10).animate({ left: $left+0 },50).animate({ left: $left-10 },10).animate({ left: $left+0 },50).animate({ left: $left+10 },10).animate({ left: $left+0 },50);
	},function(){$(this).stop(true,true);});
	
    
	
	function resizePic(){
		winh = $(window).height();
		if (winh < 600){
			width = $('#kids-image img').width();
			height = $('#kids-image img').height();
			$('#kids-image img').css("width", width*.8);
			$('#kids-image img').attr("height",height*.8);
			
		}

	};
});
