//显示城市下拉列表及获取城市的经纬度，显示级别，城市编码
var cityListRs = {
    initcityOption:function(defaultcity){
        for(var i=0;i<cityData.province.length;i++){
            document.writeln('<option value="">'+cityData.province[i].pname+'</option>\n');
            for(var j=0;j<cityData.province[i].city.length;j++){
				if(defaultcity==cityData.province[i].city[j].cityName){
					document.writeln('<option value='+cityData.province[i].city[j].cityName+' selected >&nbsp;├'+cityData.province[i].city[j].cityName+'</option>\n');
				}else{
					document.writeln('<option value='+cityData.province[i].city[j].cityName+' >&nbsp;├'+cityData.province[i].city[j].cityName+'</option>\n');
				}
            }
        }
    } ,
 getcityPropertiesBycity:function(cityValue){
        var cityProperties={strLatLon:"GVCUSBXUIWTCR",zoom:"2",code:"086"};
		for(var i=0;i<cityData.province.length;i++){
			for(var j=0;j<cityData.province[i].city.length;j++){
				if(cityData.province[i].city[j].cityName==cityValue){
                    cityProperties.strLatLon= cityData.province[i].city[j].citylatlon;
                    cityProperties.zoom= cityData.province[i].city[j].cityzoom;
                    cityProperties.code= cityData.province[i].city[j].citycode;
                    break;
                } 
			}
		};        
        return cityProperties;
    }
}

function show_switches(){
	if(document.getElementById('rightPanel').style.display=='none'){
		document.getElementById('rightPanel').style.display='block'
		document.getElementById('rightPanel').style.right='2px'
		document.getElementById('leftPanel').style.marginRight='329px';
		document.getElementById('switches').style.right='315px';
		document.getElementById('switches').style.background='url(images/main_Marrow.gif) no-repeat 50%';
	}else{
		document.getElementById('rightPanel').style.display='none'
		document.getElementById('leftPanel').style.marginRight='15px';
		document.getElementById('switches').style.right='2px';
		document.getElementById('switches').style.background='url(images/main_Marrow2.gif) no-repeat 50%';
	}
	resizeAll();
}
//根据城市名称设置地图显示中心点
function setMapCity(cityValue){
	var cityprop=cityListRs.getcityPropertiesBycity(cityValue);
	document.getElementById("thematicCity").value=cityValue;
	if(typeof maplet=="object"){
		maplet.centerAndZoom(new MPoint(cityprop.strLatLon),cityprop.zoom);
	}
}
//判断是否显示滚动信息
function isShowMsg(){
	if(msgcid==""){
		return false;
	}else{
		var cidchar=msgcid.substring(0,1);
		if(cidchar.match(/[A-Za-z_]/)==null){
			msgcid="rootmapbarxml"+msgcid;
		}
	}
	try {
		if(userUrl==""){
			return false;
		}
		var isUsers="";
		var myAjax = new Ajax.Request(contextPath+"/client/showmsg/showMsgUsers.xml", 
			{ method: 'post', asynchronous:false,parameters:"", 
				onComplete: function(originalRequest) {
					if (window.ActiveXObject){
						var xmlDoc=originalRequest.responseXML;
						isUsers=xmlDoc.getElementsByTagName(msgcid)[0].childNodes[0].nodeValue;
					}else if (document.implementation && document.implementation.createDocument){
						originalRequest.Charset="utf-8"; 
						originalRequest.ContentType="text/xml";
						var xmlDoc=originalRequest.responseXML;
						var root = xmlDoc.documentElement;
						var CONTENTITEM=root.getElementsByTagName(msgcid)[0];
						isUsers = (CONTENTITEM.firstChild == null)?"":CONTENTITEM.firstChild.data;
					}
				}
			}
		);
		var userArray=isUsers.split(",");
		if(userArray!=null && userArray.length>0){
			for(var i=0;i<userArray.length;i++){
				if(userArray[i]!=null && userArray[i]!="" && userUrl.indexOf(userArray[i])!=-1){
					return true;
				}
			}
		}
		return false;	
	} catch (e) {
		return false;
	}
}
//显示地图上的滚动信息
function showTimeMsg(){
	if(showmsg=="0"){
		document.getElementById("msgid").innerHTML=aArray[msgNum];
		msgNum+=1;
		if(msgNum==aArray.length) msgNum=0;
	}
	setTimeout(showTimeMsg,2000);
}
//设置信息是否滚动
function setshowmsg(val){
	showmsg=val;
}
//获取配置文件里的滚动消息信息
function getMsgUrl(){
	footermsg="";
	try {
		var myAjax = new Ajax.Request(contextPath+"/client/showmsg/msgUrl.xml", 
			{ method: 'post', asynchronous:false,parameters:"", 
				onComplete: function(originalRequest) {
					if (window.ActiveXObject){
						var xmlDoc=originalRequest.responseXML;
						var values = xmlDoc.documentElement.childNodes;
						if(values!=null){
							for(var i=0;i<values.length;i++){
								if(values[i].tagName!=null && values[i].tagName=="msg"){
									if(values[i].childNodes[0].text!=null && values[i].childNodes[1].text!=null){
										aArray[i]="<a href='"+values[i].childNodes[0].text+"' onmouseover='setshowmsg(1);' onmouseout='setshowmsg(0);' target='_blank'>"+values[i].childNodes[1].text+"</a>";
									}
								}else if(values[i].tagName!=null && values[i].tagName=="footermsg"){
									footermsg+="<a href='"+values[i].childNodes[0].text+"' target='_blank'>"+values[i].childNodes[1].text+"</a> ";
								}
							}
						}
					}else if (document.implementation && document.implementation.createDocument){
						originalRequest.Charset="utf-8"; 
						originalRequest.ContentType="text/xml";
						var xmlDoc=originalRequest.responseXML;
						var root=xmlDoc.documentElement.getElementsByTagName('msg');
						if(root!=null){
							for(var i=0;i<root.length;i++){
								var CONTENTITEM=root[i].getElementsByTagName('url')[0];
								var cc = (CONTENTITEM.firstChild == null)?"":CONTENTITEM.firstChild.data;
								CONTENTITEM=root[i].getElementsByTagName('msgname')[0];
								var ll = (CONTENTITEM.firstChild == null)?"":CONTENTITEM.firstChild.data;
								if(cc!=null && ll!=null)
									aArray[i]="<a href='"+cc+"' onmouseover='setshowmsg(1);' onmouseout='setshowmsg(0);' target='_blank'>"+ll+"</a>";
							}
						}
						root=xmlDoc.documentElement.getElementsByTagName('footermsg');
						if(root!=null){
							for(var i=0;i<root.length;i++){
								var CONTENTITEM=root[i].getElementsByTagName('url')[0];
								var cc = (CONTENTITEM.firstChild == null)?"":CONTENTITEM.firstChild.data;
								CONTENTITEM=root[i].getElementsByTagName('msgname')[0];
								var ll = (CONTENTITEM.firstChild == null)?"":CONTENTITEM.firstChild.data;
								if(cc!=null && ll!=null)
									footermsg+="<a href='"+cc+"' target='_blank'>"+ll+"</a> ";
							}
						}

					}
				}
			}
		);
	} catch (e) {
		//alert(e.message);
	}
}

