var navCount = "";
var navHeight = "";
var navWidth = "";
var replaceSpaces = "";

var welcomeHeight = "";
var welcomeWidth = "";
var educationHeight = "";
var educationWidth = "";

function base(){
	
	// replace all neccessary spaces with &nbsp; (like for nav drop downs)
	$("div.nav ul li ul li a").each(function(){
		var replaceSpaces = $(this).text().replace(/ /g,'\u00a0');
		$(this).text(replaceSpaces);
	});
	
	$("body").prepend("<div class='background'></div>");

	// put some arrows on those "more" links
	$("a.more").append("&nbsp;&raquo;");
	
	// main navigation dropdown
	$("div.nav ul li").hover(
		function () {			
			// show and activate upon rollover
			$(this).children("ul").show();
			$(this).addClass("active");
			
			// calculations to determine height and width of dropdowns
			$(this).children("ul").children("li").each(function(){
				// set height of dropdown
				navCount++;
				navHeight = navCount*31;
				
				// find width of dropdown and set all link widths to 100%
				if ( navWidth < $(this).children("a").width() ){
					navWidth = $(this).children("a").width();
				}
			});
			
			// set width
			$(this).children("ul").css({width:navWidth + 20});
			
			// stop all previous animations and focus on current animation
			$(this).children("ul").stop();
			$(this).children("ul").animate({height:navHeight}, 200);
		}, 
		function () {
			// reset everything
			navCount = "0";
			navHeight = "0";
			navWidth = "0";
			$(this).removeClass("active");
			
			// stop all previous animations and hide previous menu
			$(this).children("ul").stop();
			$(this).children("ul").animate({height:navHeight}, 200, function(){
				$(this).hide();
			});
		}
    );
	
	// homepage: equalize heights of welcome and education events
	welcomeHeight = $("div.welcome").height();
	educationHeight = $("div.education").height();
	if (welcomeHeight > educationHeight){
		educationHeight = welcomeHeight;
		$("div.education").css({height:welcomeHeight});
	}
	if (educationHeight > welcomeHeight){
		welcomeHeight = educationHeight;
		$("div.welcome").css({height:educationHeight});
	}
	//homepage stick those buttons in the middle of welcome and education events
	welcomeWidth = $("div.welcome a.button").width();
	educationWidth = $("div.education a.button").width();
	$("div.welcome a.button").css({marginLeft:welcomeWidth/-2-15});
	$("div.education a.button").css({marginLeft:educationWidth/-2-15});
	

	// homepage: callouts 
	$("div.callouts ul li").hover(
		function () { $(this).addClass("active"); }, 
		function () { $(this).removeClass("active"); }
    );
	$("div.callouts ul li").click(function () {
		var url = $(this).find("a").attr('href');
		window.location = url;
	}); 
	
	// homepage: enable entire flash areas to click
	$("div.flash-rotation").click(function () {
		var url = $(this).find("a").attr('href');
		window.location = url;
	}); 

	
	// internal pages: list items
	$("div.list div.list-item:odd").addClass("odd");
	$("div.list div.list-item:even").addClass("even");


}
