// author woo 2008.6.26
var sData_basePath = "/richmap/";
var sData_local = "search?act=newpoi&key=?key?&citycode=?citycode?&pagecount=?pagecount?&l=?l?&b=?b?&r=?r?&t=?t?&x=?x?&y=?y?&typecode=?typecode?&pageno=?pageno?";
var sData_bus_step1 = "search?act=bus_step1&citycode=?citycode?&begin=?begin?&end=?end?&beginx=?beginx?&beginy=?beginy?&endx=?endx?&endy=?endy?&run=?run?&arg=?arg?";
var sData_bus_step2 = "search?act=bus2&citycode=?citycode?&begin=?begin?&end=?end?&beginx=?beginx?&beginy=?beginy?&endx=?endx?&endy=?endy?&run=?run?&arg=?arg?";
var sData_driver = "search?act=driver&bcitycode=?bcitycode?&ecitycode=?ecitycode?&begin=?begin?&end=?end?&beginx=?beginx?&beginy=?beginy?&endx=?endx?&endy=?endy?&cartype=?cartype?&carbrand=?carbrand?&run=?run?&arg=?arg?";
var sData_driver_step1 = "search?act=driver_step1&citycode1=?citycode1?&citycode2=?citycode2?&begin=?begin?&end=?end?&beginx=?beginx?&beginy=?beginy?&endx=?endx?&endy=?endy?";
var sData_driver_step2 = "search?act=driver_step2&begin=?begin?&end=?end?&beginx=?beginx?&beginy=?beginy?&endx=?endx?&endy=?endy?&option=?option?";
var sData_aroundSearch = "search?act=newpoi&format=true&key=?key?&skey=?skey?&citycode=?citycode?&typecode=?typecode?&x=?x?&y=?y?&dis=?dis?&flag=?flag?&pagecount=?pagecount?&pageno=?pageno?";
var sData_busStop = "search?act=stops&format=true&key=?key?&citycode=?citycode?&count=?count?&run=?run?&arg=?arg?";
var sData_busStopId = "search?act=stopbyid&key=?key?";
var sData_busLine = "search?act=lines&citycode=?citycode?&key=?key?";
var sData_hotKey = "com/ncserv?act=LATELYKW&count=10&citycode=?citycode?";
var sData_namecard = "com/ncserv?act=CARDINFO&poiid=?poiid?&csize=?csize?&psize=?psize?";
var sData_keyword = "search?act=kwcard&citycode=?citycode?&key=?key?&isnewquery=?isnewquery?&pagecount=?pagecount?&pageno=?pageno?";
var sData_poi = "search?act=searchpoi&dwkey=?dwkey?"; 
var smsBase = "/com/ifc?act=tosendmsm&msg=";
var StopHashTable = new Array();	//Stop HashTable 用于保存Stop对象
var dialogArgument = "dialogWidth:500px;dialogHeight:460px;status:no;center:yes;help:no;minimize:no;maximize:no;scroll:no;";
window.$ = function (id){
	return document.getElementById(id);
};
String.prototype.trim = function(){
	return this.replace(/^\s+|\s+$/g,"");
};
//判断浏览器环境
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;
};
//=== 异步读取数据分页开始 ===
var CP_TitArr	=new Array();		//保存标志
var CP_CountArr	=new Array();		//保存总记录数
var CP_NPageArr	=new Array();		//保存当前页
var CP_UrlArr	=new Array();		//保存连接记录
var CP_FuncArr	=new Array();		//保存动作函数
var CP_FlagArr	=new Array();		//保存名称
var PageCounts=0;					//记录多个地方分页时的总计数
/**
*	分页 CPage v3.3 author:laoding creat:2005-12-22	LastUpdate:2006-06-28
*	@update 2006-6-28 新增分页样式 v3.2
*	@update 2006-8-4 修订分页输入框对页码的判断及点击分页的动作函数 v3.3 
*	显示异步读取的分页信息
*	@param PageShow	显示容器，同时和PageTitle一起组成本次分页的标志。如果不指定显示位置的话，分页信息将显示在该id标志的页面元素
*	@param howpages	一页显示多少条
*	@param Page_url	下一页的链接
*	@param PageFlag	本次分页的标志
*	@param TotalC	总计录数
*	@param func		指定的动作函数，即把Page_url和pageno传递给该函数
*	@param PageShowT	指定显示位置，这样，同一个分页可以显示在多个页面元素中
*	@param display	指定显示样式
					1、基本样式，形如：首页 上一页 共2538/16页 下一页 末页 到 页GO
					2、列表样式，形如：页码 << < 3 4 5 6 7 8 9 10 11 12 13 > >> 
*	@return null
*/ 
function creatPage(PageShow,howpages,Page_url,PageFlag,TotalC,func,PageShowT,display){
	var NCou=-1;	//判断是哪个地方的分页
	for(i=0;i<=PageCounts;i++){if(CP_TitArr[i]==PageFlag){NCou=i;}}
	//如果是第一次
	if(NCou==-1){
		//之前可能已经存在其他形式的分页
		if(CP_TitArr[PageCounts]!=null){PageCounts++;NCou=PageCounts;}else{NCou=PageCounts;}
		//初始化
		CP_TitArr[NCou]=PageFlag;	//记录分页标志
		CP_NPageArr[NCou]=1;		//记录本次分页的当前页
		CP_UrlArr[NCou]=Page_url;	//记录本次分页的url
		CP_FuncArr[NCou]=func;		//记录本次分页返回运行的函数
		CP_FlagArr[NCou]=PageShow;	//记录本次分页内容的显示位置
		if(TotalC==null||TotalC==""){
			//如果没有指定总记录数，那说明总记录数在生成的页面中
			CP_CountArr[NCou]=document.getElementById(PageShow+"Tb").count;
		}else{
			CP_CountArr[NCou]=TotalC;
		}
	}
	//计算总页数
	var totalpage=CP_CountArr[NCou]%howpages==0?parseInt(CP_CountArr[NCou]/howpages):(parseInt(CP_CountArr[NCou]/howpages)+1);
	if(totalpage==0){
		document.getElementById(PageShow).innerHTML="<font color=#eeeeee>无分页信息</font>";
	}else{
		if(display==null){display=1;}	//默认为分页样式1
		var pageStr="";	//定义向外输出的分页信息
		switch(display){
			case 1:	//分页样式1 形如：首页 上一页 共2538/16页 下一页 末页 到 页GO
				var firstpage=CP_NPageArr[NCou]==1?"<span class='page1_unlink'>首页</span>":"<span class='page1_link' onclick=\"turnPage("+ NCou +","+ totalpage +",1)\" id='"+ CP_FlagArr[NCou] +"_Home'>首页</span>";
				var downpage=CP_NPageArr[NCou]==totalpage?"<span class='page1_unlink' >下一页</span>":"<span onclick=\"turnPage("+ NCou +","+ totalpage +","+ (CP_NPageArr[NCou]*1+1) +")\" class='page1_link' id='"+CP_FlagArr[NCou]+"_Down'>下一页</span>";
				var uppage=CP_NPageArr[NCou]==1?"<span class='page1_unlink'>上一页</span>":"<span onclick=\"turnPage("+NCou+","+ totalpage +","+ (CP_NPageArr[NCou]*1-1) +")\" class='page1_link' id='"+CP_FlagArr[NCou]+"_Up'>上一页</span>";
				var endpage=CP_NPageArr[NCou]==totalpage?"<span class='page1_unlink'>末页</span>":"<span onclick=\"turnPage("+ NCou +","+ totalpage +","+ totalpage +")\" class='page1_link' id='"+CP_FlagArr[NCou]+"_End'>末页</span>";
				pageStr=firstpage+" "+uppage+" 共"+totalpage+"/"+CP_NPageArr[NCou]+"页 "+downpage+" "+endpage+" 到<input type='text' id='"+ CP_FlagArr[NCou] +"PN' class='page1_input' size='2' maxlength='4' onKeyDown=\"checkEnter('"+CP_FlagArr[NCou]+"GO')\">页<span id='"+ CP_FlagArr[NCou] +"GO' class='page1_btn' onclick=\"turnPage("+ NCou +","+ totalpage +")\">GO</span>";
			break;
			case 2://分页样式2 形如：页码 << < 3 4 5 6 7 8 9 10 11 12 13 > >> 
				var firstpage=CP_NPageArr[NCou]==1?"":"<span class='p_home_f' onclick=\"turnPage("+NCou+","+totalpage+",1)\" id='"+CP_FlagArr[NCou]+"_Home' title='到首页'></span>&nbsp;";
				var uppage=CP_NPageArr[NCou]==1?"":"<span class='p_back_f' onclick=\"turnPage("+NCou+","+totalpage+","+(CP_NPageArr[NCou]*1-1)+")\" id='"+CP_FlagArr[NCou]+"_Up' title='上一页'></span>&nbsp;";
				var downpage=CP_NPageArr[NCou]==totalpage?"":"<span class='p_next_f' onclick=\"turnPage("+NCou+","+totalpage+","+(CP_NPageArr[NCou]*1+1)+")\" id='"+CP_FlagArr[NCou]+"_Down' title='下一页'></span>&nbsp;";
				var endpage=CP_NPageArr[NCou]==totalpage?"":"<span class='p_end_f' onclick=\"turnPage("+NCou+","+totalpage+","+totalpage+")\" id='"+CP_FlagArr[NCou]+"_End' title='到最后一页'></span>";
				var pagelist="";	//显示页码
				var nStartPage=1;	//从第几页开始显示
				var nPageNoCount=10;	//在页面上最多显示几个页码
				var nStartPage=CP_NPageArr[NCou]==1?1:(CP_NPageArr[NCou]-1);	//如果当前页不是第一页，默认从当前页的上一页开始显示
				if((nStartPage+nPageNoCount)>totalpage&&totalpage>=nPageNoCount){nStartPage=totalpage-nPageNoCount+1}	//如果当前页后面的页码总和小于nPageNoCount页，从倒数第nPageNoCount条开始显示
				if(totalpage<nPageNoCount){nStartPage=1;}		//如果页码总和小于nPageNoCount页，从第一页开始显示
				for(var j=nStartPage;(j<=totalpage)&&(j<(nStartPage+nPageNoCount));j++){
					if(j==CP_NPageArr[NCou]){
						pagelist+="<span class='p_f'>"+j+"</span> ";
					}else{
						pagelist+="<span class='p_b' onclick=\"turnPage("+NCou+","+totalpage+","+j+")\" onMouseOver=\"this.className='p_f';\" onMouseOut=\"this.className='p_b';\">"+j+"</span> ";
					}
				}
				pageStr="共 <span class='page2_text'>"+CP_CountArr[NCou]+"</span> 条记录　 "+firstpage+uppage+pagelist+downpage+endpage;
			break;
		}
		if(PageShowT!=null&&PageShowT!=""){PageShow=PageShowT}
		document.getElementById(PageShow).innerHTML=pageStr;
	}
}
/**
*	turnPage() 判定输入的页码是否正确并运行分页
*	@param nNcou	//当前分页在总分页数组中的下标
*	@param nTotalPage	//当前分页的总页码
*	@param nPageNo	//当前分页的页码,如果不指定，说明当前的页码从输入框中来
*/
function turnPage(nNcou,nTotalPage,nPageNo){
	var oTempObj=document.getElementById(CP_FlagArr[nNcou]+"PN");	//得到页码输入框
	if((nPageNo==""||nPageNo==null)&&oTempObj){nPageNo=oTempObj.value;}	//得到输入框内值
	var sWrongStr="";	//定义错误
	if(nPageNo==""){
		sWrongStr="请输入页码！";
	}else if(nPageNo.toString().match(/^(?:[1-9]\d*|0)$/) == null){
		sWrongStr="请在页码中输入数字！";
	}else if(nPageNo<=0||nPageNo>nTotalPage){
		sWrongStr="您输入的页码超出范围！";
	}
	if(sWrongStr!=""){		
		oTempObj.focus();
		oTempObj.select();
		return false;
	}else{		
		CP_NPageArr[nNcou]=nPageNo;	//保存当前分页的当前页码		
		eval(CP_FuncArr[nNcou]+"'"+CP_UrlArr[nNcou]+"','"+nPageNo+"','"+CP_TitArr[nNcou]+"');");
	}
};
/**
*	把某输入框的回车键绑定到指定元素的onclick事件
*	@param obj 指定元素的id
*/
function checkEnter(obj){
	if(event.keyCode==13){document.getElementById(obj).fireEvent("onclick");return false;}	
};
//-------------------------------异步读取数据分页结束-------------------------------
//------------------------------- 窗口拖动函数组开始 -------------------------------
var nEvent_x=0,nEvent_y=0;	//初始化鼠标x,y
var nDrag_x=0,nDrag_y=0;	//初始化拖动窗口x,y
var nInfo_x=0,nInfo_y=0;	//初始化地图左边窗口x,y
var nInfoBtn_x=0,nInfoBtn_y=0; //初始化地图左边窗口按钮x,y
var bMoveable=false;		//当前是否有窗口处于被拖动状态
/**
*	DragDiv v1.0 窗口拖动公用函数	Author:laoding @ Richmap	CreatDate: 2006-04-14
*	开始拖动
*	@param classObj	窗口类，该类必须符合以下条件
			必须有成员.m_oDragObj,该成员指定了窗口拖动的起始鼠标触发事件的元素
			必须有成员函数getPositionX(x)来返回窗口的坐标x
			必须有成员函数getPositionY(y)来返回窗口的坐标y
			必须有成员函数setPosition(x,y)来设置窗口的坐标x,y
*/
function startDrag(classObj){
	if(event.button==1)	{
		classObj.m_oDragObj.setCapture();
		nEvent_x = event.clientX;
		nEvent_y = event.clientY;
		nDrag_x = classObj.getPositionX();
		nDrag_y = classObj.getPositionY();
		bMoveable = true;
	}
};
//拖动
function draging(classObj){
	if(bMoveable){
		classObj.setPosition(nDrag_x + event.clientX - nEvent_x,nDrag_y + event.clientY - nEvent_y);
	}
};
//结束拖动
function stopDrag(classObj){
	if(bMoveable){
		classObj.m_oDragObj.releaseCapture();
		bMoveable = false;
	}
	//当窗口被拖动到顶部以上
	if(classObj.getPositionY()<0){classObj.setPosition(classObj.getPositionX(),0);}
	//当窗口被拖动到底部以下
	var nBodyTop=document.body.scrollTop;
	var nBodyHeight=document.body.offsetHeight;
	if(classObj.getPositionY() > nBodyTop + nBodyHeight-50){
		classObj.setPosition(classObj.getPositionX(),nBodyTop + nBodyHeight-50);
	}
};
//------------------------------- 窗口拖动函数组结束 -------------------------------
//公用视窗
var windowIndex = 0;
var windowsTable = [];
var windowsFocus = null;
function Windows(w,h){
	var tempWin = this;
	if(w == null || w=="")w = 300;
	if(h == null || h == "")h = 150;
	this.showObj = document.createElement("div");
	document.body.appendChild(this.showObj);
	this.isInit = false;
	this.index = windowIndex;
	windowsTable[this.index] = this;
	windowIndex ++ ;
	with(this.showObj.style){
		position = "absolute";
		left = "0px";
		top = "0px";
		display = "none";
		width = w + "px";
		zIndex = this.index;
	}
	this.showObj["onclick"] = function(){
		tempWin.focus();
	};
	this.showObj.innerHTML = '<table width="100%" cellpadding="0" cellspacing="0"><tr><td class="win_l_t"></td><td id="dragObj_' + this.index + '" class="win_bg_t" onmousedown="startDrag(windowsTable[' + this.index + '])" onmouseup="stopDrag(windowsTable[' + this.index + '])" onmousemove="draging(windowsTable[' + this.index + '])">&nbsp;</td><td class="win_bg_t" width="20" align="right"><span class="win_close" title="关闭" onclick="windowsTable[' + this.index + '].close();"></span></td><td class="win_r_t"></td></tr></table>'
		+ '<table width="100%" cellpadding="0" cellspacing="0"><tr><td class="win_l_con"></td><td class="win_bg_con" valign="top" id="windows_' + this.index + '" height="' + h + '"></td><td class="win_r_con"></td></tr></table>'
		+ '<table width="100%" cellpadding="0" cellspacing="0"><tr><td class="win_l_b"></td><td class="win_bg_b">&nbsp;</td><td class="win_r_b"></td></tr></table>';
	this.isInit = true;
	this.m_oDragObj = $("dragObj_" + this.index);
	this.show = function(msg,x,y){
		if(msg != null){
			this.setContent(msg);
		}
		this.showObj.style.display = "";
		this.setPosition(x,y);
		this.focus();
		return true;
	};
	this.focus = function(){
		if(windowsFocus != null){
			windowsFocus.blur();	
		};
		this.showObj.style.zIndex = 999;
		windowsFocus = this;
	};
	this.blur = function(){
		this.showObj.style.zIndex = this.index;
		windowsFocus = null;
	};
	this.setTitle = function(tit){
		this.m_oDragObj.innerHTML = tit;
	};
	this.setContent = function(msg){
		$("windows_" + this.index).innerHTML = msg;
	};
	this.setPosition = function(x,y){
		this.showObj.style.left = x + "px";
		this.showObj.style.top = y + "px";
	};
	this.getPositionX = function(){
		return parseInt(this.showObj.style.left);
	};
	this.getPositionY = function(){
		return parseInt(this.showObj.style.top);
	};
	this.close = function(){
		this.showObj.style.display = "none";
	};
	this.del = function(){
		this.showObj.parentElement.removeChild(this.showObj);
		this.showObj = null;
		windowsTable[this.index] = null;
		return true;
	};
};
//在页面上显示一个tooltip
var winIndex = 1;
var nowWinIndex = 1;
//var nowFocusWin = null;
var nowPositionHashTable = [];
var positionIndex = 0;
function getPosition(){
	for(var i=0;i<=positionIndex;i++){
		if(!nowPositionHashTable[i]){
			nowPositionHashTable[i] = true;
			return i;
			break;
		}
	}
	positionIndex ++;
	nowPositionHashTable[positionIndex] = true;
	return positionIndex;
};
function message(w,h){
	this.showObj = document.createElement("div");
	this.isInit = false;
	this.winIndex = winIndex;
	winIndex ++;
	this.positionIndex = getPosition();
	with(this.showObj.style){
		border = "solid 1px #F7BB79";
		if(w!=null)width = w;
		if(h!=null)height = h;
		padding = "5px";
		position = "absolute";
		color = "#F37A4B";
		display = "none";
		zIndex = this.winIndex;
		backgroundColor = "#ffffff";
	};
	var thisMsg = this;
	this.showObj.onmouseover = function(){
		//if(nowFocusWin == this)return;
		//if(nowFocusWin != null)nowFocusWin.showObj.style.zIndex = nowWinIndex;
		nowWinIndex = parseInt(thisMsg.showObj.style.zIndex);
		thisMsg.showObj.style.zIndex = 999;
		//nowFocusWin = this;
	};
	this.showObj.onmouseout = function(){
		thisMsg.showObj.style.zIndex = nowWinIndex;
	};
	document.body.appendChild(this.showObj);
	//nowFocusWin = this;
	this.isInit = true;
	this.show = function(msg,x,y){
		this.showObj.style.display = "";
		if(msg != null)this.showObj.innerHTML = msg;
		if(x != null)this.showObj.style.left = x + this.positionIndex*4;
		if(y != null)this.showObj.style.top = y + this.positionIndex*4;
	};
	this.setCon = function(msg){
		this.showObj.innerHTML = msg;
	};
	this.close = function(){
		this.showObj.style.display = "none";
	};
	this.del = function(){
		this.showObj.parentElement.removeChild(this.showObj);
		this.showObj = null;
		nowPositionHashTable[this.positionIndex] = false;
		return;
	};
};
//公用验证码框
var checkCodeMsg = null;
var nowFocusText = null;
var notClose = false;
function showCheckCode(obj){
	nowFocusText = obj;	
	if(checkCodeMsg == null){
		//初始化一个弹出框
		checkCodeMsg = new message(180,65);
		checkCodeMsg.setCon('<img src="loginmng?act=CODEIMG" id="autoCode" width="50" height="20"><br><font color=black>请输入上面图片上的数字</font><br>看不清楚？<a href="javascript:void(0)" onclick="return changeCode();">换一张</a>');
		checkCodeMsg.showObj["onmousedown"] = function(){
			notClose = true;
			checkCodeMsg.show();
		};
	}		
	obj.nextSibling.appendChild(checkCodeMsg.showObj);	
	checkCodeMsg.show(null,-120,-70);
	changeCode();
	return false;
};
function changeCode(){
	if(!$("autoCode"))return;
	$("autoCode").src="loginmng?act=CODEIMG";
	try{if(nowFocusText)nowFocusText.focus();}catch(e){}
	return false;
};
function closeCheckCode(){
	if(notClose){notClose = false;return;}
	nowFocusText = null;
	checkCodeMsg.close();
};
var nowBusIndex = null;
function setBusFocus(i){
	if(i==nowBusIndex) return;
	if(nowBusIndex!=null){
		$("busSolution"+nowBusIndex).style.color="#003399";
		$("busSolution"+nowBusIndex).style.fontWeight="normal";
	}
	$("busSolution"+i).style.color="#FF0000";
	$("busSolution"+i).style.fontWeight="bold";
	nowBusIndex = i;
};
/*
*	开始换乘查询
*/
function startBusSearch(strUrl,begin,end,beginx,endx,beginy,endy,cityCode){
	//sData_bus="search?act=bus&citycode=?citycode?&begin=?begin?&end=?end?&beginflag=?beginflag?&endflag=?endflag?&beginx=?beginx?&beginy=?beginy?&endx=?endx?&endy=?endy?&run=?run?&arg=?arg?";
	var flag = getRandFlag();
	
	//if(!Results.getObj(flag,"从“" + begin + "”到“" + end + "”",cityCode,"公交换乘"))return false;
	//组合查询路径
	sUrl = 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>'
					+'</div>';
					//+'<li>使用地图上的<img src="/images/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));
				bs.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);					
					bs.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&&walkNode.childNodes&&walkNodeText!=""){
				var direct;
				var b_name;
				var b_x;
				var b_y;
				var e_name;
				var e_x;
				var e_y;
				if(m_sUserAgent == "msie"){
					direct = xmlObj.selectSingleNode("root/Content/Direction").text;
					b_name = xmlObj.selectSingleNode("root/Content/Begin").getAttribute("name");
					b_x = xmlObj.selectSingleNode("root/Content/Begin").getAttribute("x");
					b_y = xmlObj.selectSingleNode("root/Content/Begin").getAttribute("y");
					e_name = xmlObj.selectSingleNode("root/Content/End").getAttribute("name");
					e_x = xmlObj.selectSingleNode("root/Content/End").getAttribute("x");
					e_y = xmlObj.selectSingleNode("root/Content/End").getAttribute("y");
				}else if(m_sUserAgent == "firefox"){
					direct = Sarissa.getText(xmlObj.firstChild.childNodes[1].childNodes[3]);
					b_name = xmlObj.firstChild.childNodes[1].childNodes[0].getAttribute("name");
					b_x = xmlObj.firstChild.childNodes[1].childNodes[0].getAttribute("x");
					b_y = xmlObj.firstChild.childNodes[1].childNodes[0].getAttribute("y");
					e_name = xmlObj.firstChild.childNodes[1].childNodes[1].getAttribute("name");
					e_x = xmlObj.firstChild.childNodes[1].childNodes[1].getAttribute("x");
					e_y = xmlObj.firstChild.childNodes[1].childNodes[1].getAttribute("y");
				}
				var str = "<br>路程较短，建议步行。<br>往<font color=red>"+direct+"</font>方向步行"+walkNodeText+"米即到。";
				//Results.show(flag,str);
				bs.show(str);
				//showMarket(1,b_name,b_x,b_y);
				//showMarket(2,e_name,e_x,e_y);
			}else{
				var stateNode = "";
				if(m_sUserAgent == "msie"){
					if(xmlObj.selectSingleNode("root/Content/BusSolution")){
						stateNode = xmlObj.selectSingleNode("root/Content/BusSolution").getAttribute("state");
					}	
				}else if(m_sUserAgent == "firefox"){
					stateNode = xmlObj.firstChild.childNodes[1].childNodes[0].getAttribute("state");					
					if(!stateNode) stateNode = xmlObj.firstChild.childNodes[1].childNodes[2].getAttribute("state");
				}				
			switch(stateNode){
				case "ONE":
					//显示选择框
					var beginNode = null;
					var endNode = null;
					if(m_sUserAgent == "msie"){
						beginNode = xmlObj.selectSingleNode("root/Content/BusSolution/Begin").childNodes;
						endNode = xmlObj.selectSingleNode("root/Content/BusSolution/End").childNodes;
					}else if(m_sUserAgent == "firefox"){
						beginNode = xmlObj.firstChild.childNodes[1].firstChild.childNodes[0].childNodes;
						endNode = xmlObj.firstChild.childNodes[1].firstChild.childNodes[1].childNodes;
					}
					if(beginNode.length == 0){
						//Results.show(flag,errorStr);
						bs.show(errorStr);
						return false;
					}
					if(endNode.length == 0){
						//Results.show(flag,errorStr);
						bs.show(errorStr);
						return false;
					}
					nowBusFlag = flag;
					var outStr = "<div style='color:black;font-weight:bold;padding:5px;'>请选择起点：</div>";
					//outStr += "<img src='images/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;'>请选择终点：</div>";					
					//outStr += "<img src='images/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); 
					bs.show(outStr);
					if(m_sUserAgent == "msie"){
						try{$("begin_" + flag).firstChild.fireEvent("onclick");}catch(e){}
						try{$("end_" + flag).firstChild.fireEvent("onclick");}catch(e){}
					}else if(m_sUserAgent == "firefox"){
						try{
							var evt = document.createEvent('MouseEvent');   
 							evt.initEvent('click',false,false); 
							$("begin_" + flag).firstChild.dispatchEvent(evt);
						}catch(e){}
						try{
							var evt = document.createEvent('MouseEvent');   
 							evt.initEvent('click',false,false); 
							$("end_" + flag).firstChild.dispatchEvent(evt);
						}catch(e){}
					}
					outstr = null;
					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);
						bs.show(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=\"bs.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);
					//bs.show(outStr);
					bs.setFocusScript(mySolution);
					bs.showBus(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);
};
function startLineSearch(value,citycode){
	window.open(encodeURI(sData_basePath+"bmap.jsp?act=line&key=" + value + "&citycode=" + citycode));
	return false;
};
//换乘对象
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);
	};
};
//公交换乘或自驾方案第一步选择的时候的对象
var publicSelect = new function(){
	this.bname = [];	//起点
	this.ename = [];	//终点
	this.bx = [];	//起点加密经度
	this.ex = [];	//终点加密经度
	this.by = [];	//起点加密纬度
	this.ey = [];	//终点加密纬度
	this.bf = [];	//起点标志
	this.ef = [];	//终点标志
	this.citycode = [];		//城市
	this.focusBeginFlag = [];
	this.focusEndFlag = [];
	this.searchType = [];
	this.mouseOver = function(act,flag,obj){
		switch(act){
			case 1:		//选择起点
				if(this.focusBeginFlag[flag] != obj)obj.className = "sOver";
			break;
			case 2:		//选择终点
				if(this.focusEndFlag[flag] != obj)obj.className = "sOver";
			break;
			default:
			return;
			break;
		}
	};
	this.mouseOut = function(act,flag,obj){
		switch(act){
			case 1:		//选择起点
				if(this.focusBeginFlag[flag] != obj)obj.className = "sOut";
			break;
			case 2:		//选择终点
				if(this.focusEndFlag[flag] != obj)obj.className = "sOut";
			break;
			default:
			return;
			break;
		}
	};
	this.onClick = function(flag,obj,act,name,x,y){
		switch(act){
			case 1:
				if(this.focusBeginFlag[flag] == obj)return;
				try{this.focusBeginFlag[flag].className = "sOut";}catch(e){}
				this.bname[flag] = name;
				this.bx[flag] = x;
				this.by[flag] = y;
				this.bf[flag] = flag;
				this.focusBeginFlag[flag] = obj;
			break;
			case 2:
				if(this.focusEndFlag[flag] == obj)return;
				try{this.focusEndFlag[flag].className = "sOut";}catch(e){}
				this.ename[flag] = name;
				this.ex[flag] = x;
				this.ey[flag] = y;
				this.ef[flag] = flag;
				this.focusEndFlag[flag] = obj;
			break;
			default:
			return;
			break;
		}
		obj.className = "sFocus";
	};
	//提交查询
	this.commit = function(flag){
		if(this.searchType[flag] == 1){
			startBusSearch(sData_bus_step2,this.bname[flag],this.ename[flag],this.bx[flag],this.ex[flag],this.by[flag],this.ey[flag],this.citycode[flag]);
		}else{
			//startDriverSearch(this.bname[flag],this.ename[flag],this.bx[flag],this.ex[flag],this.by[flag],this.ey[flag],this.citycode[flag]);
			startDriverSearch(sData_driver_step2,this.bname[flag],this.ename[flag],this.bx[flag],this.ex[flag],this.by[flag],this.ey[flag],this.citycode[flag],this.citycode[flag]);
		}
	};
};
//公交换乘第一步时候的选择
var busSelect = new function(){
	this.bname = [];	//起点
	this.ename = [];	//终点
	this.bx = [];	//起点加密经度
	this.ex = [];	//终点加密经度
	this.by = [];	//起点加密纬度
	this.ey = [];	//终点加密纬度
	this.bf = [];	//起点标志
	this.ef = [];	//终点标志
	this.citycode = [];		//城市
	this.focusBeginFlag = [];
	this.focusEndFlag = [];
	this.searchType = [];
	this.mouseOver = function(act,flag,obj){
		switch(act){
			case 1:		//选择起点
				if(this.focusBeginFlag[flag] != obj)obj.className = "sOver";
			break;
			case 2:		//选择终点
				if(this.focusEndFlag[flag] != obj)obj.className = "sOver";
			break;
			default:
			return;
			break;
		}
	};
	this.mouseOut = function(act,flag,obj){
		switch(act){
			case 1:		//选择起点
				if(this.focusBeginFlag[flag] != obj)obj.className = "sOut";
			break;
			case 2:		//选择终点
				if(this.focusEndFlag[flag] != obj)obj.className = "sOut";
			break;
			default:
			return;
			break;
		}
	};
	this.onClick = function(flag,obj,act,name,x,y){		
		switch(act){
			case 1:
				if(this.focusBeginFlag[flag] == obj)return;
				try{this.focusBeginFlag[flag].className = "sOut";}catch(e){}
				this.bname[flag] = name;
				this.bx[flag] = x;
				this.by[flag] = y;
				this.bf[flag] = flag;
				this.focusBeginFlag[flag] = obj;
				showMarket(act,name,x,y);
			break;
			case 2:
				if(this.focusEndFlag[flag] == obj)return;
				try{this.focusEndFlag[flag].className = "sOut";}catch(e){}
				this.ename[flag] = name;
				this.ex[flag] = x;
				this.ey[flag] = y;
				this.ef[flag] = flag;
				this.focusEndFlag[flag] = obj;
				showMarket(act,name,x,y);
			break;
			default:
			
			break;
		}
		if(name!="用户标注起点"&&name!="用户标注终点"){
			if(this.bx[flag]!=null&&this.ex[flag]!=null){	
				var MBR = [0,0,0,0];//l b r t				
				if(this.bx[flag] < this.ex[flag]){ 
					MBR[0] = this.bx[flag]; MBR[2] = this.ex[flag];
				}else{
					MBR[2] = this.bx[flag]; MBR[0] = this.ex[flag];
				}
				if(this.by[flag] < this.ey[flag]){
					MBR[3] = this.by[flag]; MBR[1] = this.ey[flag];
				}else{ 
					MBR[1] = this.by[flag]; MBR[3] = this.ey[flag];
				}				
				richmap.zoomToMBR(MBR[0],MBR[1],MBR[2],MBR[3]);
			}
		}
		obj.className = "sFocus";
	};
	//提交查询
	this.commit = function(flag){
		startBusSearch(sData_bus_step2,this.bname[flag],this.ename[flag],this.bx[flag],this.ex[flag],this.by[flag],this.ey[flag],this.citycode[flag]);
	};
};
//设置列表的某行被选中
var nowFocusSinglePoint = null;
var nowFocusWingElement = "";
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 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)
	}
};
//在页面上显示一个tooltip
var titleDivObj = null;
function showTitle(msg){
	if(titleDivObj == null){
		titleDivObj = document.createElement("div");
		with(titleDivObj){
			style.border = "solid 1px #F7BB79";
			style.padding = "2px";
			style.position = "absolute";
			style.color = "#F37A4B";
			style.display = "none";
			style.textAlign = "left";
			style.width = "200px";
			style.backgroundColor = "#ffffff";
			style.zIndex = 666;
		}
	}
	document.body.appendChild(titleDivObj);
	titleDivObj.style.display = "";
	titleDivObj.innerHTML = msg;
	titleDivObj.style.left = event.x + 12;
	titleDivObj.style.top = document.body.scrollTop + event.y + 5;
}
function closeTitle(){
	try{titleDivObj.style.display = "none";}catch(e){}
};
//站点对象
function 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(basePath + sData_busStopId.replace("?key?",this.id));
		if(xmlObj.parseError!=0){
			//alert("查找不到您要的内容\r载入错误！");
			//Results.m_aObj[flag].show("xml载入错误！错误描述:\r\n"+Sarissa.getParseErrorText(xmlObj));
			bs.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]));
					bs.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;
		return false;
		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);$(\"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,3");
		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 startDriverSearch(strUrl,begin,end,beginx,endx,beginy,endy,beginCity,endCity){
	//sData_driver="search?act=driver_step1&citycode1=?citycode1?&citycode2=?citycode2?&begin=?begin?&end=?end?&beginx=?beginx?&beginy=?beginy?&endx=?endx?&endy=?endy?";
	var flag = getRandFlag();
	//if(!Results.getObj(flag,"从“" + begin + "”到“" + end + "”",beginCity,"自驾方案"))return false;
	//组合查询路径
	sUrl = sData_basePath + strUrl;
	sUrl = sUrl.replace("?begin?",begin);
	sUrl = sUrl.replace("?end?",end);
	sUrl = sUrl.replace("?beginx?",beginx);
	sUrl = sUrl.replace("?endx?",endx);
	sUrl = sUrl.replace("?citycode1?",beginCity);
	sUrl = sUrl.replace("?citycode2?",endCity);
	sUrl = sUrl.replace("?beginy?",beginy);
	sUrl = sUrl.replace("?endy?",endy);
	sUrl = sUrl.replace("?option?","0");
	sUrl = encodeURI(sUrl);
	//开始异步查询
	var xmlObj = Sarissa.getDomDocument();
	xmlObj.async = true;
	xmlObj.onreadystatechange = function(){
		if(xmlObj.readyState == 4){
			if(xmlObj.parseError!=0){
				Results.m_aObj[flag].show("抱歉，没有找到可用的自驾方案");
				return false;
			}
			try{
				var testNode = "";
				if(m_sUserAgent == "msie"){
					testNode = xmlObj.selectSingleNode("root/Return").text;
				}else if(m_sUserAgent == "firefox"){
					testNode = xmlObj.getElementsByTagName("root")[0].getElementsByTagName("Return")[0].firstChild.nodeValue;					
					//testNode = Sarissa.getText(xmlObj.firstChild.firstChild,true);
				}
				if(testNode == "0"){
					//Results.m_aObj[flag].show("抱歉，没有找到可用的自驾方案");
					bs.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.getElementsByTagName("root")[0].getElementsByTagName("Content")[0].getElementsByTagName("DriverSolution")[0].getAttribute("state");
				}
			}catch(e){	
				if(m_sUserAgent == "msie"){
					walkNode = xmlObj.selectSingleNode("root/Content/WalkDistance");
					
				}else if(m_sUserAgent == "firefox"){
					if(stateNode ==""){
						try{
							stateNode = xmlObj.getElementsByTagName("root")[0].getElementsByTagName("Content")[0].getElementsByTagName("DriverSolution")[0].getAttribute("state");
						}catch(e){}	
					}
					walkNode = xmlObj.getElementsByTagName("root")[0].getElementsByTagName("Content")[0].getElementsByTagName("WalkDistance");
				}
				if(walkNode){
					stateNode = "TWO";
				}else{
					//Results.m_aObj[flag].show("抱歉，没有找到可用的自驾方案");
					bs.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>");
						bs.show("<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>");
					    bs.show("<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);
					bs.show(outStr);
					if(m_sUserAgent == "msie"){
						try{$("begin_" + flag).firstChild.fireEvent("onclick");}catch(e){}
						try{$("end_" + flag).firstChild.fireEvent("onclick");}catch(e){}
					}else if(m_sUserAgent == "firefox"){
						try{
							var evt = document.createEvent('MouseEvent');   
 							evt.initEvent('click',false,false);
							$("begin_" + flag).firstChild.dispatchEvent(evt);
						}catch(e){}
						try{
							var evt = document.createEvent('MouseEvent');   
 							evt.initEvent('click',false,false);
							$("end_" + flag).firstChild.dispatchEvent(evt);
						}catch(e){} 
					}
					outstr = null;
				break;
				case "TWO":
					var mySolution = new DriverSolution();
					var beginNode=null;
					var endNode=null;
					var walkDistance = null;
					var solutionNode=null;
					var totalLength = null;
					var smsStr = "";
					var smsUrl = "";
					with(mySolution){
						if(m_sUserAgent == "msie"){
							beginNode = xmlObj.selectSingleNode("root/Content/Begin");
							beginName = beginNode.text;
						}else if(m_sUserAgent == "firefox"){
							//beginNode = xmlObj.firstChild.childNodes[1].childNodes[1];
							//beginName = Sarissa.getText(beginNode);
							beginNode = xmlObj.getElementsByTagName("root")[0].getElementsByTagName("Content")[0].getElementsByTagName("Begin")[0];
												
						}						
						if(m_sUserAgent == "msie"){
							endNode = xmlObj.selectSingleNode("root/Content/End");
							endName = endNode.text;
						}else if(m_sUserAgent == "firefox"){
							endNode =  xmlObj.getElementsByTagName("root")[0].getElementsByTagName("Content")[0].getElementsByTagName("End")[0];											
						}									
						if(walkNode){
							beginName = beginNode.getAttribute("name");							
							beginScreenX = beginNode.getAttribute("x");							
							beginScreenY = beginNode.getAttribute("y");
							endName = endNode.getAttribute("name");
							endScreenX = endNode.getAttribute("x");
							endScreenY = endNode.getAttribute("y");
							var walkDirect = "";
							if(m_sUserAgent == "msie"){
								walkDirect = xmlObj.selectSingleNode("root/Content/Direction").text;
								walkDistance = walkNode.text;
								
							}else if(m_sUserAgent == "firefox"){
								walkDirect = xmlObj.getElementsByTagName("root")[0].getElementsByTagName("Content")[0].getElementsByTagName("Direction")[0].firstChild.nodeValue;
								walkDistance = walkNode[0].firstChild.nodeValue;
							}
							outStr += "<div style='padding:5px;padding-left:12px;cursor:pointer;' onclick=\"Results.m_aObj['" + flag + "'].m_oFocusScript.show(this)\">两点距离较近，建议您步行！<br>步行方案：从起点开始向"+walkDirect+"步行 <font color=red>"+walkDistance+"</font> 米即到终点</div>";
							smsStr += "两点距离较近，建议您步行！步行方案：从起点开始向"+walkDirect+"步行"+walkDistance+"米即到终点";
							isWalk = true;
							left = beginScreenX<endScreenX?beginScreenX:endScreenX;
							bottom = beginScreenY>endScreenY?beginScreenY:endScreenY;
							right = beginScreenX>endScreenX?beginScreenX:endScreenX;
							top = beginScreenY<endScreenY?beginScreenY:endScreenY;
							//提交地图显示
								//Results.m_aObj[flag].setFocusScript(mySolution);
								//Results.show(flag,outStr);
								bs.setFocusScript(mySolution);
								bs.show(outStr);
								try{
									if(m_sUserAgent == "msie"){
										//Results.m_aObj[flag].container.firstChild.fireEvent("onclick");
									}else if(m_sUserAgent == "firefox"){
										var evt = document.createEvent('MouseEvent');   
										evt.initEvent('click',false,false);
										//Results.m_aObj[flag].container.firstChild.dispatchEvent(evt);
									}
								}catch(e){};
						}else{
							beginName = beginNode.firstChild.nodeValue;	
							endName = endNode.firstChild.nodeValue;		
							beginScreenX = beginNode.getAttribute("screenX");
							beginScreenY = beginNode.getAttribute("screenY");
							endScreenX = endNode.getAttribute("screenX");
							endScreenY = endNode.getAttribute("screenY");		
							if(m_sUserAgent == "msie"){
								totalLength = xmlObj.selectSingleNode("root/Content/DriverSolution").getAttribute("Length");
							}else if(m_sUserAgent == "firefox"){
								totalLength = xmlObj.getElementsByTagName("root")[0].getElementsByTagName("Content")[0].getElementsByTagName("DriverSolution")[0].getAttribute("Length");
							}
							if(totalLength > 1000){totalLength = (parseInt(totalLength / 100)/10).toString() + "公里";}else{totalLength += "米";}
								outStr += "<div style='padding:5px;padding-left:12px;cursor:pointer;' class='info_normal_focus' onclick=\"Results.m_aObj['" + flag + "'].m_oFocusScript.show(this)\">点击显示全程线路(线路总长：" + totalLength + "）</div>";
							
							if(m_sUserAgent == "msie"){
								solutionNode = xmlObj.selectSingleNode("root/Content/Solution").childNodes;
							}else if(m_sUserAgent == "firefox"){
								solutionNode = xmlObj.getElementsByTagName("root")[0].getElementsByTagName("Content")[0].getElementsByTagName("Solution")[0].getElementsByTagName("Road");								
							}
							var nameNode = "";
							var direction = "";
							var distance = "";
							var actNode = "";
							var cross = "";
							for(var i=0;i<solutionNode.length;i++){
								solutions[i] = new Array();
								if(m_sUserAgent == "msie"){
									solutions[i]["path"] = solutionNode[i].selectSingleNode("Path").text;
									nameNode = solutionNode[i].selectSingleNode("Name").text;
									direction = solutionNode[i].selectSingleNode("Direction").text;
									distance = solutionNode[i].selectSingleNode("Distance").text;
									actNode = solutionNode[i].selectSingleNode("Action").text;
									cross = solutionNode[i].selectSingleNode("Crossing").text;
								}else if(m_sUserAgent == "firefox"){								
									solutions[i]["path"] = solutionNode[i].getElementsByTagName("Path")[0].firstChild.nodeValue;								
									nameNode = solutionNode[i].getElementsByTagName("Name")[0].firstChild.nodeValue;
									direction =solutionNode[i].getElementsByTagName("Direction")[0].firstChild.nodeValue;
									distance = solutionNode[i].getElementsByTagName("Distance")[0].firstChild.nodeValue;									
									cross = solutionNode[i].getElementsByTagName("Crossing")[0].firstChild.nodeValue;									
									if(solutionNode[i].getElementsByTagName("Action")[0].childNodes.length >0){									
									 	 actNode =solutionNode[i].getElementsByTagName("Action")[0].firstChild.nodeValue;
									}														
								}								
								var showImg = "";
								switch(actNode){
									case "向前直走":
										showImg = "go";
									break;
									case "左拐":
										showImg = "left";
									break;
									case "右拐":
										showImg = "right";
									break;
									case "调头":
										showImg = "reverse";
									break;
									default:
										showImg = "go";
									break;
								}
								
								outStr += "<div style='padding:5px;padding-left:12px;cursor:pointer;' class='info_normal_focus' onclick=\"bs.m_oFocusScript.show(this," + i + ")\"><img src='images/bmap/"+showImg+".gif' />";								
								if(solutionNode.length == 1){
									outStr += '<b>' + (i+1) + '</b>、从<b>起点</b>开始沿<b>'+nameNode+'</b>向' + direction + '方向行驶约<font color=red>' + distance + '</font>后到达终点。</div>';
									smsStr += (i+1) + "、从起点开始沿"+nameNode+"向" + direction + "方向行驶约" + distance + "后到达终点。";
								}else if(i == 0){
									outStr += '<b>' + (i+1) + '</b>、从<b>起点</b>开始沿<b>'+nameNode+'</b>向' + direction + '方向行驶约<font color=red>' + distance + '</font>到达<b>' + cross + '</b>的交叉口。</div>';
									smsStr += (i+1) + "、从起点开始沿"+nameNode+"向" + direction + "方向行驶约" + distance + "</font>到达" + cross + "的交叉口。";
								}else if((i+1) != solutionNode.length){
									outStr += '<b>' + (i+1) + '</b>、在该交叉口<b>'+actNode.replace("向前直走","直行")+'</b>，沿<b>'+nameNode+'</b>向' + direction + '方向行驶约<font color=red>' + distance + '</font><b>' + cross + '</b>的交叉口。</div>';
									smsStr += (i+1) + '、在该交叉口'+actNode.replace("向前直走","直行")+'，沿<b>'+nameNode+'向' + direction + '方向行驶约' + distance + cross + '的交叉口。';
								}else{
									outStr += '<b>' + (i+1) + '</b>、在该交叉口<b>'+actNode.replace("向前直走","直行")+'</b>，沿<b>'+nameNode+'</b>向' + direction + '方向行驶约<font color=red>' + distance + '</font>后到达<b>终点。</font></div>';
									smsStr += (i+1) + '、在该交叉口'+actNode.replace("向前直走","直行")+'，沿<b>'+nameNode+'向' + direction + '方向行驶约' + distance + '后到达终点。';
								}								
								smsUrl = encodeURI(smsBase+smsStr);
								outStr += "<div style='padding:5px;padding-left:12px;'><a href='javascript:void(0);' onClick=\"window.showModalDialog('"+smsUrl+"', '','"+dialogArgument+"')\"></a></div>";
								
								//提交地图显示
								//Results.m_aObj[flag].setFocusScript(mySolution);
								bs.setFocusScript(mySolution);
								bs.show(outStr);
								bs.focusScript();
								//Results.show(flag,outStr);
								try{
									if(m_sUserAgent == "msie"){
										//Results.m_aObj[flag].container.firstChild.fireEvent("onclick");
									}else if(m_sUserAgent == "firefox"){
										var evt = document.createEvent('MouseEvent');   
										evt.initEvent('click',false,false);
										//Results.m_aObj[flag].container.firstChild.dispatchEvent(evt);
									}
								}catch(e){};
							}
						}						
					};
					
					
				break;
				default:
				return;
				break;
			}
		}
	};
	xmlObj.load(sUrl);
};
//自驾对象
function 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 startAroundSearch(cname,cx,cy,dis,key,cityCode,sUrl,pageno,flag,typecode,sFlag){
	//sData_aroundSearch="search?act=around&format=true&key=?key?&skey=?skey?&citycode=?citycode?&x=?x?&y=?y?&dis=?dis?&pagecount=?pagecount?&pageno=?pageno?";
	if(!sFlag)var sFlag ="";
	if(sUrl == null){
		//得到标志
		var flag = getRandFlag();
		//if(!Results.getObj(flag,cname,cityCode,"周边查询"))return false;
		sUrl = sData_basePath + sData_aroundSearch;
		sUrl = sUrl.replace("?key?",key);
		sUrl = sUrl.replace("?skey?",cname);
		sUrl = sUrl.replace("?citycode?",cityCode);
		sUrl = sUrl.replace("?l?",0);
		sUrl = sUrl.replace("?b?",0);
		sUrl = sUrl.replace("?r?",0);
		sUrl = sUrl.replace("?t?",0);
		sUrl = sUrl.replace("?x?",cx);
		sUrl = sUrl.replace("?y?",cy);
		sUrl = sUrl.replace("?dis?",dis);
		sUrl = sUrl.replace("?flag?",sFlag);
		sUrl = sUrl.replace("?pagecount?","10");
		sUrl = sUrl.replace("?pageno?","");
		if(typeof typecode == "undefined"){
			typecode ="";
		}
		sUrl = sUrl.replace("?typecode?",typecode);
		
		pageno = 1;		
	}else{
		//清空之前容器内的内容
		//Results.show(flag,"读取信息...");
		bs.show("");
	}
	//开始异步查询
	var xmlObj = Sarissa.getDomDocument();
	xmlObj.async = true;
	xmlObj.onreadystatechange = function(){
		if(xmlObj.readyState == 4){
			if(xmlObj.parseError!=0){
				bs.show("<div style='padding:10px;'>xml载入错误！错误描述:\r\n"+Sarissa.getParseErrorText(xmlObj)+"</div>");
				return false;
			}
			try{
				var testNode = "";
				if(m_sUserAgent == "msie"){
					testNode = xmlObj.selectSingleNode("root/Return").text;
				}else if(m_sUserAgent == "firefox"){
					testNode = Sarissa.getText(xmlObj.firstChild.firstChild,true);
				}
				if(testNode == "0"){
					//Results.show(flag,"<div style='padding:8px'><font color=red>对不起，在“"+cname+"”周围"+dis+"米内查询不到“"+key+"”相关的信息</font><br><br><b>提示：</b>您可以扩大范围进行查询，或者更换周边关键字进行重新查询</div>");
					bs.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;			
			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("RelateLink").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("RelateLink").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% ;color:#1886CE;' >" + (i+1).toString() + "、" + POIHashTable[dwkey].displayName + "</div>";				
				if(POIHashTable[dwkey].address != ""){
					outStr = outStr + "<div style='width:100%'>地址：" + POIHashTable[dwkey].address + "</div>";
				}
				if(POIHashTable[dwkey].phone != ""){
					outStr = outStr + "<div style='width:100%'>电话：" + POIHashTable[dwkey].phone + "</div>";
				}
				outStr = outStr + "</div>";
				//判定MBR
				if(i==0){
					myAroundObj.poiList.left = x;
					myAroundObj.poiList.bottom = y;
					myAroundObj.poiList.right = x;
					myAroundObj.poiList.top = y;
				}else{
					if(myAroundObj.poiList.left>x)myAroundObj.poiList.left = x;
					if(myAroundObj.poiList.bottom<y)myAroundObj.poiList.bottom = y;
					if(myAroundObj.poiList.right<x)myAroundObj.poiList.right = x;
					if(myAroundObj.poiList.top>y)myAroundObj.poiList.top = y;
				}
				//加入列表
				if(myAroundObj.poiList.xyList[x + "_" + y]==null){
					myAroundObj.poiList.poiList[j] = new Array();
					myAroundObj.poiList.xyList[x + "_" + y] = j;
					j++;
				}
				myAroundObj.poiList.poiShowNum[dwkey] = i+1;		//保存列表的位置
				myAroundObj.poiList.poiList[myAroundObj.poiList.xyList[x + "_" + y]].push(dwkey);
			}
			//提交地图显示
			//Results.m_aObj[flag].setFocusScript(myAroundObj);
			bs.setFocusScript(myAroundObj);
			bs.show(outStr);
			bs.focusScript();
			//Results.show(flag,outStr);
			outstr = null;
			var tcount = 0;
			if(m_sUserAgent == "msie"){
				tcount = xmlObj.selectSingleNode("root/Content/Companies").getAttribute("totalCount");
			}else if(m_sUserAgent == "firefox"){
				tcount = xmlObj.firstChild.childNodes[1].childNodes[2].getAttribute("totalCount");
			}
			//显示分页
			bs.createDiv("showPage_" + flag);
			creatPage("showPage_" + flag,10,sUrl,flag,parseInt(tcount),"startAroundSearch('','','','','','',","",1,"");
		}
	};	
	xmlObj.load(encodeURI(sUrl + pageno));
};
//周边查询对象
function AroundSolution(){
	this.centerName  = "";	//中心点名称
	this.centerX = 0;		//中心点加密经度
	this.centerY = 0;		//中心点加密纬度
	this.distance = 0;		//查询的周边距离
	this.poiList = new POIList();	//查询后得到的周边名址列表对象（POIList对象）
	this.showObj = null;
	this.toMap = function(){
		//显示周边点
		this.poiList.toMap();
		//显示中心点
		this.showCenter();
	};
	this.showCenter = function(){
		var tempAround = this;		
		this.showObj = new wingBasePoint("Around_" + this.centerName,this.centerX,this.centerY);
		var tempObj = new wingPicObj();
		tempObj.sImageSrc = "images/icon/center.png";		//图片地址
		tempObj.nImageWidth = 27;		//图片长
		tempObj.nImageHeight = 28;		//图片高
		tempObj.sAlt = this.centerName;
		tempObj.nScreenX = 0;			//图片热点相对坐标x
		tempObj.nScreenY = -28;			//图片热点相对坐标y		
		tempObj.onclick = function(){			
	//		var showContent = publicSearch.getSearch("Around_"+ tempAround.centerName,"我的位置",tempAround.centerX,tempAround.centerY,richmap.getCity(),"0,1,2,3");
	//		showDialog(tempAround.centerName,370,200,tempAround.centerX,tempAround.centerY,richmap.getCity(),showContent,"");
			richmap.zoomToPosition(tempAround.centerX,tempAround.centerY,parseInt(richmap.getWidth()*0.5),parseInt(richmap.getHeight()*0.7),richmap.getLayer());
		};
		tempObj.onmouseover = function(){
			try{wEMouseOver("Around_" + tempAround.centerName);}catch(e){}
		};
		this.showObj.addObj(tempObj);
		var textObj = new wingTextObj();
		textObj.sText = this.centerName;
		textObj.nScreenX = 27;
		textObj.nScreenY = -28;
		//textObj.sTextType = "HTML";
		textObj.sSize = "12px";
		textObj.sColor = "red";
		textObj.sBorder = "solid 1px red";
		textObj.sPadding = "2px";
		textObj.sBgColor = "#ffffff";
		textObj.onmouseover = function(){
			try{wEMouseOver("Around_" + tempAround.centerName);}catch(e){}
		};
		this.showObj.addObj(textObj);
		richmap.showElement(this.showObj);
		return true;
	};
};
var POIHashTable  = new Array();	//POI HashTable 用于保存POI对象
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 = $("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);
	};
};
//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();
			tempPOI.openDomain();
		};
		this.showObj.addObj(tempObj);	
		var textObj = new wingTextObj();
		textObj.sText = "<nobr>" + this.name + "</nobr>";
		//textObj.sTextType = "HTML";
		textObj.sSize = "12px";
		if(this.isVipUser == "false"){
			textObj.nScreenX = 12;
			textObj.nScreenY = -27;
			textObj.sColor = "#000000";
			textObj.sBorder = "solid 1px #943008";
			textObj.sBgColor = "#FFFFFF";
		}else{
			textObj.nScreenX = 13;
			textObj.nScreenY = -29;
			textObj.sColor = "red";
			textObj.sBorder = "solid 1px red";
			textObj.sBgColor = "#F7F7CE";
		}
		textObj.sPadding = "2px";
		textObj.onmouseover = function(){
			try{wEMouseOver("POI_" + tempPOI.id);}catch(e){}
		};
		this.showObj.addObj(textObj);
		richmap.addWingElement(this.showObj);
	};
	
	this.onclick = function(type){
		var showContent = "";
		var tempPoiObj = this;
		var tempComPoi = this;
		var smsUrl = "";
		if(this.isVipUser == "true" && this.getNamecardInfo == false){
			//读取名片信息
			//sData_namecard = "com/ncserv?act=CARDINFO&poiid=?poiid?&csize=?csize?&psize=?psize?";
			var sUrl = sData_basePath + sData_namecard;
			sUrl = sUrl.replace("?poiid?",this.id);
			sUrl = sUrl.replace("?csize?","5");
			sUrl = sUrl.replace("?psize?","1");
			//开始异步查询
			var xmlObj = Sarissa.getDomDocument();
			xmlObj.async = true;
			xmlObj.onreadystatechange = function(){
				if(xmlObj.readyState == 4){
					if(xmlObj.parseError!=0){
						tempPoiObj.isVipUser = "false";
						tempPoiObj.onclick();
						//Results.m_aObj[flag].show("xml载入错误！错误描述:\r\n"+Sarissa.getParseErrorText(xmlObj));
						return false;
					}
					try{
						var testNode = "";
						if(m_sUserAgent == "msie"){
							testNode = xmlObj.selectSingleNode("root/Return").text;
						}else if(m_sUserAgent == "firefox"){
							testNode = Sarissa.getText(xmlObj.firstChild.firstChild,true);
						}
						if(testNode == "0"){
							tempPoiObj.isVipUser = "false";
							tempPoiObj.onclick();
							//Results.m_aObj[flag].show(xmlDocArr[sFlag].selectSingleNodes("root/Error").text);
							return false;
						}
					}catch(e){
						tempPoiObj.isVipUser = "false";
						tempPoiObj.onclick();
						return false;
					}
					//解析数据
					var myNode = null;
					if(m_sUserAgent == "msie"){
						myNode = xmlObj.selectSingleNode("root/Content/NameCard");
					}else if(m_sUserAgent == "firefox"){
						myNode = xmlObj.firstChild.childNodes[1].firstChild;
					}
					//var poiId = myNode.selectSingleNode("PoiID").text;
					var imgNode = null;
					if(m_sUserAgent == "msie"){
						if(type==1){
							tempPoiObj.name = myNode.selectSingleNode("CompanyCnName").text;
							tempPoiObj.address = myNode.selectSingleNode("CnAddress").text;
							tempPoiObj.province = myNode.selectSingleNode("Province").text;	
							tempPoiObj.city = myNode.selectSingleNode("City").text;	
							tempPoiObj.county = myNode.selectSingleNode("County").text;
							tempPoiObj.screenX = myNode.selectSingleNode("ScreenX").text;
							tempPoiObj.screenY = myNode.selectSingleNode("ScreenY").text;
							tempPoiObj.phone = myNode.selectSingleNode("Tel").text;
						}
						tempPoiObj.profile = myNode.selectSingleNode("Profile").text;
						tempPoiObj.email = myNode.selectSingleNode("Email").text;
						tempPoiObj.namecardId = myNode.selectSingleNode("CardID").text;
						tempPoiObj.domainName = myNode.selectSingleNode("DomainName").text;
						imgNode = myNode.selectSingleNode("Images").childNodes;
					}else if(m_sUserAgent == "firefox"){
						if(type==1){
							tempPoiObj.name = Sarissa.getText(myNode.childNodes[3]);
							tempPoiObj.address = Sarissa.getText(myNode.childNodes[4]);
							tempPoiObj.province = Sarissa.getText(myNode.childNodes[6]);
							tempPoiObj.city = Sarissa.getText(myNode.childNodes[7]);	
							tempPoiObj.county = Sarissa.getText(myNode.childNodes[8]);
							tempPoiObj.screenX = Sarissa.getText(myNode.childNodes[9]);
							tempPoiObj.screenY = Sarissa.getText(myNode.childNodes[10]);
							tempPoiObj.phone = Sarissa.getText(myNode.childNodes[11]);
						}
						tempPoiObj.profile = Sarissa.getText(myNode.childNodes[15]);
						tempPoiObj.email = Sarissa.getText(myNode.childNodes[14]);
						tempPoiObj.namecardId = Sarissa.getText(myNode.childNodes[0]);
						tempPoiObj.domainName = Sarissa.getText(myNode.childNodes[2]);
						imgNode = myNode.childNodes[16].childNodes;
					}
					for(var i=0;i<imgNode.length;i++){
						tempPoiObj.imgArr[i] = new Array();
						tempPoiObj.imgArr[i]["url"] = imgNode[i].getAttribute("imgUrl");
						if(m_sUserAgent == "msie"){
							tempPoiObj.imgArr[i]["name"] = imgNode[i].text;
						}else if(m_sUserAgent == "firefox"){
							tempPoiObj.imgArr[i]["name"] = Sarissa.getText(imgNode[i]);
						}
					}
					var proNode = null;
					if(m_sUserAgent == "msie"){
						proNode = myNode.selectSingleNode("Products").childNodes;
					}else if(m_sUserAgent == "firefox"){
						proNode = myNode.childNodes[17].childNodes;
					}
					for(var i=0;i<proNode.length;i++){
						tempPoiObj.products[i] = new Array();
						tempPoiObj.products[i]["link"] = proNode[i].getAttribute("detailurl");
						tempPoiObj.products[i]["imgurl"] = proNode[i].getAttribute("imgUrl");
						if(m_sUserAgent == "msie"){
							tempPoiObj.products[i]["content"] = proNode[i].text;
						}else if(m_sUserAgent == "firefox"){
							tempPoiObj.products[i]["content"] = Sarissa.getText(proNode[i]);
						}
					}
					tempPoiObj.getNamecardInfo = true;
					tempPoiObj.show();
				}
			};
			xmlObj.load(sUrl);
			return false;
		}else if(this.getNamecardInfo == true && this.isVipUser == "true"){
			//显示地图名片
			//显示上面部分
			smsUrl = encodeURI(smsBase + "名称："+this.name.replace(/\<[^>]*\>/g,"")+" 地址："+this.address.replace(/\<[^>]*\>/g,"")+" 电话："+this.phone+" Email："+this.email);
			showContent += "<div style='width:100%;padding:5px;position:relative;height:120px;'>"
						+ "<div style='position:absolute;left:0px;top:0px;padding:1px;border:solid 1px #999999'><img src='"+ (this.imgArr[0]!=null?(sData_basePath+this.imgArr[0]["url"]):"images/nopic.gif") + "' width='120' height='120'></div>"
						+ "<div style='position:absolute;left:135px;top:0px;'>"
						+ "<span style='font-size:14px;color:#18397C;font-weight:bold;line-height:20px;'>" + this.name + "</span><br>"
						+ "<b>地址：</b>" + this.address + "<br>"
						+ "<b>电话：</b>" + this.phone + "<br>"
						+ "<b>Email：</b>" + this.email + "<br>"
						+ "<b>详情：</b><a href='http:\/\/"+this.domainName+".vip.richmap.cn/' target='_blank'>http:\/\/"+this.domainName+".vip.richmap.cn/</a><br>"
						+ "<a href='javascript:void(0);' onClick=\"window.showModalDialog('"+smsUrl+"', '','"+dialogArgument+"')\"><img src='images/map/mobile.gif' border='0'></a>"
						+ "</div>"
						+ "</div><br>";
			//简介
			/*showContent += "<div style='width:100%;padding:5px;position:relative;color:#999999'>" + this.profile.atrim().substring(0,100) + "...</div>";*/
			//产品信息
			var productStr = '<div class="cContent" style="display:?dis?;height:80px;">';
			var tempLeft = 10;
			if(this.products.length==0)productStr += "暂无产品信息";
			for(var i=0;(i<this.products.length) && (i < 4);i++){
				productStr += '<div style="position:absolute;left:'+tempLeft+'px;right:0px;cursor:pointer;"><a href="javascript:void(0);" title="'+this.products[i]["content"]+'" onclick="';
				if(this.products[i]["link"] != null&&this.products[i]["link"]!=""){
					productStr += 'self.open(\'' + this.products[i]["link"] + '\');';
				}
				productStr += '"><img style="border:solid 1px #999999" src="'+ sData_basePath + this.products[i]["imgurl"]+'"><br>';
				if(this.products[i]["content"]!=null)productStr += (this.products[i]["content"].length<6?this.products[i]["content"]:(this.products[i]["content"].substring(0,5)+'...'));
				productStr += '</a></div>';
				tempLeft += 80;
			}
			productStr += '</div>';
	//		publicSearch.labelArr[4]["content"] = productStr;
	//		showContent += publicSearch.getSearch(this.id,this.name,this.screenX,this.screenY,this.citycode,"4,0,1,2",1);
			//richmap.showDialog(this.screenX,this.screenY,400,300,showContent);
	//		showDialog(this.name,370,300,this.screenX,this.screenY,this.citycode,showContent,this.domainName);
		}else if(this.isVipUser == "false" && this.name == ""){
			//读取名片信息
			//sData_poi = "search?act=searchpoi&dwkey=?dwkey?";
			var poiUrl = sData_basePath + sData_poi;
			poiUrl = poiUrl.replace("?dwkey?",this.id);
			//开始异步查询
			var xmlObj = Sarissa.getDomDocument();
			xmlObj.async = true;
			xmlObj.onreadystatechange = function(){
				if(xmlObj.readyState == 4){
					if(xmlObj.parseError!=0){
						return false;
					}
					try{
						var testNode = "";
						if(m_sUserAgent == "msie"){
							testNode = xmlObj.selectSingleNode("root/Return").text;
						}else if(m_sUserAgent == "firefox"){
							testNode = Sarissa.getText(xmlObj.firstChild.firstChild,true);
						}						
						if(testNode == "0"){
							return false;
						}
					}catch(e){
						return false;
					}
					//解析数据
					var myNode = null;
					if(m_sUserAgent == "msie"){
						myNode = xmlObj.selectSingleNode("root/Content/Company");
						//var poiId = myNode.selectSingleNode("PoiID").text;
						tempComPoi.name = myNode.selectSingleNode("Name").text;
						tempComPoi.address = myNode.selectSingleNode("Address").text;
						tempComPoi.province = myNode.selectSingleNode("Province").text;	
						tempComPoi.city = myNode.selectSingleNode("City").text;	
						tempComPoi.county = myNode.selectSingleNode("County").text;
						tempComPoi.screenX = myNode.selectSingleNode("ScreenX").text;
						tempComPoi.screenY = myNode.selectSingleNode("ScreenY").text;
						tempComPoi.phone = myNode.selectSingleNode("Phone").text;
					}else if(m_sUserAgent == "firefox"){
						myNode = xmlObj.firstChild.childNodes[1].firstChild;
						//var poiId = myNode.selectSingleNode("PoiID").text;
						tempComPoi.name = Sarissa.getText(myNode.childNodes[7]);
						tempComPoi.address = Sarissa.getText(myNode.childNodes[8]);
						tempComPoi.province = Sarissa.getText(myNode.childNodes[2]);	
						tempComPoi.city = Sarissa.getText(myNode.childNodes[3]);	
						tempComPoi.county = Sarissa.getText(myNode.childNodes[4]);
						tempComPoi.screenX = Sarissa.getText(myNode.childNodes[5]);
						tempComPoi.screenY = Sarissa.getText(myNode.childNodes[6]);
						tempComPoi.phone = Sarissa.getText(myNode.childNodes[9]);
					}
					tempPoiObj.show();
				}
			};
			xmlObj.load(poiUrl);
			return false;
		}else{
			//showContent += "<div><b>"+this.name+"</b></div>";
			smsUrl = encodeURI(smsBase + "名称："+this.name.replace(/\<[^>]*\>/g,"")+" 地址："+this.address.replace(/\<[^>]*\>/g,"")+"电话："+this.phone);
			if(this.address != "")showContent += "<div>地址：" + this.address + "</div>";
			if(this.phone != "")showContent += "<div>电话：" + this.phone + "</div>";
		//  showContent += "<div><a href='javascript:void(0);' onClick=\"window.showModalDialog('"+smsUrl+"', '','"+dialogArgument+"')\"><img src='images/map/mobile.gif' border='0'></a></div>";
		//	if(this.isPOI)showContent += "<div align='right'><a href='"+sData_basePath+"page/poi_"+this.id+".html' target='_blank'>详情 &gt;&gt;</a></div>";
		//	showContent += "";
		//	showContent += publicSearch.getSearch(this.id,this.name,this.screenX,this.screenY,this.citycode,"0,1,2,3");
			//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);
	};
	this.openDomain = function (){
		if(this.isVipUser =="true" && this.domainName !=""){
			window.open("/richmap/page/pob_"+this.domainName+".html?req="+Math.random());
		}else{
		if(confirm("还没有地图名片，帮忙申请一个。")){
				window.open("/richmap/vip/join.jsp");
			}
		}
	}
};