function changeOptions(model, formNumber)
{
	while (array_index < packages.length) {
		if (toBeRemoved != packages[array_index]) {
			document.forms[0].elements[otherSelect].options[opt_count] = new Option(packages[array_index], packages[array_index]);
			if (packages[array_index] == currentlyOtherSelected) {
				document.forms[0].elements[otherSelect].options[opt_count].selected = true;
			}
			++opt_count;
		}
		++array_index;
	}
	document.forms[0].elements[otherSelect].options[opt_count] = null;
}

function changeCompModel(model, formIndex) {
	compModel = document.forms[formIndex].cmpModelName.options[document.forms[formIndex].cmpModelName.selectedIndex].value;
	
	whichSelect = document.forms[formIndex].cmpModelTrimID;
	
	while (whichSelect.length > 0) { whichSelect.options[whichSelect.length - 1] = null; }
	
	whichSelect.options[whichSelect.length] = new Option("--Select a Model--","");
	
	if (model == "cts") {
		switch(compModel) {
			case "Audi A4":
			whichSelect.options[whichSelect.length] = new Option("2.0 T","18012");
			whichSelect.options[whichSelect.length] = new Option("2.0 T quattro","18014");
			whichSelect.options[whichSelect.length] = new Option("2.0 T quattro with Tiptronic","18015");
			whichSelect.options[whichSelect.length] = new Option("2.0 T with Multitronic","18013");
			whichSelect.options[whichSelect.length] = new Option("3.2 quattro with Tiptronic","18016");
			break;
			case "BMW 3 Series Sedan":
			whichSelect.options[whichSelect.length] = new Option("325i","16876");
			whichSelect.options[whichSelect.length] = new Option("330i","16877");
			break;
			case "Mercedes-Benz C-Class":
			whichSelect.options[whichSelect.length] = new Option("C230 Sport Sedan","17353");
			whichSelect.options[whichSelect.length] = new Option("C280 Luxury Sedan","17356");
			whichSelect.options[whichSelect.length] = new Option("C350 Luxury Sedan","17357");
			whichSelect.options[whichSelect.length] = new Option("C350 Sport Sedan","17354");
			break;
			case "Infiniti G35 Sedan":
			whichSelect.options[whichSelect.length] = new Option("Base","18303");
			whichSelect.options[whichSelect.length] = new Option("6MT","18305");
			whichSelect.options[whichSelect.length] = new Option("xAWD","18304");
			break;
			case "Acura TL":
			whichSelect.options[whichSelect.length] = new Option("5-Spd AT","18389");
			whichSelect.options[whichSelect.length] = new Option("6-Spd MT","18390");
			whichSelect.options[whichSelect.length] = new Option("5-Spd AT / Navigation System","18391");
			whichSelect.options[whichSelect.length] = new Option("6-Spd MT / Navigation System","18392");
			break;
			case "Lexus ES 350":
			whichSelect.options[whichSelect.length] = new Option("Front Wheel Drive","19104");
			break;
		}
	}

	if (model == "ctsv") {
			switch(compModel) {
			case "Audi S4":
			whichSelect.options[whichSelect.length] = new Option("Sport Sedan","17973");
			whichSelect.options[whichSelect.length] = new Option("Sport Sedan with Tiptronic","17974");
			break;
			case "Infiniti M":
			whichSelect.options[whichSelect.length] = new Option("Luxury","16669");
			whichSelect.options[whichSelect.length] = new Option("Sport","16670");
			break;
			case "BMW M3":
			whichSelect.options[whichSelect.length] = new Option("Coupe","18282");
			break;
			case "Mercedes-Benz C-Class":
			whichSelect.options[whichSelect.length] = new Option("AMG Sports Sedan","17355");
			break;
		}
	}

	if (model == "stsv") {
			switch(compModel) {
			case "BMW M5":
			whichSelect.options[whichSelect.length] = new Option("Sedan","18566");
			break;
			case "Jaguar S-Type":
			whichSelect.options[whichSelect.length] = new Option("4.2-Liter R","18587");
			break;
			case "Mercedes-Benz E-Class":
			whichSelect.options[whichSelect.length] = new Option("E55 AMG Sedan","16778");
			break;
			case "Mercedes-Benz CLS-Class":
			whichSelect.options[whichSelect.length] = new Option("CLS55 AMG 4-Door Coupe","16699");
			break;
			case "Audi S4":
			whichSelect.options[whichSelect.length] = new Option("Sport Sedan with Tiptronic","17974");
			break;
		}
	}
	
	
	if (model == "sts") {
		switch(compModel) {
			case "Audi RS 4":
			whichSelect.options[whichSelect.length] = new Option("2007 Audi RS 4 Sedan","19017");
			break;
			case "Audi A6":
			whichSelect.options[whichSelect.length] = new Option("3.2 with Tiptronic","18025");
			whichSelect.options[whichSelect.length] = new Option("4.2 with Tiptronic","17985");
			break;
			case "BMW 5 Series":
			whichSelect.options[whichSelect.length] = new Option("525i Sedan","16849");
			whichSelect.options[whichSelect.length] = new Option("525xi Sedan","16852");
			whichSelect.options[whichSelect.length] = new Option("530i Sedan","19075");			
			whichSelect.options[whichSelect.length] = new Option("530i Sedan","16850");
			whichSelect.options[whichSelect.length] = new Option("530xi Sedan","16853");
			break;
			case "Infiniti M":
			whichSelect.options[whichSelect.length] = new Option("45 Luxury","16669");
			whichSelect.options[whichSelect.length] = new Option("45 Sport","16670");
			break;
			case "Lexus GS 300":
			whichSelect.options[whichSelect.length] = new Option("AWD","16786");
			whichSelect.options[whichSelect.length] = new Option("Base","16785");
			case "Lexus GS 430":
			whichSelect.options[whichSelect.length] = new Option("Base","16798");
			break;
			case "Mercedes-Benz E-Class":
			whichSelect.options[whichSelect.length] = new Option("E320 CDI Sedan","16774");
			whichSelect.options[whichSelect.length] = new Option("E350 Sedan","20192");
			whichSelect.options[whichSelect.length] = new Option("E550 Sedan","20195");
			break;
			case "Jaguar S-Type":
			whichSelect.options[whichSelect.length] = new Option("3.0-Liter","18585");
			whichSelect.options[whichSelect.length] = new Option("4.2-Liter","18586");
			whichSelect.options[whichSelect.length] = new Option("4.2-Liter R","18587");
			break;
		}
	}
	
	if (model == "dts") {
		switch(compModel) {
			case "Infiniti M":
			whichSelect.options[whichSelect.length] = new Option("45 Sport","16670");
			break;
			case "Lexus LS 430":
			whichSelect.options[whichSelect.length] = new Option("Sedan","18035");
			break;
			case "Lincoln Town Car Signature":
			whichSelect.options[whichSelect.length] = new Option("Signature Limited","19795");
			break;
			case "Lincoln Town Car":
			whichSelect.options[whichSelect.length] = new Option("Signature","17370");
			whichSelect.options[whichSelect.length] = new Option("Signature L","17372");
			whichSelect.options[whichSelect.length] = new Option("Signature Limited","17371");
			break;
			case "Mercedes-Benz E-Class E350 Sedan":
			whichSelect.options[whichSelect.length] = new Option("E350 Sedan","20192");
			break;
			case "Mercedes-Benz S-Class":
			whichSelect.options[whichSelect.length] = new Option("S430 Sedan","16749");
			whichSelect.options[whichSelect.length] = new Option("S500 Sedan","16750");
			whichSelect.options[whichSelect.length] = new Option("S55 AMG Sedan","16751");
			whichSelect.options[whichSelect.length] = new Option("S600 Bi-T Sedan","16752");
			break;
			case "Acura RL":
			whichSelect.options[whichSelect.length] = new Option("Sedan","18638");
			break;
		}
	}
	
	if (model == "xlr") {
		switch(compModel) {
			case "Jaguar XK-Series":
			whichSelect.options[whichSelect.length] = new Option("XK8 Convertible","17481");
			whichSelect.options[whichSelect.length] = new Option("XK8 Coupe","17480");
			whichSelect.options[whichSelect.length] = new Option("XKR Convertible","17483");
			whichSelect.options[whichSelect.length] = new Option("XKR Coupe","17482");
			break;
			case "Mercedes-Benz CL-Class":
			whichSelect.options[whichSelect.length] = new Option("CL500 Coupe","17423");
			break;
			case "Mercedes-Benz SL-Class":
			whichSelect.options[whichSelect.length] = new Option("SL500 Roadster","17365");
			whichSelect.options[whichSelect.length] = new Option("SL55 AMG Roadster","17366");
			whichSelect.options[whichSelect.length] = new Option("SL600 Roadster","17367");
			whichSelect.options[whichSelect.length] = new Option("SL65 AMG Roadster","17368");
			break;
			case "Lexus SC430":
			whichSelect.options[whichSelect.length] = new Option("Convertible","17483");
			break;
		}
	}
	
	if (model == "xlrv") {
		switch(compModel) {
			case "Jaguar XK-Series":
			whichSelect.options[whichSelect.length] = new Option("XKR Convertible","17483");
			whichSelect.options[whichSelect.length] = new Option("XKR Coupe","17482");
			break;
			case "Mercedes-Benz SL-Class":
			whichSelect.options[whichSelect.length] = new Option("SL55 AMG Roadster","17365");
			whichSelect.options[whichSelect.length] = new Option("SL55 AMG Roadster","17366");
			break;
		}
	}

	if (model == "srx") {
		switch(compModel) {
			case "Mercedes-Benz M-Class":
			switch(caddyModelTrimID) {
				case('17308'):  // V6
				whichSelect.options[whichSelect.length] = new Option("ML350","16830");
				break;
				case('17309'): // V8
				whichSelect.options[whichSelect.length] = new Option("ML500","16831");
				break;
				}
			break;
			case "Volvo XC90":
			switch(caddyModelTrimID) {
				case('17308'):  // V6
				whichSelect.options[whichSelect.length] = new Option("2.5T","17467");
				break;
				case('17309'): // V8
				whichSelect.options[whichSelect.length] = new Option("V8","17469");
				break;
			}
			break;
			case "BMW X5":
			switch(caddyModelTrimID) {
				case('17308'):  // V6
				whichSelect.options[whichSelect.length] = new Option("3.0i Sports Activity Vehicle","18288");
				break;
				case('17309'): // V8
				whichSelect.options[whichSelect.length] = new Option("4.4i Sports Activity Vehicle","18289");
				whichSelect.options[whichSelect.length] = new Option("4.8i Sports Activity Vehicle","18290");
				break;
			}
			break;
			case "BMW X3":
			whichSelect.options[whichSelect.length] = new Option("3.0i Sports Activity Vehicle","18287");
			break;
			case "Lexus RX 330":
			whichSelect.options[whichSelect.length] = new Option("Front Wheel Drive","18569");
			whichSelect.options[whichSelect.length] = new Option("All Wheel Drive","18570");
			break;
			case "Acura MDX":
			whichSelect.options[whichSelect.length] = new Option("Premium","18393");
			whichSelect.options[whichSelect.length] = new Option("Touring Package","18394");
			whichSelect.options[whichSelect.length] = new Option("Touring Package w/ Rear DVD","18395");
			whichSelect.options[whichSelect.length] = new Option("Touring Package w/ Navigation system","18396");
			whichSelect.options[whichSelect.length] = new Option("Touring Package w/ Navigation system and Rear DVD","18397");
			break;
			case "Infiniti FX35":
			whichSelect.options[whichSelect.length] = new Option("2WD","18264");
			whichSelect.options[whichSelect.length] = new Option("AWD","18265");
			break;
			case "Infiniti FX45":
			whichSelect.options[whichSelect.length] = new Option("AWD","18266");
			break;
		}
	}
	
	if (model == "escalade" || model == "esv" || model == "ext") {
		switch(compModel) {
			case "HUMMER H2 SUT":
			whichSelect.options[whichSelect.length] = new Option("Sport Utility","17307");
			break;
			case "HUMMER H2 SUV":
			whichSelect.options[whichSelect.length] = new Option("Sport Utility","17074");
			break;
			case "Land Rover Range Rover":
			whichSelect.options[whichSelect.length] = new Option("HSE","16862");
			break;
			case "Land Rover Range Rover Sport":
			whichSelect.options[whichSelect.length] = new Option("HSE","16855");
			break;
			case "Land Rover LR3":
			whichSelect.options[whichSelect.length] = new Option("V6","18545");
			break;
			case "Lexus LX 470":
			whichSelect.options[whichSelect.length] = new Option("Sport Utility","17220");
			break;
			case "Lincoln Navigator":
			whichSelect.options[whichSelect.length] = new Option("4X2 Luxury","19825");
			whichSelect.options[whichSelect.length] = new Option("4X2 Luxury","17023");
			whichSelect.options[whichSelect.length] = new Option("4X2 Ultimate","17024");
			whichSelect.options[whichSelect.length] = new Option("4X4 Luxury","19827");			
			whichSelect.options[whichSelect.length] = new Option("4X4 Luxury","17025");
			whichSelect.options[whichSelect.length] = new Option("4X4 Ultimate","17026");
			break;
			case "Lincoln Mark LT":
			whichSelect.options[whichSelect.length] = new Option("Lincoln Mark LT","20055");
			break;
			case "Infiniti QX56":
			whichSelect.options[whichSelect.length] = new Option("RWD","18269");
			whichSelect.options[whichSelect.length] = new Option("AWD","18270");
			break;
		}
	}

}


