var xmlhttp=false;
function httpRequest(xUrl, method, sendData, async, callbackHandler) {
  if (window.ActiveXObject) // if IE
  {
    try
    {
       xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch(e)
    {
      try
      {
        xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
      }
      catch(e){ xmlhttp = false; }
    }
  }
  else
  {  
    if (window.XMLHttpRequest) // if Mozilla, Safari etc
    {
      try
      {
        xmlhttp = new XMLHttpRequest();		
      }
      catch (e){  xmlhttp = false; }
    }
    else
      return false;
  }
  
   // initial xmlhttp end..
  
   // uppercase post and get
   method = method.toUpperCase();
  
   if(method!="POST" && method!="GET")
       return false;
  
   xmlhttp.open(method, xUrl, async);     
   if(async) xmlhttp.onreadystatechange = callbackHandler;
   if(method=="POST")
       xmlhttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');

   // send data to server      
   xmlhttp.send(sendData);
   if(!async)
     return xmlhttp.responseText;
   else
     return true;
}

function ajax_place(cityid,areaid,search_class)
{
  //if(checkthispage(v1,v2.replace('skeyword',''))!=false){
  //displayMsg('start async =======');

  var url = 'getplace.aspx?CityID='+cityid+'&AreaID='+areaid+'&search_class='+search_class+'&t='+(new Date()).getTime(); // return timestamp return timestamp to void browser cache, also can user Date.parse(new Date())

  //displayMsg(url);
  if(httpRequest(url, "GET", "", true, handler)) {
  	//displayMsg('');  
  //}
}
}


function handler()
{
   if(xmlhttp.readyState==4 && xmlhttp.status==200)
   {
      displayMsg(xmlhttp.responseText);
   }
}

function displayMsg(msg)
{
	var now = new Date();
	//var str_now = now.getHours() + ":" + now.getMinutes() + ":" + now.getSeconds() + "." + now.getMilliseconds();
	
	document.getElementById("showplace").innerHTML = "<br>"+msg;
	

}


function getscode(years,months)
{

  //if(checkthispage(v1,v2.replace('skeyword',''))!=false){
  //displayMsg('start async =======');
  var url = 'getevent.aspx?years='+years+'&months='+months+'&t='+(new Date()).getTime(); // return timestamp return timestamp to void browser cache, also can user Date.parse(new Date())
  //displayMsg(url);
  if(httpRequest(url, "GET", "", true, handlercode)) {
  	//displayMsg('');  
  //}
}
}

function handlercode()
{
   if(xmlhttp.readyState==4 && xmlhttp.status==200)
   {
      displayMsgCode(xmlhttp.responseText);
   }
}

function displayMsgCode(msg)
{
	var now = new Date();
	//var str_now = now.getHours() + ":" + now.getMinutes() + ":" + now.getSeconds() + "." + now.getMilliseconds();
	document.getElementById("scode").innerHTML = "<table border='0' style='width: 584px;' align='left' cellpadding='0' cellspacing='0' id='___6'><tr><td ><img id='actions_01' src='images/actions_01.gif' width='106' height='33' alt='' /></td><td  ><img src='images/actions_02.gif' alt='' name='actions_02' width='310' height='33' id='actions_02' /></td><td width='88'><img id='actions_03' src='images/actions_03.gif' width='88' height='33' alt='' /></td></tr>" + msg + "</table>";
	
}