/*
大地图搜索 
2008 6 16 QiuLin Woo ver1.0
*/
var basePath = "";
var sData_basePath = "";
var sData_local = "search?act=newpoi&key=?key?&skey=?skey?&citycode=?citycode?&pagecount=?pagecount?&l=?l?&b=?b?&r=?r?&t=?t?&x=?x?&y=?y?&source=RICHMAP&typecode=?typecode?&pageno=?pageno?";
var sData_bus_step1 = "search?act=bus_step1&citycode=?citycode?&begin=?begin?&end=?end?&beginx=?beginx?&beginy=?beginy?&endx=?endx?&endy=?endy?&run=?run?&arg=?arg?";
var sData_bus_step2 = "search?act=bus2&citycode=?citycode?&begin=?begin?&end=?end?&beginx=?beginx?&beginy=?beginy?&endx=?endx?&endy=?endy?&run=?run?&arg=?arg?";
//var sData_driver = "search?act=driver&bcitycode=?bcitycode?&ecitycode=?ecitycode?&begin=?begin?&end=?end?&beginx=?beginx?&beginy=?beginy?&endx=?endx?&endy=?endy?&cartype=?cartype?&carbrand=?carbrand?&run=?run?&arg=?arg?";
var sData_driver_step1 = "search?act=driver_step1&citycode1=?citycode1?&citycode2=?citycode2?&begin=?begin?&end=?end?&beginx=?beginx?&beginy=?beginy?&endx=?endx?&endy=?endy?";
var sData_driver_step2 = "search?act=driver_step2&begin=?begin?&end=?end?&beginx=?beginx?&beginy=?beginy?&endx=?endx?&endy=?endy?&option=?option?";
var sData_aroundSearch = "search?act=around&format=true&key=?key?&skey=?skey?&citycode=?citycode?&typecode=?typecode?&x=?x?&y=?y?&dis=?dis?&pagecount=?pagecount?&pageno=?pageno?";
var sData_busStop = "search?act=stops&format=true&key=?key?&citycode=?citycode?&count=?count?&run=?run?&arg=?arg?";
var sData_busStopId = "search?act=stopbyid&key=?key?";
var sData_busLine = "search?act=lines&citycode=?citycode?&key=?key?";
var sData_hotKey = "com/ncserv?act=LATELYKW&count=10&citycode=?citycode?";
var sData_namecard = "com/ncserv?act=CARDINFO&poiid=?poiid?&csize=?csize?&psize=?psize?";
var sData_keyword = "search?act=kwcard&citycode=?citycode?&key=?key?&isnewquery=?isnewquery?&pagecount=?pagecount?&pageno=?pageno?";
var sData_poi = "search?act=searchpoi&dwkey=?dwkey?"; 
var smsBase = "com/ifc?act=tosendmsm&msg=";
var dialogArgument = "dialogWidth:500px;dialogHeight:460px;status:no;center:yes;help:no;minimize:no;maximize:no;scroll:no;";
var richmap = null;
window.onload = function (){
	if(!checkUserEnvironment()){return; }	
	changeSideBar($("sideBar1"));
	attachSideBarEvent();
	attachInputEvent();
	attachHelpsEvent();
	reSize();
	attachArrowLR();
	initMap();
	
};
window.onresize = function(){
	reSize();
};
//显示隐身城市列表
function showHideCityList(){
	var obj = $("cityContainer");
	obj.style.display = (obj.style.display == "")?"none":"";
};
//帮助信息
function attachHelpsEvent(){
	var spans = document.getElementsByTagName("span");
	var len = spans.length;
	var tempi = 0;
	for(var i = 0 ; i < len ; i++){
		if(spans[i].className == "helps"){				
			spans[i]["onmouseover"] = function (){
				var info = "";
				if(document.all){
					info = this.code;
				}else{
					info = this.getAttribute("code");
				}
				showTitle(info);
			}
			spans[i]["onmouseout"] = function (){
				closeTitle();
			}
		}
	}
}
//搜索和结果页面选项卡的切换
var oldStyle =null;
function changeSideBar(obj){	
	if(oldStyle == obj)return;
		obj.className = "sideBar1";		
	if(oldStyle !=null){
		oldStyle.className = "sideBar2";			
	}
	oldStyle = obj;		
};
//搜索和结果页面选项卡的切换事件响应
function attachSideBarEvent(){
	$("sideBar1").onclick = function(){
		changeSideBar($("sideBar1"));
		$("searchType").style.display ="";
		$("searchResult").style.display ="none";
	};
	$("sideBar2").onclick = function(){
		changeSideBar($("sideBar2"));
		$("searchType").style.display ="none";
		$("searchResult").style.display ="";
	};
};
//公交查询
var busT = ["busChange","busLines","busStops"];
var BUSSEARCH = 0;
function _getBus(act){
	if(act == 0){
		$(busT[0]).style.display = "";
		$(busT[1]).style.display = "none";
		$(busT[2]).style.display = "none";
		$("b").checked = true;
	}else if(act == 1){
		$(busT[0]).style.display = "none";
		$(busT[1]).style.display = "";
		$(busT[2]).style.display = "none";
		$("l").checked = true;
	}else if(act == 2){
		$(busT[0]).style.display = "none";
		$(busT[1]).style.display = "none";
		$(busT[2]).style.display = "";
		$("s").checked = true;
	};
	BUSSEARCH = act;
}
//查询输入框事件响应
var inputTextHT = [];
function attachInputEvent(){
	var obj = document.getElementsByTagName("input");
	var len = obj.length;
	for(var i = 0 ; i < len ; i ++){
		if(obj[i].type == "text"){
			inputTextHT[obj[i].id] = obj[i].value;
			(function(){
				var tempI = i ;
				obj[tempI]["onfocus"] = function (){
					if(inputTextHT[this.id] == this.value){
						this.value = "";
					}
				};
				obj[tempI]["onblur"] = function (){
					if(this.value.trim() == ""){
						this.value = inputTextHT[this.id];
					}
				}
			})()
		}
	}
};
//var arrowImg = {right:["arrow_left","arrow_left_over"],left:["arrow_right","arrow_right_over"]};
//绑定搜索框开关事件 箭头开关
var oldArrowImg = null;
function attachArrowLR(way){
	if(!way) var way = {forward:["arrow_left","arrow_left_over"],flag:"none",act:false};
	var arrowLR = $("arrowIMG");
	if(way.act){
		arrowLR.src = "images/bmap/arrow_right.gif";
	}else {
		arrowLR.src = "images/bmap/arrow_left.gif";
	}
	(function (){
		arrowLR["onmouseover"] = function (){
			this.src= this.src.replace(way.forward[0],way.forward[1]);
		}
		arrowLR["onmouseout"] = function (){
			this.src= this.src.replace(way.forward[1],way.forward[0]);
		}
		arrowLR["onclick"] = function (){
			$("leftContainer").style.display=way.flag;
			setOCSize(way.act);	
			setArrowImg(way.act);		
		}
	})()
};
//搜索框开关 箭头重新设置图片
function setArrowImg(flag){
	if(flag){
		attachArrowLR();
	}else {
		attachArrowLR({forward:["arrow_right","arrow_right_over"],flag:"",act:true});
	}
}
//搜索框开关重新计算位置 设置地图显示大小
function setOCSize(flag){
	var mapC = $("mapContainer");
	if(!flag){
		mapC.style.width = document.body.clientWidth -20
	}else{
		mapC.style.width = document.body.clientWidth - MaxRW - 25;
	}
	if(richmap!=null){
		richmap.resizeMap(parseInt(mapC.style.width),parseInt(mapC.style.height));
	}
}
function setCityCode(code){
	citycode = code;
}

//生成一覆盖层
var overDivObj = null;
function overDiv(act){
	overDivObj = document.createElement("div");	
	with(overDivObj.style){
		background = "#7D847D";
		width = document.body.clientWidth;
		height = document.body.clientHeight;
		zIndex = 555;
		top = "0px" ;
		left = "0px";
		position = "absolute";
		filter ="alpha(opacity=50)";
		opacity ="0.5";
		textAlign ="center";
	}	
	document.body.appendChild(overDivObj);
	document.body.appendChild(setCatalogList(act));	
}
//清除覆盖层
function clearOverDiv(){
	var cDiv = $(cataDivId);
	if(overDivObj!=null && cDiv !=null){
		try{
			document.body.removeChild(overDivObj);
			document.body.removeChild(cDiv);
		}catch(e){}
	}
}
//选取分类 并把分类的值和属性存起来
var catalogValueHT = [];
var catalogCodeHT = [];
var cHashT = [];
function setCValue (obj){
	var str = "";	
	if(obj.checked){	
		if(document.all){	
			catalogCodeHT.push(obj.code);
		}else{
			catalogCodeHT.push(obj.getAttribute("code"));
		}
		catalogValueHT.push(obj.value);
		cHashT[obj.value] = obj.value;
		catalogValueHT.join(",");
	}else{
		if(document.all){	
			//catalogCodeHT.del(obj.code);
			for(var i=0;i<catalogCodeHT.length;i++){
				if(catalogCodeHT[i]==obj.code){
					catalogCodeHT.remove(i);
					catalogValueHT.remove(i);
				}
			}
		}else{
			//catalogCodeHT.del(obj.getAttribute("code"));
			for(var i=0;i<catalogCodeHT.length;i++){
				if(catalogCodeHT[i]==obj.getAttribute("code")){
					catalogCodeHT.remove(i);
					catalogValueHT.remove(i);
				}
			}
		}		
		
		//catalogValueHT.remove(obj.value);
		cHashT[obj.value] = "";
	}
	var len = catalogCodeHT.length;	
	for(i = 0 ; i < len;i++){		
		if(i<2){
			str += catalogCodeHT[i]+",";
		}
	}
	if(str.trim() == ""){
		str = "所有分类";		
	}
	$("cataType").innerHTML = str;
};
//选取搜索类型
var searchTypeHT = [];
var areaTemp = null;
function setAValue(obj){
	$("seType").innerHTML = obj.value;
	areaTemp = obj.id;
};
function sSub(){ 
	if(areaTemp!=null){
		switch(areaTemp){
			case "around":
				s_arounds();
			break;
			case "area":				
				s_rectArear();
			break;
			case "maps":
				s_maps();
			break;
			default :
			break;
		}
	}
	clearOverDiv();
};
function clear(act){
	if(act ==1 ){
		$("cataType").innerHTML="所有分类";
		catalogValueHT = [];
		catalogCodeHT=[];
		cHashT = [];
		selectAllType();
	}else if(act == 2){
		$("seType").innerHTML = "默认搜索类型";
	}
};
//商家类别
var cataDivId = "cataDivId";
var catalogArr = [["好吃的","01"],["买东西","11"],["变漂亮","19"],["好玩的","02"],["便民的","16"],["健康的","05"],["出行的","12"]];
function setCatalogList(act){
	var h = 327;
	var outStr = '<table><tr><td style="color:#E3893B;font-weight:bold;font-size:14px;">请选择你要查询的条件分类</td><td width="300" align="right"><span style="cursor:pointer;" onclick="clearOverDiv()"><img src="images/bmap/city_06.gif"></span></td></tr></table>';
		outStr +='<table border="0" cellpadding="0" width="96%" cellspacing="0" style="padding:3 0 3 15px;color:#189645">';						
	if(act ==1){	
		outStr +='<tr><td style="border-bottom:1px dashed #d4d4d4;"><label for="catalogType">选择分类</label>&nbsp;&nbsp;<a href="javascript:clear(1);" style="color:red;">清空</a></td></tr>';
		var checked = '';
		for(var i = 0 ; i < catalogArr.length ; i++){			
			if(cHashT[catalogArr[i][1]]!=null && cHashT[catalogArr[i][1]]==catalogArr[i][1]){
				checked = 'checked = "checked"';
			}else{
				checked = '';
			}
			outStr +='<tr><td style="padding-left:25px;border-bottom:1px dashed #d4d4d4;"><input '+checked+' type="checkbox" onclick="setCValue(this)" id="catalogType_'+i+'" code="'+catalogArr[i][0]+'" value ="'+catalogArr[i][1]+'"/><label  for="catalogType_'+i+'">'+catalogArr[i][0]+'</label></td></tr>';
		}
	}else if(act == 2){
		h = 200;
		outStr +='<tr><td style="border-bottom:1px dashed #d4d4d4;"><label for="catalogType">选择搜索类型</label>&nbsp;&nbsp;<a href="javascript:clear(2);" style="color:red;">清空</a></td></tr>';
		//outStr +='<tr><td style="padding-left:25px;border-bottom:1px dashed #d4d4d4;"><input type="radio" onclick="setAValue(this)" id="around" name="a"  value ="按周边搜索"/><label  for="around">按周边搜索</label></td></tr>';
		outStr +='<tr><td style="padding-left:25px;border-bottom:1px dashed #d4d4d4;"><input type="radio" onclick="setAValue(this)" id="area" name="a"  value ="框选搜索"/><label  for="area">框选搜索</label></td></tr>';
		outStr +='<tr><td style="padding-left:25px;border-bottom:1px dashed #d4d4d4;"><input type="radio" onclick="setAValue(this)" id="maps" name="a"  value ="按当前地图搜索"/><label  for="maps">按当前地图搜索</label></td></tr>';
	}	
	outStr +='<tr><td colspan="2" style="padding-top:10px;" align="center"><input class="buttons" type="button" onclick="sSub();" value ="确定"/>&nbsp;&nbsp;<input class="buttons" onclick="clearOverDiv()" type="button" value ="关闭"/></td></tr></table>';
	var sDiv = document.createElement("div");
		sDiv.id = cataDivId;
		with(sDiv.style){
			background = "#ffffff";
			width = 506;
			height = h;
			zIndex = 600;
			top = document.body.clientHeight * 0.5 - parseInt(h/2) ;
			left = document.body.clientWidth *0.5 - 258;
			position = "absolute";	
			textAlign = "center";
			paddingTop ="30px";
			border = "2px solid #25B02C";
		}	
	sDiv.innerHTML = outStr;
	return sDiv;	
};
//全选店铺类别
function selectAllType(){
	var objs = document.getElementsByTagName("input");	
	for(var i = 0 ; i < objs.length;i++){
		if(objs[i].type == "checkbox"){
			if(objs[i].id != "catalogType"){
				objs[i].checked = false;				
			}
		}		
	};	
};
//重置页面时，内容随页面大小变化
var MaxRW = 252;
var MaxRH = 555;
var MinRW = MinRH = 0;
var pageW = pageH = 0;
var pageTop = 82;
function reSize(){
	var searchCon = $("searchType");
	var resultCon = $("searchResult");
	var mapCon = $("mapContainer");//地图容器
	var valueCon = $("searchResultContainer");
	var arrowLR = $("arrowLR");	//打开/关闭搜索框
	var wClientWidth = document.body.clientWidth;
	var wClientHeight = document.body.clientHeight;
	pageW = ((wClientWidth- MaxRW -20)<0)?0:(wClientWidth- MaxRW -20);
	pageH = ((wClientHeight- pageTop - 5)<0)?0:(wClientHeight- pageTop - 5);	
	mapCon.style.width = ((pageW - 5)<0)?0:(pageW - 5);
	arrowLR.style.height = pageH +3;	
	mapCon.style.height = pageH +3;
	valueCon.style.height = ((pageH - 152)<0)?0:(pageH - 152);
	//searchCon.style.height =((pageH - 71)<0)?0:(pageH - 71);
	arrowLR.firstChild.style.paddingTop = ((pageH/2 -40)<0)?0:(pageH/2 -40);
	if(richmap!=null){
		richmap.resizeMap(parseInt(mapCon.style.width),parseInt(mapCon.style.height));
	}
}
//初始化地图