function changeModel(whichForm) {
	model = (whichForm == 0	? document.forms[whichForm].model.options[document.forms[whichForm].model.selectedIndex].value
							: document.forms[whichForm].compModel.options[document.forms[whichForm].compModel.selectedIndex].value)
	switch (model)
	{
		case "cts": packageNames = new Array("2.8L Standard","3.6L Standard");
		pvcs = new Array("5162","5160");
		trimIDs = new Array("19033", "19034");
		break;
		case "ctsv": packageNames = new Array("Standard");
		pvcs = new Array("5140");
		trimIDs = new Array("19036");
		break;
		case "dts": packageNames = new Array("DTS");
		pvcs = new Array("540");
		trimIDs = new Array("19829");
		break;
		case "escalade": packageNames = new Array("Two-Wheel Drive","All-Wheel Drive");
		pvcs = new Array("5101","5100");
		trimIDs = new Array("18822","18823");
		break;
		case "esv": packageNames = new Array("Standard");
		pvcs = new Array("5104");
		trimIDs = new Array("19009");
		break;
		case "ext": packageNames = new Array("Standard");
		pvcs = new Array("5103");
		trimIDs = new Array("18997");
		break;
		case "srx": packageNames = new Array("V6 Standard","V8 Standard");
		pvcs = new Array("530","531");
		trimIDs = new Array("17308", "17309");
		break;
		case "sts": packageNames = new Array("V6 Standard","V8 Standard");
		pvcs = new Array("5340","5343");
		trimIDs = new Array("20003","20004");
		break;
		case "stsv": packageNames = new Array("Standard");
		pvcs = new Array("550");
		trimIDs = new Array("20000");
		break;
		case "xlr": packageNames = new Array("Standard");
		pvcs = new Array("520");
		trimIDs = new Array("19955");
		break;
		case "xlrv": packageNames = new Array("Standard");
		pvcs = new Array("522");
		trimIDs = new Array("19956");
		break;
	}
	targetSelect = (whichForm == 0 ? document.forms[whichForm].baseVehicleId : document.forms[whichForm].cmpModelTrimID);
	
	for (i = targetSelect.length; i >= 0; --i) {
		targetSelect.options[i] = null;
	}
	targetSelect.options[0] = new Option();
	targetSelect.options[0].text = '-- Select a Package--';
	targetSelect.options[0].value = '';
	targetSelect.options[0].selected = true;

	for (i = 0; i < packageNames.length; ++i) {
		targetSelect.options[i + 1] = new Option();
		targetSelect.options[i + 1].text = packageNames[i];
		targetSelect.options[i + 1].value = (whichForm == 0 ? pvcs[i] : trimIDs[i]);
	}
}

