var MITS = "mits";
var COMP = "comp";


/* These values need to be kept in-sync with the current vehicle roster; changeouts affect the entries here */
var urlSignature = new Object();
urlSignature["eclipse/09"] = "2009 Eclipse";
urlSignature["eclipse/08"] = "2008 Eclipse";
urlSignature["galant/09"] = "2009 Galant";
//urlSignature["galant/08"] = "2008 Galant";
//urlSignature["spyder/08"] = "2008 Eclipse Spyder";
urlSignature["spyder/09"] = "2009 Eclipse Spyder";
//urlSignature["lancer/06"] = "2006 Lancer";
urlSignature["lancer/09"] = "2009 Lancer";
urlSignature["evo/08"] = "2008 Lancer Evolution";
//urlSignature["outlander/06"] = "2006 Outlander";
urlSignature["outlander/08"] = "2008 Outlander";
urlSignature["outlander/09"] = "2009 Outlander";
urlSignature["outlander/10"] = "2009 Outlander";
//urlSignature["endeavor/06"] = "2006 Endeavor";
//urlSignature["endeavor/07"] = "2007 Endeavor";
urlSignature["endeavor/08"] = "2008 Endeavor";
//urlSignature["montero/06"] = "2006 Montero";
//urlSignature["raider/06"] = "2006 Raider"; 
 urlSignature["raider/08"] = "2008 Raider";  
urlSignature["raider/09"] = "2009 Raider";
urlSignature["endeavor/10"] = "2010 Endeavor";
urlSignature["lancer/10"] = "2010 Lancer";
urlSignature["spyder/10"] = "2010 Eclipse Spyder";
urlSignature["sportback/10"] = "2010 Lancer Sportback";
urlSignature["evo/10"] = "2010 Lancer Evolution";
urlSignature["eclipse/10"] = "2010 Eclipse";
urlSignature["galant/10"] = "2010 Galant";

/* type can be COMP (competitive) or MITS (mistubishi) */
function comparison(type) {
	//test for null values from AIC
	/*
	4:02:13 PM: ah, i follow ... finding the best place to test for that null ...
	4:03:31 PM: I'd say the first thing you do in comparison() is check for it
	4:04:02 PM: but, you'll have to make sure that it doesn't return to comparison if it is null
	4:04:16 PM: you'll have to initiate an ajax call, and have the callback of that be comparison
	4:04:53 PM: mmm, yeah i suppose the entrypoint, good call ... ok right, otherwise it would still try and chew on no data ... and that way it'll catch null data if it comes back that way again
	4:05:17 PM: yeah, and you can display some kind of error message
	4:05:23 PM: 'cause if you have no Mits models, you've got nothing
	*/
	
	//resize the container, accordingly ... 3 ancestorsBack should be the same size as element with id bottomHousing. last param is extra padding added to the height
	resizeAncestor("bottomHousing", 3, $("bottomHousing").offsetTop + 250); 
	
	//set the style of tabs for "Compare Mitsubishi Models" and "Compare Competitive Models"	
	$("compareCompetitors").className = (type == COMP) ? "vehNewAICTabSelected" : "vehTab";
	$("compareMits").className = (type == COMP) ? "vehTab" : "vehNewAICTabSelected";
	$(("selectNewModel1")).innerHTML = "<a id=\"selectNewLink1\" href=\"javascript:selectNewGateway('1');\">" + TEXT_SELECT_NEW_MODEL + "</a>";

	//some init business:
	StateMonitor.clear();
	hideCompareResults();
	redrawFlash();
	if(type == MITS) {
		//alert(StateMonitor.numberSelected);
		//buildMitsuSet(4);
		StateMonitor.setCompetitiveTabState(selectedTrimsMonitor.OFF); //passing a constant
		for(var i=1; i <= 4; i++) {
			resetSelectset(i);
			buildModelDropdown((i), aicModels);
		}
		setMitsModelOnChangeHandlers(); // set/restore event handlers
		hideMakesDropdowns(); //hide any visible makes dropdowns
		//one time invocation:
		if(mitsuModelIndexes == null) {
			buildMitsuIndexes();
		}
		determineDefaultMitsuTrim(); // MITS always gets hit before COMP so we only need this here
		setDefaultTrimColumn(); // leftmost column needs to match the current mitsu vehicle
		$("vImg1Border").style.visibility = "hidden";
		$("legalCopy").style.top = "400px";
	}
	else if(type == COMP) {
		
			resetSelectset(1);
			buildModelDropdown((1), aicModels);
		
		setMitsModelOnChangeHandlers(); // set/restore event handlers
		//hideMakesDropdowns(); //hide any visible makes dropdowns
		//one time invocation:
		if(mitsuModelIndexes == null) {
			buildMitsuIndexes();
		}
		determineDefaultMitsuTrim(); // MITS always gets hit before COMP so we only need this here
	
		//buildCompetitiveSet();
		StateMonitor.setCompetitiveTabState(selectedTrimsMonitor.ON); //passing a constant
		//resetSystem();
		setDefaultTrimColumn();
		prepareCompetitiveScreen();
		$("vImg1Border").style.visibility = "visible";
		$("legalCopy").style.top = "400px";
	}
	setAICMessaging(); // instructive text above columns
	
}
comparison["name "]= "comparison";

// jjg: scrape names of mitsu vehicles from refSelectOptions object
// and use them to fill mitsuModelIndexes dropdown/select ???
function buildMitsuIndexes() {
	mitsuModelIndexes = new Object;
	var refSelectOptions = $("models1").options;
	for(var i=0; i < refSelectOptions.length; i++) {
		var option = refSelectOptions[i];
		mitsuModelIndexes[option.text] = i;
	}
}

