var reqObj = null;
function createRequest(){
	try {
	   reqObj = new ActiveXObject("Msxml2.XMLHTTP");
	}
	catch (err)	{
			try {
			reqObj = new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (err2) {
			try {
			   reqObj = new XMLHttpRequest();
			}
			catch (err3) {
			   reqObj = null;
			}
		}
	}
	return reqObj;
}

function get_location(selcat){
	if(selcat != ''){
		xmlhttp = createRequest();
		if(xmlhttp != null){
			xmlhttp.open("GET", hurl+"ajx.php?act=location&selcat="+selcat+"&rand="+Math.random(1,10), true);
			xmlhttp.onreadystatechange = change_locationdd;
			xmlhttp.send(null);
		}
	}
}

function change_locationdd(){
	frm	= document.form1;	
	frm.locationdd.options.length = 0;
	if (xmlhttp.readyState == 4) {
		if (xmlhttp.status == 200) {
			var text1  = xmlhttp.responseText;
			//alert(text1); 
			if(text1 == 0){
				frm.locationdd.options[0] = new Option('Not Available',0);
			}
			else{
				var del_arr   = text1.split(',');

				frm.locationdd.options[0] = new Option(' - select - ', '');
				for(i=0; i<del_arr.length; i++){
					var val = del_arr[i];
					var val_arr = val.split('::');
					val	= val_arr[0];
					dis	= val_arr[1];

					var j = i+1;
					frm.locationdd.options[j] = new Option(dis,val);
				}
			}
		}
	}
}