function printPage(compareToWhat) {
	prepend = '';
	if (compareToWhat == 'competitive') { prepend = 'comp'; }
	win = window.open('','newWin','');
	windoc = win.document;
	windoc.open();
	windoc.writeln('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"');
	windoc.writeln('"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">');
	windoc.writeln('<html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en">');
	windoc.writeln('<head>');
	windoc.writeln('<title>Cadillac - Compare Vehicles</title>');
	windoc.writeln('<meta http-equiv="pragma" content="no-cache" />');
	windoc.writeln('<meta http-equiv="cache-control" content="no-cache" />');
	windoc.writeln('<meta http-equiv="expires" content="0" />');
	windoc.writeln('<meta http-equiv="keywords" content="Cadillac - Compare Vehicles" />');
	windoc.writeln('<meta http-equiv="description" content="Cadillac - Compare Vehicles" />');
	windoc.writeln('<style type="text/css" media="all">@import url(style/cadillac.css);</style>');
	windoc.writeln('<style type="text/css" media="all">@import url(style/tools.css);</style>');
	windoc.writeln('<link rel="shortcut icon" href="/favicon.ico" />');
	windoc.writeln('<script>var imgary=new Array();imgary[0]=new Image();imgary[0].src=\'/_res/i/all/btn_cwa.gif\';imgary[1]=new Image;imgary[1].src=\'/_res/i/all/btn_cwi.gif\';imgary[2]=new Image();imgary[2].src=\'/_res/i/all/btn_prntlg_a.jpg\';imgary[3]=new Image();imgary[3].src=\'/_res/i/all/btn_prntlg_i.jpg\'<\/script>');
	windoc.writeln('<meta http-equiv="content-type" content="text/html; charset=iso-8859-1" />');
	windoc.writeln('<meta http-equiv="Content-Type" content="text/html; charset=utf-8"></head>');
	windoc.writeln('<body id="pu" >');
	windoc.writeln('<div id="puhdr" style="height:30px;">');
	windoc.writeln('<img src="/_res/i/all/ttl_cv_' + prepend + 'modcom.gif" class="fl" />');
	windoc.writeln('<a href="javascript:self.close()"><img src="/_res/i/all/btn_cwi.gif" onmouseover="this.src=imgary[0].src;" onmouseout="this.src=imgary[1].src;" id="btn_cw" class="fr pl" alt="close window" /></a>');
	windoc.writeln('</div>');
	windoc.writeln('<div id="stack_wspu">');
	windoc.writeln('<table border=0 cellpadding=0 cellspacing=0 id="top_model_table">');
	windoc.writeln('<tr>');
	windoc.writeln('<td width=120 valign=top style="padding:10px 10px 0 0;">');
	windoc.writeln('<a href="javascript:window.print();"><img id="btn_prntlg_" onmouseover="this.src=imgary[2].src" onmouseout="this.src=imgary[3].src" src="/_res/i/all/btn_prntlg_i.jpg" alt="Print" class="pl" /></a>');
	windoc.writeln('</td>');
	windoc.writeln('<td valign=top width=143 style="padding:10px 8px 0 8px;">' + document.getElementById("name0").innerHTML + '</td>');
	windoc.writeln('<td valign=top width=143 style="padding:10px 8px 0 8px;">' + document.getElementById("name1").innerHTML + '</td>');
	windoc.writeln('<td valign=top width=143 style="padding:10px 8px 0 8px;">' + document.getElementById("name2").innerHTML + '</td></tr>');
	windoc.writeln('<tr>');
	windoc.writeln('<td>');
	windoc.writeln('&nbsp;');
	windoc.writeln('</td>');
	windoc.writeln('<td class="note" style="padding:3px 8px 3px 8px;border-right:1px solid #FFFFFF;">');
	windoc.writeln('<strong>Base MSRP $41,020*</strong>');
	windoc.writeln('</td>');
	windoc.writeln('<td class="note" style="padding:3px 8px 3px 8px;">');
	windoc.writeln('<strong>Base MSRP $43,970*</strong>');
	windoc.writeln('</td>');
	windoc.writeln('<td class="note" style="padding:3px 8px 3px 8px;">');
	windoc.writeln('<strong>Base MSRP $53,770*</strong>');
	windoc.writeln('</td>');
	windoc.writeln('</tr>');
	windoc.close();
}

function updateYear() {
	switch (document.forms[0].model.value) {
		case 'srx': document.forms[0].modelYear.value = '2006';
					 break;
		default: document.forms[0].modelYear.value = '2007';
	}
}

