function getHttpObject() {
	var xmlhttp;
	if (window.ActiveXObject){
		try {
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e){
			try {
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (E){
				xmlhttp = false;
			}
		}
	} else if (window.XMLHttpRequest) {
		try {
			xmlhttp = new XMLHttpRequest();
		} catch (e) {
			xmlhttp = false;
		}
	}
	return xmlhttp;
}

function addListener(obj, eventType, func, cap){
	if(obj.attachEvent) {
		obj.attachEvent('on' + eventType, func);
	} else if(obj.addEventListener){
		obj.addEventListener(eventType, func, cap);
	} else {
		alert('No support on your Browser');
		return false;
	}
}

//通过都道府县，找景区
function getAreaByCity(bIdName,mIdName,sIdName,hiddenMIdName,hiddenSIdName,mSpanName,sSpanName,lang,onChangeFlg){
  
  var bId = document.getElementById(bIdName).value;
  var mId= "";
  if (document.getElementById(hiddenMIdName)!=null){
	  mId = document.getElementById(hiddenMIdName).value;
  }
  var httpObj = getHttpObject();
	  httpObj.onreadystatechange = function(){
		  if((httpObj.readyState == 4) && (httpObj.status == 200)) {
			$(mSpanName).innerHTML = httpObj.responseText;
		  } 
	  }
	  httpObj.open("GET", "/common/ajaxphp/getareabycity.php?bId="+bId+"&mId="+mId+"&bIdName="+bIdName+"&lang="+lang+"&mIdName="+mIdName+"&sIdName="+sIdName+"&hiddenSIdName="+hiddenSIdName+"&hiddenMIdName="+hiddenMIdName+"&sSpanName="+sSpanName+"&mSpanName="+mSpanName+"&onChangeFlg="+onChangeFlg,true);
	  httpObj.setRequestHeader("If-Modified-Since","0");
	  httpObj.send(null);
}

//通过景区，找景点(如果景区为空，通过都道府县找景点）
function getSpotByArea(bIdName,mIdName,sIdName,hiddenSIdName,spanId,lang){

  var bId = document.getElementById(bIdName).value;
  var mId="";
  if (document.getElementById(mIdName)!=null){
	  mId = document.getElementById(mIdName).value;
  }
  var sId="";
   if (document.getElementById(hiddenSIdName)!=null){
	  sId = document.getElementById(hiddenSIdName).value;
  }

  var httpObj = getHttpObject();
	  httpObj.onreadystatechange = function(){
		  if((httpObj.readyState == 4) && (httpObj.status == 200)) {
			$(spanId).innerHTML = httpObj.responseText;
		  } 
	  }

	  httpObj.open("GET", "/common/ajaxphp/getspotbyarea.php?bId="+bId+"&mId="+mId+"&sId="+sId+"&sIdName="+sIdName+"&lang="+lang,true);
	  httpObj.setRequestHeader("If-Modified-Since","0");
	  httpObj.send(null);
}
//通过大分类找小分类
function getPointType(bIdName,mIdName,hiddenMIdName,spanId,lang,onChangeFlg){
  var bId = document.getElementById(bIdName).value;

  var mId= "";
  if (document.getElementById(hiddenMIdName)!=null){
	  mId = document.getElementById(hiddenMIdName).value;
  }

  var httpObj = getHttpObject();
	  httpObj.onreadystatechange = function(){
		  if((httpObj.readyState == 4) && (httpObj.status == 200)) {
			$(spanId).innerHTML = httpObj.responseText;
		  } 
	  }
	  httpObj.open("GET", "/common/ajaxphp/getpointtype.php?bId="+bId+"&mId="+mId+"&lang="+lang+"&bIdName="+bIdName+"&mIdName="+mIdName+"&onChangeFlg="+onChangeFlg,true);
	  httpObj.setRequestHeader("If-Modified-Since","0");
	  httpObj.send(null);
}
//通过大分类,小分类,找不同设施
function getPointTypeContens(bIdName,mIdName,spanId){
  
  var bId = document.getElementById(bIdName).value;
  var mId= "";
  if (document.getElementById(mIdName)!=null){
	  mId = document.getElementById(mIdName).value;
  }

  var httpObj = getHttpObject();
	  httpObj.onreadystatechange = function(){
		  if((httpObj.readyState == 4) && (httpObj.status == 200)) {
			$(spanId).innerHTML = httpObj.responseText;
		  } 
	  }
	  httpObj.open("GET", "/common/ajaxphp/getpointtypecontens.php?bId="+bId+"&mId="+mId,true);
	  httpObj.setRequestHeader("If-Modified-Since","0");
	  httpObj.send(null);
}
//通过国家找城市
function getCityByContry(bIdName,mIdName,hiddenMIdName,spanId,lang){
  var bId = document.getElementById(bIdName).value;

  var mId= "";
  if (document.getElementById(hiddenMIdName)!=null){
	  mId = document.getElementById(hiddenMIdName).value;
  }

  var httpObj = getHttpObject();
	  httpObj.onreadystatechange = function(){
		  if((httpObj.readyState == 4) && (httpObj.status == 200)) {
			$(spanId).innerHTML = httpObj.responseText;
		  } 
	  }
	  httpObj.open("GET", "/common/ajaxphp/getcitybycontry.php?bId="+bId+"&mId="+mId+"&lang="+lang+"&bIdName="+bIdName+"&mIdName="+mIdName,true);
	  httpObj.setRequestHeader("If-Modified-Since","0");
	  httpObj.send(null);
}





