var xmlHttp;
var HtmlTagId;
//------AJAX------AJAX------AJAX------AJAX------AJAX------AJAX------

function GetStateValcolour(tagid,cid,controlid,width)
{ 
	
	
	HtmlTagId=tagid;
	//alert('hi');
	if (document.getElementById("loadflag").value == "false")
	{
		
		document.getElementById(HtmlTagId).innerHTML="<img src='images/loading.gif' hspace=0 vspace=0 border=0><br>" + document.getElementById(HtmlTagId).innerHTML;
		document.getElementById("loadflag").value = "true";
		//document.getElementById("ddlModel").value = "**Loding**"
	}
	
	var url="get_colour.asp?sid="+ Math.random() +"&countryid="+ cid +"&controlid="+ controlid +"&width="+ width +"&se="+ document.getElementById("se").value ;
	xmlHttp=GetXmlHttpObject(stateChanged);
	xmlHttp.open("Get", url , true);
	xmlHttp.send(null);
} 

function GetStateVal(tagid,cid,controlid,width)
{ 
	
	
	HtmlTagId=tagid;
	//alert('hi');
	if (document.getElementById("loadflag").value == "false")
	{
		
		document.getElementById(HtmlTagId).innerHTML="<img src='images/loading.gif' hspace=0 vspace=0 border=0><br>" + document.getElementById(HtmlTagId).innerHTML;
		document.getElementById("loadflag").value = "true";
		//document.getElementById("ddlModel").value = "**Loding**"
	}
	
	var url="get_model_default.aspx?sid="+ Math.random() +"&countryid="+ cid +"&controlid="+ controlid +"&width="+ width +"&se="+ document.getElementById("se").value +"&model="+ document.getElementById("txtModelText").value ;
	xmlHttp=GetXmlHttpObject(stateChanged);
	xmlHttp.open("Get", url , true);
	xmlHttp.send(null);
} 

function stateChanged() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	{ 
		document.getElementById(HtmlTagId).innerHTML=xmlHttp.responseText;
		document.getElementById("loadflag").value = "false";
	} 
} 

function GetXmlHttpObject(handler)
{ 
	var objXmlHttp=null;
	if (navigator.userAgent.indexOf("Opera")>=0)
	{
		alert("This page doesn't work in Opera") 
		return; 
	}
	if (navigator.userAgent.indexOf("MSIE")>=0)
	{ 
		var strName="Msxml2.XMLHTTP";
		if (navigator.appVersion.indexOf("MSIE 5.5")>=0)
		{
			strName="Microsoft.XMLHTTP";
		}
		try
		{ 
			
			objXmlHttp=new ActiveXObject(strName);
			objXmlHttp.onreadystatechange=handler ;
			return objXmlHttp;
		} 
		catch(e)
		{ 
			alert("Error. Scripting for ActiveX might be disabled") 
			return;
		} 
	} 
	if (navigator.userAgent.indexOf("Mozilla")>=0)
	{
		objXmlHttp=new XMLHttpRequest();
		objXmlHttp.onload=handler;
		objXmlHttp.onerror=handler;
		return objXmlHttp;
	}
} 

//------AJAX------AJAX------AJAX------AJAX------AJAX------AJAX------

function Price()
{
	
	if (document.getElementById("ddlCategory").value==0)
	{
		alert('Please Select Category.');
		document.getElementById("ddlCategory").focus();
		return false;
	}
	if (parseFloat(document.getElementById("ddlMinPrice").value) > parseFloat(document.getElementById("ddlMaxPrice").value))
	{
		alert('Minimum Price must be lessthan the Maximum Price.');
		document.getElementById("ddlMinPrice").focus();
		return false;
	}
	document.Form1.HModel.value=document.getElementById("ddlModel").value;
}
