/*
*	本脚本使用于richmap5.0大地图搜索页
*	本脚本必须被混淆后才能提供使用
*	编码：utf-8
*	create date:2007.05.23 laoding
*	update record:	user	date	memo
*/
//	后台数据源全局变量定义
var img_url="";
var phone_url="";
var basePath = "";
var sData_basePath = "search?";
var sData_local = "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 = "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 = "act=bus2&citycode=?citycode?&begin=?begin?&end=?end?&beginx=?beginx?&beginy=?beginy?&endx=?endx?&endy=?endy?&run=?run?&arg=?arg?";
var sData_driver = "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 = "act=driver_step1&citycode1=?citycode1?&citycode2=?citycode2?&begin=?begin?&end=?end?&beginx=?beginx?&beginy=?beginy?&endx=?endx?&endy=?endy?";
var sData_driver_step2 = "act=driver_step2&begin=?begin?&end=?end?&beginx=?beginx?&beginy=?beginy?&endx=?endx?&endy=?endy?&option=?option?";
var sData_aroundSearch = "act=around&format=true&key=?key?&skey=?skey?&citycode=?citycode?&x=?x?&y=?y?&dis=?dis?&pagecount=?pagecount?&pageno=?pageno?";
var sData_busStop = "act=stops&format=true&key=?key?&citycode=?citycode?&count=?count?&run=?run?&arg=?arg?";
var sData_busStopId = "act=stopbyid&key=?key?";
var sData_busLine = "act=lines&citycode=?citycode?&key=?key?";
var sData_hotKey_bak = "act=LATELYKW&count=10&citycode=?citycode?";
var sData_hotKey = "act=gethot&size=20&zone=?citycode?";
var sData_namecard = "act=CARDINFO&poiid=?poiid?&csize=?csize?&psize=?psize?";
var sData_keyword = "act=kwcard&citycode=?citycode?&key=?key?&isnewquery=?isnewquery?&pagecount=?pagecount?&pageno=?pageno?";
var sData_poi = "act=searchpoi&dwkey=?dwkey?";

