
function displayNews() {
	if ( $("div#newsyou-content").length != 1) return;
	$("div#newsyou-content").load("/news.html");
}

function updateNav() {
	// check the page and change the style for subpages
	var loc = location.href;
	var sty = null;
	
	if (loc.indexOf('/why-an-mba/') >= 0) {
		sty = 'nav1-link';
	} else if (loc.indexOf('/jobs-and-careers/') >= 0) {
		sty = 'nav2-link';
	} else if (loc.indexOf('/schools-and-programs/') >= 0) {
		sty = 'nav3-link';	
	} else if (loc.indexOf('/plan-and-prepare/') >= 0) {
		sty = 'nav4-link';	
	} else if (loc.indexOf('/request/') >= 0) {
		sty = 'nav5-link';
	} else if (loc.indexOf('/about-us/') >= 0) {
		sty = 'nav6-link';	
	}
	
	if (sty == null || sty.length < 1) {
		return;
	}
	
	// set the class to 'active', which will display the tabs
	$("#" + sty).attr('class', 'active');
}

function onPageReady() {
	displayNews();
	updateNav();
	
	$("table.school-list tr")
	.mouseover(function() {
		$(this).addClass("school-list-row");
	})
	.mouseout(function() {
		$(this).removeClass("school-list-row");
	});
}

$(document).ready(onPageReady);


function submitRequest(key) {
	inp = document.createElement("input");
	inp.setAttribute("type", "hidden");
	inp.setAttribute("name", "form_key");
	inp.setAttribute("value", key);
	
	var form = $("form#request_form");
	form.append(inp);
	form.submit();
}