function initMap(){
	richmap = new RWing($("mapContainer"));
	richmap.showStop(true);
	richmap.showEagle(true);
	//richmap.showNoteBtn(true);
	richmap.showDirection(false);
	richmap.setRectSelect(true);
	richmap.addEventListener("onsuccess","loadSuccess");
	richmap.addEventListener("onmark","markreturns.show");
	richmap.addEventListener("onStopClick","onStopClick");
	richmap.addEventListener("onrectselect","rectSelectBack");
	richmap.addEventListener("onbussearchstart","mybussearch");
	richmap.addEventListener("ondriversearchstart","startDriverSearch");
	richmap.addEventListener("onaroundsearchstart","myaroundsearch");
	richmap.init();	
	reSize();
	Results.init();	//初始化结果容器对象	
};
//地图成功加载事件
function loadSuccess(){
	richmap.addEventListener("onerror","myerror");
	richmap.showCity(citycode,11);	
	checkApiData(); 
};
function myerror(msg){
	alert(msg);
};
function myaroundsearch(centerName,centerx,centery,typekey,searchDis,citycode){
	startAroundSearch(centerName,centerx,centery,searchDis,typekey,citycode);
};
function mybussearch(begin,end,beginx,endx,beginy,endy,citycode){
	startBusSearch(sData_bus_step1,begin,end,beginx,endx,beginy,endy,citycode);
};
//框选赋值
function rectSelectBack(l,b,r,t){
	rectSelect(l,b,r,t);	
	smain.MBR[0] = l;
	smain.MBR[1] = b;
	smain.MBR[2] = r;
	smain.MBR[3] = t;
	$("sideBar1").fireEvent("onclick");
}
//每个城市的默认中心点位置
var centerPositionArray = {"FJFZ":[4585505,931713],"FJXM":[4467967,1091052],"FJZZ":[4420727,1088167],"FJQZ":[4514713,1048819],"FJPT":[4556077,996492],"FJLY":[4358176,1029399],"FJSM":[4418430,912581],"FJNP":[4472606,875464],"FJND":[4607390,873186]}
//自定义标点进行周边查询
var myMark = [0,0];
function myMarkPosition(_x,_y){
	myMark[0]= _x;
	myMark[1]= _y;
	s_arounds();
}
//选择周边查询
function s_arounds (){
	richmap.clearAllElement();
	cookies = new Cookie();
	smain.around = new AroundSolution();
	var myPositionX = 0;
	var myPositionY = 0;	
	var coo = cookies.getCookie();	
	var thisCity = "";	
	//优先级 自定义-》 cookie -》用户信息 -》 地图中心点位置。
	 if(myMark[0]!=0){
		myPositionX = myMark[0];
		myPositionY = myMark[1];
	}//else if(coo!=null && coo!=""){
	//	var _value = coo.split("_");
	//	thisCity = _value[2];			
	//	if(thisCity == citycode){
	//		myPositionX = _value[0];
	//		myPositionY = _value[1];
	//	}
	//}
	else if(userlagitude!="0.0" && userlongitude!="0.0"){
		myPositionX = userlagitude;
		myPositionY = userlongitude;
	}else if(richmap!=null){
		var center = centerPositionArray[citycode];//richmap.getCenter();				
		myPositionX = center[0];
		myPositionY = center[1];
	}
	with(smain.around){
		centerName = "中心位置";
		distance = 1500;	
		centerX = myPositionX;
		centerY = myPositionY;
		showCenter();
	}
	if(richmap!=null){
		richmap.zoomTo(13,myPositionX,myPositionY);
	}
};
//选择框选查询
function s_rectArear(){
	richmap.clearAllElement();
	richmap.setState(5);
};
//选项以当前地图查询
function s_maps(){
	richmap.clearAllElement();
	richmap.setState(0);
	smain.MBR = richmap.getMBR();
};
//搜索类
var  smain = {
	MBR : [0,0,0,0],	
	around : null,
	keyVO : null,
	keyVT : null,
	cataT : null,
	areaT : null,
	helpKey : null,
	isLocal : function (){//是本地名址查询
		var obj =  $("keystring");		
		this.keyVO = obj.value.trim();
		if(this.keyVO==null && key_load != "" && key_load !="null"){
			this.keyVO = key_load;
		}
		this.helpKey = this.keyVO;
		if(this.keyVO == inputTextHT[obj.id]){			
			this.keyVO = "";
		}
		isLocalSearch = true;
		var sUrl = "";
		sUrl = sData_local;
		var flag = getRandFlag();
		sUrl = sUrl.replace("?key?",this.keyVO);
		sUrl = sUrl.replace("?skey?","");
		sUrl = sUrl.replace("?citycode?",citycode);
		sUrl = sUrl.replace("?pagecount?","10");
		sUrl = sUrl.replace("?pageno?","");
		sUrl = sUrl.replace("?l?",this.MBR[0]);
		sUrl = sUrl.replace("?b?",this.MBR[1]);
		sUrl = sUrl.replace("?r?",this.MBR[2]);
		sUrl = sUrl.replace("?t?",this.MBR[3]);
		sUrl = sUrl.replace("?typecode?",catalogValueHT);
		if(this.around !=null){
			sUrl = sUrl.replace("?x?",this.around.centerX);
			sUrl = sUrl.replace("?y?",this.around.centerY);	
		}else{
			sUrl = sUrl.replace("?x?",0);
			sUrl = sUrl.replace("?y?",0);	
		}
		//alert(page_path);
		if(!Results.getObj(flag,this.keyVO,citycode,"本地查询"))return false;	
		getLocalData(page_path + sUrl,1,flag,citycode);//得到本地查询的结果
	},
	isLine : function (){//线路查询
		var keyObj = $("line");
		this.helpKey = keyObj.value;
		if(key_load=="null"){	
			if(keyObj.value == inputTextHT[keyObj.id] || keyObj.value.trim() == ""){alert("请输入公交线路名称");keyObj.focus();return false;}
		}
		startLineSearch(keyObj.value.trim(),citycode);
	},
	isStop : function (){//站点查询
		var keyObj = $("stops");
		this.helpKey = keyObj.value;	
		if(key_load=="null"){
			if(keyObj.value == inputTextHT[keyObj.id] || keyObj.value.trim() == ""){alert("请输入公交站点名称");keyObj.focus();return false;}	
		}
		//得到一个显示对象
		flag = getRandFlag();
		if(!Results.getObj(flag,keyObj.value,citycode,"公交站点"))return false;
		//得到地址
		sUrl = sData_busStop;
		sUrl = sUrl.replace("?key?",keyObj.value.trim());
		sUrl = sUrl.replace("?citycode?",citycode);
		sUrl = sUrl.replace("?run?","");
		sUrl = sUrl.replace("?arg?","");
		sUrl = sUrl.replace("?count?","10");		
		//进入查询
		getStopData(sData_basePath + sUrl,flag,citycode);
	},
	isBusChanges : function (){//公交换乘
		var keyObj1 = $("busstart");
		var keyObj2 = $("busend");
		this.helpKey = keyObj1.value + " 到 " + keyObj2.value;
		if(begin_load=="null" && end_load == "null"){
			if(keyObj1.value == inputTextHT[keyObj1.id] || keyObj1.value.trim() == ""){alert("请输入公交换乘起点");keyObj1.focus();return false;}		
			if(keyObj2.value == inputTextHT[keyObj2.id] || keyObj2.value.trim()== ""){alert("请输入公交换乘终点");keyObj2.focus();return false;}
		}
		startBusSearch(sData_bus_step1,keyObj1.value,keyObj2.value,"","","","",citycode);
	},
	isDriver : function (){//自驾
		var keyObj1 = $("driverstart");
		var keyObj2 = $("driverend");
		this.helpKey = keyObj1.value + " 到 " + keyObj2.value;	
		if(begin_load=="null" && end_load == "null"){
			if(keyObj1.value == inputTextHT[keyObj1.id] || keyObj1.value.trim() == ""){alert("请输入自驾起点");keyObj1.focus();return false;}		
			if(keyObj2.value == inputTextHT[keyObj2.id] || keyObj2.value.trim()== ""){alert("请输入自驾终点");keyObj2.focus();return false;}
		}
		startDriverSearch(sData_driver_step1,keyObj1.value,keyObj2.value,"","","","",citycode,citycode);
	},
	submit : function (act){//判断提交查询
		if(!richmap.isInit()){
			return ;
		}		
		if(act == 0){
			isLocalSearch = true;
			this.isLocal();//本地搜索
		}else if(act == 1){
			isLocalSearch = false;
			switch(BUSSEARCH){
				case 0:
					this.isBusChanges();//公交换乘
				break;
				case 1:
					this.isLine();//线路查询
				break;
				case 2:
					this.isStop();//站点查询
				break;
				default :
				break;
			}
		}else if(act == 2){
			isLocalSearch = false;
			this.isDriver();//自驾查询
		}
	},
	forHelp : function(){//转向互助社
		var key = encodeURI(this.helpKey);
		var s_url = "/com/help?act=QUESTIONSEARCH&subject="+key;		
		return s_url;		
	}
	
};
//回车事件
function checkENT(evt,obj,act){//
	var evt = window.event || evt;
	if(evt.keyCode == 13){
		smain.submit(act);
	}
};
//由第三方传入的参数进行数据查询
function checkApiData(){
	key_load = key_load.trim();	
	smain.helpKey = key_load;
	//Results.m_oHelpBox.setHelpMsg(0);
	switch(act_load){
		case "local":	//本地查询
			if(key_load != "" && key_load !="null"){
				$("keystring").value = key_load;
				$("keystring").style.color="#000000";		
				startSearch(0);	
				isLocalSearch = true;
			}else{
				return false;	
			}
		break;
		case "line":	//线路查询
			_getBus(1);
			if(key_load != "" && key_load !="null"){				
				isLocalSearch = false;
				$("line").value = key_load;
				$("line").style.color="#000000";				
				startSearch(2);				
			}else{
				return false;	
			}
		break;
		case "stop":	//站点查询
			_getBus(2);
			if(key_load != "" && key_load !="null"){				
				isLocalSearch = false;
				$("stops").value = key_load;
				$("stops").style.color="#000000";
				smain.helpKey = key_load;
				startSearch(3);				
			}else{
				return false;	
			}
		break;
		case "bus":		//公交换乘
			_getBus(0);
			if(begin_load != "" && end_load != "" && begin_load != "null" && end_load != "null"){				
				isLocalSearch = false;
				$("busstart").value = begin_load;
				$("busstart").style.color="#000000";
				$("busend").value = end_load;
				$("busend").style.color="#000000";
				if(beginx_load == "null")beginx_load = "";
				if(endx_load == "null")endx_load = "";
				if(beginy_load == "null")beginy_load = "";
				if(endy_load == "null")endy_load = "";
				smain.helpKey = begin_load +" 到 " + end_load;
				startBusSearch(sData_bus_step1,begin_load,end_load,beginx_load,endx_load,beginy_load,endy_load,citycode);				
			}
		break;
		case "driver":	//自驾方案
			if(begin_load != "" && end_load != "" && begin_load != "null" && end_load != "null"){
				isLocalSearch = false;
				$("driverstart").value = begin_load;
				$("driverend").value = end_load;
				$("driverstart").style.color="#000000";
				$("driverend").style.color="#000000";
				if(beginx_load == "null")beginx_load = "";
				if(endx_load == "null")endx_load = "";
				if(beginy_load == "null")beginy_load = "";
				if(endy_load == "null")endy_load = "";
				//startDriverSearch(begin_load,end_load,beginx_load,endx_load,beginy_load,endy_load,citycode);
				smain.helpKey = begin_load +" 到 " + end_load;
				startDriverSearch(sData_driver_step1,begin_load,end_load,beginx_load,endx_load,beginy_load,endy_load,citycode,citycode);				
			}
		break;
		case "around":	//周边查询		
			if(key_load != "" && key_load != "null" && typekey_load != "" && typekey_load != "null" && centerx_load != "" && centerx_load != "null" && centery_load != "" && centery_load != "null" && dis_load != "" && dis_load != "null"){
				try{
					if(parseInt(centerx_load) == 0)return false;
					if(parseInt(centery_load) == 0)return false;
					if(parseInt(dis_load) == 0)return false;
					isLocalSearch = true;
					smain.helpKey = key_load;
					startAroundSearch(key_load,centerx_load,centery_load,dis_load,typekey_load,citycode);					
				}catch(e){return false;}
			}
		case "card":	//根据名片的所属POI的id来定位该名片
			var cardcity = citycode.substring(0,4);
			POIHashTable[cardId_load] = new POI();
			POIHashTable[cardId_load].id = cardId_load;
			POIHashTable[cardId_load].isVipUser = "true";
			POIHashTable[cardId_load].citycode = cardcity;			
			POIHashTable[cardId_load].onclick(1);
		break;
		case "poi":	//根据POI的dwkey来定位该POI
			POIHashTable[poi_load] = new POI();
			POIHashTable[poi_load].id = poi_load;
			POIHashTable[poi_load].isVipUser = "false";
			POIHashTable[poi_load].onclick();
		break;
		case "tpapiMatch":	//旧的API，关于第三方传入名称地址，后台进行自动匹配或手动关联的点进行地图定位
			if(key_load !="" && key_load!= "null"){
				//如果有匹配到就定位点
				if(centerx_load != "null" && centerx_load != "" && centery_load != "null" && centery_load != "" && parseInt(centerx_load)!=0){
					var tpapiPOI = new POI();
					tpapiPOI.id = "tpapiDwkey";
					tpapiPOI.isPOI = false;
					tpapiPOI.screenX = parseInt(centerx_load);
					tpapiPOI.screenY = parseInt(centery_load);
					tpapiPOI.name = key_load;
					tpapiPOI.displayName = key_load;
					tpapiPOI.address = typekey_load;
					tpapiPOI.citycode = citycode;
					tpapiPOI.show(null,1);
				}else{
				//否则针对名称进行全文检索
					$("keystring").value = key_load;
					startSearch(0);
				}
			}
		break;
		default:
		return false;
		break;
	}
};
/*
* 开始查询
*	@param act			查询类别
*	@param keyvalue		传入的第一个关键字的值
*	@param keyvalue1	传入的第二个关键字的值
*	@param flag			旧的查询标志
*/
function startSearch(act,keyvalue,keyvalue1,oldflag){
	var keyObj = null;
	var keyObj1 = null;
	var flag = "";
	var sUrl = "";	
	switch(act){
		case 0:		//本地查询
			keyObj = $("keystring");
			keyObj.value = keyObj.value.trim();
			if(keyObj.value == ""){alert("请输入本地搜索关键字");keyObj.focus();return false;}
			//得到一个显示对象
			flag = getRandFlag();
			if(!Results.getObj(flag,keyObj.value,citycode,"本地查询"))return false;
			//得到地址进行本地查询
			sUrl = sData_local;			
			sUrl = sUrl.replace("?key?",keyObj.value);
			sUrl = sUrl.replace("?skey?","");
			sUrl = sUrl.replace("?citycode?",citycode);
			sUrl = sUrl.replace("?pagecount?","10");			
			sUrl = sUrl.replace("?typecode?","");
			sUrl = sUrl.replace("?x?","0");
			sUrl = sUrl.replace("?y?","0");
			sUrl = sUrl.replace("?l?","0");
			sUrl = sUrl.replace("?b?","0");
			sUrl = sUrl.replace("?r?","0");
			sUrl = sUrl.replace("?t?","0");
			sUrl = sUrl.replace("?pageno?","");			
			isLocalSearch = true;
			getLocalData(page_path+ sUrl,1,flag,citycode);			
			return;
			break;
		case 1:		//公交换乘
			isLocalSearch = false;
			keyObj = $("busstart");
			keyObj.value = clearKey(keyObj.value);
			if(keyObj.value == ""){alert("请输入公交换乘起点");keyObj.focus();return false;}
			keyObj1 = $("busend");
			keyObj1.value = clearKey(keyObj1.value);
			if(keyObj1.value == ""){alert("请输入公交换乘终点");keyObj1.focus();return false;}
			//进入查询
			startBusSearch(sData_bus_step1,keyObj.value,keyObj1.value,"","","","",citycode);
			break;
		case 2:		//公交线路
			isLocalSearch = false;
			keyObj = $("line");
			keyObj.value = clearKey(keyObj.value);
			if(keyObj.value == ""){alert("请输入公交线路关键字，如：20路");keyObj.focus();return false;}
			//进入查询			
			startLineSearch(keyObj.value,citycode);
			break;
		case 3:		//公交站点
			isLocalSearch = false;
			if(keyvalue != null && oldflag != null){
				setCityCode(Results.m_aObj[oldflag].citycode);
			}else{
				keyObj = $("stops");
				keyObj.value = keyObj.value.trim();
				
				if(keyObj.value == ""){alert("请输入站点相关关键字，如：古三座、火车站、开睿动力科技有限公司等");keyObj.focus();return false;}
				keyvalue = keyObj.value;
			}
			//得到一个显示对象
			flag = getRandFlag();
			if(!Results.getObj(flag,keyvalue,citycode,"公交站点"))return false;
			//得到地址
			sUrl = sData_busStop;
			sUrl = sUrl.replace("?key?",keyvalue);
			sUrl = sUrl.replace("?citycode?",citycode);
			sUrl = sUrl.replace("?run?","");
			sUrl = sUrl.replace("?arg?","");
			sUrl = sUrl.replace("?count?","10");		
			//进入查询
			getStopData(sData_basePath + sUrl,flag,citycode);
			break;
		case 4:		//自驾方案
			isLocalSearch = false;
			keyObj = $("driverstart");
			keyObj.value = keyObj.value.trim();
			if(keyObj.value == ""){alert("请输入自驾方案起点");keyObj.focus();return false;}
			keyObj1 = $("driverend");
			keyObj1.value = keyObj.value.trim();
			if(keyObj1.value == ""){alert("请输入自驾方案终点");keyObj1.focus();return false;}
			//startDriverSearch(keyObj.value,keyObj1.value,"","","","",citycode);
			startDriverSearch(sData_driver_step1,keyObj.value,keyObj1.value,"","","","",citycode,citycode);
			break;
		default:
			return false;
			break;
	}
}
//在地图上画框选区域
function rectSelect(l,b,r,t){
	richmap.clearAllElement();
	var wingShap = new wingShapeObj();
	wingShap.sId = "b";
	wingShap.alpha = 60;			//透明度 1-100%
	wingShap.strokeColor = "#ffffff";	//外边框线路颜色
	wingShap.sBgColor = "#53A3CE";			//背景颜色，如果背景透明，留空
	wingShap.strokeWeight = 1;			//外框线路粗细
	wingShap.aScreenX[0] = l;	//l
	wingShap.aScreenX[1] = r;	//r
	wingShap.aScreenX[2] = r;	//r
	wingShap.aScreenX[3] = l;	//l
	wingShap.aScreenY[0] = t;	//t
	wingShap.aScreenY[1] = t;	//t
	wingShap.aScreenY[2] = b;	//b
	wingShap.aScreenY[3] = b;	//b
	richmap.showElement(wingShap);	
};
//Cookie类
var cookies = null;
function Cookie (){
	this.name ="center";
	this.value="";
	this.city = "FJFZ";
	this.time = 100;
	this.setCookie = function (name,value,time,city){
		this.name  = name;
		this.value = value;
		this.time  = time;
		this.city = city;
		var date = new Date();
		date.setTime(date.getTime() + time);		
		var str = this.name +"=" + this.value +"_"+this.city+"=CCC;expires="+ date.toGMTString();
		document.cookie = str;		
	};
	this.getCookie =function (){
		var str = document.cookie;		
		if(str.indexOf(this.name)>0){
			str = str.substring(str.indexOf(this.name)+ this.name.length+1,str.indexOf("=CCC"));		
			return str;
		}else{
			return "";
		}
	}
	this.delCookie = function (){
		var date = new Date();
		date.setTime(date.getTime() -1000);	
		var str = this.name +"=" + escape(this.value) +"_"+this.city+"=CCC;expires = "+ date.toGMTString();	
		document.cookie = str;
	};
};
//结果容器对象
var Results = new function(){
	this.m_nCount = 0;//保存结果集的序列，用于后退、前进、转到某结果等操作
	this.m_aObjCount = [];//保存对象的同步索引
	this.m_aObjIndex = [];
	this.m_oContainer = null;//结果外部总容器对象
	this.m_oResultCon = null;//结果子容器对象
	this.m_oResultBot = null;//结果容器底部信息对象
	this.m_oResultTit = null;//结果容器标题
	this.m_oPageCon = null;//翻页
	this.m_aObj = [];//保存各种结果对象的哈希表
	this.m_bIsClose = false;//当前是否在关闭状态
	this.m_nWidth = 250;//结果总容器的长
	this.m_nTitleCount = 21;//最长10个汉字
	this.m_sFocusFlag = "";//当前聚焦的子容器的flag
	this.backToSe =null;
	this.m_oBar = null;//搜索结果展示面板
	this.b_oBar = null;//搜索条件面板
	this.m_oHelpBox = null;//互助社帮助框对象
	this.init = function(){
		this.m_oContainer = $("searchResult");
		this.m_oResultCon = $("searchResultContainer");
		this.m_oResultBot = $("resultBox");
		this.m_oResultTit = $("sMidtools");
		this.m_oBar = $("sideBar2");
		this.b_oBar = $("sideBar1");
		this.m_oHelpBox = helpMsgBox;
		this.m_oHelpBox.init("helpMsgBox");
		this.m_oHelpBox.showOrHide("none");		
	};
	this.showTitle = function(str){
		this.m_oResultTit.title = str;
		if(str.length > this.m_nTitleCount){
			str = str.substring(0,this.m_nTitleCount-1) + "...";
		}
		this.m_oResultTit.innerHTML ="&nbsp;"+ str;
	};
	//每次查询向这个函数传入唯一的flag和这个结果的标题来生成结果子容器对象
	this.getObj = function(flag,title,citycode,zone){
		//生成子容器
		//判断count值,确定是否显示前进或后退键
		//刷新前进下拉列表和后退下拉列表
		this.m_aObjCount[this.m_nCount] = flag;//保存这个子容器所处的显示队列的位置，count数字越大，表示这个容器显示的越靠前		
		this.m_aObjIndex[flag] = this.m_nCount;
		this.m_aObj[flag] = new Result(flag,title,citycode,zone);
		this.show(flag);//显示容器
		this.open();
		this.m_nCount ++;
		return true;
	};
	this.showHide = function(){
		if(this.m_bIsClose){
			this.open();
		}else{
			this.close();
		}
	};
	this.showHelpBox =function (status){
		if(!status)var status = "";
		this.m_oHelpBox.showOrHide(status);
	}
	//显示主容器
	this.open = function(){		
		try{
			if(document.all){
				this.m_oBar.fireEvent("onclick");
			}else{
				this.m_oBar.onclick();
			}
			//this.m_oHelpBox.showOrHide("");
		}catch(e){};	
	};
	//隐藏主容器
	this.close = function(){
		try{
			if(document.all){
				this.b_oBar.fireEvent("onclick");				
			}else{
				this.b_oBar.onclick();
			}
		}catch(e){};
	};
	//显示下一个结果
	this.next = function(){
		if(this.m_sFocusFlag != null){			
			var nowCount = this.m_aObjIndex[this.m_sFocusFlag];
			if(this.m_aObjIndex[this.m_sFocusFlag] != null && nowCount < this.m_aObjCount.length){
				for(var i=nowCount+1;i<this.m_aObjCount.length;i++){
					if(this.m_aObjCount[i] != ""){this.show(this.m_aObjCount[i]);this.open();return true;break;}
				}				
			}
		}
		
		return false;
	};
	//显示上一个结果
	this.previous = function(){
		if(this.m_sFocusFlag != null){			
			var nowCount = this.m_aObjIndex[this.m_sFocusFlag];
			if(this.m_aObjIndex[this.m_sFocusFlag] != null && nowCount != 0){
				for(var i=nowCount-1;i>=0;i--){
					if(this.m_aObjCount[i] != ""){this.show(this.m_aObjCount[i]);this.open();return true;break;}
				}
			}
		}		
		return false;
	};
	//传入查询唯一标志来显示这个历史查询结果
	this.show = function(flag,htmlStr){	
		if(this.m_aObj[flag] == null)return false;
		//找到之前在焦点的结果框并隐藏
		if(this.m_sFocusFlag != "" && this.m_sFocusFlag != flag){
			this.m_aObj[this.m_sFocusFlag].hidden();
		}
		this.m_sFocusFlag = flag;
		this.showTitle(this.m_aObj[flag].title + "-" + this.m_aObj[flag].zone);
		this.m_aObj[flag].show(htmlStr);
		//判断菜单显示样式
		this.checkMenu();		
		return true;
	};
	this.showBus = function(flag,htmlStr){
		if(this.m_aObj[flag] == null)return false;
		//找到之前在焦点的结果框并隐藏
		if(this.m_sFocusFlag != "" && this.m_sFocusFlag != flag){
			this.m_aObj[this.m_sFocusFlag].hidden();
		}
		this.m_sFocusFlag = flag;
		this.showTitle(this.m_aObj[flag].title + "-" + this.m_aObj[flag].zone);
		this.m_aObj[flag].showBus(htmlStr);
		//判断菜单显示样式
		this.checkMenu();
		return true;
	};
	//判断当前是否有后退或前进的可能，并设置上面的按钮
	this.checkMenu = function(){
		var bNext = false;
		var bPrevious = false;
		var bClose = false;	//关闭的，后面再做
		if(this.m_aObjIndex[this.m_sFocusFlag] > 0){
			//向列表前面进行查找
			for(var i=this.m_aObjIndex[this.m_sFocusFlag]-1;i>=0;i--){
				if(this.m_aObjCount[i] != "" && this.m_aObjCount[i] != null){bPrevious = true;break;}
			}
		}
		if(this.m_aObjIndex[this.m_sFocusFlag] != this.m_aObjCount.length){
			//向列表后面进行查找
			for(var i=this.m_aObjIndex[this.m_sFocusFlag]+1;i<this.m_aObjCount.length;i++){
				if(this.m_aObjCount[i] != "" && this.m_aObjCount[i] != null){bNext = true;break;}
			}
		}
		if(bPrevious){
			$("showPrevious").style.backgroundImage = "url(images/map/back_02.jpg)";			
		}else{
			$("showPrevious").style.backgroundImage = "url(images/map/back_01.gif)";
		}
		if(bNext){
			$("showNext").style.backgroundImage = "url(images/map/forward_02.jpg)";
		}else{
			$("showNext").style.backgroundImage = "url(images/map/forward_01.jpg)";
		}
		//是否显示关闭按钮和错误反馈按钮
		if(this.m_sFocusFlag == ""){
			$("showClose").style.backgroundImage = "url(images/map/close_01.jpg)";
			$("showError").style.backgroundImage = "url(images/map/errorReport_01.jpg)";
		}else{
			$("showClose").style.backgroundImage = "url(images/map/close_02.jpg)";
			$("showError").style.backgroundImage = "url(images/map/errorReport_02.jpg)";
		}
	};
	//当前错误反馈
	this.errorReport = function(){
		if(this.m_sFocusFlag == "")return false;
		showErrorAdvice(richmap.getCityNameByCode(this.m_aObj[this.m_sFocusFlag].citycode),this.m_aObj[this.m_sFocusFlag].zone,this.m_aObj[this.m_sFocusFlag].title,'');
	};
	//传入查询唯一标志来删除这个历史查询结果
	this.del = function(flag){
		if(flag == null){
			if(this.m_sFocusFlag == "")return false;
			flag = this.m_sFocusFlag;
		}
		//显示下一个或前一个结果框
		if(!this.next()){
			if(!this.previous()){
				this.m_sFocusFlag = "";
				this.showTitle("搜索结果");
			}
		}
		//清除页面元素		
		this.m_aObj[flag].del();
		this.m_aObj[flag] = null;
		//清除索引
		this.m_aObjCount[this.m_aObjIndex[flag]] = "";
		this.m_aObjIndex[flag] = null;
		//判断菜单显示样式
		this.checkMenu();
		return true;
	};

};
//--------------------这是邪恶的分割线------------------------------//
var markreturns = new function(){
	this.show = markReturn1;
};
function markReturn1(x,y){
	var tempStop = this;
	this.showObj = new wingBasePoint("usermark",x,y);
	var textObj = new wingTextObj();
	var showContent = "<div>为您的标注点选择操作：</div><div>&nbsp;</div>";
	showContent += publicSearch.getSearch("usermark","您标注的位置",x,y,richmap.getCity(),"0,1,2");
	showDialog("您标注的位置",370,210,x,y,richmap.getCity(),showContent);
	richmap.zoomToPosition(x,y,parseInt(richmap.getWidth()*0.5),parseInt(richmap.getHeight()*0.5),richmap.getLayer());
	//richmap.zoomTo(richmap.getLayer(),x,y);	
	var value = x+"_"+y;
	cookies.setCookie("center",value,2592000,citycode);
	myMarkPosition(x,y);
	return true;
}
//周边查询对象
function AroundSolution(){
	this.centerName  = "";	//中心点名称
	this.centerX = 0;		//中心点加密经度
	this.centerY = 0;		//中心点加密纬度
	this.distance = 0;		//查询的周边距离
	this.poiList = new POIList();	//查询后得到的周边名址列表对象（POIList对象）
	this.showObj = null;
	this.toMap = function(){
		//显示周边点
		this.poiList.toMap();
		//显示中心点
		this.showCenter();
	};
	this.showCenter = function(){
		var tempAround = this;		
		this.showObj = new wingBasePoint("Around_" + this.centerName,this.centerX,this.centerY);
		var tempObj = new wingPicObj();
		tempObj.sImageSrc = "images/icon/center.png";		//图片地址
		tempObj.nImageWidth = 27;		//图片长
		tempObj.nImageHeight = 28;		//图片高
		tempObj.sAlt = this.centerName;
		tempObj.nScreenX = 0;			//图片热点相对坐标x
		tempObj.nScreenY = -28;			//图片热点相对坐标y		
		tempObj.onclick = function(){			
			var showContent = publicSearch.getSearch("Around_"+ tempAround.centerName,"我的位置",tempAround.centerX,tempAround.centerY,richmap.getCity(),"0,1,2,3");
			showDialog(tempAround.centerName,370,200,tempAround.centerX,tempAround.centerY,richmap.getCity(),showContent,"");
			richmap.zoomToPosition(tempAround.centerX,tempAround.centerY,parseInt(richmap.getWidth()*0.5),parseInt(richmap.getHeight()*0.7),richmap.getLayer());
		};
		tempObj.onmouseover = function(){
			try{wEMouseOver("Around_" + tempAround.centerName);}catch(e){}
		};
		this.showObj.addObj(tempObj);
		var textObj = new wingTextObj();
		textObj.sText = this.centerName;
		textObj.nScreenX = 27;
		textObj.nScreenY = -28;
		//textObj.sTextType = "HTML";
		textObj.sSize = "12px";
		textObj.sColor = "red";
		textObj.sBorder = "solid 1px red";
		textObj.sPadding = "2px";
		textObj.sBgColor = "#ffffff";
		textObj.onmouseover = function(){
			try{wEMouseOver("Around_" + tempAround.centerName);}catch(e){}
		};
		this.showObj.addObj(textObj);
		richmap.showElement(this.showObj);
		return true;
	};
};
//自驾对象
function DriverSolution(){
	this.totalLength = ""; //总里程
	this.beginName = "";		//用户起点
	this.endName = "";			//用户终点
	this.beginScreenX = "";		//起点加密经度
	this.beginScreenY = "";		//起点加密纬度
	this.endScreenX = "";			//终点加密经度
	this.endScreenY = "";			//终点加密纬度
	this.left = 0;			//全程方案线路的最小加密经度
	this.bottom = 0;		//全程方案线路的最大加密纬度
	this.right = 0;		//全程方案线路的最大加密经度
	this.top = 0;			//全程方案线路的最小加密纬度
	this.isWalk = false;
	this.solutions = new Array(); //保存连续的子方案中车辆经过道路
	/* 用法
	this.solutions[0]= new Array(); 保存子道路中的详细信息
	this.solutions[0][“path”] 线路路径
	this.solutions[1] = new Array();
	…
	*/
	this.toMap = function(doI){
		//显示用户起点
		var beginObj = new wingBasePoint("driverBegin",this.beginScreenX,this.beginScreenY);
		beginObj.nShadow = 2;
		var tempObj = new wingPicObj();
		tempObj.sImageSrc = "images/icon/user_start.png";		//图片地址
		tempObj.nImageWidth = 25;	//图片长
		tempObj.nImageHeight = 27;	//图片高
		tempObj.sAlt = this.beginName;
		tempObj.nScreenX = 0;			//图片热点相对坐标x
		tempObj.nScreenY = -27;			//图片热点相对坐标y
		tempObj.onmouseover = function(){
			try{wEMouseOver("driverBegin_" + this.beginName);}catch(e){}
		};
		beginObj.addObj(tempObj);
		var textObj = new wingTextObj();
		textObj.sText = this.beginName;
		textObj.nScreenX = 29;
		textObj.nScreenY = -30;
		textObj.sSize = "12px";
		textObj.sColor = "#FF7139";
		textObj.sBorder = "solid 1px #FF7139";
		textObj.sPadding = "2px";
		textObj.sBgColor = "#ffffff";
		beginObj.addObj(textObj);
		richmap.addWingElement(beginObj);
		//显示用户终点
		var endObj = new wingBasePoint("driverEnd",this.endScreenX,this.endScreenY);
		endObj.nShadow = 2;
		var tempObj1 = new wingPicObj();
		tempObj1.sImageSrc = "images/icon/user_end.png";		//图片地址
		tempObj1.nImageWidth = 25;	//图片长
		tempObj1.nImageHeight = 27;	//图片高
		tempObj1.sAlt = this.endName;
		tempObj1.nScreenX = 0;			//图片热点相对坐标x
		tempObj1.nScreenY = -27;			//图片热点相对坐标y
		tempObj1.onmouseover = function(){
			try{wEMouseOver("driverEnd_" + this.endName);}catch(e){}
		};
		endObj.addObj(tempObj1);
		var textObj1 = new wingTextObj();
		textObj1.sText = this.endName;
		textObj1.nScreenX = 29;
		textObj1.nScreenY = -30;
		textObj1.sSize = "12px";
		textObj1.sColor = "#FF7139";
		textObj1.sBorder = "solid 1px #FF7139";
		textObj1.sPadding = "2px";
		textObj1.sBgColor = "#ffffff";
		endObj.addObj(textObj1);
		richmap.addWingElement(endObj);
		if(this.isWalk){	//如果是步行方案
			//显示步行线路
			var tempLine = new wingLineObj();
			tempLine.aScreenX.push(this.beginScreenX);
			tempLine.aScreenY.push(this.beginScreenY);
			tempLine.aScreenX.push(this.endScreenX);
			tempLine.aScreenY.push(this.endScreenY);
			tempLine.sId = "driverSolution";
			tempLine.sColor = "red";
			tempLine.nWeight = 1;
			richmap.addWingElement(tempLine);
			return true;
		}
		this.left = 0;
		this.bottom = 0;
		this.right = 0;
		this.top = 0;
		//显示全部线路
		var tempLine = new wingLineObj();
		tempLine.run = true;
		for(var i=0;i<this.solutions.length;i++){
			if(this.solutions[i]["paths"] == null)this.solutions[i]["paths"] = this.solutions[i]["path"].split(" ");
			if(doI == i){var tempLine1 = new wingLineObj();}
			for(var j=0;j<this.solutions[i]["paths"].length;j++){
				var x = parseInt(this.solutions[i]["paths"][j]);
				j++;
				var y = parseInt(this.solutions[i]["paths"][j]);
				if(doI == null || doI == i){
					this.left = this.left==0?x:this.left>x?x:this.left;
					this.bottom = this.bottom==0?y:this.bottom<y?y:this.bottom;
					this.right = this.right==0?x:this.right<x?x:this.right;
					this.top = this.top==0?y:this.top>y?y:this.top;
				}
				if(doI == i){
					tempLine1.aScreenX.push(x);
					tempLine1.aScreenY.push(y);
				}
				tempLine.aScreenX.push(x);
				tempLine.aScreenY.push(y);
			}
			if(doI == i){
				tempLine1.sId = "driverSolution";
				tempLine1.sColor = "red";
				tempLine1.nWeight = 1;				
			}
		}
		tempLine.sId = "driverSolution_all";
		tempLine.sColor = "green";
		tempLine.nWeight = 1;		
		richmap.addWingElement(tempLine);
		if(tempLine1){richmap.addWingElement(tempLine1);}
	};
	this.show = function(obj,doI){
		richmap.clearAllElement();
		this.toMap(doI);
		if(obj != null){selectRowChange(obj);}
		richmap.zoomToMBR(this.left,this.bottom,this.right,this.top);
	};
};
//换乘对象
function BusSolution(){
	this.citycode = "";		//换乘方案涉及的城市
	this.beginName = "";		//换乘用户起点
	this.endName = "";			//换乘用户终点
	this.beginScreenX = "";		//用户起点经度
	this.beginScreenY = "";		//用户起点纬度
	this.endScreenX = "";			//用户终点经度
	this.endScreenY = "";			//用户终点纬度
	this.solutions = new Array(); //保存多个换乘方案数组
	/* 用法
	this.solutions[0]=new Array(); 保存单个换乘方案
	this.solutions[0][“left”] = “”; 单个换乘方案的最小经度
	this.solutions[0][“bottom”] = “”;单个换乘方案的最大纬度
	this.solutions[0][“right”] = “”;单个换乘方案的最大经度
	this.solutions[0][“top”] = “”;单个换乘方案的最小纬度
	this.solutions[0][“path”] = “”;单个换乘线路路径
	this.solutions[0][“passStop”] = new Array();	保存这个方案中经过的站点
		this.solutions[0][“passStop”][0]["name"] = "";
		this.solutions[0][“passStop”][0]["x"] = 0;
		this.solutions[0][“passStop”][0]["y"] = 0;
		this.solutions[0][“passStop”][0]["isTransfer"] = true;
		…
	this.solutions[1]=new Array();
	…
	*/
	this.toMap = function(doI){
		if(doI == null)doI = 0;
		//显示线路
		var tempLine = new wingLineObj();
		var paths = this.solutions[doI]["path"].split(" ");
		for(var i=0;i<paths.length;i++){
			var x = parseInt(paths[i]);
			i++;
			var y = parseInt(paths[i]);
			tempLine.aScreenX.push(x);
			tempLine.aScreenY.push(y);
		}
		tempLine.sId = "busSolution";
		tempLine.sColor = "blue";
		tempLine.nWeight = 1;		
		richmap.addWingElement(tempLine);
		//显示沿途站点及中转站		
		for(var i=0;i<this.solutions[doI]["passStop"].length;i++){
			var stopid = this.solutions[doI]["passStop"][i]["id"];
			if(StopHashTable[stopid] == null){
				StopHashTable[stopid] = new Stop();
				StopHashTable[stopid].id = stopid;
			}
			if(this.solutions[doI]["passStop"][i]["isTransfer"]){
				StopHashTable[stopid].toMap(false,true);
			}else{
				StopHashTable[stopid].toMap();
			}
		}
		//显示用户起点
		var beginObj = new wingBasePoint("busBegin",this.beginScreenX,this.beginScreenY);
		beginObj.nShadow = 2;
		var tempObj = new wingPicObj();
		tempObj.sImageSrc = "images/icon/user_start.png";		//图片地址
		tempObj.nImageWidth = 25;	//图片长
		tempObj.nImageHeight = 27;	//图片高
		tempObj.sAlt = this.beginName;
		tempObj.nScreenX = 0;			//图片热点相对坐标x
		tempObj.nScreenY = -27;			//图片热点相对坐标y
		tempObj.onmouseover = function(){
			try{wEMouseOver("busBegin_" + this.beginName);}catch(e){}
		};
		beginObj.addObj(tempObj);
		var textObj = new wingTextObj();
		textObj.sText = this.beginName;
		textObj.nScreenX = 26;
		textObj.nScreenY = -27;
		textObj.sSize = "12px";
		textObj.sColor = "#FF7139";
		textObj.sBorder = "solid 1px #FF7139";
		textObj.sPadding = "2px";
		textObj.sBgColor = "#ffffff";
		textObj.onmouseover = function(){
			try{wEMouseOver("busBegin_" + this.beginName);}catch(e){}
		};
		beginObj.addObj(textObj);
		richmap.addWingElement(beginObj);
		//显示用户终点
		var endObj = new wingBasePoint("busEnd",this.endScreenX,this.endScreenY);
		endObj.nShadow = 2;
		var tempObj1 = new wingPicObj();
		tempObj1.sImageSrc = "images/icon/user_end.png";		//图片地址
		tempObj1.nImageWidth = 25;	//图片长
		tempObj1.nImageHeight = 27;	//图片高
		tempObj1.sAlt = this.endName;
		tempObj1.nScreenX = 0;			//图片热点相对坐标x
		tempObj1.nScreenY = -27;			//图片热点相对坐标y
		tempObj1.onmouseover = function(){
			try{wEMouseOver("busEnd_" + this.endName);}catch(e){}
		};
		endObj.addObj(tempObj1);
		var textObj1 = new wingTextObj();
		textObj1.sText = this.endName;
		textObj1.nScreenX = 26;
		textObj1.nScreenY = -27;
		textObj1.sSize = "12px";
		textObj1.sColor = "#FF7139";
		textObj1.sBorder = "solid 1px #FF7139";
		textObj1.sPadding = "2px";
		textObj1.sBgColor = "#ffffff";
		textObj1.onmouseover = function(){
			try{wEMouseOver("busEnd_" + this.endName);}catch(e){}
		};
		endObj.addObj(textObj1);
		richmap.addWingElement(endObj);
	};
	this.show = function(obj,doI){
		if(doI == null)doI = 0;
		richmap.clearAllElement();
		this.toMap(doI);
		if(obj != null){selectRowChange(obj);}
		richmap.zoomToMBR(this.solutions[doI]["l"],this.solutions[doI]["b"],this.solutions[doI]["r"],this.solutions[doI]["t"]);
	};
	this.showBus = function(obj,doI){
		richmap.clearAllElement();
		if(doI == null)doI = 0;
		var stopid;
		//显示起点\终点及中转站
		if(this.solutions[doI].length == 1){
			for(var i=0;i<this.solutions[doI][0]["stop"].length;i++){
				stopid = this.solutions[doI][0]["stop"][i];
				if(StopHashTable[stopid] == null){
					StopHashTable[stopid] = new Stop();
					StopHashTable[stopid].id = stopid;
					StopHashTable[stopid].citycode = this.citycode;
					StopHashTable[stopid].toMap();
				}else{
					StopHashTable[stopid].toMap();
				}
			}
		}else{
			for(var i=0;i<this.solutions[doI].length;i++){
				for(var j=0;j<2;j++){
					stopid = this.solutions[doI][i]["stop"][j];
					if(StopHashTable[stopid] == null){
						StopHashTable[stopid] = new Stop();
						StopHashTable[stopid].id = stopid;
						StopHashTable[stopid].citycode = this.citycode;
					}
					if(i != 0 && j == 0){
						StopHashTable[stopid].toMap(false,true);
					}else{
						StopHashTable[stopid].toMap();
					}
				}
			}
		}
		//显示线路
		var tempLine = new Array();
		var tempLines = new Array();
		for(var i=0;i<this.solutions[doI].length;i++){
			tempLine[i] = new wingLineObj();
			tempLine[i].run = true;
			var paths = this.solutions[doI][i]["path"].split(" ");
			for(var j=0;j<paths.length;j++){
				var x = parseInt(paths[j]);
				j++;
				var y = parseInt(paths[j]);
				if(isNaN(x) || isNaN(y))continue;
				tempLine[i].aScreenX.push(x);
				tempLine[i].aScreenY.push(y);
			}
			tempLine[i].sId = "busSolution"+i;
			tempLine[i].sColor = (i==0||i==2)?"blue":"green";
			tempLine[i].nWeight = 1;
			richmap.addWingElement(tempLine[i]);
			//显示步行线路
			if(i == 0 && (this.beginScreenX != tempLine[i].aScreenX[0] || this.beginScreenY != tempLine[i].aScreenY[0])){
				tempLines[i] = new wingLineObj();
				tempLines[i].aScreenX.push(this.beginScreenX);
				tempLines[i].aScreenY.push(this.beginScreenY);
				tempLines[i].aScreenX.push(tempLine[i].aScreenX[0]);
				tempLines[i].aScreenY.push(tempLine[i].aScreenY[0]);
				tempLines[i].sId = "lineS" + i;
				tempLines[i].sColor = "red";
				tempLines[i].nWeight = 1;
				richmap.addWingElement(tempLines[i]);
			}
			if(i != 0){
				//如果中间换乘的时候不在同个站点，需要步行则要画步行线路
				if(this.solutions[doI][i-1]["stop"][1] != this.solutions[doI][i]["stop"][0]){
					var tempL = new wingLineObj();
					tempL.aScreenX.push(tempLine[i-1].aScreenX[tempLine[i-1].aScreenX.length-1]);
					tempL.aScreenY.push(tempLine[i-1].aScreenY[tempLine[i-1].aScreenY.length-1]);
					tempL.aScreenX.push(tempLine[i].aScreenX[0]);
					tempL.aScreenY.push(tempLine[i].aScreenY[0]);
					tempL.sId = "lineS" + i + "_1";
					tempL.sColor = "red";
					tempL.nWeight = 1;
					richmap.addWingElement(tempL);
				}
			}
		}
		//显示步行线路
		var lastPointX = tempLine[tempLine.length-1].aScreenX[tempLine[tempLine.length-1].aScreenX.length-1];
		var lastPointY = tempLine[tempLine.length-1].aScreenY[tempLine[tempLine.length-1].aScreenY.length-1];
		if(this.endScreenX != lastPointX || this.endScreenY != lastPointY){
			var tempL = new wingLineObj();
			tempL.aScreenX.push(lastPointX);
			tempL.aScreenY.push(lastPointY);
			tempL.aScreenX.push(this.endScreenX);
			tempL.aScreenY.push(this.endScreenY);
			tempL.sId = "lineS" + i;
			tempL.sColor = "red";
			tempL.nWeight = 1;
			richmap.addWingElement(tempL);
		}
		//显示用户起点
		var beginObj = new wingBasePoint("busBegin",this.beginScreenX,this.beginScreenY);
		beginObj.nShadow = 2;
		var tempObj = new wingPicObj();
		tempObj.sImageSrc = "images/icon/user_start.png";		//图片地址
		tempObj.nImageWidth = 25;	//图片长
		tempObj.nImageHeight = 27;	//图片高
		tempObj.sAlt = this.beginName;
		tempObj.nScreenX = 0;			//图片热点相对坐标x
		tempObj.nScreenY = -27;			//图片热点相对坐标y
		tempObj.onmouseover = function(){
			try{wEMouseOver("busBegin");}catch(e){}
		};
		beginObj.addObj(tempObj);
		var textObj = new wingTextObj();
		textObj.sText = this.beginName;
		textObj.nScreenX = 26;
		textObj.nScreenY = -27;
		textObj.sSize = "12px";
		textObj.sColor = "#FF7139";
		textObj.sBorder = "solid 1px #FF7139";
		textObj.sPadding = "2px";
		textObj.sBgColor = "#ffffff";
		textObj.onmouseover = function(){
			try{wEMouseOver("busBegin_" + this.beginName);}catch(e){}
		};
		beginObj.addObj(textObj);
		richmap.addWingElement(beginObj);
		//显示用户终点
		var endObj = new wingBasePoint("busEnd",this.endScreenX,this.endScreenY);
		endObj.nShadow = 2;
		var tempObj1 = new wingPicObj();
		tempObj1.sImageSrc = "images/icon/user_end.png";		//图片地址
		tempObj1.nImageWidth = 25;	//图片长
		tempObj1.nImageHeight = 27;	//图片高
		tempObj1.sAlt = this.endName;
		tempObj1.nScreenX = 0;			//图片热点相对坐标x
		tempObj1.nScreenY = -27;			//图片热点相对坐标y
		tempObj1.onmouseover = function(){
			try{wEMouseOver("busEnd");}catch(e){}
		};
		endObj.addObj(tempObj1);
		var textObj1 = new wingTextObj();
		textObj1.sText = this.endName;
		textObj1.nScreenX = 26;
		textObj1.nScreenY = -27;
		textObj1.sSize = "12px";
		textObj1.sColor = "#FF7139";
		textObj1.sBorder = "solid 1px #FF7139";
		textObj1.sPadding = "2px";
		textObj1.sBgColor = "#ffffff";
		textObj1.onmouseover = function(){
			try{wEMouseOver("busEnd_" + this.endName);}catch(e){}
		};
		endObj.addObj(textObj1);
		richmap.addWingElement(endObj);
		if(obj != null){selectRowChange(obj);}
		//richmap.zoomToMBR(this.solutions[doI]["l"],this.solutions[doI]["b"],this.solutions[doI]["r"],this.solutions[doI]["t"]);
		var l = null;
		var b = null;
		var r = null;
		var t = null;
		if(this.beginScreenX > this.endScreenX){ l = this.endScreenX; r = this.beginScreenX;}
		else{ r = this.endScreenX; l = this.beginScreenX;}
		if(this.beginScreenY > this.endScreenY){ t = this.endScreenY; b = this.beginScreenY;}
		else{ b = this.endScreenY; t = this.beginScreenY;}
		for(var i=0;i<this.solutions[doI].length;i++){
			for(var j=2;j<this.solutions[doI][i]["stop"].length-2;j++){
				if(parseInt(this.solutions[doI][i]["stop"][j]) < l) l=parseInt(this.solutions[doI][i]["stop"][j]);
				else if(parseInt(this.solutions[doI][i]["stop"][j]) > r) r=parseInt(this.solutions[doI][i]["stop"][j]);
			}
			for(var k=4;j<this.solutions[doI][i]["stop"].length;j++){
				if(parseInt(this.solutions[doI][i]["stop"][k]) < t) t=parseInt(this.solutions[doI][i]["stop"][k]);
				else if(parseInt(this.solutions[doI][i]["stop"][k]) > b) b=parseInt(this.solutions[doI][i]["stop"][k]);
			}
		}
		richmap.zoomToMBR(l,b,r,t);
	};
};
//线路对象
function Line(){
	this.id  = "";			//唯一id
	this.name = "";			//名称
	this.direction = "";	//方向（上行、下行）
	this.distance = "";		//里程
	this.fromTo = "";		//起点和终点
	this.county = "";		//城市
	this.startTime1 = "";	//夏季始发时间
	this.endTime1 = "";		//夏季末班时间
	this.startTime2 = "";	//冬季始发时间
	this.endTime2 = "";		//冬季末班时间
	this.priceDesc  = "";	//票价信息
	this.Valid = "Y";		//是否停开，停开的时候标志为“Ｐ”
	this.path  = "";		//路径
	this.paths = null;		//路径数组
	this.left  = 0;			//路径最小经度
	this.bottom = 0;		//路径最大纬度
	this.right = 0;			//路径最大经度
	this.top = 0;			//路径最小纬度
	this.passStops = new Array();	//经过的站点，保存的是站点的id
	//提交地图显示
	this.toMap = function(){
		var tempLine = new wingLineObj();
		if(this.paths == null){this.paths = this.path.split(" ");}
		//var paths = this.path.split(" ");
		for(var i=0;i<this.paths.length;i++){
			var x = parseInt(this.paths[i]);
			i++;
			var y = parseInt(this.paths[i]);
			if(isNaN(x) || isNaN(y))continue;
			tempLine.addPoint(x,y);
			//tempLine.setScreenX(x);
			//tempLine.setScreenY(y);
			//tempLine.aScreenX.push(x);
			//tempLine.aScreenY.push(y);
		}
		tempLine.setId(this.id);			//设置线路唯一ID，ID重复将覆盖前一条线路
		tempLine.setColor("green");			//设置线路颜色
		//tempLine.setAlpha(30);				//设置透明度，100不透明（缺省）
		tempLine.setArrow(true);			//设置有箭头
		tempLine.setLineWidth(1);
		tempLine.setRun(true);
		//tempLine.run = true;
		//tempLine.sId = this.id;
		//tempLine.sColor = "green";
		//tempLine.nWeight = 1;
		richmap.addWingElement(tempLine);
	};
	this.show = function(obj){
		richmap.clearAllElement();
		this.toMap();
		if(obj){selectRowChange(obj);}
		//显示起点站和终点站
		StopHashTable[this.passStops[0]["id"]].toMap(true);
		StopHashTable[this.passStops[this.passStops.length-1]["id"]].toMap(true);
		//richmap.zoomTo(13,this.left,this.top);
		richmap.zoomToMBR(this.left,this.bottom,this.right,this.top);
	};
	//根据线路id获取该线路的信息
	this.getLineInfo = function(){
		
	};
	this.showAllStop = function(){
		this.show();
		for(var i=0;i<this.passStops.length;i++){
			StopHashTable[this.passStops[i]["id"]].toMap(true);
		}
	};
};
//站点对象
function Stop(){
	this.id = "";	//站点唯一id
	this.screenX = 0;	//加密经度
	this.screenY = 0;	//加密纬度
	this.roadName = "";	//道路名
	this.name = "";		//站点名
	this.showObj = null;
	this.citycode = "";
	this.passLine = new Array();	//经过线路
	/*使用方法
		this.passLine[0][“name”]=
		this.passLine[0][“id”]=
	*/
	//获得站点信息
	this.getStopInfo = function(){
		//根据id读取站点信息
		//开始异步查询
		var flag = getRandFlag();
		var xmlObj = Sarissa.getDomDocument();
		xmlObj.async = false;
		xmlObj.load(sData_basePath + sData_busStopId.replace("?key?",this.id));		
		if(xmlObj.parseError!=0){
			//alert("查找不到您要的内容\r载入错误！");
			Results.m_aObj[flag].show("xml载入错误！错误描述:\r\n"+Sarissa.getParseErrorText(xmlObj));
			//alert("xml载入错误！错误描述:\r\n"+Sarissa.getParseErrorText(xmlObj));
			return false;
		}
		try{
			var testNode = "";
			if(m_sUserAgent == "msie"){
				testNode = xmlObj.selectSingleNode("root/Return").text;
			}else if(m_sUserAgent == "firefox"){
				testNode = Sarissa.getText(xmlObj.firstChild.firstChild,true);
			}
			if(testNode == "0"){			
				if(m_sUserAgent == "msie"){
					Results.m_aObj[flag].show(xmlDocArr[sFlag].selectSingleNodes("root/Error").text);
				}else if(m_sUserAgent == "firefox"){
					Results.m_aObj[flag].show(Sarissa.getText(xmlDocArr[sFlag].firstChild.childNodes[1]));
				}
				return false;
			}
		}catch(e){
			return false;
		}
		//解析数据
		var myNode = null;
		if (m_sUserAgent == "msie"){
			myNode = xmlObj.selectSingleNode("root/Content/Stop");
		}else if (m_sUserAgent == "firefox"){
			myNode = xmlObj.firstChild.childNodes[1].firstChild;
		}
		var stopid = myNode.getAttribute("stopid");
		with(StopHashTable[stopid]){
			id = stopid;
			screenX = myNode.getAttribute("screenX");
			screenY = myNode.getAttribute("screenY");
			roadName = myNode.getAttribute("roadname");
			name = myNode.getAttribute("name");
			citycode = richmap.getCity();
			passLine = new Array();	//经过线路
			var lineObj = myNode.childNodes;
			for(var j=0;j<lineObj.length;j++){
				passLine[j] = new Array();
				passLine[j]["lineid"] = lineObj[j].getAttribute("lineid");
				passLine[j]["name"] = lineObj[j].getAttribute("name");
				passLine[j]["direction"] = lineObj[j].getAttribute("direction");
			}
			lineObj = null;
		};
		//提交显示
		//StopHashTable[stopid].toMap(true);	
	};
	/*
	* 提交地图显示
	*	@param show 是否立即在地图上显示
	*	@param isTransfer 是否显示为中转站点
	*/
	this.toMap = function(show,isTransfer){
		if(this.screenX == 0 || this.name == ""){
			this.getStopInfo();
			//return false;
		}
		var tempStop = this;
		this.showObj = new wingBasePoint("Stop_" + this.id,this.screenX,this.screenY);
		this.showObj.nShadow = 1;	//阴影
		var tempObj = new wingPicObj();
		if(isTransfer){
			tempObj.sImageSrc = "images/icon/bus_transfer.png";
			tempObj.sAlt = "中转站：" + this.name;
		}else{
			tempObj.sImageSrc = "images/icon/stop_show.png";		//图片地址
			tempObj.sAlt = this.name;
		}
		tempObj.nImageWidth = 20;	//图片长
		tempObj.nImageHeight = 28;	//图片高
		tempObj.nScreenX = -10;			//图片热点相对坐标x
		tempObj.nScreenY = -28;			//图片热点相对坐标y		
		tempObj.onclick = function(){
			tempStop.onclick();
		};
		tempObj.onmouseover = function(){
			try{wEMouseOver("Stop_" + tempStop.id);}catch(e){}
		};
		this.showObj.addObj(tempObj);	
		var textObj = new wingTextObj();
		textObj.sText = this.name;
		textObj.nScreenX = 11;
		textObj.nScreenY = -26;
		//textObj.sTextType = "HTML";
		textObj.sSize = "12px";
		textObj.sColor = "#5A5984";
		textObj.sBgColor = "#ffffff";
		textObj.sBorder = "solid 1px #333333";
		textObj.sPadding = "1px";
		textObj.sBgColor = "#ffffff";
		textObj.onmouseover = function(){
			try{wEMouseOver("Stop_" + tempStop.id);}catch(e){}
		};
		this.showObj.addObj(textObj);
		if(!show){
			richmap.addWingElement(this.showObj);
		}else{
			richmap.showElement(this.showObj);
		}
		return true;
	};
	this.show = function(obj){
		richmap.clearAllElement();
		if(!this.toMap())return;
		if(obj){selectRowChange(obj)};
		richmap.zoomTo(13,this.screenX,this.screenY);
	};
	this.onclick = function(){
		if(!this.toMap(true))return;
		var showContent = "";
		//showContent += "<div><b>站点名称：</b>" + this.name.replace("<font color=#CC0033>","").replace("</font>","") + "</div>";
		showContent += "<div><b>途经线路：</b><span style='color:#999999'>";
		var tempHashTable = [];
		for(var j=0;j<this.passLine.length;j++){
			if(!tempHashTable[this.passLine[j]["name"]]){
				showContent += "<span style='color:#1E3B87;cursor:pointer;' onClick='$(\"line\").value=\""+this.passLine[j]["name"]+"\";startSearch(2);'>"+ this.passLine[j]["name"] + ",</span> ";
				tempHashTable[this.passLine[j]["name"]] = true;
			}else{
				continue;
			}
		}
		tempHashTable = null;
		showContent += "</span></div>";
		showContent += "<div>&nbsp;</div>";
		showContent += publicSearch.getSearch(this.id,this.name.replace("<font color=#CC0033>","").replace("</font>",""),this.screenX,this.screenY,this.citycode,"0,1,2");
		richmap.showDialog(this.screenX,this.screenY,350,200,showContent,"公交站点："+ this.name);
		richmap.zoomToPosition(this.screenX,this.screenY,parseInt(richmap.getWidth()*0.5),parseInt(richmap.getHeight()*0.7),richmap.getLayer());
		//richmap.zoomTo(richmap.getLayer(),this.screenX,this.screenY);
	};
}
//地图上公交站点的点击动作
function onStopClick(stopid){
	if(StopHashTable[stopid] == null){
		StopHashTable[stopid] = new Stop();
		StopHashTable[stopid].id = stopid;
	}
	StopHashTable[stopid].onclick();
};

