

// Footer snaps to bottom
window.onload = function() {
	adjustScroll();
}

window.onresize = function() {
	adjustScroll();
}

function adjustScroll() {
	if ($(window).height() < $("html").width())
		$('wrapper').addClass('scroll');
	else
		$('wrapper').removeClass('scroll');
}
$(document).ready(function(){

   // Search text
	$('#q').val('Search NU');
	$('#q').css('color','#a2a2a2'); 
	$('#q').focus(function() {
		if($(this).val() == 'Search NU') {
		   $(this).val('');
		   $(this).css('color','#000');
		}
	});
	$('#q').blur(function() {
		if ($(this).val() == '') {
		   $(this).val('Search NU');
		   $(this).css('color','#a2a2a2'); 
		}
	});
	
	// darken .greytext on hover
	$(".greytext").parent().hover(function() {
		$(this).find('.greytext').css('color','#000');
	}, function() {								  
		$(this).find('.greytext').css('color','');
	});
	// external links			   
	$(".external").before(" <a href=\"" + $(".external").attr("href") + "\"><img class=\"icon\" src=\"/common/icons/external.png\"></a> ");
	
	// video links			   
//	$(".videolink").before(" <a href=\"" + $(".videolink").attr("href") + "\"><img class=\"icon\" src=\"/common/icons/video.png\"></a> ");

	// audio links			   
	$(".audiolink").before(" <a href=\"" + $(".audiolink").attr("href") + "\"><img class=\"icon\" src=\"/common/icons/audio.png\"></a> ");

	
	// zebra table 
   $(".zebratable tr:nth-child(odd)").addClass("odd");

   // highlight current menu link
   	var current_url = new String(window.location);
	var loc = current_url.indexOf(".edu")+4;
		loc = current_url.substr(loc);
	var loc2 = loc.indexOf("?");
	if(loc2 > 0) {
		loc = loc.substr(loc,loc2);
	}
	$(".menu a[href=" + loc + "]").addClass("current");

 });
