function showBio(id){
	$("#bio_wrapper div:visible").fadeOut(function(){
		$("#"+id).fadeIn();
	});
	
}

//functions to handle sub-page videos, and auto close after playing
function getFlashContent(name) {
if (navigator.appName.indexOf("Microsoft") != -1) {
		return window[name];
	} else {
		return document[name];
	}
}

function videoComplete() {
	//alert("video ended");
	$("#page_head .video_link").trigger('click');
	return false;
}

function callToActionscript() {
	getFlashContent("VideoSlideShow").sendToActionscript();
}


$(document).ready(function(){	
	$("#page_head .video_link").toggle(function(){
		$(this).text("Hide Video");		
		// fix for IE -- clone the hidden HTML (can't prepopulate with Javascript because we need PHP variables)
		$("#flash_player").clone(true).addClass("new_flash").insertAfter("#flash_player").animate({
			height: '130px'
		}, 0,function(){
			$(".new_flash").animate({
				height: '299px'
			}, 800);
			$("#flash_head").animate({
				height: '299px'
			}, 800);
			$("#flash_bottom").animate({
				top: '437px'
	        }, 800);
			$("#section_photo").hide();
		});		
	}, function(){
		$(this).text("Watch Video");
		$("#section_photo").show();
		$("#flash_head").animate({
				height: '130px'
			}, 800);
		$("#flash_bottom").animate({
				top: '268px'
	        }, 800);
		$(".new_flash").animate({
			height: '130px'
		}, 800,function(){
			$(".new_flash").animate({
				opacity: 'hide'
			}, 400,function(){
				// fix for IE -- remove the cloned div; will re-clone on show again
				$(".new_flash").remove()});
		});
	});
	
	$(".side-videos a").click(function(){
		if($("#flash_player").is(":hidden")){
			$("#flash_player").animate({
				height: '130px'
			}, 0,function(){
				$("#flash_player").animate({
					height: '299px'
				}, 800);
				$("#flash_head").animate({
					height: '299px'
				}, 800);
				$("#flash_bottom").animate({
					top: '437px'
				}, 800);
				$("#section_photo").hide();
			});		
		}
	});

	$("#flash_video_bar .in_page").toggle(function(){
		$(this).children(".video_link").toggleClass("open").text("Hide Video");
			$(this).parent().siblings(".flash_video").clone(true).addClass("new_video").insertAfter(".flash_video").animate({
				height: 'show',
				opacity: 'show'
			}, 'slow');	
	}, function(){
		$(this).children(".video_link").toggleClass("open").text("Watch Video");
		$(this).parent().siblings(".new_video").animate({
			height: 'hide',
			opacity: 'hide'
		}, 'slow',function(){
				$(".new_video").remove()});	
	return false;
	});
	
	
	$(".quick_bio").hover(function(){
		var hvrPhoto = $(this).siblings(".photo").children().attr("src");
		var length = hvrPhoto.length;
		newhvrPhoto = hvrPhoto.substring(0,length-6);
		$(this).siblings(".photo").children().attr({src: newhvrPhoto+"hv.jpg"});
	}, function(){
		$(this).siblings(".photo").children().attr({src: newhvrPhoto+"nm.jpg"});
	});
	
	$(".student").children(".quick_bio").animate({opacity: 0})
	$(".student").hover(function(){
		$(this).children(".quick_bio").animate({			
			opacity: .95
	  	}, 'fast');
	}, function(){
		$(this).children(".quick_bio").animate({			
			opacity: 0
	  	}, 'fast');
	});
	
	
	$(".accordion li ul").hide();
	$(".accordion li a:not(li > ul li a)").parent().addClass("closed");
	$(".accordion li a:not(li > ul li a)").toggle(function(){
		$(this).parent().children("ul").animate({
				height: 'show',
				opacity: 'show'
			}, 'normal');
		$(this).parent().addClass("open");
		$(this).parent().removeClass("closed");
		return false;
	}, function(){
		$(this).parent().children("ul").animate({
				height: 'hide',
				opacity: 'hide'
			}, 'normal');
		$(this).parent().addClass("closed");
		$(this).parent().removeClass("open");
		return false;
	});
	$(".accordion .close a").click(function(){
		$(this).parent().parent().parent().parent().children().trigger("click");
		return false;
	});
	
	$("#side_news h3:not(h3.open), .newsarchive h3:not(h3.open)").siblings("ul").hide();
	$("#side_news h3:not(h3.open), .newsarchive h3:not(h3.open)").addClass("closed");
	$("#side_news h3 a, .newsarchive h3 a").click(function(){
		if ($(this).parent().hasClass("closed")){
			$(this).parent().siblings("ul").animate({
					height: 'show',
					opacity: 'show'
				}, 'normal');
			$(this).parent().addClass("open");
			$(this).parent().removeClass("closed");
			return false;
		} else {
			$(this).parent().siblings("ul").animate({
					height: 'hide',
					opacity: 'hide'
				}, 'normal');
			$(this).parent().addClass("closed");
			$(this).parent().removeClass("open");
			return false;
		}
	});
	
	$(".podcast .title").click(function(){
		$(this).siblings(".podcast_player").animate({
			height: 'show',
			opacity: 'show'
		}, "slow");
		return false;
	});
	
});
	