function closeDialog(){
	//richmap.clearElement("Dialog");
}
function showDialog(name,dialogW,dialogH,screenX,screenY,citycode,sContent,namecardId){
		var nBoxW = 350;	//指定对话框的长度
	var nBoxH = 0;		//高度自适应
	var bArrowModule = false;	//显示大箭头，小箭头用true
	var nZoom = 1;			//聚焦到该对话框
	var bClosebtn = false;		//显示关闭按钮
	var bShadowStyle = true;	//阴影离对话框远点
	richmap.showMsgBox(screenX,screenY,sContent,nBoxW,nBoxH,bArrowModule,nZoom,bClosebtn,bShadowStyle);
		//richmap.showMsgBox(screenX,screenY,sContent);

		return;
		if(richmap.getElementObj("Dialog")!=null){richmap.clearElement("Dialog");}
		//richmap.closeDialog();		
		var showObj = new wingBasePoint("Dialog",screenX,screenY,true);
		var textObj = new wingTextObj();
		textObj.nScreenX = 15-45;
		textObj.nScreenY = -20-dialogH-30;
		textObj.sBorder = 0;
		textObj.sTextType = "HTML";
		textObj.sText = '<div style="position:absolute;left:0px;top:0px;width:'+dialogW+'px;height:'+(dialogH+30)+'px;z-index:999;">'
						+'	<div style="position:absolute;left:0px;top:0px;width:100%;height:27px; background-image:url(images/dialog/image2_04.gif);">'
						+'		<div style="position:absolute;left:0px;top:0px;width:3px;"><img src="images/dialog/image1_03.gif"></div>'
						+'		<div style="position:absolute;left:10px;top:7px;width:'+(dialogW-100)+'px;color:#064781;font:bold">';
		if(namecardId!=null){textObj.sText += '<a href="http:\/\/'+namecardId+'.vip.richmap.cn/" target="_blank">'+name+'</a>';}
		else{ textObj.sText += name;}
		textObj.sText += '		</div><div style="position:absolute;left:'+(dialogW-97)+'px;top:7px;width:64px;"><img src="images/dialog/image3_09.jpg" style="cursor:hand" onClick="showErrorAdvice(\'' + richmap.getCityNameByCode(citycode) + '\',\'名址详情\',\'' + name + '\',\'\')"></div>'
						+'		<div style="position:absolute;left:'+(dialogW-23)+'px;top:3px;width:17px;padding:2px;border:solid 1px #DEE7EF" onmouseover="this.style.border=\'solid 1px #ffffff\';this.style.backgroundColor=\'#FFFBDE\'" onmouseout="this.style.border=\'solid 1px #DEE7EF\';this.style.backgroundColor=\'\'"><img src="images/dialog/image4_11.gif" style="cursor:hand" onClick="closeDialog()" title="关闭对话框"></div>'
						+'		<div style="position:absolute;left:'+(dialogW-3)+'px;top:0px;width:3px"><img src="images/dialog/image5_06.gif"></div>'
						+'	</div>'
						+'	<div  style="position:absolute;left:0px;top:27px;width:100%;height:'+(dialogH+30-70)+'px;background-color:#ffffff;border-left:solid 1px #427DCB;border-right:solid 1px #427DCB">'
						+'  <div style="position:absolute;left:10px;top:10px;width:'+(dialogW-17)+'px;height:'+(dialogH+30-70-15)+'px;">'+sContent+'</div>'
						+'	</div>	'
						+'	<div style="position:absolute;left:0px;top:'+(dialogH+30-43)+'px;width:100%;height:43px;">';
		if(m_sUserAgent=="msie"){	
			textObj.sText +='		<div style="position:absolute;left:0px;top:0px;width:15px;height:13px;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=crop,src=\'images/dialog/left_30.png\',opacity=20)"></div>';
		}else if(m_sUserAgent=="firefox"){	
			textObj.sText +='		<div style="position:absolute;left:0px;top:0px;width:15px;height:13px;"><img src="images/dialog/left_30.png"></div>';
		}
		textObj.sText +='		<div style="position:absolute;left:15px;top:0px;line-height:0px;width:30px;height:13px;background-color:#FFFFFF;border-bottom:solid 1px #427DCB;">&nbsp;</div>'
						+'		<div style="position:absolute;left:45px;top:0px;line-height:0px;width:74px;height:13px;background-color:#FFFFFF;"></div>';
		if(m_sUserAgent=="msie"){
			textObj.sText +='		<div style="position:absolute;left:45px;top:13px;width:74px;height:43px;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=crop,src=\'images/dialog/bjz_35.png\',opacity=20)"></div>';
		}else if(m_sUserAgent=="firefox"){		
			textObj.sText +='		<div style="position:absolute;left:45px;top:13px;width:74px;height:43px;"><img src="images/dialog/bjz_35.png"></div>';
		}
		textObj.sText +='		<div style="position:absolute;left:119px;top:0px;line-height:0px;width:'+(dialogW-136)+'px;height:13px;background-color:#FFFFFF;border-bottom:solid 1px #427DCB;">&nbsp;</div>';
		if(m_sUserAgent=="msie"){
			textObj.sText +='		<div style="position:absolute;left:'+(dialogW-17)+'px;top:0px;width:17px;height:13px;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=crop,src=\'images/dialog/right_32.png\',opacity=20)"></div>';
		}else if(m_sUserAgent=="firefox"){
			textObj.sText +='		<div style="position:absolute;left:'+(dialogW-17)+'px;top:0px;width:17px;height:13px;"><img src="images/dialog/right_32.png"></div>';
		}
		textObj.sText +='	</div>'
						+'</div>';
		if(m_sUserAgent=="msie"){				
			textObj.sText +='<div style="position:absolute;left:'+dialogW+'px;top:'+(dialogH+30-211)+'px;width:20px;height:168px;filter : progid:DXImageTransform.Microsoft.Alpha(opacity=20,finishOpacity=50);">'
							+'	<div style="position:relative;width:20px;height:168px;filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=crop,src=\'images/dialog/yy_17.png\')"></div>'
							+'</div>';
		}else if(m_sUserAgent=="firefox"){
			textObj.sText +='<div style="position:absolute;left:'+dialogW+'px;top:'+(dialogH+30-211)+'px;width:20px;height:168px;opacity:0.2;">'
							+'	<div style="position:relative;width:20px;height:168px;"><img src="images/dialog/yy_17.png"></div>'
							+'</div>';
		}		
		showObj.addObj(textObj);
		richmap.showElement(showObj);
	}
