var _m,_cv;
(function(){
var g={path:'map412/',city:{map:'全国',bus:"北京",appid:"1421",nav:"全国",isBus:true,isNav:true,isUrlBusInfo:false,isUrlBus:false,isUrlNav:false},size:{busMiddleContainerHeight:0,busFinalContainerHeight:0,navMiddleContainerHeight:0},appCode:false
,engine:'http://lspengine4.go2map.com/WebSite/Engine'
,vamengine:'http://map.sogou.com/vamengine/VamEngine.do'
,savemapengine:'http://lspengine4.go2map.com/MapRendition/Engine'
,saveImgUrl:'http://lspengine4.go2map.com/MapRendition/GetRender'
,suggestengine:'http://lspengine4.go2map.com/WebSite/KeyWordPrompt?'
,itemUrl:"http://map.sogou.com/poi"
,APPID:'1361',SPInfo:'1,1',UserInfo:',,',ScriptType:'jsp',toolboxOn:false,mapOffsetLeft:[2,296,290]
,rps:'SDS==<custom>!!hidden_MapTool==map.EntireMap!!hidden_DISABLEQDS==true!!hidden_APPID==1361'
,sds:{id:270,name:" ",caption:" ",areaId:0,areaid:0,defaultLevel:5,defaultdisplevel:5,defaultCX:11950000,defaultdispcx:11950000,defaultCY:4150000,defaultdispcy:4150000,rmp:{id:174,name:"",caption:"",mp:{mplevel:[{caption:"",cellcountx:653,cellcounty:566,cellheight:256,cellwidth:256,deltax:64000,deltay:64000,id:719,zoompercell:64000,zoomperpixel:250,zoomscreen:256000},{caption:"",cellcountx:2609,cellcounty:2262,cellheight:256,cellwidth:256,deltax:16000,deltay:16000,id:717,zoompercell:16000,zoomperpixel:62.5,zoomscreen:64000},{caption:"",cellcountx:10436,cellcounty:9046,cellheight:256,cellwidth:256,deltax:4000.00000000003,deltay:4000,id:715,zoompercell:4000,zoomperpixel:15.6250000000001,zoomscreen:16000},{caption:"",cellcountx:41742,cellcounty:36184,cellheight:256,cellwidth:256,deltax:1000.00000000003,deltay:1000,id:713,zoompercell:1000,zoomperpixel:3.90625000000011,zoomscreen:4000},{caption:"",cellcountx:166968,cellcounty:144736,cellheight:256,cellwidth:256,deltax:249.999999999971,deltay:250,id:711,zoompercell:250,zoomperpixel:0.976562499999886,zoomscreen:1000},{caption:"",cellcountx:2,cellcounty:2,cellheight:256,cellwidth:256,deltax:32768000,deltay:32768000,id:728,zoompercell:32768000,zoomperpixel:128000,zoomscreen:131072000},{caption:"",cellcountx:6,cellcounty:5,cellheight:256,cellwidth:256,deltax:8192000,deltay:8192000,id:726,zoompercell:8192000,zoomperpixel:32000,zoomscreen:32768000},{caption:"",cellcountx:21,cellcounty:18,cellheight:256,cellwidth:256,deltax:2048000,deltay:2048000,id:724,zoompercell:2048000,zoomperpixel:8000,zoomscreen:8192000},{caption:"",cellcountx:82,cellcounty:71,cellheight:256,cellwidth:256,deltax:512000,deltay:512000,id:722,zoompercell:512000,zoomperpixel:2000,zoomscreen:2048000},{caption:"",cellcountx:11,cellcounty:9,cellheight:256,cellwidth:256,deltax:4096000,deltay:4096000,id:725,zoompercell:4096000,zoomperpixel:16000,zoomscreen:16384000},{caption:"",cellcountx:41,cellcounty:36,cellheight:256,cellwidth:256,deltax:1024000,deltay:1024000,id:723,zoompercell:1024000,zoomperpixel:4000,zoomscreen:4096000},{caption:"",cellcountx:3,cellcounty:3,cellheight:256,cellwidth:256,deltax:16384000,deltay:16384000,id:727,zoompercell:16384000,zoomperpixel:64000,zoomscreen:65536000},{caption:"",cellcountx:164,cellcounty:142,cellheight:256,cellwidth:256,deltax:256000,deltay:256000,id:721,zoompercell:256000,zoomperpixel:1000,zoomscreen:1024000},{caption:"",cellcountx:327,cellcounty:283,cellheight:256,cellwidth:256,deltax:128000,deltay:128000,id:720,zoompercell:128000,zoomperpixel:500,zoomscreen:512000},{caption:"",cellcountx:1305,cellcounty:1131,cellheight:256,cellwidth:256,deltax:32000,deltay:32000,id:718,zoompercell:32000,zoomperpixel:125,zoomscreen:128000},{caption:"",cellcountx:5218,cellcounty:4523,cellheight:256,cellwidth:256,deltax:8000.00000000006,deltay:8000,id:716,zoompercell:8000,zoomperpixel:31.2500000000002,zoomscreen:32000},{caption:"",cellcountx:20871,cellcounty:18092,cellheight:256,cellwidth:256,deltax:1999.99999999997,deltay:2000,id:714,zoompercell:2000,zoomperpixel:7.81249999999989,zoomscreen:8000},{caption:"",cellcountx:83484,cellcounty:72368,cellheight:256,cellwidth:256,deltax:499.999999999971,deltay:500,id:712,zoompercell:500,zoomperpixel:1.95312499999989,zoomscreen:2000},{caption:"",cellcountx:524288,cellcounty:524288,cellheight:256,cellwidth:256,deltax:125,deltay:125,id:792,zoompercell:125,zoomperpixel:0.48828125,zoomscreen:500}],caption:"",id:"",maxx:32768000,maxy:32768000,minx:-32768000,miny:-32768000}},vmp:{id:"",name:"",caption:""},qds:{},dom:{}}
};
g.StyleLibraryRoot=g.path+'lib/style/';
g.msFeatures=[];
g.hotc=[];
g.city={name:"",c:""};

function resizePage(){var a=_el("maparea");var s=document.body.clientHeight-27;if(s<=20)return;a.style.height=s+"px";if(_m)	_m.map.onResize()}


function initMap()
{
	function gp(a){return _getParameter(a)}
	function shb(a){if(a){a=a.split(",");if(_m)_m.setHyBrid(a[0]=="1",a[1]=="1")}}
	var a=_el("maparea"),c=gp("c"),city=gp("city"),dc=getCookie("sogoumapdefaultcity"),lq=gp("lq"),hb=gp("hb"),appid=gp("appid");
	//appid=!appid?"1361":appid;
	g.detailURL=g.path+"detail2.jsp?appid="+appid+"&cpid=%cpid%&dataid=%dataid%&uid=%uid%";
	if(!lq) lq=gp("kw");
	_cv=new ConvertorLLndMC();
	_m=new MapClient(a);
	_m.setEngineURL(g.engine);
	_m.setStyleLibraryRoot(g.StyleLibraryRoot);
	_m.setAppId(appid);
	_m.isInfoWinAutoOpen=false;
	if(c)
	{
		c=c.split(",");		
		_m.coordRecenterTo(c[0],c[1],c[2]);
		//if(lq) G.isFixView=true;
	}
	_m.createMapArea();
	shb(hb);
	Event.addListener(_m,"sdschange",function(a)
	{
		StyleLib.preLoadStyle("preloadstyles");
		initService();
	});
	if(!appid)
	{
		_m.setSds(g.sds);
		_m.mapProcess.callback(g.rps);
	}
	else
	{
		var etm	=new EntireMapOperation(_m);
		etm.submit();
	}
}
function creatDom(o,parentNode){function applyStyles(el, styles){function setStyle(el,prop, value){if(!el||typeof value !="string") return;prop=prop?prop:"";value=value?value:"";el.style[prop]=value;return el};if(!styles)	return;if(typeof styles == "string"){var re = /\s?([a-z\-]*)\:\s?([^;]*);?/gi,matches;while ((matches = re.exec(styles)) != null){setStyle(el,matches[1], matches[2])}}else if (typeof styles=="object"){for (var style in styles){setStyle(el,style,styles[style])}}};var el=document.createElement(o.tag||'div'),useSet=el.setAttribute?true:false; for(var attr in o){if(attr=="tag"||attr=="children"||attr=="cn"||attr=="html"||attr=="style"||typeof o[attr]=="function") continue;if(attr=="cls"){el.className = o["cls"];}else{if(useSet) el.setAttribute(attr,o[attr]);else el[attr] = o[attr];}}if(o.html){el.innerHTML=o.html;}applyStyles(el,o.style);if(parentNode){parentNode.appendChild(el);}return el}	
g.creatDom=creatDom;
window.G=g;
window.resizePage=resizePage;
window.initMap=initMap;
})();
function ce(a){return document.createElement(a)}
function ct(a){return document.createTextNode(a)}
function ci(){var b=ce("iframe");b.setAttribute("frameborder","0",0);return b}
function ap(a,b){a.appendChild(b)}
function px(a){return a+"px"}
function pa(a){a.style.position="absolute"}
function lf(a,b){a.style.left=px(b)}
function tp(a,b){a.style.top=px(b)}
function wd(a,b){a.style.width=px(b)}
function ht(a,b){a.style.height=px(b)}
function cd(a){var b=ce("div");if(a) b.id=a;return b}
function cc(a){var b=ce("div");b.className=a;return b}
function cbtn(a){var b=ce("input");b.type="button";b.value=a;return b}
function el(a){return document.getElementById(a)}
function d0(a){a.style.display="none"}
function d1(a){a.style.display="block"}
function gts(a,b){return a.getElementsByTagName(b)}
function gt(a,b){var c=gts(a,b);return c&&c.length>0?c[0]:null}
function ga(a,b){return a.getAttribute(b)}
function sa(a,b,c){a.setAttribute(b,c)}
function sz(a,b){a.style.zIndex=b}
function sv(a,b){if(a&&b!=null)_el(a).value=b}

