function GetXmlHttpObject(){
  var xmlHttp=null;
 	 try{
    // Firefox, Opera 8.0+, Safari
    	xmlHttp=new XMLHttpRequest();
    }catch (e){
    // Internet Explorer
    try{
      xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }catch (e){
      xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
    }
  return xmlHttp;
}

//For search
function brandInCategory(categid){
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
		alert ("Your browser does not support AJAX!");
		return;
	} 
	if(categid!= ""){
		var url="mall_detail/searchListAjax.php";
		url=url+"?catid="+categid+"&actionFor=brandList";				
		xmlHttp.onreadystatechange=searchListdt1;
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);	
		document.getElementById('searchListdiv').innerHTML = "<select name='brand' style='width:168px;'><option value=''>--Loading--</option></select>";
	}
}
function searchListdt1(){ 		
		if (xmlHttp.readyState==4){	
				var result = xmlHttp.responseText;				
				document.getElementById('searchListdiv').innerHTML = result;
				
				}	
}

function mallInCity(cid){		
		xmlHttp=GetXmlHttpObject();
		if (xmlHttp==null){
  		alert ("Your browser does not support AJAX!");
  		return;
  		} 
		if(cid != ""){
		var url="mall_detail/mallListAjax.php";
		url=url+"?cityid="+cid+"&actionFor=mallList";				
		xmlHttp.onreadystatechange=mallListdt1;
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);	
		document.getElementById('malllistdiv').innerHTML = "<select name='mall' style='width:140px;'><option value=''>--Loading--</option></select>";
		}
}
function mallListdt1(){ 		
		if (xmlHttp.readyState==4){	
				var result = xmlHttp.responseText;				
				document.getElementById('malllistdiv').innerHTML = result;
				
				}	
}

//For Mall details page urls
function mallDetail(id){
	mallBranchId = id.split(",");
	window.location="mall_detail/mallsDetail.php?mId="+mallBranchId[0]+"&bId="+mallBranchId[1];
}

//For search
function brandInCategory(categid){
	xmlHttp=GetXmlHttpObject();
	if (xmlHttp==null){
		alert ("Your browser does not support AJAX!");
		return;
	} 
	if(categid!= ""){
		var url="mall_detail/searchListAjax.php";
		url=url+"?catid="+categid+"&actionFor=brandList";				
		xmlHttp.onreadystatechange=searchListdt1;
		xmlHttp.open("GET",url,true);
		xmlHttp.send(null);	
		document.getElementById('searchListdiv').innerHTML = "<select name='brand' style='width:168px;'><option value=''>--Loading--</option></select>";
	}
}
function searchListdt1(){ 		
		if (xmlHttp.readyState==4){	
				var result = xmlHttp.responseText;				
				document.getElementById('searchListdiv').innerHTML = result;
				
				}	
}

/****** Author Prashant Shukla *********/
var xmlhttp

function loadXMLDoc(url)
{
xmlhttp=null
// code for Mozilla, etc.
if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest()
  }
// code for IE
else if (window.ActiveXObject)
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP")
  }
if (xmlhttp!=null)
  {
  xmlhttp.onreadystatechange=state_Change
  xmlhttp.open("GET",url,true)
  xmlhttp.send(null) 
  //document.pnr_stat.action =url
  //document.pnr_stat.submit()
  }
else
  {
  alert("Your browser does not support XMLHTTP.")
  }
}

function state_Change()
{
if (xmlhttp.readyState==4)
  {
  if (xmlhttp.status==200)
  { 
  document.getElementById('loadDiv').style.display = 'block';
  document.getElementById('loadDiv').innerHTML=xmlhttp.responseText
  //writeXML()
  }
  else
  {
  alert("Problem retrieving XML data:" + xmlhttp.statusText)
  }
  }
}