var POIHashTable  = new Array();	//POI HashTable 用于保存POI对象
var POBHashTable = new Array();	//POB HashTable 用于保存POB对象
var SalesHashTable = new Array();	//Sales HashTable 用于保存Sales对象
var StopHashTable = new Array();	//Stop HashTable 用于保存Stop对象
var LineHashTable = new Array();	//Line HashTable 用于保存Line对象
//POI对象
function POI(){
	this.id = "";	//唯一标示
	this.province = "";		//省份
	this.city = "";			//城市
	this.county	 = "";		//城镇
	this.citycode = "";		//城市代码
	this.isVipUser = "false";	//是否地图名片用户
	this.isPOI = true;	//是否是pub_company中的点信息
	this.screenX = "";		//加密经度
	this.screenY = "";		//加密纬度
	this.name = "";			//名称
	this.displayName = "";	//显示名称
	this.address = "";		//地址
	this.relateLink = "";	//名址详细页地址
	this.phone = "";		//电话
	this.showObj = null;	//显示对象
	//地图名片扩展属性
	this.getNamecardInfo = false;	//是否读取过namecard的信息
	this.profile = "";		//简介
	this.imgArr = [];		//公司图片数组
	this.email = "";		//email
	this.products = [];		//产品
	this.namecardId = "";	//名片id
	this.domainName = "";	//域名id
	//提交地图显示 showNum 显示点的时候的数字
	this.toMap = function(showNum){
		var tempPOI = this;
		//通过接口显示位置
		if(showNum == null)showNum = 1;
		this.showObj = new wingBasePoint("POI_" + this.id,this.screenX,this.screenY);
		this.showObj.nShadow = 1;
		var tempObj = new wingPicObj();
		tempObj.sImageSrc = "images/icon/"+(this.isVipUser=="true"?"VIP":"POI")+"/"+showNum+".png";		//图片地址
		if(this.isVipUser == "false"){
			tempObj.nImageWidth = 21;	//图片长
			tempObj.nImageHeight = 25;	//图片高
			tempObj.nScreenX = -10;			//图片热点相对坐标x
			tempObj.nScreenY = -27;			//图片热点相对坐标y		
		}else{
			tempObj.nImageWidth = 22;	//图片长
			tempObj.nImageHeight = 27;	//图片高
			tempObj.nScreenX = -11;			//图片热点相对坐标x
			tempObj.nScreenY = -29;			//图片热点相对坐标y		
		}
		tempObj.sAlt = this.name;
		tempObj.onmouseover = function(){
			try{wEMouseOver("POI_" + tempPOI.id);}catch(e){}
		};
		tempObj.onclick = function(){
			tempPOI.show();
		};
		this.showObj.addObj(tempObj);	
		var textObj = new wingTextObj();
		textObj.sText = "<nobr>" + this.name + "</nobr>";
		//textObj.sTextType = "HTML";
		textObj.sSize = "12px";
		if(this.isVipUser == "false"){
			textObj.nScreenX = 12;
			textObj.nScreenY = -27;
			textObj.sColor = "#000000";
			textObj.sBorder = "solid 1px #943008";
			textObj.sBgColor = "#FFFFFF";
		}else{
			textObj.nScreenX = 13;
			textObj.nScreenY = -29;
			textObj.sColor = "red";
			textObj.sBorder = "solid 1px red";
			textObj.sBgColor = "#F7F7CE";
		}
		textObj.sPadding = "2px";
		textObj.onmouseover = function(){
			try{wEMouseOver("POI_" + tempPOI.id);}catch(e){}
		};
		this.showObj.addObj(textObj);
		richmap.addWingElement(this.showObj);
	};
	
	this.onclick = function(type){
		var showContent = "";
		var tempPoiObj = this;
		var tempComPoi = this;
		var smsUrl = "";		
		if(this.isVipUser == "true" && this.getNamecardInfo == false){
			//读取名片信息
			//sData_namecard = "com/ncserv?act=CARDINFO&poiid=?poiid?&csize=?csize?&psize=?psize?";
			var sUrl = sData_basePath + sData_namecard;
			sUrl = sUrl.replace("?poiid?",this.id);
			sUrl = sUrl.replace("?csize?","5");
			sUrl = sUrl.replace("?psize?","1");
			//开始异步查询
			var xmlObj = Sarissa.getDomDocument();
			xmlObj.async = true;
			xmlObj.onreadystatechange = function(){
				if(xmlObj.readyState == 4){
					if(xmlObj.parseError!=0){
						tempPoiObj.isVipUser = "false";
						tempPoiObj.onclick();
						//Results.m_aObj[flag].show("xml载入错误！错误描述:\r\n"+Sarissa.getParseErrorText(xmlObj));
						return false;
					}
					try{
						var testNode = "";
						if(m_sUserAgent == "msie"){
							testNode = xmlObj.selectSingleNode("root/Return").text;
						}else if(m_sUserAgent == "firefox"){
							testNode = Sarissa.getText(xmlObj.firstChild.firstChild,true);
						}
						if(testNode == "0"){
							tempPoiObj.isVipUser = "false";
							tempPoiObj.onclick();
							//Results.m_aObj[flag].show(xmlDocArr[sFlag].selectSingleNodes("root/Error").text);
							return false;
						}
					}catch(e){
						tempPoiObj.isVipUser = "false";
						tempPoiObj.onclick();
						return false;
					}
					//解析数据
					var myNode = null;
					if(m_sUserAgent == "msie"){
						myNode = xmlObj.selectSingleNode("root/Content/NameCard");
					}else if(m_sUserAgent == "firefox"){
						myNode = xmlObj.firstChild.childNodes[1].firstChild;
					}
					//var poiId = myNode.selectSingleNode("PoiID").text;
					var imgNode = null;
					if(m_sUserAgent == "msie"){
						if(type==1){
							tempPoiObj.name = myNode.selectSingleNode("CompanyCnName").text;
							tempPoiObj.address = myNode.selectSingleNode("CnAddress").text;
							tempPoiObj.province = myNode.selectSingleNode("Province").text;	
							tempPoiObj.city = myNode.selectSingleNode("City").text;	
							tempPoiObj.county = myNode.selectSingleNode("County").text;
							tempPoiObj.screenX = myNode.selectSingleNode("ScreenX").text;
							tempPoiObj.screenY = myNode.selectSingleNode("ScreenY").text;
							tempPoiObj.phone = myNode.selectSingleNode("Tel").text;
						}
						tempPoiObj.profile = myNode.selectSingleNode("Profile").text;
						tempPoiObj.email = myNode.selectSingleNode("Email").text;
						tempPoiObj.namecardId = myNode.selectSingleNode("CardID").text;
						tempPoiObj.domainName = myNode.selectSingleNode("DomainName").text;
						imgNode = myNode.selectSingleNode("Images").childNodes;
					}else if(m_sUserAgent == "firefox"){
						if(type==1){
							tempPoiObj.name = Sarissa.getText(myNode.childNodes[3]);
							tempPoiObj.address = Sarissa.getText(myNode.childNodes[4]);
							tempPoiObj.province = Sarissa.getText(myNode.childNodes[6]);
							tempPoiObj.city = Sarissa.getText(myNode.childNodes[7]);	
							tempPoiObj.county = Sarissa.getText(myNode.childNodes[8]);
							tempPoiObj.screenX = Sarissa.getText(myNode.childNodes[9]);
							tempPoiObj.screenY = Sarissa.getText(myNode.childNodes[10]);
							tempPoiObj.phone = Sarissa.getText(myNode.childNodes[11]);
						}
						tempPoiObj.profile = Sarissa.getText(myNode.childNodes[15]);
						tempPoiObj.email = Sarissa.getText(myNode.childNodes[14]);
						tempPoiObj.namecardId = Sarissa.getText(myNode.childNodes[0]);
						tempPoiObj.domainName = Sarissa.getText(myNode.childNodes[2]);
						imgNode = myNode.childNodes[16].childNodes;
					}
					for(var i=0;i<imgNode.length;i++){
						tempPoiObj.imgArr[i] = new Array();
						tempPoiObj.imgArr[i]["url"] = imgNode[i].getAttribute("imgUrl");
						if(m_sUserAgent == "msie"){
							tempPoiObj.imgArr[i]["name"] = imgNode[i].text;
						}else if(m_sUserAgent == "firefox"){
							tempPoiObj.imgArr[i]["name"] = Sarissa.getText(imgNode[i]);
						}
					}
					var proNode = null;
					if(m_sUserAgent == "msie"){
						proNode = myNode.selectSingleNode("Products").childNodes;
					}else if(m_sUserAgent == "firefox"){
						proNode = myNode.childNodes[17].childNodes;
					}
					for(var i=0;i<proNode.length;i++){
						tempPoiObj.products[i] = new Array();
						tempPoiObj.products[i]["link"] = proNode[i].getAttribute("detailurl");
						tempPoiObj.products[i]["imgurl"] = proNode[i].getAttribute("imgUrl");
						if(m_sUserAgent == "msie"){
							tempPoiObj.products[i]["content"] = proNode[i].text;
						}else if(m_sUserAgent == "firefox"){
							tempPoiObj.products[i]["content"] = Sarissa.getText(proNode[i]);
						}
					}
					tempPoiObj.getNamecardInfo = true;
					tempPoiObj.show();
				}
			};
			xmlObj.load(sUrl);
			return false;
		}else if(this.getNamecardInfo == true && this.isVipUser == "true"){
			//显示地图名片
			//显示上面部分
			smsUrl = encodeURI(smsBase + "名称："+this.name.replace(/\<[^>]*\>/g,"")+" 地址："+this.address.replace(/\<[^>]*\>/g,"")+" 电话："+this.phone+" Email："+this.email);
			showContent += "<div style='width:100%;padding:5px;position:relative;height:140px;'>"
						+ "<div style='position:absolute;left:0px;top:0px;padding:1px;border:solid 1px #999999'><img src='"+ (this.imgArr[0]!=null?(this.imgArr[0]["url"]):"images/nopic.gif") + "' width='120' height='120'></div>"
						+ "<div style='position:absolute;left:135px;top:0px;'>"
						+ "<span style='font-size:14px;color:#18397C;font-weight:bold;line-height:20px;'>" + this.name + "</span><br>"
						+ "<b>地址：</b>" + this.address + "<br>"
						+ "<b>电话：</b>" + this.phone + "<br>"
						+ "<b>Email：</b>" + this.email + "<br>"
						+ "<b>网址：</b>"+this.relateLink+"<br>"
						+ "<b>详情：</b><a href='page/pob_"+this.domainName+".html' target='_blank'>http:\/\/"+this.domainName+".vip.richmap.cn/</a><br>"
						+ "<a href='javascript:void(0);' onClick=\"window.showModalDialog('"+smsUrl+"', '','"+dialogArgument+"')\"></a>"
						+ "</div>"
						+ "</div><br>";
			//简介
			/*showContent += "<div style='width:100%;padding:5px;position:relative;color:#999999'>" + this.profile.atrim().substring(0,100) + "...</div>";*/
			//产品信息
			var productStr = '<div class="cContent" style="display:?dis?;height:80px;">';
			var tempLeft = 10;
			if(this.products.length==0)productStr += "暂无产品信息";
			for(var i=0;(i<this.products.length) && (i < 4);i++){
				productStr += '<div style="position:absolute;left:'+tempLeft+'px;right:0px;cursor:pointer;"><a href="javascript:void(0);" title="'+this.products[i]["content"]+'" onclick="';
				if(this.products[i]["link"] != null&&this.products[i]["link"]!=""){
					productStr += 'self.open(\'' + this.products[i]["link"] + '\');';
				}
				productStr += '"><img style="border:solid 1px #999999" src="'+ sData_basePath + this.products[i]["imgurl"]+'"><br>';
				if(this.products[i]["content"]!=null)productStr += (this.products[i]["content"].length<6?this.products[i]["content"]:(this.products[i]["content"].substring(0,5)+'...'));
				productStr += '</a></div>';
				tempLeft += 80;
			}
			productStr += '</div>';
			publicSearch.labelArr[4]["content"] = productStr;
			showContent += publicSearch.getSearch(this.id,this.name,this.screenX,this.screenY,this.citycode,"4,0,1,2",1);
			//richmap.showDialog(this.screenX,this.screenY,400,300,showContent);
			showDialog(this.name,370,300,this.screenX,this.screenY,this.citycode,showContent,this.domainName);
		}else if(this.isVipUser == "false" && this.name == ""){
			//读取名片信息
			//sData_poi = "search?act=searchpoi&dwkey=?dwkey?";
			var poiUrl = sData_basePath + sData_poi;
			poiUrl = poiUrl.replace("?dwkey?",this.id);
			//开始异步查询
			var xmlObj = Sarissa.getDomDocument();
			xmlObj.async = true;
			xmlObj.onreadystatechange = function(){
				if(xmlObj.readyState == 4){
					if(xmlObj.parseError!=0){
						return false;
					}
					try{
						var testNode = "";
						if(m_sUserAgent == "msie"){
							testNode = xmlObj.selectSingleNode("root/Return").text;
						}else if(m_sUserAgent == "firefox"){
							testNode = Sarissa.getText(xmlObj.firstChild.firstChild,true);
						}						
						if(testNode == "0"){
							return false;
						}
					}catch(e){
						return false;
					}
					//解析数据
					var myNode = null;
					if(m_sUserAgent == "msie"){
						myNode = xmlObj.selectSingleNode("root/Content/Company");
						//var poiId = myNode.selectSingleNode("PoiID").text;
						tempComPoi.name = myNode.selectSingleNode("Name").text;
						tempComPoi.address = myNode.selectSingleNode("Address").text;
						tempComPoi.province = myNode.selectSingleNode("Province").text;	
						tempComPoi.city = myNode.selectSingleNode("City").text;	
						tempComPoi.county = myNode.selectSingleNode("County").text;
						tempComPoi.screenX = myNode.selectSingleNode("ScreenX").text;
						tempComPoi.screenY = myNode.selectSingleNode("ScreenY").text;
						tempComPoi.phone = myNode.selectSingleNode("Phone").text;
					}else if(m_sUserAgent == "firefox"){
						myNode = xmlObj.firstChild.childNodes[1].firstChild;
						//var poiId = myNode.selectSingleNode("PoiID").text;
						tempComPoi.name = Sarissa.getText(myNode.childNodes[7]);
						tempComPoi.address = Sarissa.getText(myNode.childNodes[8]);
						tempComPoi.province = Sarissa.getText(myNode.childNodes[2]);	
						tempComPoi.city = Sarissa.getText(myNode.childNodes[3]);	
						tempComPoi.county = Sarissa.getText(myNode.childNodes[4]);
						tempComPoi.screenX = Sarissa.getText(myNode.childNodes[5]);
						tempComPoi.screenY = Sarissa.getText(myNode.childNodes[6]);
						tempComPoi.phone = Sarissa.getText(myNode.childNodes[9]);
					}
					tempPoiObj.show();
				}
			};
			xmlObj.load(poiUrl);
			return false;
		}else{
			//showContent += "<div><b>"+this.name+"</b></div>";
			smsUrl = encodeURI(smsBase + "名称："+this.name.replace(/\<[^>]*\>/g,"")+" 地址："+this.address.replace(/\<[^>]*\>/g,"")+"电话："+this.phone);
			if(this.address != "")showContent += "<div>名称：" + this.name + "</div>";
			if(this.address != "")showContent += "<div>地址：" + this.address + "</div>";
			if(this.phone != "")showContent += "<div>电话：" + this.phone + "</div>";
			showContent += "<div><a href='javascript:void(0);' onClick=\"window.showModalDialog('"+smsUrl+"', '','"+dialogArgument+"')\"></a></div>";
			if(this.isPOI)showContent += "<div align='right'><a href='"+sData_basePath+"page/poi_"+this.id+".html' target='_blank'>详情 &gt;&gt;</a></div>";
			showContent += "";
			showContent += publicSearch.getSearch(this.id,this.name,this.screenX,this.screenY,this.citycode,"0,1,2");
			//if(nowDialogId!=null){richmap.clearElement("Dialog"); nowDialogId = null;}
			//richmap.showDialog(this.screenX,this.screenY,320,220,showContent);
			showDialog(this.name,370,220,this.screenX,this.screenY,this.citycode,showContent);
		}
		return true;
	};
	this.show = function(obj,num){
		//
(this.screenX + "," + this.screenY);
		if(obj){
			selectRowChange(obj);
			try{
				wEMouseOver("POI_"+this.id);
			}catch(e){}
		}
		richmap.clearAllElement();
		this.toMap(num);
		if(!this.onclick())return;
		richmap.zoomToPosition(this.screenX,this.screenY,parseInt(richmap.getWidth()*0.5),parseInt(richmap.getHeight()*0.7),richmap.getMaxLayer()-1);
	};
};
//设置列表的某行被选中
function selectRowChange(obj){
	if(nowFocusSinglePoint == null){
		nowFocusSinglePoint = obj;
	}else{
		if(m_sUserAgent == "msie"){
			try{nowFocusSinglePoint.className = "info_normal_focus";}catch(e){}
		}else if (m_sUserAgent == "firefox"){
			try{nowFocusSinglePoint.setAttribute("class","info_normal_focus");}catch(e){}
		}
		nowFocusSinglePoint = obj;
	}
	if(m_sUserAgent == "msie"){
		try{nowFocusSinglePoint.className = "info_vip_focus";}catch(e){}
	}else if (m_sUserAgent == "firefox"){
		try{nowFocusSinglePoint.setAttribute("class","info_vip_focus");}catch(e){}
	}
}
function wEMouseOver(elementId){
	if(nowFocusWingElement != ""){
		try{richmap.getElementObj(nowFocusWingElement).style.zIndex = 0;}catch(e){}
	}
	nowFocusWingElement = elementId;
	try{richmap.getElementObj(nowFocusWingElement).style.zIndex = 999;}catch(e){}
}
function wEMouseOut(elementId){
	richmap.getElementObj(nowFocusWingElement).style.zIndex = "";
	nowFocusWingElement = "";
}
var nowFocusSinglePoint = null;
var nowFocusWingElement = "";
var POIListHashTable = [];
//POI列表对象
function POIList(){
	this.left = 0;		//列表的最小加密经度
	this.bottom = 0;	//列表的最大加密纬度
	this.right = 0;		//列表的最大加密经度
	this.top = 0;		//列表的最小加密纬度
	this.poiList = new Array();	//保存POI的DWKEY，然后去POIHastTable里头去查找这个POI的对象
	this.poiShowNum = new Array();	//保存这个POI LIST的每个POI显示的时候的显示下标
	this.xyList = new Array();		//以x,y值做索引的哈希表,保存的是poilist数组的下标
	//提交地图显示
	this.toMap = function(){
		richmap.clearAllElement();
		var oPoiList = this;
		for(var i=0;i<this.poiList.length;i++){
			if(this.poiList[i].length == 1){
				POIHashTable[this.poiList[i][0]].toMap(this.poiShowNum[POIHashTable[this.poiList[i][0]].id]);
			}else{
				//显示多点的图片
				var listObj = new wingBasePoint("POIList_" + i,POIHashTable[this.poiList[i][0]].screenX,POIHashTable[this.poiList[i][0]].screenY);
				var tempObj = new wingPicObj();
				tempObj.sImageSrc = "images/icon/POI/0.png";		//图片地址
				tempObj.nImageWidth = 20;	//图片长
				tempObj.nImageHeight = 24;	//图片高
				tempObj.sAlt = "请选择具体的点";
				tempObj.nScreenX = -8;			//图片热点相对坐标x
				tempObj.nScreenY = -30;			//图片热点相对坐标y
				(function(){
					var doI = i;
					tempObj.onmouseover = function(){
						try{wEMouseOver("POIList_" + doI);}catch(e){}
						var showObjList = $("showObjList");
						showObjList.innerHTML = "";
						for(var j=0;j<oPoiList.poiList[doI].length;j++){
							showObjList.innerHTML += "<div onclick=\"showHideObjList('none');POIHashTable['" + oPoiList.poiList[doI][j] + "'].show()\" style='cursor:pointer;border-bottom:solid 1px #eeeeee;'>" + oPoiList.poiShowNum[POIHashTable[oPoiList.poiList[doI][j]].id] + "、" + POIHashTable[oPoiList.poiList[doI][j]].name + "</div>";
							//POIHashTable[this.poiList[i][j]].toMap(this.poiShowNum[POIHashTable[this.poiList[i][j]].id]);
						}						
						var evt = getEvent();
						if(document.all){
							document.body.setCapture();
						}else{
							window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP|Event.MOUSEDOWN);
						}						
						showObjList.style.left = evt.clientX + 10;
						showObjList.style.top = evt.clientY +12;
						if(document.all){
							document.body.releaseCapture();
						}else{
							window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP|Event.MOUSEDOWN);
						}
						showHideObjList("");
					};
				})();
				tempObj.onmouseout = function(){
					showHideObjList("none");
				};
				listObj.addObj(tempObj);	
				richmap.addWingElement(listObj);
			}
		}
		richmap.zoomToMBR(this.left,this.bottom,this.right,this.top);
	};
}
function showHideObjList(act){
	var showObjList = $("showObjList");
	showObjList.style.display = act;
}
//POB对象,即商家名址对象
function POB(){
	this.id	 = "";			//唯一标示id
	this.province = "";		//省份
	this.city = "";			//城市
	this.county = "";		//城镇
	this.name = "";			//名称
	this.address = "";		//地址
	this.phone = "";		//电话
	this.intro = "";		//简介
	this.screenX = "";		//加密经度
	this.screenY = "";		//加密纬度
	this.remarkCount = 0;	//回复数
	this.imgUrl = "";		//商家图片地址
	this.relateLink  = "";	//商家详细页url
	//提交地图显示
	this.toMap = function(){
		
	};
}

//POBList对象，即商家名址的列表对象
function POBList(){
	this.left = "";		//列表的最小加密经度
	this.bottom = "";	//列表的最大加密纬度
	this.right = "";	//列表的最大加密经度
	this.top = "";		//列表的最小加密纬度
	this.POBList = new Array();	//保存
	this.xyList = new Array();		//以x,y值做索引的哈希表,保存的是POBList数组的下标
	/*使用方法
	this.xyList[x1+“_ ”+y1] = 0;
	this.POBList [0] = new Array();
		this.POBList[0][0] = new POB();
		this.POBList[0][1] = new POB();	
		…
	this.xyList[x1+“_ ”+y1] = 1;
	this.POBList[1] = new Array();
	…
	*/
	//提交地图显示
	this.toMap = function(){
		
	};
}

//优惠信息对象
function Sales(){
	this.id = "";		//该条优惠信息的唯一标识
	this.title = "";	//该条优惠信息标题
	this.screenX = "";	//加密经度
	this.screenY = "";	//加密纬度
	this.relateLink = "";	//该条优惠信息的详细页地址
	//提交地图显示
	this.toMap = function(){
		
	};
}

//优惠信息列表对象
function SalesList(){
	this.SalesList = new Array();
	this.xyList = new Array();		//以x,y值做索引的哈希表,保存的是SalesList数组的下标
	/*使用方法
	this.xyList[x1+“_ ”+y1] = 0;
	this. SalesList [0] = new Array();
		this. SalesList[0][0] = new Sales ();
		this. SalesList[0][1] = new Sales ();	
		…
	this.xyList[x1+“_ ”+y1] = 1;
	this. SalesList[1] = new Array();
	…
	*/
	//提交地图显示
	this.toMap = function(){
		
	};
}

