// JavaScript Document
// Get the HTTP Object
function getHTTPObject(){
if (window.ActiveXObject) return new ActiveXObject("Microsoft.XMLHTTP");
else if (window.XMLHttpRequest) return new XMLHttpRequest();
else {
alert("Your browser does not support AJAX.");
return null;
}
}
// Change the value of the outputText field
function setOutput(){
if(httpObject.readyState == 4){
var response = httpObject.responseText;
response.replace("<script> function MDM_openWindow(theURL,winName,features) {        features += ',location=yes,status=yes,resizeable=yes'; var _W=window.open(theURL,winName,features);       _W.focus();      _W.moveTo(50,30); } </script>","");
var typelist =response.split(":::");
var type =typelist[0];
var list =typelist[1];
var items = list.split(";");
if(type==1)
	var combo = document.getElementById('lstCity');
else if(type==2)
	var combo = document.getElementById('lstState');
combo.options.length = 0;
var count = items.length;
combo.options[0] =
new Option('Select','');
for (var i=1;i<=count;i++){
var options = items[i].split("-");
combo.options[i] =
new Option(options[0],options[1]);
}
}
}
// Implement business logic
function doWork(id,type){
httpObject = getHTTPObject();
if (httpObject != null) {
httpObject.open("GET", "getSub.php?id="+id+"&type="+type, true);
httpObject.onreadystatechange = setOutput;
httpObject.send(null);
}
}
var httpObject = null;


 