function _loadScript(url,id){var a=document.getElementById(id),b=document.createElement("script");b.type="text/javascript";b.charset="GB2312";b.id=id;b.src=url ;document.getElementsByTagName('body')[0].replaceChild(b,a);}
function getPageURL(a){var a=a?a:window.location.href,b,c;b=a.indexOf("?");if(b>-1) a=a.substring(0,b);c=a.indexOf("#");if(c>-1) a=a.substring(0,c);return a}
function getState(){if(_m)return [_m.getCenterX(),_m.getCenterY(),_m.getLevelIndex()]}
function getService(a,b){if(a&&b){var ab=a.split("!!");for(var i=0;i<ab.length;i++){var ac=ab[i].split("==");if(ac[0]==b){return ac[1];}}return "";}}
function _parseDomFromString_(a){var aa = a.getResult("Wmsxml");var dom;if (aa!=""){aa=(aa.indexOf("<?xml version=")>-1?'':'<?xml version="1.0" encoding="GB2312"?>')+aa;dom = _getDomFromString(aa);}if(dom)	{return dom;}else{return false;}}
function addFavorite(){var a="搜狗Sogou--地图搜索";var b;b=window.location.href;if (typeof window.sidebar=='object'&&typeof window.sidebar.addPanel=='function'){window.sidebar.addPanel(a,b,"")}else{window.external.AddFavorite(b,a); }}