//地图随意贴对象
function Note(){
	this.id  = "";		//该条随意贴的唯一标识
	this.title = "";	//该条随意贴标题
	this.imgSrc = "";	//该条随意贴显示图标地址
	this.screenX = "";	//加密经度
	this.screenY = "";	//加密纬度
	this.message = "";	//该条随意贴的详细信息
	this.toMap = function(){
		
	};
}

//随意贴列表对象
function NoteList(){
	this. NoteList = new Array();
	this.xyList = new Array();		//以x,y值做索引的哈希表,保存的是NoteList数组的下标
	/*使用方法
	this.xyList[x1+“_ ”+y1] = 0;
	this. NoteList [0] = new Array();
		this. NoteList[0][0] = newNote ();
		this. NoteList[0][1] = new Note ();	
		…
	this.xyList[x1+“_ ”+y1] = 1;
	this. NoteList[1] = new Array();
	*/
	this.toMap = function(){
		
	};
};
/*
*	公共查询接口
*	使用方法：publicSearch.getSearch(flag,title,screenX,screenY,citycode,searchType) 具体参看这个成员函数
*/
var publicSearch = new function(){
	this.totalWidth = 320;	//总长
	this.labelHeight = 22;	//选项卡高度
	this.labelWidth = 75;	//选项卡长度
	this.labelArr = [];		//保存选项卡的卡片数组
	this.labelArr[0] = [];
	this.labelArr[0]["title"] = "去这里";
	this.labelArr[0]["content"] = '<div class="cContent" style="display:?dis?">'
		+ '起点：<input type="text" class="textInput" id="cBegin_?flag?" class="cInputText" onkeydown="publicSearch.checkEnter(this);"><br>'
		+ '<input type="button" class="public_btn" value="公交换乘" onclick="publicSearch.searchBusSolution(\'?flag?\',1)">&nbsp;&nbsp;'
		+ '<input type="button" class="public_btn" value="自驾方案" onclick="publicSearch.searchDriverSolution(\'?flag?\',1)">'
		+ '</div>';
	this.labelArr[1] = [];
	this.labelArr[1]["title"] = "从这来";
	this.labelArr[1]["content"] = '<div class="cContent" style="display:?dis?">'
		+ '终点：<input type="text" id="cEnd_?flag?" class="cInputText" onkeydown="publicSearch.checkEnter(this);"><br>'
		+ '<input type="button" class="public_btn" value="公交换乘" onclick="publicSearch.searchBusSolution(\'?flag?\',2)">&nbsp;&nbsp;'
		+ '<input type="button" class="public_btn" value="自驾方案" onclick="publicSearch.searchDriverSolution(\'?flag?\',2)">'
		+ '</div>';
	this.labelArr[2] = [];
	this.labelArr[2]["title"] = "周边搜索";
	this.labelArr[2]["content"] = '<div class="cContent" style="display:?dis?">'
		+ '周边范围：<input type="text" id="cDistance_?flag?" class="cInputText" value="500" size="4" readonly> 米　<a href="javascript:void(0);" onclick="publicSearch.setDistance(\'?flag?\',200);">200米</a> <a href="javascript:void(0);" onclick="publicSearch.setDistance(\'?flag?\',500);">500米</a> <a href="javascript:void(0);" onclick="publicSearch.setDistance(\'?flag?\',1000);">1公里</a> <a href="javascript:void(0);" onclick="publicSearch.setDistance(\'?flag?\',2000);">2公里</a> <br>'
		+ '周边关键字：<input type="text" id="cAroundKey_?flag?" onkeyup="checkEnter(\'btnAroundSearch\')" size="14">&nbsp;'
		+ '<input type="button" id="btnAroundSearch" class="public_btn" value=" 搜索 " onclick="publicSearch.searchAround(\'?flag?\')">'
		+ '</div>';
	this.labelArr[3] = [];
	this.labelArr[3]["title"] = "生成随意贴";
	this.labelArr[3]["content"] = '<div class="cContent" style="display:?dis?">以该位置生成猎图随意贴！ 　　<a href="javascript:void(0);" onclick="publicSearch.showUserNote(\'?flag?\');" style="text-decoration:underline;">>>点击这里开始</a><br>'
								+ '1、填上具体内容； <br>'
								+ '2、生成随意贴； <br>'
								+ '3、把随意贴发给您的亲朋好友！'
								+ '</div>';
	this.labelArr[4] = [];
	this.labelArr[4]["title"] = "产品信息";
	this.labelArr[4]["content"] = "";
	this.focusLabel = [];		//保存每个选项卡当前所处的选项卡位置
	this.aTitle = [];			//保存每个选项卡的中心点关键字
	this.aX = [];				//保存每个选项卡的中心点加密经度
	this.aY = [];				//保存每个选项卡的中心点加密纬度
	this.citycode = [];			//保存每个选项卡的中心点所属城市代码
	this.proCon = [];			//为产品列表添加内容
	/*
	*	@param sFlag			选项卡唯一标志
	*	@param title		选项卡中心点关键字
	*	@param screenX		选项卡中心点加密经度
	*	@param screenY		选项卡中心点加密纬度
	*	@param searchType	选项卡的卡片种类,字符串,取值：0 去这里 1 从这来 2 周边搜索 3 生成随意贴，多个的用逗号隔开如："1,2,3"
	*/
	this.getSearch = function(sFlag,title,screenX,screenY,cityCode,searchType,styleType){
		var myWidth = this.totalWidth;
		if(searchType.indexOf(",")){
			countArr = searchType.split(",");
			if(countArr.length > 4){myWidth = myWidth + 80;}
		}
		if(searchType == null && searchType == "")return "";
		var outStr = "";
		var conStr = "";
		switch(styleType){
			case 1:
				outStr= '<div style="position:relative;width:'+(myWidth+5)+'px;" id="searchBox_' + sFlag +'"><div style="height:25px;background-color:#F0F7FF">';
				conStr = "";
				if(searchType.indexOf(",")){
					var searchArr = searchType.split(",");
					for(var i=0;i<searchArr.length;i++){
						var doI = parseInt(searchArr[i]);
						outStr +='<div style="left:' + (i*69).toString() + 'px;" class="' + (i==0?'vcFocus':'vcBlur') + '" onclick="publicSearch.setFocus(\'' + sFlag + '\',' + i + ',\'vcFocus\',\'vcBlur\')">' + this.labelArr[doI]["title"] + '</div>';
						conStr += this.labelArr[doI]["content"].replace(/\?flag\?/g,sFlag);
						if(i==0){conStr = conStr.replace(/\?dis\?/,"");}else{conStr = conStr.replace(/\?dis\?/,"none");};
					}
					outStr += '</div>';
				}else{
					outStr += '<div style="left:0px;" class="vcFocus">'+ this.labelArr[parseInt(searchType)]["title"] + '</div>';
					conStr += this.labelArr[parseInt(searchType)]["content"].replace(/\?flag\?/g,sFlag).replace(/\?dis\?/,"");
				}
				outStr += '<div class="vcContainer">';
				outStr += conStr+'</div></div>';
				break;
			default:
				outStr = '<div style="position:relative;width:' + myWidth + 'px;" id="searchBox_' + sFlag + '"><div style="height:' + this.labelHeight + 'px;">';
				conStr = "";
				if(searchType.indexOf(",")){
					var searchArr = searchType.split(",");
					var i;
					for(i=0;i<searchArr.length;i++){
						var doI = parseInt(searchArr[i]);
						outStr += '<div style="left:' + (i*this.labelWidth).toString() + 'px;" class="' + (i==0?'cFocus':'cBlur') + '" onclick="publicSearch.setFocus(\'' + sFlag + '\',' + i + ',\'cFocus\',\'cBlur\')">' + this.labelArr[doI]["title"] + '</div>';
						conStr += this.labelArr[doI]["content"].replace(/\?flag\?/g,sFlag);
						if(i==0){conStr = conStr.replace(/\?dis\?/,"");}else{conStr = conStr.replace(/\?dis\?/,"none");};
					}
					outStr += '<div style="left:'+(i*this.labelWidth)+'px;width:' + (myWidth - this.labelWidth*i) + 'px;" class="cRest"></div></div>';
				}else{
					outStr += '<div style="left:0px;" class="cFocus">'+ this.labelArr[parseInt(searchType)]["title"] + '</div>';
					outStr += '<div style="left:'+this.labelWidth+'px;width:' + this.labelWidth + 'px;" class="cRest"></div></div>';
					conStr += this.labelArr[parseInt(searchType)]["content"].replace(/\?flag\?/g,sFlag).replace(/\?dis\?/,"");
				}
				outStr += '<div class="cContainer">';
				outStr += conStr + "</div></div>";
				break;
		}
		this.focusLabel[sFlag] = 0;
		this.aTitle[sFlag] = title;
		this.aX[sFlag] = screenX;
		this.aY[sFlag] = screenY;
		this.citycode[sFlag] = cityCode;		
		return outStr;
	};
	/*
	*	@param flag 唯一标志
	*	@param doI 第几个选项卡
	*/
	this.setFocus = function(flag,doI,scFocus,scBlur){
		if(this.focusLabel[flag] == doI)return false;
		var searchContainer = $("searchBox_" + flag);
		if(m_sUserAgent == "msie"){
			searchContainer.children[0].children[this.focusLabel[flag]].className = scBlur;
			searchContainer.children[1].children[this.focusLabel[flag]].style.display = "none";
		}else if (m_sUserAgent == "firefox"){
			checkChild(searchContainer.childNodes[0].childNodes,this.focusLabel[flag]).setAttribute("class",scBlur);
			checkChild(searchContainer.childNodes[1].childNodes,this.focusLabel[flag]).style.display = "none";
		}
		this.focusLabel[flag] = doI;
		if(m_sUserAgent == "msie"){
			searchContainer.children[0].children[this.focusLabel[flag]].className = scFocus;
			searchContainer.children[1].children[this.focusLabel[flag]].style.display = "";
		}else if (m_sUserAgent == "firefox"){
			checkChild(searchContainer.childNodes[0].childNodes,this.focusLabel[flag]).setAttribute("class",scFocus);
			checkChild(searchContainer.childNodes[1].childNodes,this.focusLabel[flag]).style.display = "";
		}
	};
	//进行周边查询
	this.searchAround = function(flag){
		var searchDis = $("cDistance_" + flag).value;
		var searchKey = $("cAroundKey_" + flag);
		if(searchKey.value.trim() == ""){alert('请输入周边关键字');searchKey.focus();return false;}
		//下面进行周边查询
		isLocalSearch = true;
		startAroundSearch(this.aTitle[flag],this.aX[flag],this.aY[flag],searchDis,searchKey.value,this.citycode[flag]);
	};
	//设置选项卡周边距离
	this.setDistance = function(flag,distance){
		$("cDistance_" + flag).value = distance;
	};
	//输入框的回车键响应
	this.checkEnter = function(obj){
		if(event.keyCode == 13){obj.nextSibling.nextSibling.fireEvent("onclick");}
	};
	//进行换乘方案
	this.searchBusSolution = function(flag,act){
		isLocalSearch = false;
		switch(act){
			case 1:		//去这里
				var searchKey = $("cBegin_" + flag);
				var obj = $("busstart");
				var obj1 = $("busend");				
				obj.value = searchKey.value;
				obj1.value = this.aTitle[flag];
				if(searchKey.value.trim() == ""){alert('请输入换乘起点关键字');searchKey.focus();return false;}
				startBusSearch(sData_bus_step1,searchKey.value.trim(),this.aTitle[flag],"",this.aX[flag],"",this.aY[flag],this.citycode[flag]);
			break;
			case 2:
				var searchKey = $("cEnd_" + flag);
				var obj = $("busstart");
				var obj1 = $("busend");				
				obj1.value = searchKey.value;
				obj.value = this.aTitle[flag];
				if(searchKey.value.trim() == ""){alert('请输入换乘终点关键字');searchKey.focus();return false;}
				startBusSearch(sData_bus_step1,this.aTitle[flag],searchKey.value.trim(),this.aX[flag],"",this.aY[flag],"",this.citycode[flag]);
			break;
			default:
			return;
			break;
		}
	};
	//进行自驾方案查询
	this.searchDriverSolution = function(flag,act){
		isLocalSearch = false;
		switch(act){
			case 1:		//去这里
				var searchKey = $("cBegin_" + flag);
				var obj = $("driverstart");
				var obj1 = $("driverend");
				obj.value = searchKey.value;
				obj1.value = this.aTitle[flag];
				if(searchKey.value.trim() == ""){alert('请输入自驾起点关键字');searchKey.focus();return false;}
				//startDriverSearch(searchKey.value.trim(),this.aTitle[flag],"",this.aX[flag],"",this.aY[flag],this.citycode[flag]);
				startDriverSearch(sData_driver_step1,searchKey.value.trim(),this.aTitle[flag],"",this.aX[flag],"",this.aY[flag],this.citycode[flag],this.citycode[flag]);
			break;
			case 2:
				var searchKey = $("cEnd_" + flag);
				var obj = $("driverstart");
				var obj1 = $("driverend");
				obj1.value = searchKey.value;
				obj.value = this.aTitle[flag];
				if(searchKey.value.trim() == ""){alert('请输入自驾终点关键字');searchKey.focus();return false;}
				//startDriverSearch(this.aTitle[flag],searchKey.value.trim(),this.aX[flag],"",this.aY[flag],"",this.citycode[flag]);
				startDriverSearch(sData_driver_step1,this.aTitle[flag],searchKey.value.trim(),this.aX[flag],"",this.aY[flag],"",this.citycode[flag],this.citycode[flag]);
			break;
			default:
			return;
			break;
		}
	};
	//显示随意贴
	this.showUserNote = function(flag){
		richmap.closeDialog();
		closeDialog();
		richmap.showNote(this.aX[flag],this.aY[flag]);
		//showUserNote(richmap,this.aX[flag],this.aY[flag]);
		//richmap.zoomToPosition(this.aX[flag],this.aY[flag],100,100,richmap.getLayer());
	};
};
function checkChild(obj,k){
	var j = 0;
	for(var i=0;i<obj.length;i++){
		if(obj[i].tagName) {
			if(j==k)return obj[i];
			j++;
		}
	}
}
//结果子容器对象
var isLocalSearch = false;
function Result(sFlag,sTitle,sCityCode,sZone){
	this.flag = sFlag;		//保存每次查询的唯一标志	
	this.title = sTitle;
	this.m_oFocusScript = null;	//保存聚焦对象索引
	this.citycode = sCityCode;	//保存城市代码
	this.zone = sZone;			//保存查询区域
	this.container = document.createElement("div");
	this.container.style.width = "100%";
	this.container.style.height = "100%";
	this.container.style.position = "absolute";
	this.container.style.left = "0px";
	this.container.style.top = "0px";
	this.container.style.overflowX = "hidden";
	this.container.style.overflowY = "auto";
	this.container.style.backgroundColor = "#ffffff";
	this.container.innerHTML = "读取信息中...";
	this.container.style.display = "none";
	Results.m_oResultCon.appendChild(this.container);
	//每个字容器的底部内容窗口
	this.container1 = document.createElement("div");
	this.container1.id = "showPage_"+this.flag;
	this.container1.style.width = "100%";
	this.container1.style.height = "30";
	this.container1.style.position = "absolute";
	if(document.all){
		this.container1.style.left = "-230px";
	}else{
		this.container1.style.left = "0px";
	}
	this.container1.style.top = "0px";
	this.container1.style.padding = "5px";
	this.container1.style.overflow = "hidden";
	this.container1.style.backgroundColor = "#ffffff";
	this.container1.style.textAlign = "right";
	//this.container1.innerHTML = "<a href='http:\/\/www.richmap.cn/' target=_blank style='color:#000000'>猎图网 Rich<font color='#C72307'>m</font><font color='#E4AE06'>a</font><font color='#37AB3C'>p</font> &copy; 2007</a>";
	this.container1.style.display = "none";	
	Results.m_oResultBot.appendChild(this.container1);	
	//保存当前这个子对象聚焦的时候需要运行的脚本
	this.focusScript = function(){
		if(this.m_oFocusScript != null){
			try{this.m_oFocusScript.toMap();}catch(e){}
		}else{
			richmap.clearAllElement();
		}
	};
	//专用于公交换乘功能同this.show
	this.showBus = function(htmlStr){
		if(htmlStr != null && htmlStr != ""){
			this.container.innerHTML = htmlStr;
		}
		this.container.style.display = "block";
		if(isLocalSearch){			
			this.container1.style.display ="block";			
		}else{
			this.container1.style.display ="none";
		}
		//运行代码
		if(this.m_oFocusScript != null){
			try{this.m_oFocusScript.showBus();}catch(e){}
		}else{
			richmap.clearAllElement();
		}
	};
	//传入html代码在容器上显示内容,为空的时候显示这个子容器即可
	this.show = function(htmlStr){
		if(htmlStr != null && htmlStr != ""){
			this.container.innerHTML = htmlStr;
		}
		this.container.style.display = "block";		
		if(isLocalSearch){
			this.container1.style.display ="block";			
		}else{
			this.container1.style.display ="none";			
		}
		//运行代码
		this.focusScript();
		
	};
	this.hidden = function(){
		this.container.style.display = "none";
		this.container1.style.display = "none";
	};
	this.del = function(){
		this.container.innerHTML = "";
		Results.m_oResultCon.removeChild(this.container);
		this.container = null;
		this.container1.innerHTML = "";
		Results.m_oResultBot.removeChild(this.container1);
		this.container1 = null;
		this.m_oFocusScript = null;
		//this = null;
	};
	//传入一个函数用于当这个结果对象聚焦的时候需要运行的脚本
	this.setFocusScript = function(obj){
		this.m_oFocusScript = obj;
	};
};
//关闭按钮的鼠标动作
function btnOver(obj){
	if(Results.m_bIsClose){
		obj.className='closeBtn_right_over';
	}else{
		obj.className='closeBtn_left_over';
	}
}
//关闭按钮的鼠标动作
function btnOut(obj){
	if(Results.m_bIsClose){
		obj.className='closeBtn_right_out';
	}else{
		obj.className='closeBtn_left_out';
	}
};
//判断浏览器环境
var m_sUserAgent = "";
var checkUserEnvironment = function(){
	if(!window.RegExp) return false;
	var AGENTS = ["opera","msie","safari","firefox","netscape","mozilla"];
	var agent = navigator.userAgent.toLowerCase();
	for (var i = 0; i < AGENTS.length; i++){
		m_sUserAgent = AGENTS[i];
		if(agent.indexOf(this.m_sUserAgent) != -1){
			var versionExpr = new RegExp(this.m_sUserAgent + "[ \/]?([0-9]+(\.[0-9]+)?)");
			var m_sUserVersion;
			if (versionExpr.exec(agent) != null){m_sUserVersion = parseFloat(RegExp.$1);}
			if (m_sUserAgent == "opera")return m_sUserVersion >= 7;
			if (m_sUserAgent == "safari")return m_sUserVersion >= 125;
			if (m_sUserAgent == "msie")return (m_sUserVersion >= 5.5 &&agent.indexOf("powerpc") == -1);
			if (m_sUserAgent == "netscape")return m_sUserVersion > 7;
			if (m_sUserAgent == "firefox")return m_sUserVersion >= 0.8;
		}
	}
	return !!document.getElementById;
};
function showMarket(act,name,x,y){
	if(act==1){
		busBeginX = parseInt(x);
		busBeginY = parseInt(y);
		if(richmap.getElementObj("begin")!=null){richmap.clearElement("begin");}
		var beginObj = new wingBasePoint("begin",parseInt(x),parseInt(y));
		beginObj.nShadow = 2;
		var tempObj = new wingPicObj();
		tempObj.sImageSrc = "images/icon/user_start.png";		//图片地址
		tempObj.nImageWidth = 25;	//图片 长
		tempObj.nImageHeight = 27;	//图片高
		tempObj.sAlt = name;
		tempObj.nScreenX = 0;			//图片热点相对坐标x
		tempObj.nScreenY = -27;			//图片热点相对坐标y
		beginObj.addObj(tempObj);
		var textObj = new wingTextObj();
		textObj.sText = name;
		textObj.nScreenX = 26;
		textObj.nScreenY = -27;
		textObj.sSize = "12px";
		textObj.sColor = "#FF7139";
		textObj.sBorder = "solid 1px #FF7139";
		textObj.sPadding = "2px";
		textObj.sBgColor = "#ffffff";
		beginObj.addObj(textObj);
		richmap.addWingElement(beginObj);
		//if(name=="用户标注起点"){ richmap.showElement(beginObj); return;}
		richmap.showElement(beginObj)
	}else if(act==2){
		busEndX = parseInt(x);
		busEndY = parseInt(y);
		if(richmap.getElementObj("end")!=null){richmap.clearElement("end");}
		var endObj = new wingBasePoint("end",parseInt(x),parseInt(y));
		endObj.nShadow = 2;
		var tempObj1 = new wingPicObj();
		tempObj1.sImageSrc = "images/icon/user_end.png";		//图片地址
		tempObj1.nImageWidth = 25;	//图片长
		tempObj1.nImageHeight = 27;	//图片高
		tempObj1.sAlt = name;
		tempObj1.nScreenX = 0;			//图片热点相对坐标x
		tempObj1.nScreenY = -27;			//图片热点相对坐标y
		endObj.addObj(tempObj1);
		var textObj1 = new wingTextObj();
		textObj1.sText = name;
		textObj1.nScreenX = 26;
		textObj1.nScreenY = -27;
		textObj1.sSize = "12px";
		textObj1.sColor = "#FF7139";
		textObj1.sBorder = "solid 1px #FF7139";
		textObj1.sPadding = "2px";
		textObj1.sBgColor = "#ffffff";
		endObj.addObj(textObj1);
		richmap.addWingElement(endObj);
		//if(name=="用户标注终点"){ richmap.showElement(endObj); return;}
		richmap.showElement(endObj)
	}
};
/*
*	本地查询
*	@param sUrl		查询地址
*	@param pageno	页码
*	@param flag		本次查询标志
*/
function getLocalData(sUrl,pageno,flag,cityCode){
	var errorStr = "<div style='font-size:14px;line-height:20px;padding:5px;'>抱歉，没有找到与查询“<font color='red'>"+$('keystring').value+"</font>”相符的信息。<br>"
				+"<br><b>猎图建议您：</b><br/>"
				//+"<li>"+smain.toHelp()+"</li>"
				+"<li>看看输入的文字是否有误</li><li>检查是否选择了正确的城市</li>"				
				+"<li>在公交线路中查询“<span style='color:blue;cursor:pointer;' onClick='$(\"line\").value=\""+$('keystring').value+"\";$(\"line\").style.color=\"#000000\";startSearch(2);'>"+$('keystring').value+"</span>”</li>"
				+"<li>在公交站点中查询“<span style='color:blue;cursor:pointer;' onClick='$(\"stops\").value=\""+$('keystring').value+"\";$(\"stops\").style.color=\"#000000\";startSearch(3);'>"+$('keystring').value+"</span>”</li>"
				+"<li>请换用其它的查询字词</li></div>";
	//清空之前容器内的内容	
	Results.show(flag,"读取信息...");	
	//开始异步查询			
	var xmlObj = Sarissa.getDomDocument();	
	xmlObj.async = false;
	xmlObj.onreadystatechange = function(){		
		if(xmlObj.readyState == 4){				
			//var oSerializer = new XMLSerializer();
			//alert(oSerializer.serializeToString(xmlObj));	
			if(xmlObj.parseError!=0){				
				Results.m_aObj[flag].show(errorStr);
				Results.m_oHelpBox.setHelpMsg(0);
				return false;
			}
			try{
				var testNode = "";
				if(m_sUserAgent == "msie"){
					testNode = xmlObj.selectSingleNode("root/Return").text;
				}else if(m_sUserAgent == "firefox"){
					testNode = Sarissa.getText(xmlObj.firstChild.firstChild,true);
				}
				if(testNode == "0"){
					Results.m_aObj[flag].show(errorStr);					
					return false;
				}			
				
			}catch(e){
				Results.m_aObj[flag].show(errorStr);
				Results.m_oHelpBox.setHelpMsg(1);			
				return false;
			}
			//解析数据
			var myNode = null;
			if(m_sUserAgent == "msie"){
				myNode = xmlObj.selectSingleNode("root/Content/Companies").childNodes;
			}else if(m_sUserAgent == "firefox"){
				myNode = xmlObj.getElementsByTagName("root")[0].getElementsByTagName("Content")[0].getElementsByTagName("Companies")[0].getElementsByTagName("Company");//.firstChild.childNodes[1].childNodes[2].childNodes;				
			}
			POIListHashTable[flag] = new POIList();
			var elapsedSeconds = null;
			if(m_sUserAgent == "msie"){
				elapsedSeconds = xmlObj.selectSingleNode("root/Content/ElapsedSeconds").text;
			}else if(m_sUserAgent == "firefox"){
				elapsedSeconds = Sarissa.getText(xmlObj.firstChild.childNodes[1].childNodes[5]);
			}
		
			var j=0;
			var outStr = "<div style='width:100%;height:26px;padding:3px;background-image:url(images/bmap/showAll_bg.jpg);'>查询用时："+elapsedSeconds+"秒　<a href='javascript:void(0);' onClick='POIListHashTable[\""+flag+"\"].toMap()' style='color:red;font-weight:bold'><image src='images/bmap/showAll.jpg' border='0'></a></div>";
			var dwkey = "";
			var priority = "";
			var x = "";
			var y = "";					
			for(var i=0;i<myNode.length;i++){//Sarissa.selectNodesValue(myNode[i].selectSingleNode("Phone"))
				dwkey = Sarissa.selectNodesValue(myNode[i].selectSingleNode("DwKey"));
				priority = myNode[i].getAttribute("priority");
				x = parseInt(Sarissa.selectNodesValue(myNode[i].selectSingleNode("ScreenX")));
				y = parseInt(Sarissa.selectNodesValue(myNode[i].selectSingleNode("ScreenY")));
				if(POIHashTable[dwkey] == null){
					POIHashTable[dwkey] = new POI();
					POIHashTable[dwkey].id = dwkey;
					POIHashTable[dwkey].citycode = cityCode;
					POIHashTable[dwkey].province = Sarissa.selectNodesValue(myNode[i].selectSingleNode("Province"));
					POIHashTable[dwkey].city = Sarissa.selectNodesValue(myNode[i].selectSingleNode("City"));
					POIHashTable[dwkey].county =Sarissa.selectNodesValue( myNode[i].selectSingleNode("County"));
					POIHashTable[dwkey].isVipUser = Sarissa.selectNodesValue(myNode[i].selectSingleNode("VipUser"));
					if(priority){POIHashTable[dwkey].isVipUser = "true";}
					POIHashTable[dwkey].screenX = x;
					POIHashTable[dwkey].screenY = y;
					POIHashTable[dwkey].name =Sarissa.selectNodesValue(myNode[i].selectSingleNode("Name"));
					POIHashTable[dwkey].displayName = Sarissa.selectNodesValue(myNode[i].selectSingleNode("DisplayName"));
					POIHashTable[dwkey].address = Sarissa.selectNodesValue(myNode[i].selectSingleNode("Address"));
					POIHashTable[dwkey].relateLink =Sarissa.selectNodesValue(myNode[i].selectSingleNode("WebSite"));
					POIHashTable[dwkey].phone = Sarissa.selectNodesValue(myNode[i].selectSingleNode("Phone"));
				}else{
					POIHashTable[dwkey].displayName = Sarissa.selectNodesValue(myNode[i].selectSingleNode("DisplayName"));
					POIHashTable[dwkey].address = Sarissa.selectNodesValue(myNode[i].selectSingleNode("Address"));
				}	
				outStr += "<div ";
				if(POIHashTable[dwkey].isVipUser == "true"){
					outStr += "style=\"width:100%;padding:3px;cursor:pointer;float:left;\"";
					outStr += " class='info_normal_focus' onclick=\"POIHashTable['"+dwkey+"'].show(this,"+(i+1)+");\">"
					+ "<div style=\"float:left;width:23px;height:27px;margin:0;border:0;padding:0px;";
					if(m_sUserAgent == "msie"){
						outStr += "filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, "
						+ "src='images/icon/VIP/" + (i+1).toString() + ".png');background:none;";
					}else if(m_sUserAgent == "firefox"){
						outStr += "background-image:url('images/icon/VIP/" + (i+1).toString() + ".png');background-repeat:no-repeat;";
					}
					outStr += "\">&nbsp;</div>"
					+ "<div style=\"width:180px;float:left;border:0;padding:0px;margin:0;\">"
					+ "<div style=\"width:100%;border:0;padding:0px;margin:0;\">"
					+ "&nbsp;&nbsp;<span class='infoTit_vip' >" + POIHashTable[dwkey].displayName + "</span></div>";
				}else{
					outStr += "style=\"width:100%;padding:3px;cursor:pointer;float:left;\"";
					outStr += " class='info_normal_focus' onclick=\"POIHashTable['"+dwkey+"'].show(this,"+(i+1)+");\">"
					+ "<div style=\"float:left;width:23px;height:28px;margin:0;border:0;padding:0px;";
					if(m_sUserAgent == "msie"){	
						outStr += "filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, "
						+ "src='images/icon/POI/" + (i+1).toString() + ".png');background:none;";
					}else if(m_sUserAgent == "firefox"){
						outStr += "background-image:url('images/icon/POI/" + (i+1).toString() + ".png');background-repeat:no-repeat;";
					}
					outStr += "\">&nbsp;</div>"
					+ "<div style=\"width:180px;float:left;border:0;padding:0px;margin:0;\">"
					+ "<div style=\"width:100%;border:0;padding:0px;margin:0;\">"
					+ "&nbsp;&nbsp;<span class='infoTit_normal' >" + POIHashTable[dwkey].displayName + "</span></div>";
				}
				if(POIHashTable[dwkey].address != ""){
					outStr = outStr + "<div style='width:100%;border:0;padding-left:5px;margin:0;'>地址：" + POIHashTable[dwkey].address + "</div>"; //.replace("<font color=#CC0033>","").replace("</font>","")
				}
				if(POIHashTable[dwkey].phone != ""){
					outStr = outStr + "<div style='width:100%;border:0;padding-left:5px;margin:0;'>电话：" + POIHashTable[dwkey].phone + "</div>";
				}
				outStr = outStr + "</div></div>";
				
				//判定MBR
				if(i==0){
					POIListHashTable[flag].left = x;
					POIListHashTable[flag].bottom = y;
					POIListHashTable[flag].right = x;
					POIListHashTable[flag].top = y;
				}else{
					if(POIListHashTable[flag].left>x)POIListHashTable[flag].left = x;
					if(POIListHashTable[flag].bottom<y)POIListHashTable[flag].bottom = y;
					if(POIListHashTable[flag].right<x)POIListHashTable[flag].right = x;
					if(POIListHashTable[flag].top>y)POIListHashTable[flag].top = y;
				}
				//加入列表
				if(POIListHashTable[flag].xyList[x + "_" + y]==null){
					POIListHashTable[flag].poiList[j] = new Array();
					POIListHashTable[flag].xyList[x + "_" + y] = j;
					j++;
				}
				POIListHashTable[flag].poiShowNum[dwkey] = i+1;		//保存列表的位置
				POIListHashTable[flag].poiList[POIListHashTable[flag].xyList[x + "_" + y]].push(dwkey);
			}
			//提交地图显示
			///POIListHashTable[flag].toMap();//地图上显示各点
			Results.m_aObj[flag].setFocusScript(POIListHashTable[flag]);
			Results.show(flag,outStr);
			Results.m_oHelpBox.setHelpMsg(0);		
			outstr = null;
			//显示分页
			var tcount = null;
			if(m_sUserAgent == "msie"){
				tcount = xmlObj.selectSingleNode("root/Content/Companies").getAttribute("totalCount");
			}else if(m_sUserAgent == "firefox"){
				tcount = xmlObj.firstChild.childNodes[1].childNodes[6].getAttribute("totalCount");	
			}			
			creatPage("showPage_" + flag,10,sUrl,flag,parseInt(tcount),"getLocalData(","",1,"");
		};
		if(m_sUserAgent == "firefox"){	
			$("sideBar2").onclick();
		}
	};	
	xmlObj.load(encodeURI(sUrl+pageno));
	
};
// 用户自定义起始和终点位置

