$(function(){

	$('#content-main .intro p').append('<span></span>');
	
	/* Clear search box onFocus */
	$("#search input#searchbox").focus( function() {if ($(this).val()=="search undergrad") {$(this).val("");}}).blur( function() {if ($(this).val()=="") {$(this).val("search undergrad");}}); //

    /* Set columns on the home page to the same height
    equalHeight($("#tools #firstyear, #tools #transfer, #tools #stories")); */ //
	
	/* Load video when you link the thumbnail */
	$('#video-nav li a').each(function() {
		var videolink = $(this).attr("href");
		var videotitle = $(this).children('span.video-title').html()
		var videobody = $(this).children('span.video-body').html()
		$(this).click(function(){
			$('#video object param[movie]').attr('value', videolink).hide().fadeIn('slow');
			$('#video embed').attr('src', videolink).hide().fadeIn('slow');
			$('#video-desc p span.video-title').text(videotitle).hide().fadeIn(1000);
			$('#video-desc p span.video-body').text(videobody).hide().fadeIn(1000);
			return false;
		});
		
	}); //

	// Cycle plugin
	$('#video ul') 
	.before('<div id="nav-cycle">') 
	.cycle({ 
		fx:       'fade', 
		timeout:  0, 
		pager:    '#nav-cycle' 
	}); //

	//jQuery active navigation
	$('#sidenav li a').each(function() {
		var navlink = $(this).attr("href");
		if (navlink.toLowerCase()==location.href.toLowerCase()) {
			$(this).parent("li").addClass("active");
		}
	});


}); // End jQuery


/* Equal height columns */
function equalHeight(group) {
	tallest = 0;
	group.each(function() {
		thisHeight = $(this).height();
		if(thisHeight > tallest) {
			tallest = thisHeight;
		}
	});
	group.height(tallest);
} //