function blurPoint(a,b,c){if(a){if(b){b.style.backgroundColor="";b.style.borderTop="1px solid #FFF";b.style.borderBottom="1px solid #FFF";}var i=_m.getFeatureById(a);if(i&&!c){var iw=_m.map.infoWindow;if(iw&&iw.feature&&iw.feature==i&&iw.isVisible())	return;i.element.blur();var b=i.element.label;if(b&&i.label.on=="false")b.style.visibility="hidden";}}}
function focusPoint(a,b,c){if(a){if(b){b.style.backgroundColor="#EAEAEA";b.style.borderTop="1px dashed gray";b.style.borderBottom="1px dashed gray";}var i=_m.getFeatureById(a);if(i&&!c){i.element.focus();var b=i.element.label;if( b )b.style.visibility="visible";}}}
function loadData(a){cleanMapAreaMark();drawFeatures(a,null,null,null,G.isFixView);if(G.isFixView){var b=_getParameter("iw"),c;if(b){c=_m.getFeatureById(b);if(c)_m.setTimeout(_m.showInfoWindow,500,c)}}G.isFixView=false}
function getMapResultFactory(a){var b=new MapResultFactory();b.setResult(a);return b;}
function drawPoint(a,fs){try{if(vsc) vsc.close();cleanMapAreaMark(2);var f=_m.getFeatureById(a),b,c,d,e,g;b=!f;if(b||f.type!="S"){fs=!fs?G.msFeatures:fs;for(var i=0;i<fs.length;i++){c=fs[i].id;if(c=="COPY_"+a) d=fs[i];else if(c==a) f=fs[i];if((f&&d)||(f&&f.type=="S")) break;}if(b) _m.map.addFeature(f);if(f.type!="S"&&d&&!_m.getFeatureById(d.id)) _m.map.addFeature(d);}var l=f.level;if(f.type!="S") _m.adjustMapFitFeature(f,14);else if (l){g=_m.getLevelIndex();l=parseInt(l);l=l>g?l:g;e=f.bounds,x=(e.minX+e.maxX)/2,y=(e.minY+e.maxY)/2;_m.coordRecenterTo(x,y,l)}_m.showInfoWindow(!d?f:d);}catch(e){alert("drawPoint()::"+e.description)}}
function getCluster(a){var b=G.ifrmClusterRqst;if(!b){b=G.ifrmClusterRqst=ci();ap(document.body,b);d0(b)}b.src=G.path+"cluster.html?id="+a}
function drawXY(a,b,c,d,e){return _m.map.addPoint(a,b,c,'',d,{"on":"true","style":e})}
function getDeCode(a){if(a&&a.indexOf("%")>-1){try{var d=_getDomFromFile(G.path+"inc/decode.jsp?w="+a);a=d.selectSingleNode( "/Data" ).getAttribute("word");}catch(e){}}return a}
function getEnCode(a){try{var d=_getDomFromFile(G.path+"inc/encode.jsp?w="+a);a=d.selectSingleNode( "/Data" ).getAttribute("word");}catch(e){}return a}
function removeFeatrues(a){if (!a)	return;var fs,b,c;if(a.features){fs=a.features;}else {fs=a}if(_m) {b=_m.map;c=b.infoWindow}for(var i=0;i<fs.length;i++){_m.map.removeFeature(fs[i]);if(c&&c.feature==fs[i]) b.closeInfoWindow();}}
function clearArray(a){while(a.length>0){var i=a.length-1;a.pop();return a}}
function showCityList(f,c,d,e){var id="dialog_citylist",a=G.cityListDialog,b;G.cityListDlgSrc=f;function u(z){z=z||window.event;var v=!z.target?z.srcElement:z.target;if(f&&v!=G.cityListDlgSrc)a.close()};if(!a){a=new Dialog(id,460,300,148,145);sz(a.div,2008);ap(a.title,ct("城市列表"));b=ci();a.iframe=b;pa(b);lf(b,2);tp(b,2);wd(b,456);ht(b,271);ap(a.body,b);G.cityListDialog=a;Event.addBuiltInListener(document,"click",u);a.div.onclick=function(z){_stopEvent(z)}}a.show();c=!c?"mapcitylist2.jsp":c;a.iframe.src=G.path+c+(c.indexOf("?")>-1?"&":"?")+"el="+id;a.setLeftTop(!d?148:d,!e?145:e);}
function replaceCity(a){if(a){a=a.replace("市","");return a;}}
function getCookieVal(offset){var endstr=document.cookie.indexOf(";",offset);if(endstr==-1)endstr=document.cookie.length;return unescape(document.cookie.substring(offset,endstr));}
function getCookie(name){var arg=name+"=",alen=arg.length,clen=document.cookie.length;var i=0;while(i<clen){var j=i+alen;if(document.cookie.substring(i,j)==arg)return getCookieVal(j);i=document.cookie.indexOf(" ",i)+1;if(i==0)break;}return null;}
function setCookie(name,value){var argv=arguments;var argc=argv.length;var date = new Date();date.setTime(date.getTime()+31536000);var expires=(2<argc)?argv[2]:date;var path="/";var domain=null;var secure=false;document.cookie=name+"="+escape(value)+((expires==null)?"":("; expires="+expires.toGMTString()))+((path==null)?"":("; path="+path))+((domain==null)?"":("; domain="+domain))+((secure==true)?"; secure":"");}
function setCity(a,b){var d=getState();d=!d?"":d.join(",");if(a)G.city.name=a;G.city.c=!b?d:b;if(toolbox)toolbox.setNowCity(G.city.name+","+G.city.c,true);}
function transformNode(a,b,c,d){try{if (typeof(a)=="string"){a=_getDomFromString(a);}g=StyleLib.baseURL+b;h=XmlStyleSheet.getCached(g);if(!h){h=XmlStyleSheet.create(_getDomFromFile(g));XmlStyleSheet.cache(g,h);}h.transformToHTML(a,c);}catch(ex){}}
function autoSubmitSearch(a){if(a){submitLocalQuery({what:a});}}
function vMapCitys(){var a=_el("city").value,b=G.city;if((b.name&&a!=b.name)||_el("map_panel_result").innerHTML==""){submitLocalQuery({init:b.name});}}
function voidCitys(a){if(!a)return;function mapcitys(a){a=a?replaceCity(a):'全国';if(document.all){_el("search_city").innerText=a;}else{_el("search_city").textContent=a;}sv("city",a);}if(typeof a=="object"){a.city=getDeCode(a.city);a.city=(a.city=="ALL"?"全国":a.city);setCity(a.city);mapcitys(a.city);}}
function resetQueryState(){sv("where","");sv("fType","Name");sv("page","1");sv("dataSet","2");sv("radius","");sv("vam","0");sv("init","");sv("c","");}
function submitLocalQuery(a){var c,d;if(a){if(a.city){a.city=a.city.split(":");c=a.city[0];voidCitys({city:c})}if(!c&&a.init) c=a.init;if(c){c=(c=="ALL"?"全国":c);}if(a.c){d=a.c.split(",")}if(a.what)sv("query",a.what);sv("where",a.where?a.where:"");sv("fType",a.type?a.type:"Name");sv("page",a.page?a.page:"1");sv("dataSet",a.dataSet?a.dataSet:"2");sv("radius",a.radius?a.radius:"");sv("vam",a.vam?a.vam:"0");sv("init",a.init?a.init:"");sv("c",a.c?a.c:"");}el("map_form").submit()}
function cleanMapAreaMark(a){try{if(_m)_m.map.closeInfoWindow();removeFeatrues(G.msFeatures)}catch(e){}}
function showErrorMsg(a){var b=_el("errTxt");d1(_el("errDialog"));b.innerHTML=a;}