var nowFocusFlag = 1;
var nowBusFlag = "";
var selectObj1 = "";
var selectObj2 = "";
function markReturn(x,y){
	if(nowFocusFlag==1){
		showMarket(1,"用户标注起点",x,y);
		selectObj3 = "<div class='sFocus' onmouseover=\"busSelect.mouseOver(1,'" + nowBusFlag + "',this)\" onmouseout=\"busSelect.mouseOut(1,'" + nowBusFlag + "',this)\" onclick=\"busSelect.onClick('" + nowBusFlag + "',this,1,'用户标注起点'," + x + "," + y + ")\">用户标注起点</div>"+selectObj1.replace("sFocus","sOut");
		document.getElementById("begin_"+nowBusFlag).innerHTML = selectObj3;
		try{$("begin_" + nowBusFlag).firstChild.fireEvent("onclick");}catch(e){}
		//alert($("begin_" + nowBusFlag).children[1].innerHTML);
		//alert($("begin_" + nowBusFlag).children[1].className);
	}
	if(nowFocusFlag==2){
		showMarket(2,"用户标注终点",x,y);
		selectObj4 = "<div class='sFocus' onmouseover=\"busSelect.mouseOver(2,'" + nowBusFlag + "',this)\" onmouseout=\"busSelect.mouseOut(2,'" + nowBusFlag + "',this)\" onclick=\"busSelect.onClick('" + nowBusFlag + "',this,2,'用户标注终点'," + x + "," + y + ")\">用户标注终点</div>"+selectObj2.replace("sFocus","sOut");
		document.getElementById("end_"+nowBusFlag).innerHTML = selectObj4;
		try{$("end_" + nowBusFlag).firstChild.fireEvent("onclick");}catch(e){}
	}
	richmap.setState(0);
	richmap.clearElement("onMark_showPic");
	markreturns.show = markReturn1;
}
function busMark(flag){
	nowFocusFlag = flag;
	richmap.setState(4);
	markreturns.show = markReturn;
}

