window.onload = getName;

function getName(){
	// Gets the current page name and puts it in the body onload tag as a parameter to the selectTab function
	var url = window.location.pathname;
	var filename = url.substring(url.lastIndexOf('/')+1);
	document.getElementsByTagName('body')[0].onload = selectTab(filename);
}

function selectTab(name) {
	//name = name.substring(0,name.lastIndexOf('.'));		// Remove extention in case it exists
	var i;
	if (name == "index")
		i = 3;	// Start at 2 because 1st a tag is for the logo and 2nd a tag is mailto link
	else if (name == "products")
		i = 4;
	else if (name == "diamondlift")
		i = 5;
	else if (name == "services")
		i = 6;
	else if (name == "photogallary")
		i = 7;
	else if (name == "rental-quote-form")
		i = 8;
	else if (name == "account-application")
		i = 9;
	else if (name == "contactus")
		i = 10;
	document.getElementsByTagName('a')[i].className = "selected";
}