function drawFeatures(a,b,c,d,e,z)//(xmldom,styleIds,lable{on:"true|false",style:""},detailURL,isFixView,FeatrueNodes)
{
	try
	{
		if(!a) {Log.write("drawFeatures() error.");return};
		var f,f2,h,i,r,p=null,dn,ds,fs,rt,sid,st,cpid,did,cg,bd,lbd=new Bounds(),x,y,fl=0,pf,id;
		if(!z) z=G.msFeatures=[];
		else {removeFeatrues(z);clearArray(z)}
		function gd(a,b,c,d){return a.replace(/%cpid%/g,b).replace(/%dataid%/g,c).replace(/%uid%/g,d)+(b=="246"?"&vam=1":"")};
		r=gt(a,"Response");
		ds=ga(r,"dataset");
		r=gt(a,"Data");
		pf=ga(r,"prefix");
		pf=!pf?"":pf;
		if(r)
		{
			fs=gts(r,"Style");
			for(i=0;i<fs.length;i++)
			{
				sa(fs[i],"id",ga(fs[i],"id").substring(0,1)+"01")
			}			
			dn=DataNode.loadFromXML(r);
			fs=dn.features;
			fl=fs.length;
			if(fl&&fl>0)
			{
				r=gt(a,"Ref");
				if(r)
				{
					f2=gt(r,"Feature");
					if(f2)
					{
						var ra=ga(f2,"radius"),f3,pc,bc;
						f2=FeatureNode.loadFromXML(f2);	
						f2.id="QA_"+f2.id;
						f2.isQA=true;
						fs.push(f2);
						if(ra)
						{
							ra=parseInt(ra)/2;
							pc=f2.points[0];
							bc=_cv.boundByMC(pc,ra);
							bc=new Bounds(bc[0],bc[1],bc[2],bc[3]);
							lbd.clone(bc);
							f3=f2.clone();
							f3.id="R"+f2.id;
							f3.type="R";
							f3.bounds=bc;
							f3.style=StyleLib.getStyleById("R12");
							f3.xml=null;
							f3.isQA=true;
							//_m.map.addFeature(f3);
							_m.setQueryArea(f3);
							z.push(f3);
						}
						
					}
				}
				for(i=0;i<fs.length;i++)
				{
					f=fs[i],fx=f.xml;
					id=f.id;
					f.id=(!f.isQA?pf:"QA_")+id;
					cpid=ga(fx,"cpid");
					did=ga(fx,"dataid");
					cg=ga(fx,"catalog");
					f.level=ga(fx,"level");
					//cl=ga(fx,"clustering");
					bd=f.bounds;
					sid="S8"+(ds=="0"?"5":"4")+i;
					if(b&&b.length>0)
					{
						if(b.length==1) sid=b[0];
						else sid=!b[i]?sid:b[i];
					}
					if(i<10) st=StyleLib.getStyleById(sid);
					if(lbd.isNull()) lbd.clone(bd);
					else lbd=Bounds.merge(lbd,bd);
					switch (f.type)
					{
						case "R":
							x=(parseFloat(bd.minX)+parseFloat(bd.maxX))/2;
							y=(parseFloat(bd.minY)+parseFloat(bd.maxY))/2;
						break;
						case "L":
							var ps,len,p1,p2;
							ps=f.segments;
							ps=!ps?f.points:ps[0];
							len=ps.length;p1=ps[len>>1];p2=ps[(len>>1)-1];
							if(len%2==0) {x=(p1.x+p2.x)/2;y=(p1.y+p2.y)/2}
							else{x=p1.x;y=p1.y}
						break;
						case "S":
							if(!f.isQA) f.style=st;
							else f.style=StyleLib.getStyleById("S1155");
						break;
					}			
					f.label.on=!f.isQA?(!c?"false":c.on):(did?"true":"false");
					f.label.style=!c?"F24":c.style;
					if(!f.isQA||did)
					{
						d=!d?G.detailURL:d;
						f.detail.src=gd(d,cpid,did,id);
						f.detail.width="271";
						f.detail.height=((cpid=="1"||cpid=="48")?"240":"280");
						f.detail.content="";
						if(f.detail.href=="") f.detail.href=G.itemUrl+"/"+cpid+"_"+did+".htm";
					}
					z.push(f);
					if(f.type!="S"&&!f.isQA)
					{
						p=f.clone();
						p.id="COPY_"+id;
						p.type="S";
						p.points=[new Point(x,y)];
						p.segments=[p.points];
						p.bounds=new Bounds(x,y,x,y);
						p.style=st;
						z.push(p);
						f=p;
					}
					_m.map.addFeature(f);
					if(f.type=="S"&&f.element)f.element.setZIndex(100-i*9);
				}
				f=new FeatureNode();
				f.type="R";
				f.bounds=lbd;
				if(!e){_m.map.closeInfoWindow();_m.adjustMapFitFeature(f,14)}
			}
		}
	}catch(ex){Log.write("drawFeatures():"+ex.description);}
}
 