//查询专题数据
function getThematicData(param,pn,rn){
	try {
		if(typeof maplet!="object"){
			return;
		}
		if(pn==null || pn==""){
			pn=1;
		}
		if(rn==null || rn==""){
			rn=10;
		}
		var themP=document.getElementById("MTS_line");
		var themR=document.getElementById("MTS_result");
		var themPage=document.getElementById("MTS_page");
		themR.innerHTML="<div style='margin-top:10px;'><img style='text-align:center;margin:0 5px 0 0;'  src='../thematic/images/loading.gif'/><span style='position:relative;top:5px;'>载入中···</span></div>";
		var pstr="";
		var results="";
		var pageStr="";
		var myAjax = new Ajax.Request(contextPath+"/js/proxy.jsp"+param+"&pn="+pn+"&rn="+rn, 
			{ method: 'post', asynchronous:true,parameters:"", 
				onComplete: function(originalRequest) {
					eval(originalRequest.responseText);
					if(APRS){
						if(APRS.dn!=null && APRS.dn>0){
							pstr="共有"+APRS.pager.length+","+APRS.pager.min+"-"+APRS.pager.max+"个结果";
						}else{
							pstr="共有"+APRS.pager.length+"个结果";
						}
						if(APRS.result!=null && APRS.result.length>0){
							results="<ol>";
							//清除在地图上画点
							maplet.clean();
							maplet.clearOverlays();
							for(var i=0;i<APRS.result.length;i++){
								if(APRS.result[i].strlatlon==null || APRS.result[i].strlatlon=="" || APRS.result[i].strlatlon=="UFBVA"){
									results+="<li class='li"+(1+i)+"'>";
									results+="<a href='javascript:;' class='a001'  onmousemove='setPoiStrD("+(1+i)+");' onmouseout='setPoiStrN("+(1+i)+");'>"+APRS.result[i].name+"</a>";
									results+="<p id='poicolorid"+(1+i)+"' style='color:#f60;display:none;'>此信息还没有在地图标注位置！</p>";
									results+="<p>地址: "+APRS.result[i].address+"</p><p>电话: "+APRS.result[i].phone+"</p>";
									if (APRS.result[i].privatePointUrl1!=''){
										results+="<p><a href='"+APRS.result[i].privatePointUrl1+"' target='_blank' >"+APRS.result[i].privatePointUrl1+"</a></p>";
									}
									results+="</li>";
								}else{
									var tname=APRS.result[i].name;
									tname=tname.replace(/\\/g,"");
									tname=tname.replace(/\//g,"");
									//tname=tname.replace(/\"/g,"");
									//tname=tname.replace(/,/g,"");
									tname=tname.replace(/;/g,"");
									//tname=tname.replace(/:/g,"");
									//alert(APRS.result[i].name+"  -- "+tname);
									results+="<li class='li"+(1+i)+"'><a href='javascript:;' onclick='showPoi("+i+");return false;' class='a001' >"+tname+"</a>";
									results+="<p>地址: "+APRS.result[i].address+"</p><p>电话: "+APRS.result[i].phone+"</p>";
									if (APRS.result[i].privatePointUrl1!=''){
										results+="<p><a href='"+APRS.result[i].privatePointUrl1+"' target='_blank' >"+APRS.result[i].privatePointUrl1+"</a></p>";
									}
									results+="</li>";
									var point=new MPoint(APRS.result[i].strlatlon);
									var icon=new MIcon(contextPath+"/thematic/images/tb"+(i+1)+".gif",30,30,11,35);
									var infowindow="<div style='position:absolute;width:255px;'><div style='float:right;margin-left:3px;cursor:default;'>";
									if (APRS.result[i].privatePointUrl!=''){
										infowindow+="<img style='width:100px;'  src='"+APRS.result[i].privatePointUrl+"'/>";
									}
									infowindow+="</div><div style='margin:5px 10px 0 4px;font-size:12px;cursor:default;'>";
									if(APRS.result[i].type!=''){
										infowindow+="<p style='margin:2px 0;'>类型: "+APRS.result[i].type+"</p>";
									}
									if(APRS.result[i].address!=''){
										infowindow+="<p style='margin:2px 0;'>地址: "+APRS.result[i].address+"</p>";
									}
									if (APRS.result[i].phone!=''){
										infowindow+="<p style='margin:2px 0;'>电话: "+APRS.result[i].phone+"</p>";
									}
									if (APRS.result[i].privatePointUrl1!=''){
										infowindow+="<p style='margin:2px 0;'><a style='' href='javascript:;' onclick='window.open(\""+APRS.result[i].privatePointUrl1+"\");'>链接地址&raquo;</a></p>";
									}
									if(APRS.result[i].detail!=''){
										infowindow+="<p style='margin:2px 0;color:#666;'>详细信息: "+APRS.result[i].detail+"</p>";
									}
									infowindow+="</div>";
									infowindow+="<div class='bubEx' style='height:85px;'><ul id='bubLayerMenu'><li id='tiptoDivli' class='current'>";
									infowindow+="<a onclick='searchTypeDiv(\"tiptoDiv\");return false;' href='javascript:void(0);'>到达这里</a></li>";
									infowindow+="<li id='toli'><a onclick='searchTypeDiv(\"to\");return false;' href='javascript:void(0);'>从这里出发</a></li>";
									infowindow+="<li id='neighborli'><a onclick='searchTypeDiv(\"neighbor\");return false;' href='javascript:void(0);'>查找周边</a></li></ul>";

									infowindow+="<div id='tiptoDiv' class='bubEx_sp'>";
									infowindow+="<p>从 <input type='text' value='' class='inputText fromInput' id='inforwindowChuFa'/> 到这里</p>";
									infowindow+="<p style='margin:5px 0 0 16px;'><input type='button' class='searchButt' value='查公交' ";
									infowindow+="onclick='searchDestBus(\""+APRS.result[i].strlatlon+"\",document.getElementById(\"inforwindowChuFa\").value,\""+tname+"\",\""+APRS.result[i].city+"\")'/>";
									infowindow+="<input type='button' class='searchButt' value='查驾车' onclick='searchDestDriver(\""+APRS.result[i].strlatlon;
									infowindow+="\",document.getElementById(\"inforwindowChuFa\").value,\""+tname+"\",\""+APRS.result[i].city+"\")'/></p></div>";

									infowindow+="<div style='display:none;' id='to' class='bubEx_sp'>";
									infowindow+="<p>从这里到 <input type='text' value='' class='inputText' name='searchmudi' id='inforwindowMudi'/></p>";
									infowindow+="<p style='margin:5px 0 0 51px;'><input type='button' class='searchButt' value='查公交' name='button' onclick='searchOrigBus(\""+APRS.result[i].strlatlon;
									infowindow+="\",\""+tname+"\",document.getElementById(\"inforwindowMudi\").value,\""+APRS.result[i].city+"\")'/>";
									infowindow+="<input type='button' class='searchButt' value='查驾车' name='button' onclick='searchOrigDriver(\""+APRS.result[i].strlatlon;
									infowindow+="\",\""+tname+"\",document.getElementById(\"inforwindowMudi\").value,\""+APRS.result[i].city+"\")'/></p></div>";

									infowindow+="<div style='display:none;' id='neighbor' class='bubEx_sp'>";
									infowindow+="<p>附近的 <input type='text' class='inputText neigborInput' name='poitype' id='infoWindowPoitype'/></p>";
									infowindow+="<p style='margin:5px 0 0 40px;'><input type='submit' class='searchButt' value='搜 索' onclick='searchNear(\""+APRS.result[i].city+"\",\"";
									infowindow+=APRS.result[i].strlatlon+"\",\""+tname+"\",document.getElementById(\"infoWindowPoitype\").value)'/></p></div></div>";
									
									if(tname!=null && tname.len()>11){
										tname=tname.substring(0,11)+"...";
									}else{
										tname=tname;
									}
									var mlabel=new MLabel(tname);
									var infoWindow=new MInfoWindow(tname,infowindow);
									var newMMarker= null;
									if(isShowPoiName=="t"){
										newMMarker=new MMarker(point,icon,infoWindow,mlabel);
									}else{
										newMMarker=new MMarker(point,icon,infoWindow);
									}
									maplet.addOverlay(newMMarker);
									pois[i]=newMMarker;
									infoWindow.setZMBtnVisible(false);
								}
							}
							if(APRS.mapinfo.center!=null && APRS.mapinfo.center!="" && APRS.mapinfo.center!="UFBVA"){
								maplet.centerAndZoom(new MPoint(APRS.mapinfo.center),APRS.mapinfo.scale-1);
							}
							results+="</ol>";
						}else{
							results="没有符合条件的查询结果.";
						}
						pageStr="";
						if(APRS.pager.totalPage>0){
							var apn=APRS.pager.pn;
							if(apn!=1){
								pageStr+="<a href='javascript:;' onclick='getThematicData(\""+param+"\","+(apn-1)+")'>上页</a>&nbsp;&nbsp;";
							}
							var iterator = "";
							if(apn<5){
								iterator =[1,2,3,4,5,6,7,8,9,10];
							}else{
								iterator =[apn-4,apn-3,apn-2,apn-1,apn,apn*1+1,apn*1+2,apn*1+3,apn*1+4,apn*1+5];
							}
							for(var i=0;i<iterator.length;i++){
								if( iterator[i]<=APRS.pager.totalPage){
									if( iterator[i]!=apn){					
										pageStr+="<a href='javascript:;' onclick='getThematicData(\""+param+"\","+iterator[i]+")'>"+iterator[i]+"</a>&nbsp;&nbsp;";
									}else{
										pageStr+=iterator[i]+"&nbsp;&nbsp;";
									}	
								}	
							}
							if(apn!=APRS.pager.totalPage){
								pageStr+="<a href='javascript:;' onclick='getThematicData(\""+param+"\","+(apn+1)+")'>下页</a>";
							}

						}
						//pageStr+="<p style='height:1px;'/>";
					}else{
						pstr="共有0个结果";
						results="没有符合条件的查询结果.";
					}
					themP.innerHTML=pstr;
					themR.innerHTML=results;
					themPage.innerHTML=pageStr;
				}
				
			}
		);
	} catch (e) {}
}

//设置查询参数
function topic_doSearch(text,value){
	var param="";
	if(text!=null && text!="" && value!=null && value!=""){
		param="&op_"+text+"=EQ&"+text+"="+encodeURIComponent(value);
	}
	var urlParam="?api=searchPois&CID="+cid+"&_type=json&encode=utf-8&city="+encodeURIComponent(document.getElementById("thematicCity").value)+param;
	getThematicData(urlParam);
}

//复合查询
function searchSelect(form){
	var formSelects=form.getElementsByTagName("select");
	var param="";
	for(var i=0;i<formSelects.length;i++){
		if(formSelects[i].value!=null && formSelects[i].value!=""){
			var text=formSelects[i].id;
			param+="&op_"+text.substring(6)+"=EQ&"+text.substring(6)+"="+encodeURIComponent(formSelects[i].value);
		}
	}
	var name=document.getElementById("textname");
	if(name!=null && name.value!="" && name.value!='输入关键字'){
		param+="&name="+encodeURIComponent(name.value);
	}
	var urlParam="?api=searchPois&CID="+cid+"&_type=json&encode=utf-8&city="+encodeURIComponent(document.getElementById("thematicCity").value)+param;
	getThematicData(urlParam);
}

function setSelectOption(id,value){
	var selectid=document.getElementById(id);
	if(selectid){
		selectid.innerHTML="";
		var newOption = document.createElement("option");
		newOption.value=value;
		newOption.selected=true;
		selectid.appendChild(newOption);
	}
}

//高级搜索
function searchTopic(form){	
	var inputs = form.getElementsByTagName('input');
	var b=0;
	var checkboxArr=new Array();
	for (var i = 0; i < inputs.length; i++) {
		var input = inputs[i];
		if (input.type.toLowerCase() == 'checkbox'){
			//input.checked=false;
			for(var j=0;j<checkboxArr.length;j++){
				if(input.name==checkboxArr[j]){
					b=1;
					break;
				}
			}
			if(b!=1){
				checkboxArr[checkboxArr.length]=input.name;
			}
			b=0;
		}
	}
	var param="";
	for(var j=0;j<checkboxArr.length;j++){
		var ck=document.getElementsByName(checkboxArr[j]);
		if(ck!=null){
			var np=0;
			for(var i=0;i<ck.length;i++){
				if(ck[i].checked){
					if(np==0){
						param+="&op_"+checkboxArr[j]+"=EQ";
						np=1;
					}
					param+="&"+checkboxArr[j]+"="+encodeURIComponent(ck[i].value);
				}
			}
		}
	}
	var urlParam="?api=searchPois&CID="+cid+"&_type=json&encode=utf-8&city="+encodeURIComponent(document.getElementById("thematicCity").value)+param;
	getThematicData(urlParam);
}
//打开气泡
function showPoi(index){
	if(pois){
		pois[index].openInfoWindow();
	}
}

//显示层
function topic_showPopupWin(objId){
	var obj = document.getElementById(objId);
	if (obj){
		obj.style.display="block";
	}
}
//隐藏层
function topic_closePupupWin(objId){
	var obj = document.getElementById(objId);
	if (obj)
		obj.style.display="none";
}
//设置所以复选为不选
function topic_clearConditions(formId){
	var form = document.getElementById(formId);
	var inputs = form.getElementsByTagName('input');

	for (var i = 0; i < inputs.length; i++) {
		var input = inputs[i];
		if (input.type.toLowerCase() == 'checkbox'){
			input.checked=false;
		}
	}
}
//设置气泡查询层显示
function searchTypeDiv(divid){
	document.getElementById("tiptoDiv").style.display = "none";
	document.getElementById("tiptoDivli").className = "";
	document.getElementById("to").style.display = "none";
	document.getElementById("toli").className = "";
	document.getElementById("neighbor").style.display = "none";
	document.getElementById("neighborli").className = "";

	document.getElementById(divid).style.display = "";
	document.getElementById(divid+"li").className = "current";	
}
//气泡里周边查询
function searchNear(city,latLon,name,keyword){
	if(keyword==null || keyword.trim()==""){
		alert("查询值不能为空！");
		return false;
	}
	window.open("http://www.mapbar.com/localsearch/index.html#ac=nb&city="+encodeURIComponent(city)+"&strlatlon="+latLon+"&name="+encodeURIComponent(name)+"&poitype="+encodeURIComponent(keyword),"mapbarNear");
}
//
function searchOrigBus(latLon,origName,keyword,city){
	if(keyword==null || keyword.trim()==""){
		alert("查询值不能为空！");
		return false;
	}
	window.open("http://bus.mapbar.com/mapview/index.jsp#ac=bus&city="+city+"&origLatLon="+latLon+"&origName="+encodeURIComponent(origName)+"&destName="+encodeURIComponent(keyword),"mapbarOrigBus");
}

function searchDestBus(latLon,keyword,name,city){
	if(keyword==null || keyword.trim()==""){
		alert("查询值不能为空！");
		return false;
	}
	window.open("http://bus.mapbar.com/mapview/index.jsp#ac=bus&city="+city+"&destLatLon="+latLon+"&origName="+encodeURIComponent(keyword)+"&destName="+encodeURIComponent(name),"mapbarDestBus");
}

function searchOrigDriver(latLon,name,keyword,cityName){
	if(keyword==null || keyword.trim()==""){
		alert("查询值不能为空！");
		return false;
	}
	window.open("http://nav.mapbar.com/mapview/index1.jsp#ac=nav&origLatLon="+latLon+"&origName="+encodeURIComponent(name)+"&destName="+encodeURIComponent(keyword)+"&origCity="+encodeURIComponent(cityName)+"&destCity="+encodeURIComponent(cityName),"mapbarOrigDriver");
}

function searchDestDriver(latLon,keyword,name,cityName){
	if(keyword==null || keyword.trim()==""){
		alert("查询值不能为空！");
		return false;
	}
	window.open("http://nav.mapbar.com/mapview/index1.jsp#ac=nav&destLatLon="+latLon+"&origName="+encodeURIComponent(keyword)+"&destName="+encodeURIComponent(name)+"&origCity="+encodeURIComponent(cityName)+"&destCity="+encodeURIComponent(cityName),"mapbarDestDriver");
}

function showbussearch(){
	window.open("http://bus.mapbar.com/mapview/index.jsp#city="+encodeURIComponent(document.getElementById('thematicCity').value),"_blank");
}
function shownavsearch(){
	window.open("http://nav.mapbar.com/","_blank");
}

//重新设置页面元素大小
function resizeAll(){
	//获得页面大小和窗口大小
	var mySize=getPageSize();
	var width=0;
	var height = (mySize[3]-document.getElementById("searchTheatic").clientHeight-110);
	if(showfootermsg=="f"){
		height=height/1+22;
	}
	if(height<120){
		height=120;
	}

		var leftPanel=document.getElementById("leftPanel");
		leftPanel.style.height=height+"px";

		var switches=document.getElementById("switches");
		switches.style.height=height+"px";

		var rightPanel=document.getElementById("rightPanel");
		rightPanel.style.height=height+"px";
		
		var MTS_result=document.getElementById("MTS_result");
		MTS_result.style.height=height-75+"px";
		
		var mapbarMap =document.getElementById("mapbarMap");
		mapbarMap.style.width=document.getElementById("leftPanelTitle").clientWidth+"px";
		if(showfootermsg=="f"){
			mapbarMap.style.height=height-22+"px";
		}else{
			mapbarMap.style.height=height-44+"px";
		}

		if(typeof maplet=="object"){
			var mw=mapbarMap.style.width;
			if(mw.indexOf("px")!=-1){
				mw=mw.substring(0,mw.length-2);
			}
			var mh=mapbarMap.style.height;
			if(mh.indexOf("px")!=-1){
				mh=mh.substring(0,mh.length-2);
			}
			if(mw>0 && mh>0){
				maplet.resize(mw,mh);
			}
		}

}
//获得页面大小
function getPageSize(){
	var xScroll, yScroll;
	if (window.innerHeight && window.scrollMaxY) {
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ 
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { 
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}

	var windowWidth, windowHeight;
	if (self.innerHeight) { 
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { 
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { 
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}

	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else {
		pageHeight = yScroll;
	}

	if(xScroll < windowWidth){
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}
	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight);
	return arrayPageSize;
}
function setPoiStrD(val){
		document.getElementById('poicolorid'+val).style.display="";
}
function setPoiStrN(val){
		document.getElementById('poicolorid'+val).style.display="none";
}
//js 中英文字符串长度
String.prototype.len=function(){                  
	return this.replace(/[^\x00-\xff]/g,"rr").length;
}
String.prototype.trim = function(){
    return this.replace(/(^[\s]*)|([\s]*$)/g, "");
}

