// JavaScript Document
function callDealer()
 {
	var brand;
	//var selectBox = document.warranty.strBrand;
	var selectBox = new getObj("strBrand");
	brand = selectBox.obj.options[selectBox.obj.selectedIndex].value
	var type;
	//var selectBox2 = document.warranty.strProductType;
	selectBox2 = new getObj("strProductType");
	type = selectBox2.obj.options[selectBox2.obj.selectedIndex].value

	var strProductType = new getObj("strProductType");
	strProductType.obj.value = selectBox2.obj.options[selectBox2.obj.selectedIndex].value;
	var url = '/wiliam/find_a_dealer.asp?'
		+'brandid=' + brand
		+'&typeid=' + type

		//alert(url);
       loadXMLActivity (url);
      // window.open (url);
		
	   return false;
}

function callOther(str)
{
	var product;
	var selectBox = document.find_a_dealer.strProduct;
	product = str.options[str.selectedIndex].value;
	var product1 = new getObj("strProduct");
	product1.obj.value = product;
	// alert(product)
	var obj = new getObj("other");
	
	if (product== -1 ){
		obj.style.display = "inline";
		} 
	else {
				obj.style.display = "none";
		}
	
}


var act;

function loadXMLActivity(url) 
{
	//window.open (url);
    // branch for native XMLHttpRequest object
    if (window.XMLHttpRequest) {
        act = new XMLHttpRequest();
        act.onreadystatechange = processActivity;
        act.open("GET", url, true);
        act.send(null);
    // branch for IE/Windows ActiveX version
    } else if (window.ActiveXObject) {
        act = new ActiveXObject("Microsoft.XMLHTTP");
        if (act) {
            act.onreadystatechange = processActivity;
            act.open("GET", url, true);
            act.send();
        }
    }
}


function processActivity() 
{
	var obj = new getObj("prductlist");
    // only if req shows "complete"
    switch (act.readyState) {
		case 1:
			//obj.obj.innerHTML = "<img src='/images/loading-anim.gif'>";
		break;

		case 4:
			// only if "OK"
			if (act.status == 200) {
				obj.obj.innerHTML = act.responseText;
			} else {
				alert("There was a problem retrieving the XML data:\n" + act.statusText);
			}
		break;
    }
}

function callResults()
 {
	 
		var obj = new getObj("results");
	   	
	 if (obj.style.display == "inline") {
				obj.style.display = "none";
		} 
		else {
				obj.style.display = "inline";
			}
}