function PopWin(a,b,c,d,e)
{
var t=this;
t.createWindow(b);
t.createContentArea();
t.createCloseButton();
ap(a,t.windowDiv);
if(!d) d=50;
if(!e) e=50;
t.setSize(d,e);
t.hide()
};
PopWin.prototype.createWindow=function(a)
{
var b,c,d,e,f,g,h,i,j,k,l,u="http://key.go2map.com/lib/images/popwin40/",t=this,r=Layer.createDiv,s=Layer.create;
b=t.window={};
c=b.title=r(1,1,1,27,3);
c.style.background="url("+u+"popwintitlebg.gif)";
d=b.body=r(28,1,1,1,3);
d.style.backgroundColor="#F0EDCD";
e=t.windowDiv=r(0,0,1,1,a);
e.onmousedown=t.onMouseDown;
e.onclick=t.onMouseDown;
f=t.shadowDiv=r(4,4,1,1,1);
f.style.backgroundColor="#000";
f.style.filter="alpha(opacity=30)";
f.style.opacity="0.3";
_setStyle(f,"noprint");
g=t.backDiv=r(0,0,1,1,2);
g.style.backgroundColor="#fff";
g.style.border="#7B6137 1px solid";
b.corner=[];
h=b.corner[0]=s(u+"lt.gif",21,23,-20,10,9,true);
d0(h);
i=b.corner[1]=s(u+"lt.gif",21,23,-20,0,9,true);
d0(i);
j=b.corner[2]=s(u+"rt.gif",21,23,0,10,9,true);
d0(j);
k=b.corner[3]=s(u+"rt.gif",21,23,0,0,9,true);
d0(k);
ap(e,c);
ap(e,d);
ap(e,f);
ap(e,g);
ap(e,h);
ap(e,i);
ap(e,j);
ap(e,k);
Event.addBuiltInListener(e,"mouseout",t.eventHandler("onMouseOut"));
Event.addBuiltInListener(e,"mouseover",t.eventHandler("onMouseOver"));
};
PopWin.prototype.createContentArea=function()
{
var a,b,t=this;
a=t.contentArea=Layer.createDiv(26,3,1,1,3);
_setCursor(a,"auto"); 
a.onmousedown=t.onMouseDown;
ap(t.windowDiv,a);
a=t.offscreenContainer=Layer.createDiv(-screen.height,-screen.width,screen.width,screen.height);
a.style.visibility="hidden";
ap(document.body,a);
a=t.offscreenArea=Layer.createDiv(26,3,null,null,3);
_setCursor(a,"auto");
a.onmousedown=t.onMouseDown;
ap(t.offscreenContainer,t.offscreenArea);
b=t.caption=Layer.createDiv(3,3,null,16,3);
b.style.overflow="hidden";
b.style.whiteSpace="nowrap";
b.style.padding="2px";
_setStyle(b,"PopWinCaption");
ap(t.windowDiv,b);
};
PopWin.prototype.createCloseButton=function()
{
var b,c,d,t=this;
c=t;
b=c.closeButton=Layer.createDiv(6,1,12,12,3);
b.style.color="#000";
b.style.fontSize="12px";
b.innerHTML="×";
_setCursor(b,"pointer");
b.onmousedown=c.eventHandler("onCloseMouseDown");
b.onclick=c.eventHandler("onCloseMouseDown");
b.onmouseover=function(){this.style.color="#f00"};
b.onmouseout=function(){this.style.color="#000"};
ap(c.windowDiv,b)
};
PopWin.prototype.setContentSize=function(a,b)
{
this.setSize(a+6,b+30)
};
PopWin.prototype.setSize=function(a,b)
{
var t=this;
a=t.width=Math.max(a,50);
b=t.height=Math.max(b,50);
var c,d;
c=t.window;
d=c.title.style;
d.width=a-2+"px";
d=c.body.style;
d.width=a-2+"px";
d.height=(b-29)+"px";
c=t.closeButton;
d=t.width-parseInt(c.style.width)-8;
c.style.left=d+"px";
t.caption.style.width=(d-20)+"px"
c=t.windowDiv;
c.width=a+"px";
c.height=b+"px";
c=t.backDiv;
c.style.width=a+"px";
c.style.height=b+"px";
c=t.shadowDiv;
c.style.width=a+"px";
c.style.height=b+"px";
};
PopWin.prototype.getOffsetLeft=function()
{
return this.windowDiv.offsetLeft
};
PopWin.prototype.getOffsetTop=function()
{
return this.windowDiv.offsetTop
};
PopWin.prototype.hide=function()
{
this.windowDiv.style.display="none";
};
PopWin.prototype.show=function()
{
var t=this;
t.windowDiv.style.display="";
t.windowDiv.style.visibility="visible";
t.contentArea.style.visibility="visible"
};
PopWin.prototype.isVisible=function()
{
return this.windowDiv.style.display!="none"
};
PopWin.prototype.positionAt=function(a,b,c,d,e)
{
var f,g,h,i,j,k,l,m,n,p=0,t=this;
f=t.windowDiv;
g=Math.round(d.width*e.x);
h=Math.round(d.height*e.y);
m=t.window.corner;
for(n=0;n<m.length;n++) {m[n].style.display="none";m[n].style.visibility="hidden";}
if(g>t.width&&d.width-g<t.width)
{
t.left=a-Math.min(38,c.pointCoord.x)-t.width-15;
p=1
}
else
{
t.left=a+Math.min(38,c.width-c.pointCoord.x)+15;
p=0
}
if(h>t.height&&d.height-h<t.height)
{
t.top=b+Math.min(38,c.height-c.pointCoord.y)-t.height;
p=(p==0?p+1:p+2)
}
else
{
t.top=b-Math.min(38,c.pointCoord.y)-20;
p=(p==0?p+0:p+1)
}
t.windowDiv.style.left=t.left+"px";
t.windowDiv.style.top=t.top+"px";
m[1].style.top=(t.height-33)+"px";
m[2].style.left=(t.width+1)+"px";
m[3].style.left=(t.width+1)+"px";
m[3].style.top=(t.height-33)+"px";
m[p].style.display="block";
m[p].style.visibility="visible";
};
PopWin.prototype.prepareOffscreen=function(a)
{
var t=this;
if(t.windowDiv.style.display=="none")
{
t.windowDiv.style.display="";
t.windowDiv.style.visibility="hidden";
t.contentArea.style.visibility="hidden";
t.offscreenArea.style.visibility="hidden"
}
if(a)
{
t.offscreenContainer.style.width=_pixel(a)
}
};
PopWin.prototype.clearOffscreenArea=function()
{
_clearAllChildNodes(this.offscreenArea)
};
PopWin.prototype.flipOffscreenAndSize=function()
{
var a=Math.max(this.offscreenArea.offsetWidth,50);
var b=Math.max(this.offscreenArea.offsetHeight,50);
this.flipOffscreenArea(a,b);
this.setContentSize(a,b)
};
PopWin.prototype.sizeToContent=function()
{
this.setContentSize(Math.max(this.contentArea.offsetWidth,50),this.contentArea.offsetHeight)
};
PopWin.prototype.flipOffscreenArea=function(a,b)
{
var t=this;
t.offscreenContainer.removeChild(t.offscreenArea);
t.windowDiv.removeChild(t.contentArea);
var c=t.offscreenArea;
t.offscreenArea=t.contentArea;
t.contentArea=c;
ap(t.offscreenContainer,t.offscreenArea);
ap(t.windowDiv,t.contentArea);
if(a&&b)
{
t.contentArea.style.width=_pixel(a);
t.contentArea.style.height=_pixel(b)
}
t.offscreenArea.style.width="50px";
t.offscreenArea.style.height="50px";
t.contentArea.style.visibility="visible";
t.clearOffscreenArea()
};
PopWin.prototype.onMouseDown=function(a)
{
_stopEvent(a);
};
PopWin.prototype.onCloseMouseDown=function(a)
{
_stopEvent(a);
this.setTimeout(function(){Event.trigger(this,"closeclick")},300)
};
PopWin.prototype.getTotalHeightAboveGround=function()
{
return this.height;
};
PopWin.prototype.getTotalWidth=function()
{
return this.width;
};
PopWin.prototype.onMouseOut=function(a)
{
Event.trigger(this,"mouseout")
};
PopWin.prototype.onMouseOver=function(a)
{
Event.trigger(this,"mouseover")
};


