var req;
function validate()
{
	var valid = false;
	var oform = document.ayan;
	var make = oform.make.value;
	var model = oform.model;
	var zip = oform.zip.value;
	if (make != "" && model != "")
	{
		oform.year.value = model.options[model.selectedIndex].text.substring(0,4);
		/*
		model = model.split('!!');
		model = model[1].split(',');
		oform.makeid.value = model[0];
		oform.modelid.value = model[1];
		*/
		valid = true;
	}
	return valid;
}
function loadXMLDoc(model)
{
	if (!model)
	{
		document.ayan.model.length = 0;
		document.ayan.model.options.add(new Option('[Model]',''));
		return;
	}

	var url = '/getListingInfo.aspx?id=' + model;
	if (window.XMLHttpRequest)
	{
		req = new XMLHttpRequest();
		if (req)
		{
			req.onreadystatechange = processReqChange;
			req.open("GET", url, true);
			req.send(null);
		}
	}
	else if (window.ActiveXObject)
	{
		req = new ActiveXObject("Microsoft.XMLHTTP");
		if (req)
		{
			req.onreadystatechange = processReqChange;
			req.open("GET", url, true);
			req.send();
		}
	}
}
function processReqChange()
{
	if (req.readyState == 4)
	{
		if (req.status == 200)
		{
			if(!req.responseXML){alert("no data"); return;}
			var root = req.responseXML.documentElement;
			var values = root.getElementsByTagName('id');
			var texts = root.getElementsByTagName('txt');
			document.ayan.model.length = 0;
			if (values.length > 0)
			{
				for (var i = 0; i < values.length; i++)
				{
					var t=texts[i].firstChild.data, v=values[i].firstChild.data;
					if(v.length==1){v="00"+v;}else if(v.length==2){v="0"+v;}
					document.ayan.model.options[i] = new Option(t,v);
				}
			}
		}
	}
}

function clearZip(zip)
{
	if(zip.value=="[Zip]"){	zip.value=""; }
}