// JavaScript Document
function _g(id){return document.getElementById(id)};
function gL(x){var l=0;while(x){l+=x.offsetLeft;x=x.offsetParent;}return l};
function gT(x){var t=0;while(x){t+=x.offsetTop;x=x.offsetParent;}return t};

function xmlHttp(Url,xmlBack){	
var xObj=null;
try{
	xObj=new ActiveXObject("MSXML2.XMLHTTP")
	}catch(e)
	{
	try
	{
		xObj=new ActiveXObject("Microsoft.XMLHTTP")
	}catch(e2){
		try{
		xObj=new XMLHttpRequest()}catch(e){}}};
		with(xObj){
			open("get",Url, true);
			onreadystatechange=function(){
				if(readyState==4&&status==200)
				{
					xmlBack(responseText)
				}};send(null)}};


//首页城市切换
 var cityidfirst="";
function _all(cityid,obj){
	
  if (cityid!="")
  {
	  cityidfirst.id="";
   obj.id="tab_current";
  }

  xmlHttp("city.asp?cityid="+cityid,function(e){_g('main_box').innerHTML=e});

  cityidfirst=obj;
  
  
}

function _allcity(obj){
 cityidfirst.id="";
   obj.id="tab_current";
 xmlHttp("/indexallcity.asp",function(e){_g('main_box').innerHTML=e});
cityidfirst=obj;
}

//首页品牌弹出城市

function getAbsLeft(e){var l=e.offsetLeft;while(e=e.offsetParent) l   +=   e.offsetLeft;   return   l;}   
function getAbsTop(e){var   t=e.offsetTop;while(e=e.offsetParent) t   +=   e.offsetTop;return t;}




function ShowMap(classid,obj){
	var ShowObj=GetObj('chaintip');
	ShowObj.style.position='absolute';
	ShowObj.style.top =getAbsTop(obj)+60;
	ShowObj.style.left =getAbsLeft(obj)-130;
	ShowObj.style.display = "block";
	xmlHttp("classcity.asp?classid="+classid,function(e){_g('chaincontent').innerHTML=e});
}
function GetObj(objName){
	if(document.getElementById){
		return eval('document.getElementById("' + objName + '")');
	}else if(document.layers){
		return eval("document.layers['" + objName +"']");
	}else{
		return eval('document.all.' + objName);
	}
}




//首页城市切换获取地标

function _citylabel(cityid,obj){
	
	
 if (obj!="current")
 { 
     document.getElementById("hcity").value=obj.innerHTML;
	 _g("hcity").style.backgroundColor="#ffff00";
	 setTimeout(function(){_g("hcity").style.backgroundColor="#fff"},200)			  
 }

xmlHttp('citylabel.asp?cityid='+cityid,function(e){_g('search2').innerHTML=e; _g('c'+cityid).className="indexsearchcity";_g('hcity').style.color="#000000";_g("labelname").value="";});
	

		
}

//地标添充城市和附近地标
function setkey(cname,label,syid)
{    
	_g("hcity").value=label;
	_g("hcity").style.backgroundColor="#ffff00";
	_g("labelname").value=cname;
	_g("labelname").style.backgroundColor="#ffff00";
	_g("sy").value=syid;
	_g('hcity').style.color="#000000"
	setTimeout(function(){_g("labelname").style.backgroundColor="#fff";_g("hcity").style.backgroundColor="#fff"},200)
	
	
}


function nTabs(thisObj,Num,cityid){
if(thisObj.className == "active")return;
var tabObj = thisObj.parentNode.id;
var tabList = document.getElementById(tabObj).getElementsByTagName("li");
for(i=0; i <tabList.length; i++)
{
  if (i == Num)
  {
   thisObj.className = "active"; 
	xmlHttp("cil.asp?cityid="+cityid,function(e){_g('navclass_Content').innerHTML=e});
  }else{
   tabList[i].className = "normal"; 
  }
} 
}

function nTabs2(thisObj,Num,cityid){
if(thisObj.className == "active")return;
var tabObj = thisObj.parentNode.id;
var tabList = document.getElementById(tabObj).getElementsByTagName("li");
for(i=0; i <tabList.length; i++)
{
  if (i == Num)
  {
   thisObj.className = "active"; 
	xmlHttp("cityn.asp?cityid="+cityid,function(e){_g('dancityjd_Content').innerHTML=e});
  }else{
   tabList[i].className = "normal"; 
  }
} 
}
