function over(obj, number){
	obj.className = "option" + number + "Over";
}

function out(obj, number) {
	obj.className= "option" + number + "Out";
	SelectMenuItem();
}

 /**
  * Reads the uri and puts the proper item with the "active" image in the submenu
  * @author - Jorge Villalta
  */
function SelectMenuItem()
{
	if (location.href.lastIndexOf('/') != -1)
	{
		firstpos=location.href.lastIndexOf('/')+1;
		lastpos=location.href.lastIndexOf('.do');

		var sections = location.href.split("/");
		for (var i=3;i<sections.length;i++){
			if (sections[i]!=""){
				if (sections[i+1]=="?useFlash=N"){
					Namer=sections[i];
					i++;
				}
				else{
					Namer=sections[i];
				}
			}
		}
		if ((location.href.indexOf('/g8/') > -1) || (location.href.indexOf('/g6-sedan/') > -1) ||
		(location.href.indexOf('/g6-coupe/') > -1) || (location.href.indexOf('/g6-convertible/') > -1) ||
		(location.href.indexOf('/torrent/') > -1) || (location.href.indexOf('/grand-prix/') > -1) ||
		(location.href.indexOf('/solstice/') > -1) || (location.href.indexOf('/vibe-2009/') > -1) ||
		(location.href.indexOf('/vibe-2008/') > -1) ||(location.href.indexOf('/g3/') > -1) ||
		(location.href.indexOf('/g5/') > -1)){
			Namer="showModelOverview";
		}

		if (location.href.indexOf('/build-your-own/') > -1 )
			Namer="BuildYourOwn";

		if ((location.href.indexOf('/pictures/') > -1 ) || (location.href.indexOf("showPhotoGallery.do") > -1))
			Namer="showPhotoGallery";

		if (location.href.indexOf('/specs-features/') > -1 )
			Namer="features";

		if ((location.href.indexOf('/compare/') > -1 )|| (location.href.indexOf("showCompare.do") > -1))
			Namer="showCompare";

		if ((location.href.indexOf('/view-vehicles/') > -1 )||(location.href.indexOf('/all-vehicles/') > -1 ) || (location.href.indexOf("showViewAllVehicles.do") > -1))
			Namer="showViewAllVehicles";

		if ((location.href.indexOf('/help-choose/') > -1)|| (location.href.indexOf("showHelpMeChoose.do") > -1))
			Namer="showHelpMeChoose";

		if ((location.href.indexOf('/fuel-efficiency/') > -1)||(location.href.indexOf('showFuelEfficiency.do') > -1))
			Namer="showFuelEfficiency";

		if ((location.href.indexOf('/concept-cars/') > -1)|| (location.href.indexOf("showFutureVehiclesLanding.do") > -1))
			Namer="showFutureVehiclesLanding";

		if ((location.href.indexOf("getRAQ") > -1)|| (location.href.indexOf("showViewAllVehicles.do") > -1))
			Namer="showViewAllVehicles";

		if ((location.href.indexOf("compare-vehicles") > -1)||(location.href.indexOf("compare-vehicles-results") > -1) || (location.href.indexOf("compareVehiclePhoto.do") > -1)||(location.href.indexOf("compareVehicle.do") > -1))
			Namer="comparePrimaryVehicle";

		if ((location.href.indexOf("/current-offers/") > -1) || (location.href.indexOf("showCurrentOffers.do") > -1))
			Namer="showCurrentOffers";

		if ((location.href.indexOf("/owners-experience/") > -1)|| (location.href.indexOf("showViewAllVehicles.do") > -1))
			Namer="showViewAllVehicles";

		if ((location.href.indexOf("/lifestyle/") > -1)|| (location.href.indexOf("showLifeStyle.do") > -1))
			Namer="showLifeStyle";

		if ((location.href.indexOf("/news/") > -1)|| (location.href.indexOf("showNews.do") > -1))
			Namer="showNews";

		if ((location.href.indexOf("/awards-accolades/") > -1)|| (location.href.indexOf("showAwardsAccolades.do") > -1))
			Namer="showAwardsAccolades";

		if ((location.href.indexOf("/events-calendar/") > -1)|| (location.href.indexOf("eventsCalendar.do") > -1))
			Namer="eventsCalendar";

		if ((location.href.indexOf("/heritage/") > -1)|| (location.href.indexOf("showHistory.do") > -1))
			Namer="showHistory";

		if ((location.href.indexOf("/enthusiast/") > -1)|| (location.href.indexOf("showEnthusiastSites.do") > -1))
			Namer="showEnthusiastSites";

		if ((location.href.indexOf("/warranty/") > -1)|| (location.href.indexOf("showWarranty.do") > -1))
			Namer="showWarranty";

		if ((location.href.indexOf("/manuals/") > -1)|| (location.href.indexOf("showManuals.do") > -1))
			Namer="showManuals";

		if ((location.href.indexOf("/partners/") > -1)|| (location.href.indexOf("showValuedPartners.do") > -1))
			Namer="showValuedPartners";

		if ((location.href.indexOf("/owners-experience/") > -1)|| (location.href.indexOf("showOwnershipExperience.do") > -1))
			Namer="showOwnershipExperience";

		if ((location.href.indexOf("/help/") > -1)|| (location.href.indexOf("showHelp.do") > -1))
			Namer="showHelp";

		if ((location.href.indexOf("/glossary/") > -1)|| (location.href.indexOf("showGlossary.do") > -1))
			Namer="showGlossary";

		if ((location.href.indexOf("/contact/") > -1)|| (location.href.indexOf("showContactUs.do") > -1))
			Namer="showContactUs";

		if ((location.href.indexOf("/request-information/") > -1)|| (location.href.indexOf("showRequestByEmail.do") > -1))
			Namer="showRequestByEmail";
		/*if ((location.href.indexOf("/g3/") > -1)|| (location.href.indexOf("/g3") > -1) || (location.href.indexOf("/showFutureG3.do") > -1) || (location.href.indexOf("/concept-vehicle/g3") > -1) || (location.href.indexOf("/concept-vehicle/g3/") > -1))
			Namer="showFutureG3";*/

		if (document.getElementById(Namer) != null){

			var number = document.getElementById(Namer).className.charAt(6);
			try{
				document.getElementById(Namer).className = "option" + number + "Over";

			}catch (err){}
		}
	}
}

function SelectBYOTab()
{
	document.getElementById("BuildYourOwn").className = "option2Over";
}

AttachEvent(window,'load',SelectMenuItem);