//页面设置相关参数
var _pageW = 0;		//页面总长度
var _pageH = 0;		//页面总高度
var _pageMinW = 500;	//页面最小长度
var _pageMinH = 400;	//页面最小高度
var _topH = 35 + 60 + 20 + 2;		//头部高度
var _bottomH = 0;	//底部部分的高度
var _resultW = 250;	//结果容器的总长
var _closeW = 8;	//关闭按钮的宽
var _mapW = 0;		//地图窗口的宽
var _resultTitH = 29;	//结果框上部的标题高度
var _resultConH = 0;	//结果子容器内的容器高度
var _resultBotH = 29;	//结果容器底部信息容器高度
var _searchBoxLeft = 500;	//商业关键字搜索框的位置
var _searchBoxStatus = true;	//设置商业关键字搜索框默认是放大状态
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 myMoveObj = null;
var richmap = null;	//声明地图引擎对象
var nowFocusIndex = 0;	//声明当前tab页聚焦的对象在其父节点中的索引位置
var citycode = "FJFZ";	//全局城市变量
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 init(){
	resetAllSize();
	citycode = getById("page_citycode").value;
	//福州五区八县的城市代码
	if(citycode=="FJFZ-GL" || citycode=="FJFZ-JA" || citycode=="FJFZ-TJ" || citycode=="FJFZ-MW" || citycode=="FJFZ-CS" ){
		citycode="FJFZ";
	}
	richmap = new RWing(getById("mapContainer"));
	richmap.showStop(true);
	richmap.showEagle(true);
	//richmap.showNoteBtn(true);
	richmap.showDirection(false);
	richmap.addEventListener("onsuccess","loadSuccess");
	richmap.addEventListener("onmark","markreturns.show");
	//richmap.addEventListener("onStopClick","onStopClick");
	//richmap.addEventListener("onbussearchstart","mybussearch");
	//richmap.addEventListener("ondriversearchstart","startDriverSearch");
	//richmap.addEventListener("onaroundsearchstart","myaroundsearch");
	richmap.init();
	getHotKey(citycode);	//显示热点关键字
	Results.init();		//初始化结果容器对象
	Results.close();	//默认关闭状态
	myMoveObj = new moveObj();
	et_loaded();	//输入框的默认值绑定
	//getAddress();
	if(!checkUserEnvironment())return false;
};
function mybussearch(begin,end,beginx,endx,beginy,endy,citycode){
	startBusSearch(sData_bus_step1,begin,end,beginx,endx,beginy,endy,citycode);
}
function myaroundsearch(centerName,centerx,centery,typekey,searchDis,citycode){
	startAroundSearch(centerName,centerx,centery,searchDis,typekey,citycode);
}
/*
*	根据页面的当前长度和高度重新调整所有需要调整的层的位置和大小
*/
function resetAllSize(act){
	_pageW = document.body.clientWidth;
	_pageH = document.body.clientHeight;
	if(_pageW<_pageMinW)_pageW = _pageMinW;
	if(_pageH <_pageMinH)_pageH = _pageMinH;
	if(Results.m_bIsClose){
		_mapW = _pageW - 2 - _closeW;	//得到地图的长度
	}else{
		_mapW = _pageW - _resultW - _closeW;	//得到地图的长度
	}
	_bottomH = _pageH - _topH;	//得到下面部分的框架高
	//设置地图容器的大小
	var mapContainer = getById("mapContainer");
	mapContainer.style.width = _mapW - 3;
	mapContainer.style.height = _bottomH - 3;
	if(act){richmap.resizeMap(_mapW - 3,_bottomH - 3);}
	//设置底部总容器的大小
	getById("part4").style.height = _bottomH;
	getById("closeCon").style.height = _bottomH;
	//设置关闭按钮的位置
	getById("closeBtn").style.top = _bottomH*0.5 - 40;
	//设置结果子容器的高度
	_resultConH = _bottomH - _resultTitH - _resultBotH;
	getById("resultCon").style.height = _resultConH;
	//设置结果底部信息容器位置
	getById("resultBot").style.top = _resultConH + _resultTitH;
	//if(!tpapi_load){getById("mainMenu").style.left = _pageW - 820;}
	//设置商业关键字结果框位置
	setSearchBoxPosition();
}
var markreturns = new function(){
	this.show = markReturn1;
};
window.onresize = function(){resetAllSize(true);};
//地图载入完成
function loadSuccess(){
	richmap.addEventListener("onerror","myerror")
	richmap.showCity(citycode);
	checkLoadData();
}
function myerror(errstr){
	//alert(errstr);	
}
//选项卡的切换动作
function changeMainSearch(nIndex){
	if(nowFocusIndex == nIndex)return true;
	var searchConObj = getById("searchCon");
	var searchStrObj = getById("searchStr");
	if(m_sUserAgent == "msie"){
		searchConObj.children[nowFocusIndex].className = "tabTitle_blur_" + (nowFocusIndex + 1);
		searchStrObj.children[nowFocusIndex].style.display = "none";
	}else if (m_sUserAgent == "firefox"){
		checkChild(searchConObj.childNodes,nowFocusIndex).setAttribute("class","tabTitle_blur_" + (nowFocusIndex + 1));
		checkChild(searchStrObj.childNodes,nowFocusIndex).style.display = "none";
	}
	if(m_sUserAgent == "msie"){
		searchConObj.children[nIndex].className = "tabTitle_focus";
		searchStrObj.children[nIndex].style.display = "";
	}else if (m_sUserAgent == "firefox"){
		checkChild(searchConObj.childNodes,nIndex).setAttribute("class","tabTitle_focus");
		checkChild(searchStrObj.childNodes,nIndex).style.display = "";
	}
	nowFocusIndex = nIndex;
	return true;
}
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++;
		}
	}
}
//判断是否有外部参数传入并进行查询
function checkLoadData(){
	key_load = key_load.trim();
	switch(act_load){
		case "local":	//本地查询
			if(key_load != "" && key_load !="null"){
				getById("localkey").value = key_load;
				getById("localkey").style.color="#000000";
				startSearch(0);
			}else{
				return false;	
			}
		break;
		case "line":	//线路查询
			if(key_load != "" && key_load !="null"){
				changeMainSearch(2);
				getById("lineKey").value = key_load;
				getById("lineKey").style.color="#000000";
				startSearch(2);
			}else{
				return false;	
			}
		break;
		case "stop":	//站点查询
			if(key_load != "" && key_load !="null"){
				changeMainSearch(3);
				getById("stopKey").value = key_load;
				getById("stopKey").style.color="#000000";
				startSearch(3);
			}else{
				return false;	
			}
		break;
		case "bus":		//公交换乘
			if(begin_load != "" && end_load != "" && begin_load != "null" && end_load != "null"){
				changeMainSearch(1);
				getById("busBegin").value = begin_load;
				getById("busBegin").style.color="#000000";
				getById("busEnd").value = end_load;
				getById("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 = "";
				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"){
				changeMainSearch(4);
				getById("driverBegin").value = begin_load;
				getById("driverEnd").value = end_load;
				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);
				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;
					startAroundSearch(key_load,centerx_load,centery_load,dis_load,typekey_load,citycode);
				}catch(e){return false;}
			}
		case "card":	//根据名片的所属POI的id来定位该名片
			POIHashTable[cardId_load] = new POI();
			POIHashTable[cardId_load].id = cardId_load;
			POIHashTable[cardId_load].isVipUser = "true";
			POIHashTable[cardId_load].citycode = citycode;
			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{
				//否则针对名称进行全文检索
					getById("localkey").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 = "";
	minSearchBox();	//如果之前有显示，最小化商业关键字
	//var xmlObj = null;
	switch(act){
		case 0:		//本地查询
			keyObj = getById("localkey");
			//keyObj.value = clearKey(keyObj.value);
			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("?pageno?","");
			sUrl = sUrl.replace("?l?","0");
			sUrl = sUrl.replace("?b?","0");
			sUrl = sUrl.replace("?r?","0");
			sUrl = sUrl.replace("?t?","0");
			sUrl = sUrl.replace("?x?","0");
			sUrl = sUrl.replace("?y?","0");
			sUrl = sUrl.replace("?typecode?","");
			//alert(sData_basePath);
			getLocalData(sData_basePath + sUrl,1,flag,citycode);
			//进行商业关键字查询
			//sUrl = sData_keyword;
			//sUrl = sUrl.replace("?citycode?",citycode);
			//sUrl = sUrl.replace("?key?",keyObj.value);
			//sUrl = sUrl.replace("?isnewquery?","Y");
			//sUrl = sUrl.replace("?pagecount?","10");
			//sUrl = sUrl.replace("?pageno?","");
			//getKeyData(sData_basePath + sUrl,1,citycode);
			return;
			break;
		case 1:		//公交换乘
			keyObj = getById("busBegin");
			keyObj.value = clearKey(keyObj.value).trim();
			if(keyObj.value == ""){alert("请输入公交换乘起点");keyObj.focus();return false;}
			keyObj1 = getById("busEnd");
			keyObj1.value = clearKey(keyObj1.value).trim();
			if(keyObj1.value == ""){alert("请输入公交换乘终点");keyObj1.focus();return false;}
			//进入查询
			startBusSearch(sData_bus_step1,keyObj.value,keyObj1.value,"","","","",citycode);
			break;
		case 2:		//公交线路
			keyObj = getById("lineKey");
			keyObj.value = clearKey(keyObj.value).trim();
			if(keyObj.value == ""){alert("请输入公交线路关键字，如：20路");keyObj.focus();return false;}
			//进入查询
			startLineSearch(keyObj.value,citycode);
			break;
		case 3:		//公交站点
			if(keyvalue != null && oldflag != null){
				setCityCode(Results.m_aObj[oldflag].citycode);
			}else{
				keyObj = getById("stopKey");
				keyObj.value = clearKey(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");
			//alert(sData_basePath + sUrl);
			//进入查询
			getStopData(sData_basePath + sUrl,flag,citycode);
			break;
		case 4:		//自驾方案
			keyObj = getById("driverBegin");
			keyObj.value = clearKey(keyObj.value).trim();
			if(keyObj.value == ""){alert("请输入自驾方案起点");keyObj.focus();return false;}
			keyObj1 = getById("driverEnd");
			keyObj1.value = clearKey(keyObj1.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 setCityCode(code){
	citycode = code;
}
/*
*	本地查询
*	@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'>"+getById('localkey').value+"</font>”相符的信息。<br>"
				+"<br><b>猎图建议您：</b><br/><li>看看输入的文字是否有误</li><li>检查是否选择了正确的城市</li>"
				+"<li>在公交线路中查询“<span style='color:blue;cursor:pointer;' onClick='changeMainSearch(2);getById(\"lineKey\").value=\""+getById('localkey').value+"\";getById(\"lineKey\").style.color=\"#000000\";startSearch(2);'>"+getById('localkey').value+"</span>”</li>"
				+"<li>在公交站点中查询“<span style='color:blue;cursor:pointer;' onClick='changeMainSearch(3);getById(\"stopKey\").value=\""+getById('localkey').value+"\";getById(\"stopKey\").style.color=\"#000000\";startSearch(3);'>"+getById('localkey').value+"</span>”</li>"
				+"<li>请换用其它的查询字词</li></div>";
	//清空之前容器内的内容
	//Results.show(flag,"读取信息...");
	//开始异步查询
	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(errorStr);
				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);
				return false;
			}
			//解析数据
			var myNode = null;
			if(m_sUserAgent == "msie"){
				myNode = xmlObj.selectSingleNode("root/Content/Companies").childNodes;
			}else if(m_sUserAgent == "firefox"){
				myNode = xmlObj.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[1]);
			}
			var j=0;
			var outStr = "<div style='width:100%;height:26px;padding:3px;background-image:url(images/map/showAll_bg.jpg);'>查询用时："+elapsedSeconds+"秒　<a href='javascript:void(0);' onClick='POIListHashTable[\""+flag+"\"].toMap()' style='color:red;font-weight:bold'><image src='images/wmap_map/showAll.jpg' border='0'></a></div>";
			var dwkey = "";
			var priority = "";
			var x = "";
			var y = "";
			var startdwkey=''
			for(var i=0;i<myNode.length;i++){
				if(m_sUserAgent == "msie"){
					dwkey = myNode[i].selectSingleNode("DwKey").text;
					priority = myNode[i].getAttribute("priority");
					x = parseInt(myNode[i].selectSingleNode("ScreenX").text);
					y = parseInt(myNode[i].selectSingleNode("ScreenY").text);
					if(POIHashTable[dwkey] == null){
						POIHashTable[dwkey] = new POI();
						POIHashTable[dwkey].id = dwkey;
						POIHashTable[dwkey].citycode = cityCode;
						POIHashTable[dwkey].province = myNode[i].selectSingleNode("Province").text;
						POIHashTable[dwkey].city = myNode[i].selectSingleNode("City").text;
						POIHashTable[dwkey].county = myNode[i].selectSingleNode("County").text;
						POIHashTable[dwkey].isVipUser = myNode[i].selectSingleNode("VipUser").text;
						if(priority){POIHashTable[dwkey].isVipUser = "true";}
						POIHashTable[dwkey].screenX = x;
						POIHashTable[dwkey].screenY = y;
						POIHashTable[dwkey].name = myNode[i].selectSingleNode("Name").text;
						POIHashTable[dwkey].displayName = myNode[i].selectSingleNode("DisplayName").text;
						POIHashTable[dwkey].address = myNode[i].selectSingleNode("Address").text;
						POIHashTable[dwkey].relateLink = myNode[i].selectSingleNode("WebSite").text;
						POIHashTable[dwkey].phone = myNode[i].selectSingleNode("Phone").text;
					}else{
						POIHashTable[dwkey].displayName = myNode[i].selectSingleNode("DisplayName").text;
						POIHashTable[dwkey].address = myNode[i].selectSingleNode("Address").text;
					}
				}else if(m_sUserAgent == "firefox"){
					dwkey = Sarissa.getText(myNode[i].childNodes[0]);
					priority = myNode[i].getAttribute("priority");
					x = parseInt(Sarissa.getText(myNode[i].childNodes[5]));
					y = parseInt(Sarissa.getText(myNode[i].childNodes[6]));
					if(POIHashTable[dwkey] == null){
						POIHashTable[dwkey] = new POI();
						POIHashTable[dwkey].id = dwkey;
						POIHashTable[dwkey].citycode = cityCode;
						POIHashTable[dwkey].province = Sarissa.getText(myNode[i].childNodes[2]);
						POIHashTable[dwkey].city = Sarissa.getText(myNode[i].childNodes[3]);
						POIHashTable[dwkey].county = Sarissa.getText(myNode[i].childNodes[4]);
						POIHashTable[dwkey].isVipUser = Sarissa.getText(myNode[i].childNodes[1]);
						if(priority){POIHashTable[dwkey].isVipUser = "true";}
						POIHashTable[dwkey].screenX = x;
						POIHashTable[dwkey].screenY = y;
						POIHashTable[dwkey].name = Sarissa.getText(myNode[i].childNodes[7]);
						POIHashTable[dwkey].displayName = Sarissa.getText(myNode[i].childNodes[8]);
						POIHashTable[dwkey].address = Sarissa.getText(myNode[i].childNodes[9]);
						POIHashTable[dwkey].relateLink = Sarissa.getText(myNode[i].childNodes[11]);
						POIHashTable[dwkey].phone = Sarissa.getText(myNode[i].childNodes[10]);
					}else{
						POIHashTable[dwkey].displayName = Sarissa.getText(myNode[i].childNodes[9]);
						POIHashTable[dwkey].address = Sarissa.getText(myNode[i].childNodes[10]);
					}
				}
				//if(i==0){
						//startdwkey=dwkey
						//POIHashTable[dwkey].show();
				//}
				
				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);
			}
			//提交地图显示
			Results.m_aObj[flag].setFocusScript(POIListHashTable[flag]);
			Results.show(flag,outStr);
			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[2].getAttribute("totalCount");
			}
			creatPage("showPage_" + flag,10,sUrl,flag,parseInt(tcount),"getLocalData(","",1);
		};
	};
	//alert(encodeURI(sUrl+pageno));
	xmlObj.load(encodeURI(sUrl+pageno));
}
function getKeyData(sUrl,pageno,cityCode){
	//开始异步查询
	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;
			}
			if(m_sUserAgent == "msie"){
				var totalCount = parseInt(xmlObj.selectSingleNode("root/Content/NameCards").getAttribute("totalCount"));
				var pageNo = parseInt(xmlObj.selectSingleNode("root/Content/NameCards").getAttribute("pageNo"));
				var pageSize = parseInt(xmlObj.selectSingleNode("root/Content/NameCards").getAttribute("pageSize"));
				var myNode = xmlObj.selectSingleNode("root/Content/NameCards").childNodes;
			}else if(m_sUserAgent == "firefox"){
			}
			//组织显示内容
			var outStr = "";
			for(var i=0;i<myNode.length;i++){
				var dwkey = myNode[i].selectSingleNode("DwKey").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 = "true";
						screenX = myNode[i].selectSingleNode("ScreenX").text;
						screenY = myNode[i].selectSingleNode("ScreenY").text;
						name = myNode[i].selectSingleNode("Title").text;
						displayName = myNode[i].selectSingleNode("Title").text;
						address = myNode[i].selectSingleNode("Address").text;
						relateLink = "";
						phone = myNode[i].selectSingleNode("Phone").text;
					}
				}else{
					POIHashTable[dwkey].displayName = myNode[i].selectSingleNode("Title").text;
					POIHashTable[dwkey].address = myNode[i].selectSingleNode("Address").text;
				}
				outStr += '<div style="cursor:pointer;padding:2px;width:100%;" onmouseover="this.style.backgroundColor=\'#eeeeee\'" onmouseout="this.style.backgroundColor=\'\'" onclick="minSearchBox();POIHashTable[\''+dwkey+'\'].show()">' + (i+1+(pageNo-1)*10) + '、' + POIHashTable[dwkey].displayName + '</div>';
			}
			if(totalCount>pageSize){
				outStr += '<div id="keywordPage" style="width:100%;padding:2px;padding-right:8px;text-align:right;border-top:dashed 1px #cccccc;">推荐商家</div>';
			}
			//显示内容
			openSearchBox();
			//getById("keywordSearch").style.display = "";
			getById("keywordResult").innerHTML = outStr;
			//显示分页
			if(totalCount>pageSize){
				creatPage("keywordPage",10,sUrl.replace("isnewquery=Y","isnewquery=N"),"keywordPage",totalCount,"getKeyData(","",1);
			}
		}
	};
	xmlObj.load(encodeURI(sUrl + pageno));
};
function setSearchBoxPosition(){
	_searchBoxLeft = _pageW - 15 - (_searchBoxStatus?250:150);
	getById("keywordSearch").style.left = _searchBoxLeft;
}
function closeSearchBox(){
	getById("keywordSearch").style.display = "none";
	return true;
}
function minSearchBox(){
	_searchBoxStatus = false;
	setSearchBoxPosition();
	getById("keywordTit").style.borderBottom = "solid 1px #7BBACE";
	getById("keywordResult").style.display = "none";
	getById("keywordSearch").style.width = "100px";
}
function openSearchBox(act){
	if(act && _searchBoxStatus == true){
		minSearchBox();
		return;
	}
	getById("keywordSearch").style.display = "";
	getById("keywordResult").style.display = "";
	getById("keywordTit").style.borderBottom = "0px";
	_searchBoxStatus = true;
	setSearchBoxPosition();
	getById("keywordSearch").style.width = "250px";
}
/*
*	公交站点查询
*/
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 = "";
				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"){
					var errorStr = "<div style='font-size:14px;line-height:20px;padding:5px;'>抱歉，没有找到和您查询的“<font color=#ff0000>"+getById("stopKey").value+"</font>”相符的站点信息。<br>"
									+"<br><b>猎图建议您：</b></br><li>看看输入的文字是否有误</li><li>检查是否选择了正确的城市</li><li>请换用其他的查询字词</li></div>";
					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 = "";
			if(m_sUserAgent == "msie"){
				stateNode = xmlObj.selectSingleNode("root/Content/StopQuery").getAttribute("state");
			}else if(m_sUserAgent == "firefox"){
				stateNode = xmlObj.firstChild.childNodes[1].firstChild.getAttribute("state");
			}
			var outStr = "";	//定义向结果框输出的文字结果信息
			var smsStr = "";
			var smsUrl = "";
			switch(stateNode){
				case "ONE":		//没有匹配到公交站点，进行名址查询后再查这些名址周边500米范围内的公交站点
					var myNode = null;
					if(m_sUserAgent == "msie"){
						myNode = xmlObj.selectSingleNode("root/Content/StopQuery").childNodes;
					}else if(m_sUserAgent == "firefox"){
						myNode = xmlObj.firstChild.childNodes[1].firstChild.childNodes;
					}
					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++){
							if(m_sUserAgent == "msie"){
								stopText = stopNode[k].text;
							}else if(m_sUserAgent == "firefox"){
								stopText = Sarissa.getText(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);
					break;
				case "TWO":		//标准的公交站点
					//alert(xmlObj.xml);
					var myNode = null;
					if(m_sUserAgent == "msie"){
						myNode = xmlObj.selectSingleNode("root/Content/StopQuery").childNodes;
					}else if(m_sUserAgent == "firefox"){
						myNode = xmlObj.firstChild.childNodes[1].firstChild.childNodes;
					}
					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);
					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 startLineSearch(linename,cityCode){
	//得到标志
	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);
}
var HotKeyZoneStr = new Array();
function getHotKey(zone){
	if(HotKeyZoneStr[zone] != null){
		getById("hotKeyCon").innerHTML = HotKeyZoneStr[zone];
	}else{
		var sUrl = sData_basePath + sData_hotKey;
		sUrl = sUrl.replace("?citycode?",citycode);
		//开始异步查询
		var xmlObj = Sarissa.getDomDocument();
		xmlObj.async = true;
		xmlObj.onreadystatechange = function(){
			if(xmlObj.readyState == 4){
				if(xmlObj.parseError!=0){
					//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"){
						return false;
					}
				}catch(e){
					return false;
				}
				//解析数据
				//alert(Sarissa.serialize(xmlObj));
				HotKeyZoneStr[zone] = "";
				var searchUrl = "";
				var myNode = null;
				var showI = 0;
				if(m_sUserAgent == "msie"){					
					myNode = xmlObj.selectSingleNode("root/Content/Keywords").childNodes;
					for(var i=0;i<myNode.length;i++){
						if(showI > 8 || myNode[i].text.length>6)continue;
						showI ++;
						//searchUrl = encodeURI(basePath+"map.jsp?act=local&key="+myNode[i].text+"&citycode="+citycode);
						HotKeyZoneStr[zone] += "　<a href='javascript:void(0);' onclick=\"singleLocalSearch('" + myNode[i].text + "')\">" + myNode[i].text + "</a>";
					};
				}else if(m_sUserAgent == "firefox"){
					myNode = xmlObj.firstChild.childNodes[1].firstChild.childNodes;
					for(var i=0;i<myNode.length;i++){
						if(showI > 8 || myNode[i].text.length>6)continue;
						showI ++;
						//searchUrl = encodeURI(basePath+"map.jsp?act=local&key="+myNode[i].text+"&citycode="+citycode);
						HotKeyZoneStr[zone] += "　<a href='javascript:void(0);' onclick=\"singleLocalSearch('" + Sarissa.getText(myNode[i]) + "')\">" + Sarissa.getText(myNode[i]) + "</a>";
					};
				}
				getById("hotKeyCon").innerHTML = HotKeyZoneStr[zone];
			}
		};
		xmlObj.load(sUrl);
	}
};
function singleLocalSearch(key){
	getById("localkey").value = key;
	startSearch(0);
};
/*
*	公交线路查询
*/
function getLineData(sUrl,flag){
	//开始异步查询
	var xmlObj = Sarissa.getDomDocument();
	xmlObj.async = true;
	xmlObj.onreadystatechange = function(){
		if(xmlObj.readyState == 4){
			//var oSerializer = new XMLSerializer();
			//alert(oSerializer.serializeToString(xmlObj));
			var errorStr = "<div style='font-size:14px;line-height:20px;padding:5px;'>抱歉，没有找到和您查询的“<font color=#ff0000>"+getById("lineKey").value+"</font>”相符的线路信息。<br>"
							+"<br><b>猎图建议您：</b><br><li>看看输入的文字是否有误</li><li>检查是否选择了正确的城市</li><li>请换用其他的查询字词</li></div>";
			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(xmlDocArr[sFlag].selectSingleNodes("root/Error").text);
					return false;
				}
			}catch(e){
				Results.m_aObj[flag].show(errorStr);
				return false;
			}
			//解析数据
			//alert(Sarissa.serialize(xmlObj));
			
			var busLineNode = null;
			if(m_sUserAgent == "msie"){
				busLineNode = xmlObj.selectSingleNode("root/Content/BusLines");
			}else if(m_sUserAgent == "firefox"){
				busLineNode = xmlObj.firstChild.childNodes[1].firstChild;
			}
			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 = "";
				if(m_sUserAgent == "msie"){
					lineId = myNode[i].selectSingleNode("Dwkey").text;
				}else if(m_sUserAgent == "firefox"){
					lineId = Sarissa.getText(myNode[i].childNodes[0]);
				}
				if(focusLineId == "")focusLineId = lineId;
				if(LineHashTable[lineId] == null){
					LineHashTable[lineId] = new Line();
					var StopNode = null;
					with(LineHashTable[lineId]){
						if(m_sUserAgent == "msie"){
							id = lineId;
							name = myNode[i].selectSingleNode("Name").text;
							//direction = myNode[i].selectSingleNode("Direction").text;
							//distance = myNode[i].selectSingleNode("Distance").text;
							fromTo = myNode[i].selectSingleNode("FromTo").text;
							startTime1 = myNode[i].selectSingleNode("StartTime1").text;
							endTime1 = myNode[i].selectSingleNode("EndTime1").text;
							startTime2 = myNode[i].selectSingleNode("StartTime2").text;
							endTime2 = myNode[i].selectSingleNode("EndTime2").text;
							priceDesc = myNode[i].selectSingleNode("PriceDesc").text;
							path = myNode[i].selectSingleNode("Path").text;
							county = myNode[i].selectSingleNode("County").text;
							left = parseInt(myNode[i].selectSingleNode("Left").text);
							bottom = parseInt(myNode[i].selectSingleNode("Bottom").text);
							right = parseInt(myNode[i].selectSingleNode("Right").text);
							top = parseInt(myNode[i].selectSingleNode("Top").text);
							Valid = myNode[i].selectSingleNode("Valid").text;
							//left = myNode[i].selectSingleNode("Distance").text;
							StopNode = myNode[i].selectSingleNode("BusStops").childNodes;
						}else if(m_sUserAgent == "firefox"){
							id = lineId;
							name = Sarissa.getText(myNode[i].childNodes[1]);
							//direction = Sarissa.getText(myNode[i].childNodes[3]);
							//distance = Sarissa.getText(myNode[i].childNodes[4]);
							fromTo = Sarissa.getText(myNode[i].childNodes[3]);
							startTime1 = Sarissa.getText(myNode[i].childNodes[4]);
							endTime1 = Sarissa.getText(myNode[i].childNodes[5]);
							startTime2 = Sarissa.getText(myNode[i].childNodes[6]);
							endTime2 = Sarissa.getText(myNode[i].childNodes[7]);
							priceDesc = Sarissa.getText(myNode[i].childNodes[8]);
							path = Sarissa.getText(myNode[i].childNodes[15]);
							county = Sarissa.getText(myNode[i].childNodes[2]);
							left = parseInt(Sarissa.getText(myNode[i].childNodes[11]));
							bottom = parseInt(Sarissa.getText(myNode[i].childNodes[12]));
							right = parseInt(Sarissa.getText(myNode[i].childNodes[13]));
							top = parseInt(Sarissa.getText(myNode[i].childNodes[14]));
							Valid = Sarissa.getText(myNode[i].childNodes[9]);
							//left = myNode[i].selectSingleNode("Distance").text;
							StopNode = myNode[i].childNodes[10].childNodes;
						}
						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);
			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;
		}
	};
	//alert(sUrl);
	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 startAroundSearch(cname,cx,cy,dis,key,cityCode,sUrl,pageno,flag){
	//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("?x?",cx);
		sUrl = sUrl.replace("?y?",cy);
		sUrl = sUrl.replace("?dis?",dis);
		sUrl = sUrl.replace("?pagecount?","10");
		sUrl = sUrl.replace("?pageno?","");
		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.m_aObj[flag].show("<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;
			var tcount = "";
			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 = myNode[i].selectSingleNode("WebSite").text;
							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%'>" + (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;
			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),"startAroundSearch('','','','','','',","",1);
		}
	};
	xmlObj.load(encodeURI(sUrl + pageno));
}
/*
*	开始换乘查询
*/
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>看看输入的文字是否有误</li><li>检查是否选择了正确的城市</li>'
					+'<li>确保输入的出发地和目的地位于同一城市内</li>'
					+'<li>尝试使用附近的标志性建筑名称</li>'
					+'<li>使用地图上的<img src="images/wmap_map/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);
					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!=null){
				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"){
					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);
						return false;
					}
					if(endNode.length == 0){
						Results.show(flag,errorStr);
						return false;
					}
					nowBusFlag = flag;
					var outStr = "<div style='color:black;font-weight:bold;padding:5px;'>请选择起点：";
					outStr += "<img src='images/wmap_map/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/wmap_map/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);  
					if(m_sUserAgent == "msie"){
						try{getById("begin_" + flag).firstChild.fireEvent("onclick");}catch(e){}
						try{getById("end_" + flag).firstChild.fireEvent("onclick");}catch(e){}
					}else if(m_sUserAgent == "firefox"){
						try{
							var evt = document.createEvent('MouseEvent');   
 							evt.initEvent('click',false,false); 
							getById("begin_" + flag).firstChild.dispatchEvent(evt);
						}catch(e){}
						try{
							var evt = document.createEvent('MouseEvent');   
 							evt.initEvent('click',false,false); 
							getById("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);
						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.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 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{getById("begin_" + nowBusFlag).firstChild.fireEvent("onclick");}catch(e){}
		//alert(getById("begin_" + nowBusFlag).children[1].innerHTML);
		//alert(getById("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{getById("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){
		document.getElementById("busSolution"+nowBusIndex).style.color="#003399";
		document.getElementById("busSolution"+nowBusIndex).style.fontWeight="normal";
	}
	document.getElementById("busSolution"+i).style.color="#FF0000";
	document.getElementById("busSolution"+i).style.fontWeight="bold";
	nowBusIndex = i;
}
/*
*	进行自驾方案查询
*/
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);
	//alert(sUrl);
	//开始异步查询
	var xmlObj = Sarissa.getDomDocument();
	xmlObj.async = true;
	xmlObj.onreadystatechange = function(){
		if(xmlObj.readyState == 4){
			if(xmlObj.parseError!=0){
				Results.m_aObj[flag].show("抱歉，没有找到可用的自驾方案");
				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("抱歉，没有找到可用的自驾方案");
					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.firstChild.childNodes[1].firstChild.getAttribute("state");
				}
			}catch(e){
				if(m_sUserAgent == "msie"){
					walkNode = xmlObj.selectSingleNode("root/Content/WalkDistance");
				}else if(m_sUserAgent == "firefox"){
					walkNode = xmlObj.firstChild.childNodes[1].childNodes[2];
				}
				if(walkNode){
					stateNode = "TWO";
				}else{
					Results.m_aObj[flag].show("抱歉，没有找到可用的自驾方案");
				}
			}
			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{getById("begin_" + flag).firstChild.fireEvent("onclick");}catch(e){}
						try{getById("end_" + flag).firstChild.fireEvent("onclick");}catch(e){}
					}else if(m_sUserAgent == "firefox"){
						try{
							var evt = document.createEvent('MouseEvent');   
 							evt.initEvent('click',false,false);
							getById("begin_" + flag).firstChild.dispatchEvent(evt);
						}catch(e){}
						try{
							var evt = document.createEvent('MouseEvent');   
 							evt.initEvent('click',false,false);
							getById("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);
						}
						beginScreenX = beginNode.getAttribute("screenX");
						beginScreenY = beginNode.getAttribute("screenY");
						if(m_sUserAgent == "msie"){
							endNode = xmlObj.selectSingleNode("root/Content/End");
							endName = endNode.text;
						}else if(m_sUserAgent == "firefox"){
							endNode = xmlObj.firstChild.childNodes[1].childNodes[2];
							endName = Sarissa.getText(endNode);
						}
						endScreenX = endNode.getAttribute("screenX");
						endScreenY = endNode.getAttribute("screenY");
						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 = Sarissa.getText(xmlObj.firstChild.childNodes[1].childNodes[3]);
								walkDistance = Sarissa.getText(walkNode);
							}
							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;
						}else{
							if(m_sUserAgent == "msie"){
								totalLength = xmlObj.selectSingleNode("root/Content/DriverSolution").getAttribute("Length");
							}else if(m_sUserAgent == "firefox"){
								totalLength = xmlObj.firstChild.childNodes[1].firstChild.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.firstChild.childNodes[1].childNodes[3].childNodes;
							}
							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"] = Sarissa.getText(solutionNode[i].childNodes[5]);
									nameNode = Sarissa.getText(solutionNode[i].childNodes[0]);
									direction = Sarissa.getText(solutionNode[i].childNodes[1]);
									distance = Sarissa.getText(solutionNode[i].childNodes[2]);
									actNode = Sarissa.getText(solutionNode[i].childNodes[3]);
									cross = Sarissa.getText(solutionNode[i].childNodes[4]);
								}
								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/wmap_map/"+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);
}
//公交换乘或自驾方案第一步选择的时候的对象
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:
			return;
			break;
		}
		if(name!="用户标注起点"&&name!="用户标注终点"){
			if(this.bx[flag]!=null&&this.ex[flag]!=null){
				if(this.bx[flag] < this.ex[flag]){ l = this.bx[flag]; r = this.ex[flag];}
				else{ r = this.bx[flag]; l = this.ex[flag];}
				if(this.by[flag] < this.ey[flag]){ t = this.by[flag]; b = this.ey[flag];}
				else{ b = this.by[flag]; t = this.ey[flag];}
				richmap.zoomToMBR(l,b,r,t);
			}
		}
		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]);
	};
};
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)
	}
}
//结果容器对象
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_aObj = [];		//保存各种结果对象的哈希表
	this.m_bIsClose = false;		//当前是否在关闭状态
	this.m_nWidth = 250;			//结果总容器的长
	this.m_nTitleCount = 11;		//最长10个汉字
	this.m_sFocusFlag = "";			//当前聚焦的子容器的flag
	this.init = function(){
		this.m_oContainer = getById("resultsCon");
		this.m_oResultCon = getById("resultCon");
		this.m_oResultBot = getById("resultBot");
		this.m_oResultTit = getById("showResultsTitle");
	};
	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 = 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.open = function(){
		if(!this.m_bIsClose)return;
		//如果当前已经处在关闭状态
		this.m_bIsClose = false;
		//设置地图容器的位置
		var mapContainer = getById("mapContainer");
		mapContainer.style.left = _resultW + _closeW;
		resetAllSize(true);
		//设置关闭按钮的位置
		getById("closeCon").style.left = _resultW;
		//设置结果容器的大小
		this.m_oContainer.style.width = _resultW;
		//设置按钮里头的文字信息
		getById("closeBtn").className = "closeBtn_left_out";
		//getById("closeText").style.left = "-6px";
		//getById("closeText").innerText = "《";	
	};
	//隐藏主容器
	this.close = function(){
		if(this.m_bIsClose)return;
		this.m_bIsClose = true;
		//设置地图容器的位置
		var mapContainer = getById("mapContainer");
		mapContainer.style.left = _closeW + 2;
		resetAllSize(true);
		//设置关闭按钮的位置
		getById("closeCon").style.left = 2;
		//设置结果容器的大小
		this.m_oContainer.style.width = "0px";
		//设置按钮里头的文字信息
		getById("closeBtn").className = "closeBtn_right_out";
		//getById("closeText").style.left = "0px";
		//getById("closeText").innerText = "》";
	};
	//显示下一个结果
	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]);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]);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){
			getById("showPrevious").style.backgroundImage = "url(images/map/back_02.jpg)";
		}else{
			getById("showPrevious").style.backgroundImage = "url(images/map/back_01.gif)";
		}
		if(bNext){
			getById("showNext").style.backgroundImage = "url(images/map/forward_02.jpg)";
		}else{
			getById("showNext").style.backgroundImage = "url(images/map/forward_01.jpg)";
		}
		//是否显示关闭按钮和错误反馈按钮
		if(this.m_sFocusFlag == ""){
			getById("showClose").style.backgroundImage = "url(images/map/close_01.jpg)";
			getById("showError").style.backgroundImage = "url(images/map/errorReport_01.jpg)";
		}else{
			getById("showClose").style.backgroundImage = "url(images/map/close_02.jpg)";
			getById("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;
	};

};

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.7),richmap.getLayer());
	//richmap.zoomTo(richmap.getLayer(),x,y);
	return true;
}