var nowBusIndex = null;
function setBusFocus(i){
	if(i==nowBusIndex) return;
	if(nowBusIndex!=null){
		$("busSolution"+nowBusIndex).style.color="#003399";
		$("busSolution"+nowBusIndex).style.fontWeight="normal";
	}
	$("busSolution"+i).style.color="#FF0000";
	$("busSolution"+i).style.fontWeight="bold";
	nowBusIndex = i;
}
//公交换乘第一步查询
/*
*	开始换乘查询
*/
function startBusSearch(strUrl,begin,end,beginx,endx,beginy,endy,cityCode){
	//sData_bus="search?act=bus&citycode=?citycode?&begin=?begin?&end=?end?&beginflag=?beginflag?&endflag=?endflag?&beginx=?beginx?&beginy=?beginy?&endx=?endx?&endy=?endy?&run=?run?&arg=?arg?";
	var flag = getRandFlag();
	
	if(!Results.getObj(flag,"从“" + begin + "”到“" + end + "”",cityCode,"公交换乘"))return false;
	//组合查询路径
	sUrl = sData_basePath + strUrl;
	sUrl = sUrl.replace("?begin?",begin);
	sUrl = sUrl.replace("?end?",end);
	sUrl = sUrl.replace("?beginx?",beginx);
	sUrl = sUrl.replace("?endx?",endx);
	sUrl = sUrl.replace("?citycode?",cityCode);
	sUrl = sUrl.replace("?beginy?",beginy);
	sUrl = sUrl.replace("?endy?",endy);
	sUrl = sUrl.replace("?arg?","");
	sUrl = sUrl.replace("?run?","");
	sUrl = encodeURI(sUrl);
	var errorStr = '<div style="font-size:14px;line-height:20px;padding:5px;">抱歉，没有找到可用的换乘方案<br>'
					+'<br><b>猎图建议您：</b><br>'
					//+'<li>'+smain.toHelp()+'</li>'
					+'<li>看看输入的文字是否有误</li><li>检查是否选择了正确的城市</li>'
					+'<li>确保输入的出发地和目的地位于同一城市内</li>'
					+'<li>尝试使用附近的标志性建筑名称</li>'
					+'<li>使用地图上的<img src="images/bmap/mark_off.png">按钮设置目标位置，通过“去这里”或“从这来”完成查询</li></div>';
	//开始异步查询
	var xmlObj = Sarissa.getDomDocument();
	xmlObj.async = true;
	xmlObj.onreadystatechange = function(){
		if(xmlObj.readyState == 4){
			//var oSerializer = new XMLSerializer();
			//alert(oSerializer.serializeToString(xmlObj));
			if(xmlObj.parseError!=0){
				Results.m_aObj[flag].show("xml载入错误！错误描述:\r\n"+Sarissa.getParseErrorText(xmlObj));
				return false;
			}
			try{
				var testNode = "";
				if(m_sUserAgent == "msie"){
					testNode = xmlObj.selectSingleNode("root/Return").text;
				}else if(m_sUserAgent == "firefox"){
					testNode = Sarissa.getText(xmlObj.firstChild.firstChild,true);					
				}
				if(testNode == "0"){
					Results.m_aObj[flag].show(errorStr);
					Results.m_oHelpBox.setHelpMsg(0);					
					return false;
				}
			}catch(e){
				return false;
			}
			//解析数据
			try{
				var walkNode,walkNodeText;
				if(m_sUserAgent == "msie"){
					walkNode = xmlObj.selectSingleNode("root/Content/WalkDistance");
					walkNodeText = walkNode.text;
					
				}else if(m_sUserAgent == "firefox"){
					walkNode = xmlObj.firstChild.childNodes[1].childNodes[2];					
					walkNodeText = Sarissa.getText(walkNode);
				}
			}catch(e){}
			if(walkNode&&walkNode.childNodes&&walkNodeText!=""){
				var direct;
				var b_name;
				var b_x;
				var b_y;
				var e_name;
				var e_x;
				var e_y;
				if(m_sUserAgent == "msie"){
					direct = xmlObj.selectSingleNode("root/Content/Direction").text;
					b_name = xmlObj.selectSingleNode("root/Content/Begin").getAttribute("name");
					b_x = xmlObj.selectSingleNode("root/Content/Begin").getAttribute("x");
					b_y = xmlObj.selectSingleNode("root/Content/Begin").getAttribute("y");
					e_name = xmlObj.selectSingleNode("root/Content/End").getAttribute("name");
					e_x = xmlObj.selectSingleNode("root/Content/End").getAttribute("x");
					e_y = xmlObj.selectSingleNode("root/Content/End").getAttribute("y");
				}else if(m_sUserAgent == "firefox"){
					direct = Sarissa.getText(xmlObj.firstChild.childNodes[1].childNodes[3]);
					b_name = xmlObj.firstChild.childNodes[1].childNodes[0].getAttribute("name");
					b_x = xmlObj.firstChild.childNodes[1].childNodes[0].getAttribute("x");
					b_y = xmlObj.firstChild.childNodes[1].childNodes[0].getAttribute("y");
					e_name = xmlObj.firstChild.childNodes[1].childNodes[1].getAttribute("name");
					e_x = xmlObj.firstChild.childNodes[1].childNodes[1].getAttribute("x");
					e_y = xmlObj.firstChild.childNodes[1].childNodes[1].getAttribute("y");
				}
				var str = "<br>路程较短，建议步行。<br>往<font color=red>"+direct+"</font>方向步行"+walkNodeText+"米即到。";
				Results.show(flag,str);
				showMarket(1,b_name,b_x,b_y);
				showMarket(2,e_name,e_x,e_y);
			}else{
				var stateNode = "";
				if(m_sUserAgent == "msie"){
					if(xmlObj.selectSingleNode("root/Content/BusSolution")){
						stateNode = xmlObj.selectSingleNode("root/Content/BusSolution").getAttribute("state");
					}	
				}else if(m_sUserAgent == "firefox"){
					stateNode = xmlObj.firstChild.childNodes[1].childNodes[0].getAttribute("state");					
					if(!stateNode) stateNode = xmlObj.firstChild.childNodes[1].childNodes[2].getAttribute("state");
				}				
			switch(stateNode){
				case "ONE":
					//显示选择框
					var beginNode = null;
					var endNode = null;
					if(m_sUserAgent == "msie"){
						beginNode = xmlObj.selectSingleNode("root/Content/BusSolution/Begin").childNodes;
						endNode = xmlObj.selectSingleNode("root/Content/BusSolution/End").childNodes;
					}else if(m_sUserAgent == "firefox"){
						beginNode = xmlObj.firstChild.childNodes[1].firstChild.childNodes[0].childNodes;
						endNode = xmlObj.firstChild.childNodes[1].firstChild.childNodes[1].childNodes;
					}
					if(beginNode.length == 0){
						Results.show(flag,errorStr);
						Results.m_oHelpBox.setHelpMsg(0);
						return false;
					}
					if(endNode.length == 0){
						Results.show(flag,errorStr);
						Results.m_oHelpBox.setHelpMsg(0);
						return false;
					}
					nowBusFlag = flag;
					var outStr = "<div style='color:black;font-weight:bold;padding:5px;'>请选择起点：";
					outStr += "<img src='images/bmap/markbegin.gif' border='0' style='cursor:pointer;' onClick='busMark(1)' alt='用鼠标在地图上标注终点位置'></div>";
					outStr += "<div id='begin_" + flag + "' class='selectCon'>";
					
					busSelect.citycode[flag] = cityCode;
					busSelect.searchType[flag] = 1;
					var bgname = "";
					var bgx = null;
					var bgy = null;
					var bgf = null;
					var edname = "";
					var edx = null;
					var edy = null;
					var edf = null;
					for(var i=0;i<beginNode.length;i++){
						if(m_sUserAgent == "msie"){
							bgname = beginNode[i].selectSingleNode("Name").text;
							bgx = parseInt(beginNode[i].selectSingleNode("ScreenX").text);
							bgy = parseInt(beginNode[i].selectSingleNode("ScreenY").text);
							bgf = beginNode[i].parentNode.getAttribute("type");
						}else if(m_sUserAgent == "firefox"){
							bgname = Sarissa.getText(beginNode[i].childNodes[2]);
							bgx = parseInt(Sarissa.getText(beginNode[i].childNodes[0]));
							bgy = parseInt(Sarissa.getText(beginNode[i].childNodes[1]));
							bgf = beginNode[i].parentNode.getAttribute("type");
						}
						if(i == 0){
							busSelect.bname[flag] = bgname;
							busSelect.bx[flag] = bgx;
							busSelect.by[flag] = bgy;
							busSelect.bf[flag] = bgf;
							outStr += "<div class='sFocus' onmouseover=\"busSelect.mouseOver(1,'" + flag + "',this)\" onmouseout=\"busSelect.mouseOut(1,'" + flag + "',this)\" onclick=\"busSelect.onClick('" + flag + "',this,1,'" + bgname + "'," + bgx + "," + bgy + ")\">" + bgname + "</div>";
						}else{
							outStr += "<div class='sOut' onmouseover=\"busSelect.mouseOver(1,'" + flag + "',this)\" onmouseout=\"busSelect.mouseOut(1,'" + flag + "',this)\" onclick=\"busSelect.onClick('" + flag + "',this,1,'" + bgname + "'," + bgx + "," + bgy + ")\">" + bgname + "</div>";
						}
					}
					outStr += "</div><div style='color:black;font-weight:bold;padding:5px;'>请选择终点：";
					outStr += "<img src='images/bmap/markend.gif' border='0' style='cursor:pointer;' onClick='busMark(2)' alt='用鼠标在地图上标注终点位置'></div>";
					outStr += "<div id='end_" + flag + "' class='selectCon'>";
					for(var i=0;i<endNode.length;i++){
						if(m_sUserAgent == "msie"){
							edname = endNode[i].selectSingleNode("Name").text;
							edx = parseInt(endNode[i].selectSingleNode("ScreenX").text);
							edy = parseInt(endNode[i].selectSingleNode("ScreenY").text);
							edf = endNode[i].parentNode.getAttribute("type");
						}else if(m_sUserAgent == "firefox"){
							edname = Sarissa.getText(endNode[i].childNodes[2]);
							edx = parseInt(Sarissa.getText(endNode[i].childNodes[0]));
							edy = parseInt(Sarissa.getText(endNode[i].childNodes[1]));
							edf = endNode[i].parentNode.getAttribute("type");
						}
						if(i == 0){
							busSelect.ename[flag] = edname;
							busSelect.ex[flag] = edx;
							busSelect.ey[flag] = edy;
							busSelect.ef[flag] = edf;
							outStr += "<div class='sFocus' onmouseover=\"busSelect.mouseOver(2,'" + flag + "',this)\" onmouseout=\"busSelect.mouseOut(2,'" + flag + "',this)\" onclick=\"busSelect.onClick('" + flag + "',this,2,'" + edname + "'," + edx + "," + edy + ")\">" + edname + "</div>";
						}else{
							outStr += "<div class='sOut' onmouseover=\"busSelect.mouseOver(2,'" + flag + "',this)\" onmouseout=\"busSelect.mouseOut(2,'" + flag + "',this)\" onclick=\"busSelect.onClick('" + flag + "',this,2,'" + edname + "'," + edx + "," + edy + ")\">" + edname + "</div>";
						}
					}
					outStr += "</div><div style='width:100%;text-align:right;height:30px;padding-top:10px;'><input type='button' value=' '  class='confirm_btn' onclick=\"busSelect.commit('" + flag + "');\"></div>";
					//提交地图显示
					Results.show(flag,outStr); 
					Results.m_oHelpBox.setHelpMsg(0);
					if(m_sUserAgent == "msie"){
						try{$("begin_" + flag).firstChild.fireEvent("onclick");}catch(e){}
						try{$("end_" + flag).firstChild.fireEvent("onclick");}catch(e){}
					}else if(m_sUserAgent == "firefox"){
						try{
							var evt = document.createEvent('MouseEvent');   
 							evt.initEvent('click',false,false); 
							$("begin_" + flag).firstChild.dispatchEvent(evt);
						}catch(e){}
						try{
							var evt = document.createEvent('MouseEvent');   
 							evt.initEvent('click',false,false); 
							$("end_" + flag).firstChild.dispatchEvent(evt);
						}catch(e){}
					}
					outstr = null;
					selectObj1 = document.getElementById("begin_"+flag).innerHTML;
					selectObj2 = document.getElementById("end_"+flag).innerHTML;
				break;
				case "TWO":
					var solutionNode = null;
					var myNode = null;
					if(m_sUserAgent == "msie"){
						solutionNode = xmlObj.selectSingleNode("root/Content/BusSolution/Solution");
					}else if(m_sUserAgent == "firefox"){
						solutionNode = xmlObj.firstChild.childNodes[1].childNodes[2].firstChild;
					}
					if(solutionNode){
						if(m_sUserAgent == "msie"){
							myNode = xmlObj.selectSingleNode("root/Content/BusSolution").childNodes;
						}else if(m_sUserAgent == "firefox"){
							myNode = xmlObj.firstChild.childNodes[1].childNodes[2].childNodes;							
						}
					}else{
						Results.show(flag,errorStr);
						Results.m_oHelpBox.setHelpMsg(0);
						return false;
					}
					var mySolution = new BusSolution();
					with(mySolution){
						citycode = cityCode;
						if(m_sUserAgent == "msie"){
							beginName = xmlObj.selectSingleNode("root/Content/Begin").getAttribute("name");
							endName = xmlObj.selectSingleNode("root/Content/End").getAttribute("name");
							beginScreenX = parseInt(xmlObj.selectSingleNode("root/Content/Begin").getAttribute("x"));
							beginScreenY = parseInt(xmlObj.selectSingleNode("root/Content/Begin").getAttribute("y"));
							endScreenX = parseInt(xmlObj.selectSingleNode("root/Content/End").getAttribute("x"));
							endScreenY = parseInt(xmlObj.selectSingleNode("root/Content/End").getAttribute("y"));
						}else if(m_sUserAgent == "firefox"){
							beginName = xmlObj.firstChild.childNodes[1].childNodes[0].getAttribute("name");
							endName = xmlObj.firstChild.childNodes[1].childNodes[1].getAttribute("name");
							beginScreenX = parseInt(xmlObj.firstChild.childNodes[1].childNodes[0].getAttribute("x"));
							beginScreenY = parseInt(xmlObj.firstChild.childNodes[1].childNodes[0].getAttribute("y"));
							endScreenX = parseInt(xmlObj.firstChild.childNodes[1].childNodes[1].getAttribute("x"));
							endScreenY = parseInt(xmlObj.firstChild.childNodes[1].childNodes[1].getAttribute("y"));
						}
						var outStr = "";
						var smsStr = "";
						var smsUrl = "";
						for(var j = 0;j<myNode.length;j++){//myNode = Solution
							var routingObj = myNode[j].childNodes;	//routingObj = Part  得到具体方案内的经过线路节点
							outStr += "<div style='padding:3px;padding-left:8px;width:100%;line-height:20px;' class='info_normal_focus'><a href='javascript:void(0)' style='font-size:bold' onclick=\"Results.m_aObj['" + flag + "'].m_oFocusScript.showBus(this.parentNode," + j + ");setBusFocus("+(j+1)+");\"><span id='busSolution"+(j+1)+"'>换乘方案&nbsp;" + (j+1) + "</span></a>　<br>";
							if(myNode[j].getAttribute("walkdis1")!="0"&&myNode[j].getAttribute("walkdis1")!="0.0"){
								outStr += "&nbsp;&nbsp;从<b>出发地</b>步行约"+myNode[j].getAttribute("walkdis1")+"米<br>&nbsp;&nbsp;至";
								smsStr +="从出发地步行约"+myNode[j].getAttribute("walkdis1")+"米，至";
							}else{
								outStr += "从";
								smsStr += "从";
							}
							solutions[j] = new Array();
							var oldStopId = "";
							var startStopId = "";
							var startStopName = "";
							var lineObj = null;
							for(var i = 0;i<routingObj.length;i++){
								solutions[j][i] = new Array();
								solutions[j][i]["stop"] = new Array();
								if(m_sUserAgent == "msie"){
									solutions[j][i]["stop"][0] = routingObj[i].selectSingleNode("StartStop").getAttribute("id");
									solutions[j][i]["stop"][1] = routingObj[i].selectSingleNode("EndStop").getAttribute("id");
									solutions[j][i]["stop"][2] = routingObj[i].selectSingleNode("StartStop").getAttribute("x");
									solutions[j][i]["stop"][3] = routingObj[i].selectSingleNode("EndStop").getAttribute("x");
									solutions[j][i]["stop"][4] = routingObj[i].selectSingleNode("StartStop").getAttribute("y");
									solutions[j][i]["stop"][5] = routingObj[i].selectSingleNode("EndStop").getAttribute("y");
									solutions[j][i]["path"] = routingObj[i].selectSingleNode("Path").text;
									lineObj = routingObj[i].selectSingleNode("Lines").childNodes;
								}else if(m_sUserAgent == "firefox"){
									solutions[j][i]["stop"][0] = routingObj[i].childNodes[0].getAttribute("id");
									solutions[j][i]["stop"][1] = routingObj[i].childNodes[1].getAttribute("id");
									solutions[j][i]["stop"][2] = routingObj[i].childNodes[0].getAttribute("x");
									solutions[j][i]["stop"][3] = routingObj[i].childNodes[1].getAttribute("x");
									solutions[j][i]["stop"][4] = routingObj[i].childNodes[0].getAttribute("y");
									solutions[j][i]["stop"][5] = routingObj[i].childNodes[1].getAttribute("y");
									solutions[j][i]["path"] = Sarissa.getText(routingObj[i].childNodes[3]);
									lineObj = routingObj[i].childNodes[2].childNodes;
								}
								if(i == 0){	
									if(m_sUserAgent == "msie"){
										outStr += "<b>"+routingObj[i].selectSingleNode("StartStop").getAttribute("name")+"</b>站乘<br>";
										smsStr += routingObj[i].selectSingleNode("StartStop").getAttribute("name")+"站乘";
									}else if(m_sUserAgent == "firefox"){
										outStr += "<b>"+routingObj[i].childNodes[0].getAttribute("name")+"</b>站乘<br>";
										smsStr += routingObj[i].childNodes[0].getAttribute("name")+"站，乘";
									}
									for(var m=0;m<lineObj.length;m++){
										var fromTo = lineObj[m].getAttribute("fromTo").replace(" → ","”开往“");
										outStr += "&nbsp;&nbsp;<a href=\"javascript:void(0);\" style='color:red' class='normalLink' onclick=\"startLineSearch('"+lineObj[m].getAttribute("name")+"','"+cityCode+"');\" ";
										outStr += "onmouseover=\"showTitle('从“"+fromTo+"”方向，点击查看详情')\" onmouseout=\"closeTitle();\">";
										outStr += lineObj[m].getAttribute("name");
										outStr += "</a>";
										smsStr += lineObj[m].getAttribute("name");
										if(m<lineObj.length-1){
											outStr += "或";
											smsStr += "或";
										}
									}
								}else{							
									if(m_sUserAgent == "msie"){
										oldStopId = routingObj[i-1].selectSingleNode("EndStop").getAttribute("id");
										startStopId = routingObj[i].selectSingleNode("StartStop").getAttribute("id");
										startStopName = routingObj[i].selectSingleNode("StartStop").getAttribute("name");
									}else if(m_sUserAgent == "firefox"){
										oldStopId = routingObj[i-1].childNodes[1].getAttribute("id");
										startStopId = routingObj[i].childNodes[0].getAttribute("id");
										startStopName = routingObj[i].childNodes[0].getAttribute("name");
									}
									if(oldStopId!=startStopId){
										outStr += "后步行到 <b>"+startStopName+"</b> 站转<br>";
										smsStr += "后，步行到"+startStopName+"站转";
									}else{
										outStr += "，在该站转<br>";
										smsStr += "，在该站转";
									}
									for(var m=0;m<lineObj.length;m++){
										var fromTo = lineObj[m].getAttribute("fromTo").replace(" → ","”开往“");
										outStr += "&nbsp;&nbsp;<a href=\"javascript:void(0);\" style='color:red' class='normalLink' onclick=\"startLineSearch('"+lineObj[m].getAttribute("name")+"','"+cityCode+"');\" ";
										outStr += "onmouseover=\"showTitle('从“"+fromTo+"”方向，点击查看详情')\" onmouseout=\"closeTitle();\">";
										outStr += lineObj[m].getAttribute("name");
										outStr += "</a>";
										smsStr += lineObj[m].getAttribute("name");
										if(m<lineObj.length-1){
											outStr += "或";
											smsStr += "或";
										}
									}
								}
								outStr  = outStr.replace(/、$/,"");
								if(m_sUserAgent == "msie"){
									outStr += "<br>&nbsp;&nbsp;到 <b>"+routingObj[i].selectSingleNode("EndStop").getAttribute("name")+"</b> 站下车";
									smsStr += "到"+routingObj[i].selectSingleNode("EndStop").getAttribute("name")+"站下车";
								}else if(m_sUserAgent == "firefox"){
									outStr += "<br>&nbsp;&nbsp;到 <b>"+routingObj[i].childNodes[1].getAttribute("name")+"</b> 站下车";
									smsStr += "到"+routingObj[i].childNodes[1].getAttribute("name")+"站下车";
								}
							};
							solutions[j]["l"] = beginScreenX;
							solutions[j]["b"] = endScreenY;
							solutions[j]["r"] = endScreenX;
							solutions[j]["t"] = beginScreenY;
							//solutions[j]["path"] = path;	//方案路径
							routingObj = null;
							if(myNode[j].getAttribute("walkdis2")!="0"&&myNode[j].getAttribute("walkdis2")!="0.0"){
								outStr += "<br>&nbsp;&nbsp;步行约"+myNode[j].getAttribute("walkdis2")+"米，到达<b>目的地</b>";
								smsStr += "，步行约"+myNode[j].getAttribute("walkdis2")+"米，到达目的地";
							}
							smsUrl = encodeURI(smsBase+smsStr);
							outStr += "<br><a href='javascript:void(0);' onClick=\"window.showModalDialog('"+smsUrl+"', '','"+dialogArgument+"')\"></a>";
							outStr += "</div>";
						}
					};
					//提交地图显示
					Results.m_aObj[flag].setFocusScript(mySolution);
					Results.m_oHelpBox.setHelpMsg(0);
					Results.showBus(flag,outStr);
					try{
						if(m_sUserAgent == "msie"){
							Results.m_aObj[flag].container.firstChild.firstChild.fireEvent("onclick");
						}else if(m_sUserAgent == "firefox"){
							var evt = document.createEvent('MouseEvent');   
							evt.initEvent('click',false,false);
							Results.m_aObj[flag].container.firstChild.firstChild.dispatchEvent(evt);
						}
					}catch(e){};
				break;
				default:
				return;
				break;
			};
		}
			//var rootNode = xmlObj.selectSingleNode("root/Content");
		}
	};	
	xmlObj.load(sUrl);
};
//公交换乘或自驾方案第一步选择的时候的对象
var publicSelect = new function(){
	this.bname = [];	//起点
	this.ename = [];	//终点
	this.bx = [];	//起点加密经度
	this.ex = [];	//终点加密经度
	this.by = [];	//起点加密纬度
	this.ey = [];	//终点加密纬度
	this.bf = [];	//起点标志
	this.ef = [];	//终点标志
	this.citycode = [];		//城市
	this.focusBeginFlag = [];
	this.focusEndFlag = [];
	this.searchType = [];
	this.mouseOver = function(act,flag,obj){
		switch(act){
			case 1:		//选择起点
				if(this.focusBeginFlag[flag] != obj)obj.className = "sOver";
			break;
			case 2:		//选择终点
				if(this.focusEndFlag[flag] != obj)obj.className = "sOver";
			break;
			default:
			return;
			break;
		}
	};
	this.mouseOut = function(act,flag,obj){
		switch(act){
			case 1:		//选择起点
				if(this.focusBeginFlag[flag] != obj)obj.className = "sOut";
			break;
			case 2:		//选择终点
				if(this.focusEndFlag[flag] != obj)obj.className = "sOut";
			break;
			default:
			return;
			break;
		}
	};
	this.onClick = function(flag,obj,act,name,x,y){
		switch(act){
			case 1:
				if(this.focusBeginFlag[flag] == obj)return;
				try{this.focusBeginFlag[flag].className = "sOut";}catch(e){}
				this.bname[flag] = name;
				this.bx[flag] = x;
				this.by[flag] = y;
				this.bf[flag] = flag;
				this.focusBeginFlag[flag] = obj;
			break;
			case 2:
				if(this.focusEndFlag[flag] == obj)return;
				try{this.focusEndFlag[flag].className = "sOut";}catch(e){}
				this.ename[flag] = name;
				this.ex[flag] = x;
				this.ey[flag] = y;
				this.ef[flag] = flag;
				this.focusEndFlag[flag] = obj;
			break;
			default:
			return;
			break;
		}
		obj.className = "sFocus";
	};
	//提交查询
	this.commit = function(flag){
		if(this.searchType[flag] == 1){
			startBusSearch(sData_bus_step2,this.bname[flag],this.ename[flag],this.bx[flag],this.ex[flag],this.by[flag],this.ey[flag],this.citycode[flag]);
		}else{
			//startDriverSearch(this.bname[flag],this.ename[flag],this.bx[flag],this.ex[flag],this.by[flag],this.ey[flag],this.citycode[flag]);
			startDriverSearch(sData_driver_step2,this.bname[flag],this.ename[flag],this.bx[flag],this.ex[flag],this.by[flag],this.ey[flag],this.citycode[flag],this.citycode[flag]);
		}
	};
};
//公交换乘第一步时候的选择
var busSelect = new function(){
	this.bname = [];	//起点
	this.ename = [];	//终点
	this.bx = [];	//起点加密经度
	this.ex = [];	//终点加密经度
	this.by = [];	//起点加密纬度
	this.ey = [];	//终点加密纬度
	this.bf = [];	//起点标志
	this.ef = [];	//终点标志
	this.citycode = [];		//城市
	this.focusBeginFlag = [];
	this.focusEndFlag = [];
	this.searchType = [];
	this.mouseOver = function(act,flag,obj){
		switch(act){
			case 1:		//选择起点
				if(this.focusBeginFlag[flag] != obj)obj.className = "sOver";
			break;
			case 2:		//选择终点
				if(this.focusEndFlag[flag] != obj)obj.className = "sOver";
			break;
			default:
			return;
			break;
		}
	};
	this.mouseOut = function(act,flag,obj){
		switch(act){
			case 1:		//选择起点
				if(this.focusBeginFlag[flag] != obj)obj.className = "sOut";
			break;
			case 2:		//选择终点
				if(this.focusEndFlag[flag] != obj)obj.className = "sOut";
			break;
			default:
			return;
			break;
		}
	};
	this.onClick = function(flag,obj,act,name,x,y){		
		switch(act){
			case 1:
				if(this.focusBeginFlag[flag] == obj)return;
				try{this.focusBeginFlag[flag].className = "sOut";}catch(e){}
				this.bname[flag] = name;
				this.bx[flag] = x;
				this.by[flag] = y;
				this.bf[flag] = flag;
				this.focusBeginFlag[flag] = obj;
				showMarket(act,name,x,y);
			break;
			case 2:
				if(this.focusEndFlag[flag] == obj)return;
				try{this.focusEndFlag[flag].className = "sOut";}catch(e){}
				this.ename[flag] = name;
				this.ex[flag] = x;
				this.ey[flag] = y;
				this.ef[flag] = flag;
				this.focusEndFlag[flag] = obj;
				showMarket(act,name,x,y);
			break;
			default:
			
			break;
		}
		if(name!="用户标注起点"&&name!="用户标注终点"){
			if(this.bx[flag]!=null&&this.ex[flag]!=null){	
				var MBR = [0,0,0,0];//l b r t				
				if(this.bx[flag] < this.ex[flag]){ 
					MBR[0] = this.bx[flag]; MBR[2] = this.ex[flag];
				}else{
					MBR[2] = this.bx[flag]; MBR[0] = this.ex[flag];
				}
				if(this.by[flag] < this.ey[flag]){
					MBR[3] = this.by[flag]; MBR[1] = this.ey[flag];
				}else{ 
					MBR[1] = this.by[flag]; MBR[3] = this.ey[flag];
				}				
				richmap.zoomToMBR(MBR[0],MBR[1],MBR[2],MBR[3]);
			}
		}
		obj.className = "sFocus";
	};
	//提交查询
	this.commit = function(flag){
		startBusSearch(sData_bus_step2,this.bname[flag],this.ename[flag],this.bx[flag],this.ex[flag],this.by[flag],this.ey[flag],this.citycode[flag]);
	};
};
//在页面上显示一个tooltip
var titleDivObj = null;
function showTitle(msg){
	if(titleDivObj == null){
		titleDivObj = document.createElement("div");
		with(titleDivObj){
			style.border = "solid 1px #F7BB79";
			style.padding = "2px";
			style.position = "absolute";
			style.color = "#F37A4B";
			style.display = "none";
			style.textAlign = "left";
			style.width = "200px";
			style.backgroundColor = "#ffffff";
		}
	}
	document.body.appendChild(titleDivObj);
	titleDivObj.style.display = "";
	titleDivObj.innerHTML = msg;
	titleDivObj.style.left = event.x + 12;
	titleDivObj.style.top = document.body.scrollTop + event.y + 5;
}
function closeTitle(){
	try{titleDivObj.style.display = "none";}catch(e){}
};
//公交线路查询
function startLineSearch(linename,cityCode){
	//得到标志
	$("line").value = linename;
	var flag = getRandFlag();
	if(!Results.getObj(flag,linename,cityCode,"公交线路"))return false;
	//组装URL
	var sUrl = sData_busLine;
	sUrl = sUrl.replace("?key?",linename);
	sUrl = sUrl.replace("?citycode?",cityCode);
	getLineData(sData_basePath + sUrl,flag);
}
/*
*	公交线路查询
*/
function getLineData(sUrl,flag){
	//开始异步查询	
	var xmlObj = Sarissa.getDomDocument();
	xmlObj.async = true;
	xmlObj.onreadystatechange = function(){
		if(xmlObj.readyState == 4){	
			if(xmlObj.parseError!=0){
				Results.m_aObj[flag].show("xml载入错误！错误描述:\r\n"+Sarissa.getParseErrorText(xmlObj));
				return false;
			}
			var errorStr = "<div style='font-size:14px;line-height:20px;padding:5px;'>抱歉，没有找到和您查询的“<font color=#ff0000>"+$("line").value+"</font>”相符的线路信息。<br>"
							//+"<br><b>猎图建议您：</b><br>"+"<li>"+smain.toHelp()+"</li>"
							+"<li>看看输入的文字是否有误</li><li>检查是否选择了正确的城市</li><li>请换用其他的查询字词</li></div>";
			try{
				var testNode = "";				
				testNode = Sarissa.selectNodesValue(xmlObj.selectSingleNode("root/Return"));
				if(testNode == "0"){
					//xmlObj.selectSingleNode("root/Error").text
					Results.m_aObj[flag].show(errorStr);										
					Results.m_oHelpBox.setHelpMsg(0);
					return false;
				}
			}catch(e){
				return false;
			}
			//解析数据
			//alert(Sarissa.serialize(xmlObj));		
			var busLineNode =Sarissa.selectNode(xmlObj.selectSingleNode("root/Content/BusLines"));
			if(busLineNode.getAttribute("totalCount")=="0"){Results.m_aObj[flag].show(errorStr);return false;}
			var myNode = busLineNode.childNodes;			
			var outStr = "";	//定义向结果框输出的文字结果信息			
			var focusLineId = "";
			for(var i=0;i<myNode.length;i++){
				var lineId =  Sarissa.selectNodesValue(myNode[i].selectSingleNode("Dwkey"));
				if(focusLineId == ""){focusLineId = lineId;}
				if(LineHashTable[lineId] == null){
					LineHashTable[lineId] = new Line();
					var StopNode = null;
					with(LineHashTable[lineId]){
						id = lineId;
						name = Sarissa.selectNodesValue(myNode[i].selectSingleNode("Name"));
						//direction = Sarissa.selectNodesValue(myNode[i].selectSingleNode("Direction"));
						//distance = Sarissa.selectNodesValue(myNode[i].selectSingleNode("Distance"));
						fromTo =Sarissa.selectNodesValue(myNode[i].selectSingleNode("FromTo"));
						startTime1 = Sarissa.selectNodesValue(myNode[i].selectSingleNode("StartTime1"));
						endTime1 = Sarissa.selectNodesValue(myNode[i].selectSingleNode("EndTime1"));
						startTime2 = Sarissa.selectNodesValue(myNode[i].selectSingleNode("StartTime2"));
						endTime2 = Sarissa.selectNodesValue(myNode[i].selectSingleNode("EndTime2"));
						priceDesc = Sarissa.selectNodesValue(myNode[i].selectSingleNode("PriceDesc"));
						path = Sarissa.selectNodesValue(myNode[i].selectSingleNode("Path"));
						county = Sarissa.selectNodesValue(myNode[i].selectSingleNode("County"));
						left = parseInt(Sarissa.selectNodesValue(myNode[i].selectSingleNode("Left")));
						bottom = parseInt(Sarissa.selectNodesValue(myNode[i].selectSingleNode("Bottom")));
						right = parseInt(Sarissa.selectNodesValue(myNode[i].selectSingleNode("Right")));
						top = parseInt(Sarissa.selectNodesValue(myNode[i].selectSingleNode("Top")));
						Valid = Sarissa.selectNodesValue(myNode[i].selectSingleNode("Valid"));
						//left = Sarissa.selectNodesValue(myNode[i].selectSingleNode("Distance").text;
						StopNode = Sarissa.selectNodes(myNode[i].selectSingleNode("BusStops"));				
									
						for(j = 0;j<StopNode.length;j++){
							var stopid = StopNode[j].getAttribute("stopid");
							if(StopHashTable[stopid] == null){
								StopHashTable[stopid] = new Stop();
								StopHashTable[stopid].id = stopid;
							}
							passStops[j] = new Array();
							passStops[j]["name"] = StopNode[j].getAttribute("name");
							passStops[j]["id"] = StopNode[j].getAttribute("stopid");
						}
					};
				}
				with(LineHashTable[lineId]){
					var smsStr = "";
					var smsUrl = "";
					outStr += "<div style='width:100%;padding:5px;' id='mydiv' class='info_normal_focus'><div style='width:100%;cursor:pointer;' onclick=\"LineHashTable['" + id + "'].show(this.parentNode);\"><div>" + (i+1) + "、" + name + "(" + county + " " + fromTo.atrim() + ")</div>";
					smsStr += name+"（"+fromTo.atrim()+"）";
					if(Valid == "P"){
						outStr += "<div style='color:red'>该线路现已暂服务</div>";
						smsStr += "（该线路现已暂服务）";
					}
					smsStr += startTime1.replace("始发时间:","：")+"-"+endTime1.replace("夏季末班时间:","")+","+startTime2.replace("始发时间:","：")+"-"+endTime2.replace("冬季末班时间:","");
					smsStr += "," + priceDesc+",途经站点：";
					outStr += "<div>" + startTime1 + "　" + endTime1 + "</div><div>" + startTime2 + "　" + endTime2 + "</div>";
					outStr += "<div>票价：" + priceDesc + "</div>";
					outStr += "</div><div>途经站点：<input type='checkbox' style='cursor:pointer' name='displayStops" + lineId + "' id='displayStops" + lineId + "' onclick=\"displayAllStop('"+id+"','"+lineId+"');\"><label for='displayStops" + lineId + "'>显示所有站点</label></div><div>";
					for(var k = 0;k<passStops.length;k++){
						if(k != 0)outStr += "→";
						outStr += "<a href='javascript:void(0)' onclick=\"StopHashTable['"+passStops[k]["id"]+"'].onclick();\">" + passStops[k]["name"] + "</a>";
						smsStr += passStops[k]["name"]+" ";
					}
					outStr += "</div>";
					smsUrl = encodeURI(smsBase+smsStr);
					outStr += "<div><a href='javascript:void(0);' onClick=\"window.showModalDialog('"+smsUrl+"', '','"+dialogArgument+"')\"></a></div>";
					outStr += "</div>";
				}
			}
			Results.m_aObj[flag].setFocusScript(LineHashTable[focusLineId]);
			Results.show(flag,outStr);
			Results.m_oHelpBox.setHelpMsg(0);
			if(m_sUserAgent == "msie"){
				try{Results.m_aObj[flag].container.firstChild.firstChild.fireEvent("onclick");}catch(e){};
			}else if(m_sUserAgent == "firefox"){
				var evt = document.createEvent('MouseEvent');   
 				evt.initEvent('click',false,false); 
				try{Results.m_aObj[flag].container.firstChild.firstChild.dispatchEvent(evt);}catch(e){};
			}
			outstr = null;
		}
	};
	if(m_sUserAgent=="firefox"){
		sUrl = sUrl +"&format=true";
	}
	xmlObj.load(sUrl);
};
//显示公交站点
var nowCheckedStop = null;
function displayAllStop(id,lineId){
	if(nowCheckedStop!=null){
		if(lineId != nowCheckedStop)
		document.getElementById("displayStops"+nowCheckedStop).checked = false;
	}
	if(document.getElementById("displayStops"+lineId).checked){LineHashTable[id].showAllStop();}
	else{LineHashTable[id].show(this.parentNode);}
	nowCheckedStop = lineId;
};
/*
*	公交站点查询
*/
function getStopData(sUrl,flag,cityCode){
	//开始异步查询
	var xmlObj = Sarissa.getDomDocument();
	xmlObj.async = true;
	xmlObj.onreadystatechange = function(){
		if(xmlObj.readyState == 4){
			//var oSerializer = new XMLSerializer();
			//alert(oSerializer.serializeToString(xmlObj));
			if(xmlObj.parseError!=0){
				Results.m_aObj[flag].show("xml载入错误！错误描述:\r\n"+Sarissa.getParseErrorText(xmlObj));
				return false;
			}
			try{
				var testNode = Sarissa.selectNodesValue(xmlObj.selectSingleNode("root/Return"));				
				if(testNode == "0"){
					var errorStr = "<div style='font-size:14px;line-height:20px;padding:5px;'>抱歉，没有找到和您查询的“<font color=#ff0000>"+$("stops").value+"</font>”相符的站点信息。<br>"
									+"<br><b>猎图建议您：</b></br>"
									//+"<li>"+smain.toHelp()+"</li>"
									+"<li>看看输入的文字是否有误</li><li>检查是否选择了正确的城市</li><li>请换用其他的查询字词</li></div>";				
					Results.m_oHelpBox.setHelpMsg(0);
					Results.m_aObj[flag].show(errorStr);
					//Results.m_aObj[flag].show(xmlDocArr[sFlag].selectSingleNodes("root/Error").text);
					return false;
				}
			}catch(e){
				return false;
			}
			//解析数据
			var stateNode = Sarissa.selectNode(xmlObj.selectSingleNode("root/Content/StopQuery")).getAttribute("state");			
			var outStr = "";	//定义向结果框输出的文字结果信息
			var smsStr = "";
			var smsUrl = "";			
			switch(stateNode){
				case "ONE":		//没有匹配到公交站点，进行名址查询后再查这些名址周边500米范围内的公交站点
					var myNode = Sarissa.selectNodes(xmlObj.selectSingleNode("root/Content/StopQuery"));
					for(var j=0;j<myNode.length;j++){
						outStr += "<div style='width:100%;padding:3px;border-top:' class='info_normal_focus'><div>"+(j+1)+"、"+myNode[j].getAttribute("name")+"</div><div>周边站点：";
						var stopNode = myNode[j].childNodes;
						var stopText = "";
						for(var k=0;k<stopNode.length;k++){
							stopText = Sarissa.selectNodesValue(stopNode[k]);							
							outStr += "<a href=\"javascript:void(0);\" onclick=\"startSearch(3,'" + stopText + "',null,'" + flag + "');\">" + stopText + "</a>&nbsp;&nbsp;";
						}
						if(stopNode.length == 0)outStr += "无";
						outStr += "</div></div>";
					}
					Results.show(flag,outStr);
					Results.m_oHelpBox.setHelpMsg(0);
					break;
				case "TWO":		//标准的公交站点
					var myNode = Sarissa.selectNodes(xmlObj.selectSingleNode("root/Content/StopQuery"));		
					var focusStopid = "";
					for(var i=0;i<myNode.length;i++){
						var stopid = myNode[i].getAttribute("stopid");
						if(focusStopid == "")focusStopid = stopid;
						if(StopHashTable[stopid] == null){
							StopHashTable[stopid] = new Stop();
							with(StopHashTable[stopid]){
								id = stopid;
								screenX = myNode[i].getAttribute("screenX");
								screenY = myNode[i].getAttribute("screenY");
								roadName = myNode[i].getAttribute("roadname");
								citycode = cityCode;
								name = myNode[i].getAttribute("name");
								passLine = new Array();	//经过线路
								var lineObj = myNode[i].childNodes;
								for(var j=0;j<lineObj.length;j++){
									passLine[j] = new Array();
									passLine[j]["lineid"] = lineObj[j].getAttribute("lineid");
									passLine[j]["name"] = lineObj[j].getAttribute("name");
									passLine[j]["fromTo"] = lineObj[j].getAttribute("fromTo");
								}
								lineObj = null;
							};
						}
						outStr += "<div style='width:100%;padding:4px;' class='info_normal_focus'><div style='width:100%;cursor:pointer' onclick=\"StopHashTable['"+stopid+"'].show(this.parentNode);\">公交站点：" + StopHashTable[stopid].name + "</div>";
						outStr += "<div>经过线路：";
						smsStr += "经过"+StopHashTable[stopid].name.replace(/\<[^>]*\>/g,"")+"的线路：";
						for(var k=0;k<StopHashTable[stopid].passLine.length;k++){
							outStr += "<br><a href=\"javascript:void(0);\" onclick=\"startLineSearch('"+StopHashTable[stopid].passLine[k]["name"]+"','"+cityCode+"');\">" + StopHashTable[stopid].passLine[k]["name"] + "<font color=#666666>(" + StopHashTable[stopid].passLine[k]["fromTo"].replace(" ","") + ")</font>" + "</a>";
							smsStr += StopHashTable[stopid].passLine[k]["name"];
						}
						outStr += "</div>";
						smsUrl = encodeURI(smsBase+smsStr);
						outStr += "<div><a href='javascript:void(0);' onClick=\"window.showModalDialog('"+smsUrl+"', '','"+dialogArgument+"')\"></a></div>";
						outStr += "</div>";
					}
					//alert(outStr);
					//提交地图显示
					Results.m_aObj[flag].setFocusScript(StopHashTable[focusStopid]);
					Results.show(flag,outStr);
					Results.m_oHelpBox.setHelpMsg(0);
					if(m_sUserAgent == "msie"){
						try{Results.m_aObj[flag].container.firstChild.firstChild.fireEvent("onclick");}catch(e){};
					}else if(m_sUserAgent == "firefox"){
						var evt = document.createEvent('MouseEvent');   
						evt.initEvent('click',false,false); 
						try{Results.m_aObj[flag].container.firstChild.firstChild.dispatchEvent(evt);}catch(e){};
					}
					outStr = null;
					break;
				default:
					stateNode = null;
					return false;
					break;
			}
			stateNode = null;
		};
	};
	xmlObj.load(encodeURI(sUrl));
};
/*
*	进行自驾方案查询
*/
function startDriverSearch(strUrl,begin,end,beginx,endx,beginy,endy,beginCity,endCity){
	//sData_driver="search?act=driver_step1&citycode1=?citycode1?&citycode2=?citycode2?&begin=?begin?&end=?end?&beginx=?beginx?&beginy=?beginy?&endx=?endx?&endy=?endy?";
	var flag = getRandFlag();
	if(!Results.getObj(flag,"从“" + begin + "”到“" + end + "”",beginCity,"自驾方案"))return false;
	//组合查询路径
	sUrl = sData_basePath + strUrl;
	sUrl = sUrl.replace("?begin?",begin);
	sUrl = sUrl.replace("?end?",end);
	sUrl = sUrl.replace("?beginx?",beginx);
	sUrl = sUrl.replace("?endx?",endx);
	sUrl = sUrl.replace("?citycode1?",beginCity);
	sUrl = sUrl.replace("?citycode2?",endCity);
	sUrl = sUrl.replace("?beginy?",beginy);
	sUrl = sUrl.replace("?endy?",endy);
	sUrl = sUrl.replace("?option?","0");
	sUrl = encodeURI(sUrl);
	//开始异步查询
	var xmlObj = Sarissa.getDomDocument();
	xmlObj.async = true;
	xmlObj.onreadystatechange = function(){
		if(xmlObj.readyState == 4){
			if(xmlObj.parseError!=0){
				Results.m_aObj[flag].show("抱歉，没有找到可用的自驾方案");								
				Results.m_oHelpBox.setHelpMsg(0);
				return false;
			}
			try{
				var testNode = "";
				if(m_sUserAgent == "msie"){
					testNode = xmlObj.selectSingleNode("root/Return").text;
				}else if(m_sUserAgent == "firefox"){
					testNode = xmlObj.getElementsByTagName("root")[0].getElementsByTagName("Return")[0].firstChild.nodeValue;					
					//testNode = Sarissa.getText(xmlObj.firstChild.firstChild,true);
				}
				if(testNode == "0"){
					Results.m_aObj[flag].show("抱歉，没有找到可用的自驾方案");				
					Results.m_oHelpBox.setHelpMsg(0);
					return false;
				}
			}catch(e){
				return false;
			}
			var stateNode = "";
			var walkNode = null;
			//解析数据
			try{
				if(m_sUserAgent == "msie"){
					stateNode = xmlObj.selectSingleNode("root/Content/DriverSolution").getAttribute("state");
				}else if(m_sUserAgent == "firefox"){		
					stateNode = xmlObj.getElementsByTagName("root")[0].getElementsByTagName("Content")[0].getElementsByTagName("DriverSolution")[0].getAttribute("state");
				}
			}catch(e){	
				if(m_sUserAgent == "msie"){
					walkNode = xmlObj.selectSingleNode("root/Content/WalkDistance");
					
				}else if(m_sUserAgent == "firefox"){
					if(stateNode ==""){
						try{
							stateNode = xmlObj.getElementsByTagName("root")[0].getElementsByTagName("Content")[0].getElementsByTagName("DriverSolution")[0].getAttribute("state");
						}catch(e){}	
					}
					walkNode = xmlObj.getElementsByTagName("root")[0].getElementsByTagName("Content")[0].getElementsByTagName("WalkDistance");
				}
				if(walkNode){
					stateNode = "TWO";
				}else{
					Results.m_aObj[flag].show("抱歉，没有找到可用的自驾方案");					
					Results.m_oHelpBox.setHelpMsg(0);
				}
			}			
			var outStr = "";
			switch(stateNode){
				case "ONE":
					//显示选择框
					var beginNode=null;
					var endNode=null;
					if(m_sUserAgent == "msie"){
						beginNode = xmlObj.selectSingleNode("root/Content/DriverSolution/Begin").childNodes;
						endNode = xmlObj.selectSingleNode("root/Content/DriverSolution/End").childNodes;
					}else if(m_sUserAgent == "firefox"){
						beginNode = xmlObj.firstChild.childNodes[1].firstChild.childNodes[0].childNodes;
						endNode = xmlObj.firstChild.childNodes[1].firstChild.childNodes[1].childNodes;
					}
					if(beginNode.length == 0){
						Results.show(flag,"<div style='padding:8px'><font color=red>对不起，查询不到您要的自驾方案</font><br><br><b>提示：</b>您输入的起点关键字查询不到相关信息，确认您选择了正确的城市或更换关键字进行查询</div>");
						return false;
					}
					if(endNode.length == 0){
						Results.show(flag,"<div style='padding:8px'><font color=red>对不起，查询不到您要的自驾方案</font><br><br><b>提示：</b>您输入的终点关键字查询不到相关信息，确认您选择了正确的城市或更换关键字进行查询</div>");
						return false;
					}
					outStr += "<div style='color:black;font-weight:bold;padding:5px;'>请选择起点：</div>";
					outStr += "<div id='begin_" + flag + "' class='selectCon'>";
					publicSelect.citycode[flag] = beginCity;
					publicSelect.searchType[flag] = 2;
					var bgname = "";
					var bgx = null;
					var bgy = null;
					var edname = "";
					var edx = null;
					var edy = null;
					for(var i=0;i<beginNode.length;i++){
						if(m_sUserAgent == "msie"){
							bgname = beginNode[i].selectSingleNode("Name").text;
							bgx = parseInt(beginNode[i].selectSingleNode("ScreenX").text);
							bgy = parseInt(beginNode[i].selectSingleNode("ScreenY").text);
						}else if(m_sUserAgent == "firefox"){
							bgname = Sarissa.getText(beginNode[i].childNodes[2]);
							bgx = parseInt(Sarissa.getText(beginNode[i].childNodes[0]));
							bgy = parseInt(Sarissa.getText(beginNode[i].childNodes[1]));
						}
						if(i == 0){
							publicSelect.bname[flag] = bgname;
							publicSelect.bx[flag] = bgx;
							publicSelect.by[flag] = bgy;
							outStr += "<div class='sFocus' onmouseover=\"publicSelect.mouseOver(1,'" + flag + "',this)\" onmouseout=\"publicSelect.mouseOut(1,'" + flag + "',this)\" onclick=\"publicSelect.onClick('" + flag + "',this,1,'" + bgname + "'," + bgx + "," + bgy + ")\">" + bgname + "</div>";
						}else{
							outStr += "<div class='sOut' onmouseover=\"publicSelect.mouseOver(1,'" + flag + "',this)\" onmouseout=\"publicSelect.mouseOut(1,'" + flag + "',this)\" onclick=\"publicSelect.onClick('" + flag + "',this,1,'" + bgname + "'," + bgx + "," + bgy + ")\">" + bgname + "</div>";
						}
					}
					outStr += "</div><div style='color:black;font-weight:bold;padding:5px;'>请选择终点：</div>";
					outStr += "<div id='end_" + flag + "' class='selectCon'>";
					for(var i=0;i<endNode.length;i++){
						if(m_sUserAgent == "msie"){
							edname = endNode[i].selectSingleNode("Name").text;
							edx = parseInt(endNode[i].selectSingleNode("ScreenX").text);
							edy = parseInt(endNode[i].selectSingleNode("ScreenY").text);
						}else if(m_sUserAgent == "firefox"){
							edname = Sarissa.getText(endNode[i].childNodes[2]);
							edx = parseInt(Sarissa.getText(endNode[i].childNodes[0]));
							edy = parseInt(Sarissa.getText(endNode[i].childNodes[1]));
						}
						if(i == 0){
							publicSelect.ename[flag] = edname;
							publicSelect.ex[flag] = edx;
							publicSelect.ey[flag] = edy;
							outStr += "<div class='sFocus' onmouseover=\"publicSelect.mouseOver(2,'" + flag + "',this)\" onmouseout=\"publicSelect.mouseOut(2,'" + flag + "',this)\" onclick=\"publicSelect.onClick('" + flag + "',this,2,'" + edname + "'," + edx + "," + edy + ")\">" + edname + "</div>";
						}else{
							outStr += "<div class='sOut' onmouseover=\"publicSelect.mouseOver(2,'" + flag + "',this)\" onmouseout=\"publicSelect.mouseOut(2,'" + flag + "',this)\" onclick=\"publicSelect.onClick('" + flag + "',this,2,'" + edname + "'," + edx + "," + edy + ")\">" + edname + "</div>";
						}
					}
					outStr += "</div><div style='width:100%;height:40px;padding-top:10px;text-align:right'><input type='button' value=' ' class='confirm_btn' onclick=\"publicSelect.commit('" + flag + "');\"></div>";
					//提交地图显示
					Results.show(flag,outStr);
					if(m_sUserAgent == "msie"){
						try{$("begin_" + flag).firstChild.fireEvent("onclick");}catch(e){}
						try{$("end_" + flag).firstChild.fireEvent("onclick");}catch(e){}
					}else if(m_sUserAgent == "firefox"){
						try{
							var evt = document.createEvent('MouseEvent');   
 							evt.initEvent('click',false,false);
							$("begin_" + flag).firstChild.dispatchEvent(evt);
						}catch(e){}
						try{
							var evt = document.createEvent('MouseEvent');   
 							evt.initEvent('click',false,false);
							$("end_" + flag).firstChild.dispatchEvent(evt);
						}catch(e){} 
					}
					outstr = null;
				break;
				case "TWO":
					var mySolution = new DriverSolution();
					var beginNode=null;
					var endNode=null;
					var walkDistance = null;
					var solutionNode=null;
					var totalLength = null;
					var smsStr = "";
					var smsUrl = "";
					with(mySolution){
						if(m_sUserAgent == "msie"){
							beginNode = xmlObj.selectSingleNode("root/Content/Begin");
							beginName = beginNode.text;
						}else if(m_sUserAgent == "firefox"){
							//beginNode = xmlObj.firstChild.childNodes[1].childNodes[1];
							//beginName = Sarissa.getText(beginNode);
							beginNode = xmlObj.getElementsByTagName("root")[0].getElementsByTagName("Content")[0].getElementsByTagName("Begin")[0];
												
						}						
						if(m_sUserAgent == "msie"){
							endNode = xmlObj.selectSingleNode("root/Content/End");
							endName = endNode.text;
						}else if(m_sUserAgent == "firefox"){
							endNode =  xmlObj.getElementsByTagName("root")[0].getElementsByTagName("Content")[0].getElementsByTagName("End")[0];											
						}									
						if(walkNode){
							beginName = beginNode.getAttribute("name");							
							beginScreenX = beginNode.getAttribute("x");							
							beginScreenY = beginNode.getAttribute("y");
							endName = endNode.getAttribute("name");
							endScreenX = endNode.getAttribute("x");
							endScreenY = endNode.getAttribute("y");
							var walkDirect = "";
							if(m_sUserAgent == "msie"){
								walkDirect = xmlObj.selectSingleNode("root/Content/Direction").text;
								walkDistance = walkNode.text;
								
							}else if(m_sUserAgent == "firefox"){
								walkDirect = xmlObj.getElementsByTagName("root")[0].getElementsByTagName("Content")[0].getElementsByTagName("Direction")[0].firstChild.nodeValue;
								walkDistance = walkNode[0].firstChild.nodeValue;
							}
							outStr += "<div style='padding:5px;padding-left:12px;cursor:pointer;' onclick=\"Results.m_aObj['" + flag + "'].m_oFocusScript.show(this)\">两点距离较近，建议您步行！<br>步行方案：从起点开始向"+walkDirect+"步行 <font color=red>"+walkDistance+"</font> 米即到终点</div>";
							smsStr += "两点距离较近，建议您步行！步行方案：从起点开始向"+walkDirect+"步行"+walkDistance+"米即到终点";
							isWalk = true;
							left = beginScreenX<endScreenX?beginScreenX:endScreenX;
							bottom = beginScreenY>endScreenY?beginScreenY:endScreenY;
							right = beginScreenX>endScreenX?beginScreenX:endScreenX;
							top = beginScreenY<endScreenY?beginScreenY:endScreenY;
							//提交地图显示
								Results.m_aObj[flag].setFocusScript(mySolution);
								Results.show(flag,outStr);
								try{
									if(m_sUserAgent == "msie"){
										Results.m_aObj[flag].container.firstChild.fireEvent("onclick");
									}else if(m_sUserAgent == "firefox"){
										var evt = document.createEvent('MouseEvent');   
										evt.initEvent('click',false,false);
										Results.m_aObj[flag].container.firstChild.dispatchEvent(evt);
									}
								}catch(e){};
						}else{
							beginName = beginNode.firstChild.nodeValue;	
							endName = endNode.firstChild.nodeValue;		
							beginScreenX = beginNode.getAttribute("screenX");
							beginScreenY = beginNode.getAttribute("screenY");
							endScreenX = endNode.getAttribute("screenX");
							endScreenY = endNode.getAttribute("screenY");		
							if(m_sUserAgent == "msie"){
								totalLength = xmlObj.selectSingleNode("root/Content/DriverSolution").getAttribute("Length");
							}else if(m_sUserAgent == "firefox"){
								totalLength = xmlObj.getElementsByTagName("root")[0].getElementsByTagName("Content")[0].getElementsByTagName("DriverSolution")[0].getAttribute("Length");
							}
							if(totalLength > 1000){totalLength = (parseInt(totalLength / 100)/10).toString() + "公里";}else{totalLength += "米";}
								outStr += "<div style='padding:5px;padding-left:12px;cursor:pointer;' class='info_normal_focus' onclick=\"Results.m_aObj['" + flag + "'].m_oFocusScript.show(this)\">点击显示全程线路(线路总长：" + totalLength + "）</div>";
							
							if(m_sUserAgent == "msie"){
								solutionNode = xmlObj.selectSingleNode("root/Content/Solution").childNodes;
							}else if(m_sUserAgent == "firefox"){
								solutionNode = xmlObj.getElementsByTagName("root")[0].getElementsByTagName("Content")[0].getElementsByTagName("Solution")[0].getElementsByTagName("Road");								
							}
							var nameNode = "";
							var direction = "";
							var distance = "";
							var actNode = "";
							var cross = "";
							for(var i=0;i<solutionNode.length;i++){
								solutions[i] = new Array();
								if(m_sUserAgent == "msie"){
									solutions[i]["path"] = solutionNode[i].selectSingleNode("Path").text;
									nameNode = solutionNode[i].selectSingleNode("Name").text;
									direction = solutionNode[i].selectSingleNode("Direction").text;
									distance = solutionNode[i].selectSingleNode("Distance").text;
									actNode = solutionNode[i].selectSingleNode("Action").text;
									cross = solutionNode[i].selectSingleNode("Crossing").text;
								}else if(m_sUserAgent == "firefox"){								
									solutions[i]["path"] = solutionNode[i].getElementsByTagName("Path")[0].firstChild.nodeValue;								
									nameNode = solutionNode[i].getElementsByTagName("Name")[0].firstChild.nodeValue;
									direction =solutionNode[i].getElementsByTagName("Direction")[0].firstChild.nodeValue;
									distance = solutionNode[i].getElementsByTagName("Distance")[0].firstChild.nodeValue;									
									cross = solutionNode[i].getElementsByTagName("Crossing")[0].firstChild.nodeValue;									
									if(solutionNode[i].getElementsByTagName("Action")[0].childNodes.length >0){									
									 	 actNode =solutionNode[i].getElementsByTagName("Action")[0].firstChild.nodeValue;
									}														
								}								
								var showImg = "";
								switch(actNode){
									case "向前直走":
										showImg = "go";
									break;
									case "左拐":
										showImg = "left";
									break;
									case "右拐":
										showImg = "right";
									break;
									case "调头":
										showImg = "reverse";
									break;
									default:
										showImg = "go";
									break;
								}
								
								outStr += "<div style='padding:5px;padding-left:12px;cursor:pointer;' class='info_normal_focus' onclick=\"Results.m_aObj['" + flag + "'].m_oFocusScript.show(this," + i + ")\"><img src='images/bmap/"+showImg+".gif' />";								
								if(solutionNode.length == 1){
									outStr += '<b>' + (i+1) + '</b>、从<b>起点</b>开始沿<b>'+nameNode+'</b>向' + direction + '方向行驶约<font color=red>' + distance + '</font>后到达终点。</div>';
									smsStr += (i+1) + "、从起点开始沿"+nameNode+"向" + direction + "方向行驶约" + distance + "后到达终点。";
								}else if(i == 0){
									outStr += '<b>' + (i+1) + '</b>、从<b>起点</b>开始沿<b>'+nameNode+'</b>向' + direction + '方向行驶约<font color=red>' + distance + '</font>到达<b>' + cross + '</b>的交叉口。</div>';
									smsStr += (i+1) + "、从起点开始沿"+nameNode+"向" + direction + "方向行驶约" + distance + "</font>到达" + cross + "的交叉口。";
								}else if((i+1) != solutionNode.length){
									outStr += '<b>' + (i+1) + '</b>、在该交叉口<b>'+actNode.replace("向前直走","直行")+'</b>，沿<b>'+nameNode+'</b>向' + direction + '方向行驶约<font color=red>' + distance + '</font><b>' + cross + '</b>的交叉口。</div>';
									smsStr += (i+1) + '、在该交叉口'+actNode.replace("向前直走","直行")+'，沿<b>'+nameNode+'向' + direction + '方向行驶约' + distance + cross + '的交叉口。';
								}else{
									outStr += '<b>' + (i+1) + '</b>、在该交叉口<b>'+actNode.replace("向前直走","直行")+'</b>，沿<b>'+nameNode+'</b>向' + direction + '方向行驶约<font color=red>' + distance + '</font>后到达<b>终点。</font></div>';
									smsStr += (i+1) + '、在该交叉口'+actNode.replace("向前直走","直行")+'，沿<b>'+nameNode+'向' + direction + '方向行驶约' + distance + '后到达终点。';
								}								
								smsUrl = encodeURI(smsBase+smsStr);
								outStr += "<div style='padding:5px;padding-left:12px;'><a href='javascript:void(0);' onClick=\"window.showModalDialog('"+smsUrl+"', '','"+dialogArgument+"')\"></a></div>";
								
								//提交地图显示
								Results.m_aObj[flag].setFocusScript(mySolution);
								Results.show(flag,outStr);
								try{
									if(m_sUserAgent == "msie"){
										Results.m_aObj[flag].container.firstChild.fireEvent("onclick");
									}else if(m_sUserAgent == "firefox"){
										var evt = document.createEvent('MouseEvent');   
										evt.initEvent('click',false,false);
										Results.m_aObj[flag].container.firstChild.dispatchEvent(evt);
									}
								}catch(e){};
							}
						}						
					};					
				break;
				default:
				return;
				break;
			}
		}
	};
	xmlObj.load(sUrl);
};
/*
	开始周边查询
*/
function startAroundSearch(cname,cx,cy,dis,key,cityCode,sUrl,pageno,flag,typecode){
	//sData_aroundSearch="search?act=around&format=true&key=?key?&skey=?skey?&citycode=?citycode?&x=?x?&y=?y?&dis=?dis?&pagecount=?pagecount?&pageno=?pageno?";
	if(sUrl == null){
		//得到标志
		var flag = getRandFlag();
		if(!Results.getObj(flag,cname,cityCode,"周边查询"))return false;
		sUrl = sData_basePath + sData_aroundSearch;
		sUrl = sUrl.replace("?key?",key);
		sUrl = sUrl.replace("?skey?",cname);
		sUrl = sUrl.replace("?citycode?",cityCode);
		sUrl = sUrl.replace("?l?",0);
		sUrl = sUrl.replace("?b?",0);
		sUrl = sUrl.replace("?r?",0);
		sUrl = sUrl.replace("?t?",0);
		sUrl = sUrl.replace("?x?",cx);
		sUrl = sUrl.replace("?y?",cy);
		sUrl = sUrl.replace("?dis?",dis);
		sUrl = sUrl.replace("?pagecount?","10");
		sUrl = sUrl.replace("?pageno?","");
		if(typeof typecode == "undefined"){
			typecode ="";
		}
		sUrl = sUrl.replace("?typecode?",typecode);		
		pageno = 1;
	}else{
		//清空之前容器内的内容
		Results.show(flag,"读取信息...");
	}
	//开始异步查询
	var xmlObj = Sarissa.getDomDocument();
	xmlObj.async = true;
	xmlObj.onreadystatechange = function(){
		if(xmlObj.readyState == 4){
			if(xmlObj.parseError!=0){
				Results.m_aObj[flag].show("xml载入错误！错误描述:\r\n"+Sarissa.getParseErrorText(xmlObj));
				return false;
			}
			try{
				var testNode = "";
				if(m_sUserAgent == "msie"){
					testNode = xmlObj.selectSingleNode("root/Return").text;
				}else if(m_sUserAgent == "firefox"){
					testNode = Sarissa.getText(xmlObj.firstChild.firstChild,true);
				}
				if(testNode == "0"){
					Results.show(flag,"<div style='padding:8px'><font color=red>对不起，在“"+cname+"”周围"+dis+"米内查询不到“"+key+"”相关的信息</font><br><br><b>提示：</b>您可以扩大范围进行查询，或者更换周边关键字进行重新查询</div>");
					//Results.m_aObj[flag].show(xmlDocArr[sFlag].selectSingleNodes("root/Error").text);
					return false;
				}
			}catch(e){
				return false;
			}
			var myAroundObj = new AroundSolution();
			//解析数据
			var rootNode = null;
			var myNode = null;
			if(m_sUserAgent == "msie"){
				rootNode = xmlObj.selectSingleNode("root/Content");
				myAroundObj.centerName  = rootNode.selectSingleNode("CenterName").text;	//中心点名称
				myAroundObj.centerX = rootNode.selectSingleNode("CenterScreenX").text;		//中心点加密经度
				myAroundObj.centerY = rootNode.selectSingleNode("CenterScreenY").text;		//中心点加密纬度
				myAroundObj.distance = rootNode.selectSingleNode("Distance").text;		//查询的周边距离
				//myAroundObj.poiList = new POIList();	//查询后得到的周边名址列表对象（POIList对象）
				myNode = xmlObj.selectSingleNode("root/Content/Companies").childNodes;
			}else if(m_sUserAgent == "firefox"){
				rootNode = xmlObj.firstChild.childNodes[1];
				myAroundObj.centerName  = Sarissa.getText(rootNode.childNodes[0]);	//中心点名称
				myAroundObj.centerX = Sarissa.getText(rootNode.childNodes[1]);		//中心点加密经度
				myAroundObj.centerY = Sarissa.getText(rootNode.childNodes[2]);		//中心点加密纬度
				myAroundObj.distance = Sarissa.getText(rootNode.childNodes[3]);		//查询的周边距离
				//myAroundObj.poiList = new POIList();	//查询后得到的周边名址列表对象（POIList对象）
				myNode = rootNode.childNodes[6].childNodes;
			}
			var j=0;
			var outStr = "";
			var dwkey = "";
			var x = null;
			var y = null;			
			for(var i=0;i<myNode.length;i++){
				if(m_sUserAgent == "msie"){
					dwkey = myNode[i].selectSingleNode("DwKey").text;
					x = parseInt(myNode[i].selectSingleNode("ScreenX").text);
					y = parseInt(myNode[i].selectSingleNode("ScreenY").text);
					if(POIHashTable[dwkey] == null){
						POIHashTable[dwkey] = new POI();
						with(POIHashTable[dwkey]){
							id = dwkey;
							citycode = cityCode;
							province = myNode[i].selectSingleNode("Province").text;
							city = myNode[i].selectSingleNode("City").text;
							county = myNode[i].selectSingleNode("County").text;
							isVipUser = myNode[i].selectSingleNode("VipUser").text;
							screenX = x;
							screenY = y;
							name = myNode[i].selectSingleNode("Name").text;
							displayName = myNode[i].selectSingleNode("DisplayName").text;
							address = myNode[i].selectSingleNode("Address").text;
							relateLink = myNode[i].selectSingleNode("WebSite").text;
							phone = myNode[i].selectSingleNode("Phone").text;
						}
					}
				}else if(m_sUserAgent == "firefox"){
					dwkey = Sarissa.getText(myNode[i].childNodes[0]);
					x = parseInt(Sarissa.getText(myNode[i].childNodes[5]));
					y = parseInt(Sarissa.getText(myNode[i].childNodes[6]));
					if(POIHashTable[dwkey] == null){
						POIHashTable[dwkey] = new POI();
						with(POIHashTable[dwkey]){
							id = dwkey;
							citycode = cityCode;
							province = Sarissa.getText(myNode[i].childNodes[2]);
							city = Sarissa.getText(myNode[i].childNodes[3]);
							county = Sarissa.getText(myNode[i].childNodes[4]);
							isVipUser = Sarissa.getText(myNode[i].childNodes[1]);
							screenX = x;
							screenY = y;
							name = Sarissa.getText(myNode[i].childNodes[7]);
							displayName = Sarissa.getText(myNode[i].childNodes[8]);
							address = Sarissa.getText(myNode[i].childNodes[9]);
							relateLink = Sarissa.getText(myNode[i].childNodes[11])
							phone = Sarissa.getText(myNode[i].childNodes[10]);
						}
					}
				}
				outStr = outStr + "<div style='width:100%;padding:3px;cursor:pointer;border-top:dotted 1px #8CC3DE' onclick=\"POIHashTable['" + dwkey + "'].show(this)\"><div style='width:100% ;color:#1886CE;' >" + (i+1).toString() + "、" + POIHashTable[dwkey].displayName + "</div>";
				if(POIHashTable[dwkey].address != ""){
					outStr = outStr + "<div style='width:100%'>地址：" + POIHashTable[dwkey].address + "</div>";
				}
				if(POIHashTable[dwkey].phone != ""){
					outStr = outStr + "<div style='width:100%'>电话：" + POIHashTable[dwkey].phone + "</div>";
				}
				outStr = outStr + "</div>";
				//判定MBR
				if(i==0){
					myAroundObj.poiList.left = x;
					myAroundObj.poiList.bottom = y;
					myAroundObj.poiList.right = x;
					myAroundObj.poiList.top = y;
				}else{
					if(myAroundObj.poiList.left>x)myAroundObj.poiList.left = x;
					if(myAroundObj.poiList.bottom<y)myAroundObj.poiList.bottom = y;
					if(myAroundObj.poiList.right<x)myAroundObj.poiList.right = x;
					if(myAroundObj.poiList.top>y)myAroundObj.poiList.top = y;
				}
				//加入列表
				if(myAroundObj.poiList.xyList[x + "_" + y]==null){
					myAroundObj.poiList.poiList[j] = new Array();
					myAroundObj.poiList.xyList[x + "_" + y] = j;
					j++;
				}
				myAroundObj.poiList.poiShowNum[dwkey] = i+1;		//保存列表的位置
				myAroundObj.poiList.poiList[myAroundObj.poiList.xyList[x + "_" + y]].push(dwkey);
			}
			//提交地图显示
			Results.m_aObj[flag].setFocusScript(myAroundObj);
			Results.show(flag,outStr);
			outstr = null;
			var tcount = 0;
			if(m_sUserAgent == "msie"){
				tcount = xmlObj.selectSingleNode("root/Content/Companies").getAttribute("totalCount");
			}else if(m_sUserAgent == "firefox"){
				tcount = xmlObj.firstChild.childNodes[1].childNodes[2].getAttribute("totalCount");
			}
			//显示分页
			
			creatPage("showPage_" + flag,10,sUrl,flag,parseInt(tcount),"startAroundSearch('','','','','','',","",1,"");
		}
	};
	xmlObj.load(encodeURI(sUrl + pageno));
}