function Dialog(f,b,c,d,e,a) //(id,width,height,left,top,container)
{
var t=this,p;
a=t.c=!a?document.body:a,b=t.w=!b?200:b,c=t.h=!c?100:c,d=t.x=!d?100:d,e=t.y=!e?100:e,t.id=f;		
t.div=p=cc("Dlg");
p.id=f;	
ap(a,p);
t.shadow=p=cc("shadow");
ap(t.div,p);
t.panel=p=ce("div");
p.className="panel";
ap(t.div,p);
t.titleBar=p=cc("title");
ap(t.panel,p);
t.title=p=ce("span");
ap(t.titleBar,p);
t.closeBtn=p=cc("close");
ap(t.panel,p);
t.body=p=cc("body");
ap(t.panel,p);
t.setLeftTop(d,e);
t.resizeTo(b,c);
t.closeBtn.onclick=function(){t.close()};
}
Dialog.prototype.resizeTo=function(a,b)
{	
var t=this,c=t.shadow,d=t.panel,e=t.titleBar,f=t.body,h=e.offsetHeight;
wd(c,a),ht(c,b);
wd(d,a),ht(d,b);
wd(e,a);
wd(f,a),ht(f,b-h),tp(f,h);

};
Dialog.prototype.setLeftTop=function(a,b)
{
var t=this,c=t.div;
lf(c,a),tp(c,b);
};
Dialog.prototype.close=function(a)
{
var b=this.div.style;
b.visibility="hidden";
b.display="none";	
if(!a)Event.trigger(this,"close")
};
Dialog.prototype.show=function()
{
var b=this.div.style;
b.display="block";
b.visibility="visible"
};
Dialog.prototype.isShow=function()
{
return this.div.style.visibility=="visible"
};

