var xmlHttp
function  PopulateHtml(iD,mode,name,code)
{ 
		

		document.getElementById("imgLoad").style.display = 'inline';	
		if(name != "")
		{
			document.getElementById("stName").innerHTML = '<a href="index.php?state='+ code + '" class="BlueText">'+ name +'</a>';
		}
		else
		{
			document.getElementById("stName").innerHTML = "";	
		}
		
		if(mode == 1)
		{
			var url="include/populate-values.php?cID="+iD;
		}
		if(mode == 2)
		{
			var url="include/populate-values.php?sID="+iD;
		}
		
		xmlHttp = GetXmlHttpObjectThread(threadChanged);
		xmlHttp.open("GET", url , true)
		xmlHttp.send(null)
} 
function threadChanged()  
{ 
		if (xmlHttp.readyState==4 ||  xmlHttp.readyState=="complete")
		{ 
			document.getElementById("innHtml").innerHTML = "";	
			document.getElementById("imgLoad").style.display = 'none';	

			if(xmlHttp.responseText != "")
			{
				document.getElementById("innHtml").innerHTML =  xmlHttp.responseText; 
			}
			else
			{
				document.getElementById("innHtml").innerHTML = "";
			}
		}  
} 
function GetXmlHttpObjectThread(handler)
{ 
			var objXmlHttp=null
			if (navigator.userAgent.indexOf("Opera")>=0)
			{
				alert("The ajax is not working on 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
			}
	} 
