function go()
{
	var theSelect;

	theSelect = document.getElementById("modelSelect");
	if (theSelect.selectedIndex > 0) {
		if ((window.location.href.toLowerCase().indexOf("/cro/cars/pricing/index.htm") != -1) || (window.location.href.toLowerCase().indexOf("/cro/cars/car-prices/index.htm") != -1)) {
			window.location = theSelect.value + "/prices.htm";
		} else {
			window.location = theSelect.value + "/overview.htm";
		}
	} else {
		theSelect = document.getElementById("makeSelect");
		if (theSelect.selectedIndex > 0) {
			alert("Please select a model first.");
		} else {
			if (document.getElementById("new_select").checked) {
				window.location = "/cro/cars/types/new-a-to-z-index.htm";
			} else if (document.getElementById("used_select").checked) {
				window.location = "/cro/cars/types/used-a-to-z.htm";
			} else {
				alert("Please select new or used.");
			}
		}
	}
}

var casSel;

function switchNewUsed() {
	if (document.getElementById("new_select").checked) {
		casSel = null;
		document.getElementById("makeSelect").onchange = null;
		document.getElementById("modelSelect").onchange = null;
		casSel = new CascadingSelector(
			[ document.getElementById("makeSelect"), document.getElementById("modelSelect")],
			ModelPulldowns.getNewPulldowns());
		if (window.location.href.toLowerCase().indexOf("/cro/cars/pricing/index.htm") == -1) {
			document.getElementById("makeSelect").options[0].innerHTML = "All A-Z";
			document.getElementById("modelSelect").options[0].innerHTML = "All A-Z";
		}
	} else if (document.getElementById("used_select").checked) {
		casSel = null;
		document.getElementById("makeSelect").onchange = null;
		document.getElementById("modelSelect").onchange = null;
		casSel = new CascadingSelector(
			[ document.getElementById("makeSelect"), document.getElementById("modelSelect")],
			ModelPulldowns.getUsedPulldowns());
		if (window.location.href.toLowerCase().indexOf("/cro/cars/pricing/index.htm") == -1) {
			document.getElementById("makeSelect").options[0].innerHTML = "All A-Z";
			document.getElementById("modelSelect").options[0].innerHTML = "All A-Z";
		}
	}
}

function setupEvent(inNode, inType, inFunction) {
	if (inNode.addEventListener) {
		inNode.addEventListener(inType, inFunction, false);
	} else if (inNode.attachEvent) {
		inNode.attachEvent("on" + inType, inFunction);
	} else {
		inNode["on" + inType] = inFunction;
	}
}

var ns = document.getElementById("new_select");
var us = document.getElementById("used_select");
if (ns) {
	setupEvent(ns, "click", switchNewUsed);
}
if (us) {
	setupEvent(us, "click", switchNewUsed);
}
switchNewUsed();