function UserTip(a)
{
var t=this;
t.m=a;
t.fs=[];
Event.addListener(a.map,"infowindowopen",t.eventHandler("onInfoWinOpen"));
}
UserTip.prototype.selectTool=function()
{
var c=this.m;
c.selectTool("DRAWPOINT",this);
c.setCursor("toolicons/tool11.cur","点击您要标记的位置");
};
UserTip.prototype.add=function(a,b,c,f)	//(name,x,y,src)
{
if(!a||isNaN(b)||isNaN(c)) return;
var d=this.m.map,e,t=this,p,u="_USERTIP_"+Global.uniqueId();
b=Math.round(b);
c=Math.round(c);
p=d.addPoint(b,c,a,u,!t.sid?"S1036":t.sid,{on:"true",style:"F24"},{src:(!f?G.path+"usertip.html":f)+"?id="+u+"&name="+(!f?a:getEnCode(a))+"&xy="+b+","+c,width:271,height:130},true);
if(!f)
{
p.editable=true;
p.isMovable=true;
t.fs.push(p);
Event.addListener(p,"moveend",function(){t.m.showInfoWindow(p,true)});
}
return p;
};
UserTip.prototype.mapWindowCallback=function(a,b)	//(drawType,divNodes)
{
var m=this.m,c=m.map,d,e,f;
d=c.divToBitmapCoordinate(b[0].x,b[0].y);
e=c.spec.getLatLng(d.x,d.y,c.zoomLevel);
f=this.add("临时点",e.x,e.y);
m.showInfoWindow(f,true);
m.selectTool("PAN");
};
UserTip.prototype.onInfoWinOpen=function(a)
{
if(a.id.indexOf("_USERTIP_")<0) return;
var t=this,c=t.m.map,i=c.infoWindow.caption,j;
if(a.editable){i.innerHTML="画临时点";i.style.fontSize="14px";i.style.color="#cc3300";}
else{j=i.innerHTML;if(j.length>15)j=j.substring(0,15)+"...";i.innerHTML=j}
};
function HighLightOperation(a,b){this.base=MapOperation;this.base();var _a="search.HighLightByIndex",_d=a,_b=(!b?"S01":b),_c;this.submit=function( a,b,c,d ){var fd,v,mq,u=a.split(",");_f=b;_c=c;fd=new FeatureDesc();fd.setFeatureDescAsUidType(u); v=new HighLightVariant();v.setSPInfo( _d.getSpInfo() );v.setUserInfo( _d.getUserInfo() );v.setAPPID( _d.getAppId() );v.setFeatureDesc( fd );mq=new MapRequest(_a,v);_d.submit(mq, this,false,this.engine,d);};this.mapResultCallback=function(a){var b=a.getResult("ErrorMessage");if(b!="") {Event.trigger(this,"errormessage",b)}var b=a.getResult("HighLightFeatures");if(b!=""){var fs,fl,f,f2,fx,cpid,did,bd,lbd=new Bounds(),d,i,id;b=(b.indexOf("<?xml version=")>-1?'':'<?xml version="1.0" encoding="GB2312"?>')+b;dn=DataNode.loadFromString(b);fs=dn.features;fl=fs.length;if(fl&&fl>0){for(i=0;i<fl;i++){f=fs[i],fx=f.xml;id=f.id;cpid=ga(fx,"cpid");did=ga(fx,"dataid");bd=f.bounds;if(lbd.isNull()) lbd.clone(bd);else lbd=Bounds.merge(lbd,bd);f.label.on=""+!_c;d=G.detailURL;if(cpid=="1"||cpid=="246"||cpid=="48"){f.detail.content="";f.detail.src=d.replace(/%cpid%/g,cpid).replace(/%dataid%/g,did).replace(/%uid%/g,id)+(cpid=="246"?"&vam=1":"");f.detail.width="271";f.detail.height="240";if(f.detail.href=="") f.detail.href=G.itemUrl+"/"+cpid+"_"+did+".htm";}if(fl==1)f.style=StyleLib.getStyleById("S1155");f.id="HL"+id;_d.map.addFeature(f);}f2=new FeatureNode();f2.type="R";f2.bounds=lbd;if(!_f){if(fl==1){_d.map.centerAtLatLng(f.points[0]);_d.setTimeout(_d.showInfoWindow,300,f);if(_getParameter("showwin")=="0")f.detail.content="";}else{_d.map.closeInfoWindow();_d.adjustMapFitFeature(f,14)}}}Event.trigger(this,"highlightfeatures",dn)}Event.trigger(this,"mapresultcallback",a)};}
function HighLightVariant(){var t=this,s="MUST_BE_VALIDATED";t.base=WmspVariant;t.base();t.featureDescType=s;t.featureDesc=s;t.setFeatureDesc=function(a){t.featureDescType=a.getFeatureDescType();t.featureDesc=a.getFeatureDesc();}}