/*
*	公共查询接口
*	使用方法：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 = getById("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 = getById("cDistance_" + flag).value;
		var searchKey = getById("cAroundKey_" + flag);
		if(searchKey.value.trim() == ""){alert('请输入周边关键字');searchKey.focus();return false;}
		//下面进行周边查询
		startAroundSearch(this.aTitle[flag],this.aX[flag],this.aY[flag],searchDis,searchKey.value,this.citycode[flag]);
	};
	//设置选项卡周边距离
	this.setDistance = function(flag,distance){
		getById("cDistance_" + flag).value = distance;
	};
	//输入框的回车键响应
	this.checkEnter = function(obj){
		if(event.keyCode == 13){obj.nextSibling.nextSibling.fireEvent("onclick");}
	};
	//进行换乘方案
	this.searchBusSolution = function(flag,act){
		switch(act){
			case 1:		//去这里
				var searchKey = getById("cBegin_" + 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 = getById("cEnd_" + 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){
		switch(act){
			case 1:		//去这里
				var searchKey = getById("cBegin_" + 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 = getById("cEnd_" + 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 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';
	}
}
//结果子容器对象
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 = "100%";
	this.container1.style.position = "absolute";
	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 = "";
		this.container1.style.display = "";
		//运行代码
		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 = "";
		this.container1.style.display = "";
		//运行代码
		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 getSearchTab(flag){
	var outStr = '<div style="width:100%;height:100%;"></div>';
};

function closeDialog(){
	//alert(richmap.getElementObj("Dialog"));
	//richmap.clearElement("Dialog");richmap.showMsgBox();
	richmap.clearAllElement("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);
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;z-index:999;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:12px;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:12px;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 ="com/ncserv?"+ 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");//alert(tempPoiObj.products[i]["link"]);
						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(phone_url +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?(img_url+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>网址：</b><a href=\""+this.relateLink+"\" target=\"_blank\">" + this.relateLink +"</a><br>"
						+ "<b>Email：</b>" + this.email + "<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="'+ img_url + 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.name!="")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='page/poi_"+this.id+".html' target='_blank'>详情 &gt;&gt;</a></div>";
			showContent += "<div>&nbsp;</div>";
			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){
		//alert(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 = 28;	//图片长
				tempObj.nImageHeight = 32;	//图片高
				tempObj.sAlt = "请选择具体的点";
				tempObj.nScreenX = 0;			//图片热点相对坐标x
				tempObj.nScreenY = -30;			//图片热点相对坐标y
				(function(){
					var doI = i;
					tempObj.onmouseover = function(){
						try{wEMouseOver("POIList_" + doI);}catch(e){}
						var showObjList = getById("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]);
						}
						document.body.setCapture();
						showObjList.style.left = event.clientX - 3;
						showObjList.style.top = event.clientY - 3;
						document.body.releaseCapture();
						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 = getById("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(){
		
	};
}

//站点对象
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 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='changeMainSearch(2);getById(\"lineKey\").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 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.aScreenX.push(x);
			tempLine.aScreenY.push(y);
		}
		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 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 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 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(){
			//tempStop.onclick();
		};
		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 closeCityList(){
	getById("cityContainer").style.display = "none";
}
function openCityList(){
	getById("cityContainer").style.display = "";
}
function cOver(obj){
	obj.style.backgroundColor = "#eeeeee";
	obj.style.border = "solid 1px #cccccc";
}
function cOut(obj){
	obj.style.backgroundColor = "";
	obj.style.border = "solid 0px #cccccc";
}
function moveObj(){
	this.m_oDragObj = document.getElementById("cityChoice");
	this.m_oMoveObj = document.getElementById("cityContainer");
	this.getPositionX = function(x){return parseInt(this.m_oMoveObj.style.left);};
	this.getPositionY = function(x){return parseInt(this.m_oMoveObj.style.top);};
	this.setPosition = function(x,y){this.m_oMoveObj.style.left = x;this.m_oMoveObj.style.top = y;};
}

//------search notes begin-------------------------------
var g_arr_key = {
	'localBtn':{'localkey':'如：福州大学、肯德基、咖啡等名址或产品'},//本地查询
	'busBtn':{'busBegin':'比如：师大站','busEnd':'比如：福州汽车北站'},//公交换乘起点,终点
	'lineBtn':{'lineKey':'比如：20路'},//公交线路
	'stopBtn':{'stopKey':'比如：火车站、开睿动力等'},//公交站点
	'driverBtn':{'driverBegin':'比如：中亭街','driverEnd':'比如：东街口'}//自驾方案起点,终点
};
function et_loaded(){
	for(var i in g_arr_key){
		var btn_search = document.getElementById(i);
		btn_search.onclick = search_btn_click;		
		for(var j in g_arr_key[i]){
			var key_txt = document.getElementById(j);
			key_txt.setAttribute('defaultValue', g_arr_key[i][j]);
			key_txt.style.color = "#898A8A";
			key_txt.setAttribute('value', g_arr_key[i][j]);
			key_txt.setAttribute('searchType', i);
			et_event_attach(key_txt, 'click', key_text_click, false);
			et_event_attach(key_txt, 'blur', key_text_blur, false);
			key_txt.onkeydown = key_text_keydown;
		}
	}
}

function key_text_click(event){
	if(this.value == this.getAttribute('defaultValue')){
		this.value = '';
	}
		this.style.color = "#000000";
}
function key_text_blur(event){
	if(this.value == ''){
		this.value = this.getAttribute('defaultValue');
		this.style.color = "#898A8A";
	}
}

function key_text_keydown(event){
	if(typeof event == 'undefined'){event = window.event;}
	if(event.keyCode == 13){
		var search_type = this.getAttribute('searchType');
		validate_key_value(search_type);
	}
}

function search_btn_click(event){
	if(typeof event == 'undefined'){event = window.event}
	var search_type = this.getAttribute('id');
	validate_key_value(search_type);
}

function validate_key_value(search_type){
	//alert('begin validate');
	var search_index = -1;	
	for(var i in g_arr_key){
		search_index++;
		if(search_type != i){continue;}
		var valid = true;
		for(var j in g_arr_key[i]){
			var key_txt = document.getElementById(j);
			if(key_txt.value == key_txt.getAttribute('defaultValue') || key_txt.value == ''){
				valid = false;
				break;
			}
		}
		if(valid){
			startSearch(search_index);
		}else{
			alert('无效关键词');
		}
	}
}	

//在页面上显示一个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.backgroundColor = "#ffffff";
		}
	}
	document.body.appendChild(titleDivObj);
	titleDivObj.style.display = "";
	titleDivObj.innerHTML = msg;
	titleDivObj.style.left = event.x + 6;
	titleDivObj.style.top = document.body.scrollTop + event.y + 115;
}
function closeTitle(){
	try{titleDivObj.style.display = "none";}catch(e){}
};
//------search notes end-------------------------------