var toolbox,userTip,hl;
function initService()
{
	function gp(a){return _getParameter(a)}	
	hl=new HighLightOperation(_m);
	userTip=new UserTip(_m);	
	userTip.sid="S_1036";

	var city=gp("city"),lq=gp("lq"),page=gp("page"),uids=gp("uids"),mymap=gp("mymap"),c=gp("c"), tip=gp("tip"),dc=getCookie("sogoumapdefaultcity"),s=gp("s"),ms=gp("ms"),lab=gp("lab"),msv=gp("mapservice");
	if(!lq) lq=gp("kw");
	if(dc){	dc=dc.split(",");city=!city?dc[0]:city;}
	G.city={name:!city?"全国":getDeCode(city.trim()),c:!c?null:c};
	if(tip!=""){tip=tip.split(",");userTip.add(unescape(tip[0]),tip[1],tip[2],G.path+"detail3.jsp");}
	if(c){c=c.split(",");if (lab&&c[0]&&c[1]){lab=lab.split(",");if(lab[0]){drawXY(c[0],c[1],lab[0],!lab[1]?"S161":lab[1],!lab[2]?"F21":lab[2]);}}}
	Event.addListener(_m,"update",function(a)
	{
		var b=getState(),c=b.join(",");
		try{shHotCity(3<b[2]&&b[2]<9);}catch(ex){}			
	});	
	Event.addListener(hl,"errormessage",function(a)
	{
		showErrorMsg("抱歉！您定位的对象不存在。");
		if(gp('ref'))window.location.href=gp('ref')
	});		
	Event.addListener(_m.map,"infowindowopen",function(a){_setUrlHashParam("iw",a.id)});
	var ls=new LocalSearchOperation(_m);
	ls.isFakeStatic=true;
	Event.addListener(ls,"dom",function(a){var b,c="抱歉！",d;if(a){b=gt(a,"Error");if(b){if(ga(b,"id")=="010")c+="您查询的中心点不存在。";if(ga(b,"id")=="008"){d=ga(b,"msg").split(",");c+="在 "+d[0]+" 附近没有找到 "+d[1]+"。";}showErrorMsg(c)}b=gt(a,"Data");if(b)sa(b,"prefix","LS_")}cleanMapAreaMark(1);drawFeatures(a,["S1016"],{on:"false",style:"F24"},G.detailURL+"&pre=LS_")});
	if(msv=="SearchRange"&&uids!="")
	{
		var lid=getDeCode(gp("layerid")),kw="",lids={"楼盘":"164","写字楼":"165","别墅":"166","建材":"167"};
		if(!(/\d+/g.test(lid))){var rlid=lids[lid];if(!rlid){kw=lid;lid="ALL"}else lid=rlid}
		ls.uidTypeSubmit(!kw?kw:getEnCode(kw),uids,"20","",lid,gp("radius"));
	}else if(msv=="SearchRange"&&typeof uid=="undefined")
	{
		var lid=getDeCode(gp("layerid")),kw="",lids={"上海联合":"1339","北京新影联":"1340","广东珠江":"1343","四川太平洋":"1345","万达":"1341","中影南方新干线":"1342","中影星美":"1338","浙江时代":"1344"};
		if(!(/\d+/g.test(lid))){var rlid=lids[lid];if(!rlid){kw=lid;lid="ALL"}else lid=rlid}
		ls.uidTypeSubmit(!kw?kw:getEnCode(kw),uids,"50,1","",lid,gp("radius"));
	}
	else if (uids!="") hl.submit(uids,false,false,true);	
	else if(mymap!="") _loadScript(G.path+"js/mygo2map201.js","scriptloader");
	
}

