﻿window.op = navigator.userAgent.toLowerCase().indexOf('opera') > 0;
window.ie = navigator.userAgent.toLowerCase().indexOf('msie') > 0;
window.Size = {
	getWidth: function(){
		return document.documentElement.clientWidth;
	},
	getHeight: function(){
		return document.documentElement.clientHeight;
	},
	getScrollWidth: function(){
		if (window.ie) return Math.max(document.documentElement.offsetWidth, document.documentElement.scrollWidth);
		return document.documentElement.scrollWidth;
	},
	getScrollHeight: function(){
		if (window.ie) return Math.max(document.documentElement.offsetHeight, document.documentElement.scrollHeight);
		return document.documentElement.scrollHeight;
	},
	getScrollLeft: function(){
		return this.pageXOffset || document.documentElement.scrollLeft;
	},
	getScrollTop: function(){
		return this.pageYOffset || document.documentElement.scrollTop;
	},
	getSize: function(){
		return {
			'size': {'x': this.getWidth(), 'y': this.getHeight()},
			'scrollSize': {'x': this.getScrollWidth(), 'y': this.getScrollHeight()},
			'scroll': {'x': this.getScrollLeft(), 'y': this.getScrollTop()}
		};
	}
};
/**//*============================prototype.js中的部分函数================================*/
Object.extend = function(destination, source) {
	for (property in source) destination[property] = source[property];
    return destination;
}
Function.prototype.bind = function(object) {
        var __method = this;
        return function() {
            return __method.apply(object, arguments);
        }
}

Function.prototype.bindAsEventListener = function(object) {
      var __method = this;
      return function(event) {
        return __method.call(object, event || window.event);
      }
}
function $() {
        if (arguments.length == 1) return get$(arguments[0]);
        function get$(el){
            if (typeof el == 'string') el = document.getElementById(el);
            return el;
        }
}
function pinf(x,y,fs){
	var p={x:parseInt(x),y:parseInt(y)};
	var f=[];
	var fsa=fs.split(',');
	if(fsa.length==0 || fsa.length%2==1)return false;
	for(var i=0;i<fsa.length;i+=2){
		f.push({x:parseInt(fsa[i]),y:parseInt(fsa[i+1])});
	}
  if(f.length<=2)return false;
	
  var ar=0;
  var j= 0;
  for(var i=0;i<f.length;i++){
    if(i==f.length-1){j=0;}else{j=i+1;}
    if((((p.y>=f[i].y) && (p.y<f[j].y)) ||
			((p.y>=f[j].y) && (p.y<f[i].y))) &&
			(p.x<(f[j].x-f[i].x)*(p.y-f[i].y)/(f[j].y-f[i].y)+f[i].x)) {
			ar = ar+1;
		}
	}
  return ar%2==1;
}
/**//*============================基础类================================*/
function CPoint(x,y){   //坐标点
	this.x=x;
	this.y=y;
}
function CImg(x,y){   //坐标点
	this.px=x;
	this.py=y;
}
function CSize(width,height){  //矩形区域
	this.width=width;        
	this.height=height;        
}
function CBounds(p1,p2){  //矩形坐标范围，参数左上点和右下点组成
	this.minX=p1.x;        
	this.minY=p1.y;  
	this.maxX=p2.x;
	this.maxY=p2.y;      
	this.getSize=function(){
		return new CSize(this.maxX-this.minX,this.maxY-this.minY);
	}
}
window.CEvent={         //自定义事件处理
        addListener:function(obj,target,act){
        if(obj.attachEvent) obj.attachEvent("on"+target,act);
        if(obj.addEventListener) obj.addEventListener(target,act,false);
        },
        removeListener:function(obj,target,act){
        if(obj.detachEvent) obj.detachEvent("on"+target,act);
        if(obj.removeEventListener) obj.removeEventListener(target,act,false);
        },
		getCode: function(event){return (event.which)||(event.keyCode);}
} 

/**//*============================地图类================================*/
function CMap(){
	this.burl=SERVER_URL+"Block.ashx";
    this.config={imgsize:256,mapsizeX:255,mapsizeY:255};
	this.opt={t:'2',z:1,x:31892,y:32948,hr:false,rn:false,ht:false};
	this.ajaxobj=ajaxsvc;
	this.welcome=$('divld');
	this.ctn=$("sysMap");
    this.oSplit = $('sysSplit');
    this.oSideBox = $('sysSideBox');
	this.d_BW=$("d_BaseWin");
	this.mini=$("minimap");
	this.minimapbar=$("d_minimapbar");
	this.minimap=$('d_minimap');
	this.minimaparea=$("d_minimaparea");
	this.minimaplocation=$('d_minimaplocation');
	this.minimapctn=$('d_minimapctn');
	this.minimapmvl=$('d_minimapmvl');
	this.minibar=$('minbar');
	this.hcross=$('d_cross');
	this.hshint=$('d_hshint');
	this.hstip=$('d_hstip');
	//this.adzoom=$('d_adzoom');
	this.copyr=$('d_copyrights');
    this.isFullScreen = false;
    this.isShowSideBox = false;
    this.isShowSideBox2 = true;
	this.frmSidebox;
	this.cacheobj = null;
	this.getPosExternal=null;
	this.keyElement=null;
	this.hsinfo=[];
	this.currhs=null;
	this.reportip=1;
	this._center;           //实时中心点
	this.mvl;               //用于移动的层，即移动层
	this.info;               //用于移动的层，即移动层
	this.blineinfo;	
	this.tip;
	this.tbx;
	this.tipxy;
	this.amap;
	this.adol;
	this.adzoom;
	this.fly=false;
	this.paning=false;
	this.mouseopt={         //鼠标在地图上操作选项
		down:false,         //是否按下
		move:false,         //是否按下并移动过
		click:true,
		dx:0,dy:0,          //按下时移动层的left和top
		ex:0,ey:0           //按下时的事件坐标
	};
	this.mm=[];
	this.mmo=[];
	this.zm=[];
	this.rlm=[];
	this.rnm=[];
	this.rmo=[];
	this.admo=[];
		//显示标注详细信息层
    this.tip=$("d_Tip");
	var bx="<div style=\"position:relative;left:0px;top:60px;float:left\" id=\"tipP\">"+swf()+"</div><div style=\"position:relative;left:-3px;top:0px;\"><table id=\"tiptx\" cellpadding=0 cellspacing=0>"
	bx+="<tr><td style=\"text-align:right;\"></td>";//vertical-align:top
	bx+="<td style=\"vertical-align:top\">";
	bx+=this.d_BW.innerHTML;
	bx+="</td></tr>";
	bx+="</table></div>";
    this.tip.innerHTML=bx;
    this.tip.style.cssText="position:absolute;left:0px;top:0px;z-index:200;overflow:hidden;display:none";
    	
    this.ToolBar=document.createElement("DIV");
	var tb=''
	tb+='<span onclick="map._setMapStyle(1);" style="cursor:hand">航拍图</span>'
	tb+='<span onclick="map._setMapStyle(2);" style="cursor:hand">三维图</span>'
	tb+='<span onclick="map._ShowObj(1);" style="cursor:hand;" id="maproad">显示路名</span>'
	tb+='<span onclick="map._ShowObj(2);" style="cursor:hand;" id="maptip">显示标注</span>'	
	tb+='<span onclick="map.getpos(1);" style="cursor:hand" id="mapclosetip">地图便签</span>'
	tb+='<span onclick="map.getpos(2);" style="cursor:hand" id="mapclosetip">纠错举报</span>'
	tb+='<span onclick="map.getpos(3);" style="cursor:hand" id="mapclosetip">报告新标注</span>'
	this.ToolBar.innerHTML=tb;
    this.ToolBar.className = 'bgPic cssToolBar';
	this.ctn.appendChild(this.ToolBar);
	this.copyr.style.top=(document.documentElement.clientHeight-30);
	this.mapnewimg=new Array();
	this.mapimage=new Array();//当前显示的地图集合
	this.cacheimage=new Array();//图片对象缓存，避免重复创建和删除IMG对象
	this.roadimage=new Array();//当前显示的地图集合
	this.roadcacheimage=new Array();//图片对象缓存，避免重复创建和删除IMG对象
}
CMap.prototype = {
	_MapPath:function()
	{
		var Path=1
		return Path
	},
	setalpha:function(obj,a){
		if(ie){
			obj.style.filter='alpha(opacity='+a+')';
		}
		else{
			obj.style.opacity=a/100;
		}
	},
	reload:function()
	{    //外部强制重新加载地图
        this._loadmap();
	},
	onresize:function(evt)
	{//地图resize事件，供外部定义函数  
	},    
	setCenter:function(p)
	{
        this._center = p;
	},
	sethsinfo:function(val)
	{
        this.hsinfo=eval(val);
		return this.hsinfo;
	},
	getCenter:function()
	{
        return this._center;
	},
	getBounds:function()
	{    //获取地图范围
		var xx1=this._center.x-this.ctn.offsetWidth/2
		var yy1=this._center.y-this.ctn.offsetHeight/2
		var xx2=this._center.x+this.ctn.offsetWidth/2
		var yy2=this._center.y+this.ctn.offsetHeight/2
        var p1= new CPoint(xx1,yy1);
        var p2= new CPoint(xx2,yy2);
        return new CBounds(p1,p2);
	},
	_minimapCreate:function()
	{
		this.minimap.style.display='';
		this.minimapo11=document.createElement('IMG');
		this.minimapo11.style.position='absolute';
		this.minimapo12=document.createElement('IMG');
		this.minimapo12.style.position='absolute';
		this.minimapo21=document.createElement('IMG');
		this.minimapo21.style.position='absolute';
		this.minimapo22=document.createElement('IMG');
		this.minimapo22.style.position='absolute';		
		this.minimap.onmousedown=function(evt){evt.cancelBubble=true;return false;}.bindAsEventListener(this);
		this.minimap.ondblclick=function(evt){evt.cancelBubble=true;return false;}.bindAsEventListener(this);
		this.minimap.onmousemove=function(evt){evt.cancelBubble=true;return false;}.bindAsEventListener(this);
		//this.minimaparea.onmousedown=this.minimaplocationmousedown.bindAsEventListener(this);
		this.minimaplocation.onmousedown=this.minimaplocationmousedown.bindAsEventListener(this);
	 },
	 _minimapTool:function()
	{
		var bar=document.createElement('DIV');
		tb=bar.appendChild(document.createElement('TABLE'));
		tb.cellspacing="0";
		tb.cellpadding="0";
		tb.cssText="width:222px;height:18px;"
		tr=tb.appendChild(document.createElement('TBODY')).appendChild(document.createElement('TR'));

		ht=tr.appendChild(document.createElement('TD'));
		ht.innerHTML="<img src='images/space.gif' border='0' width='20' height='14' style='cursor:hand;' alt='隐藏鹰眼'>";
		ht.style.backgroundPositionY
		ht.onclick=function(){map.toggleminimap()}.bindAsEventListener(this);
		hp=tr.appendChild(document.createElement('TD'));
		hp.innerHTML="<img src='images/space.gif' border='0' width='42' height='14' style='cursor:hand;' alt='显示航拍图'>";
		hp.onclick=function(){map._setMapStyle(1)}.bindAsEventListener(this);

		hd=tr.appendChild(document.createElement('TD'));
		hd.innerHTML="<img src='images/space.gif' border='0' width='42' height='14' style='cursor:hand;' alt='显示三维图'>";
		hd.onclick=function(){map._setMapStyle(2)}.bindAsEventListener(this);

		hr=tr.appendChild(document.createElement('TD'));
		hr.innerHTML="<img src='images/space.gif' border='0' width='40' height='14' style='cursor:hand;' alt='路名'>";
		hr.onclick=function(){map._ShowObj(1)}.bindAsEventListener(this);

		hi=tr.appendChild(document.createElement('TD'));
		hi.innerHTML="<img src='images/space.gif' border='0' width='44' height='16' style='cursor:hand;' alt='标注'>";
		hi.onclick=function(){map._ShowObj(2)}.bindAsEventListener(this);
		
		this.minimapbar.appendChild(bar);
	 },
	 setbg:function(obj,x,y)
	 {
		 obj.backgroundPositionX=x;
		 obj.backgroundPositionY=y;
	 },
	 loadminimap:function()
	 {
		this.clearminimap();
		if(this.opt.z==8)
		{
			this.minimapo11.src='minimap/1/1x.gif';
			this.minimapo11.style.left='0px';
			this.minimapo11.style.top='0px';
			this.minibar.style.top='93px';
			this.minimapmvl.appendChild(this.minimapo11);
		}
		if(this.opt.z==4)
		{
			this.minimapo11.src='minimap/2/2x_01.gif';
			this.minimapo11.style.left='0px';
			this.minimapo11.style.top='0px';
			this.minibar.style.top='80px';
			this.minimapmvl.appendChild(this.minimapo11);
			this.minimapo12.src='minimap/2/2x_02.gif';
			this.minimapo12.style.left='256px';
			this.minimapo12.style.top='0px';
			this.minimapmvl.appendChild(this.minimapo12);
			this.minimapo21.src='minimap/2/2x_03.gif';
			this.minimapo21.style.left='0px';
			this.minimapo21.style.top='256px';
			this.minimapmvl.appendChild(this.minimapo21);
			this.minimapo22.src='minimap/2/2x_04.gif';
			this.minimapo22.style.left='256px';
			this.minimapo22.style.top='256px';
			this.minimapmvl.appendChild(this.minimapo22);
		}
		if(this.opt.z==2)
		{
			var sx=Math.floor((0-this.minimapmvl.offsetLeft)/256);
			var sy=Math.floor((0-this.minimapmvl.offsetTop)/256);
			this.minimapo11.src='minimap/4/4x_'+fn(sy*4+sx+1)+'.gif';
			this.minimapo11.style.left=sx*256+'px';
			this.minimapo11.style.top=sy*256+'px';
			this.minibar.style.top='63px';
			this.minimapmvl.appendChild(this.minimapo11);
			this.minimapo12.src='minimap/4/4x_'+fn(sy*4+sx+2)+'.gif';
			this.minimapo12.style.left=(sx+1)*256+'px';
			this.minimapo12.style.top=sy*256+'px';
			this.minimapmvl.appendChild(this.minimapo12);
			this.minimapo21.src='minimap/4/4x_'+fn((sy+1)*4+sx+1)+'.gif';
			this.minimapo21.style.left=sx*256+'px';
			this.minimapo21.style.top=(sy+1)*256+'px';
			this.minimapmvl.appendChild(this.minimapo21);
			this.minimapo22.src='minimap/4/4x_'+fn((sy+1)*4+sx+2)+'.gif';
			this.minimapo22.style.left=(sx+1)*256+'px';
			this.minimapo22.style.top=(sy+1)*256+'px';
			this.minimapmvl.appendChild(this.minimapo22);
		}
		if(this.opt.z==1)
		{
			var sx=Math.floor((0-this.minimapmvl.offsetLeft)/256);
			var sy=Math.floor((0-this.minimapmvl.offsetTop)/256);
			this.minimapo11.src='minimap/8/8x_'+fn(sy*8+sx+1)+'.gif';
			this.minimapo11.style.left=sx*256+'px';
			this.minimapo11.style.top=sy*256+'px';
			this.minibar.style.top='43px';
			this.minimapmvl.appendChild(this.minimapo11);
			this.minimapo12.src='minimap/8/8x_'+fn(sy*8+sx+2)+'.gif';
			this.minimapo12.style.left=(sx+1)*256+'px';
			this.minimapo12.style.top=sy*256+'px';
			this.minimapmvl.appendChild(this.minimapo12);
			this.minimapo21.src='minimap/8/8x_'+fn((sy+1)*8+sx+1)+'.gif';
			this.minimapo21.style.left=sx*256+'px';
			this.minimapo21.style.top=(sy+1)*256+'px';
			this.minimapmvl.appendChild(this.minimapo21);
			this.minimapo22.src='minimap/8/8x_'+fn((sy+1)*8+sx+2)+'.gif';
			this.minimapo22.style.left=(sx+1)*256+'px';
			this.minimapo22.style.top=(sy+1)*256+'px';
			this.minimapmvl.appendChild(this.minimapo22);
		}		
		function fn(i)
		{
			if(i.toString().length==1)
			{
				return '0'+i.toString();
			}
			return i.toString();
		}
	},
	clearminimap:function()
	{
		if(this.minimapo11.parentNode==this.minimapmvl)this.minimapmvl.removeChild(this.minimapo11);
		if(this.minimapo12.parentNode==this.minimapmvl)this.minimapmvl.removeChild(this.minimapo12);
		if(this.minimapo21.parentNode==this.minimapmvl)this.minimapmvl.removeChild(this.minimapo21);
		if(this.minimapo22.parentNode==this.minimapmvl)this.minimapmvl.removeChild(this.minimapo22);
	},
	toggleminimap:function()
	{
		dis=this.minimap.style.display;
		this.minimap.style.display=(dis=='none')?'':'none';
		if(dis=='none')
		{
			this.loadbymini(this.mini,180,-120);
		}
		else
		{
			this.loadbymini(this.mini,180,120);
		}
		this.setminimappos();
		this.loadminimap();
		this.fitminimap();
	},
	loadbymini:function(obj,t,h)
	{
		window.setTimeout(function(){obj.style.top=obj.offsetTop+h+'px';}.bind(this),t);
	},
	minimaplocationmousedown:function(evt)
	{
		var evtx=ie?evt.clientX-2:evt.clientX;
		var evty=ie?evt.clientY-2:evt.clientY;
		
		this.mvx=evtx-this.minimaplocation.offsetLeft;
		this.mvy=evty-this.minimaplocation.offsetTop;
		
		if(ie)this.minimaplocation.setCapture();
		
		this.minimap.onmousemove=function(){};
		this.ctn.onmousemove=function(){};
		this.hidehshint();
		this.currhs=null;
		
		document.onmousemove=this.docmousemove2.bindAsEventListener(this);
		document.onmouseup=this.docmouseup2.bindAsEventListener(this);
	},	
	docmousemove2:function(evt){
		var evtx=ie?evt.clientX-2:evt.clientX;
		var evty=ie?evt.clientY-2:evt.clientY;
		
		var x=evtx-this.mvx;
		var y=evty-this.mvy;
		
		var l=this.minimapctn.offsetLeft;
		var t=this.minimapctn.offsetTop;
		var r=this.minimapctn.offsetLeft+this.minimapctn.offsetWidth-this.minimaplocation.offsetWidth-33;
		var b=this.minimapctn.offsetTop+this.minimapctn.offsetHeight-this.minimaplocation.offsetHeight;
		
		var dir=0;
		
		if(x<l){
			if(this.minimapmvtm==null){
				this.minimapmvtm=window.setInterval(function(){
					this.minimapmvl.style.left=this.minimapmvl.offsetLeft+2+'px';
				}.bind(this),20);
			}
			x=l;
			dir++;
		}
		if(x>r){
			if(this.minimapmvtm==null){
				this.minimapmvtm=window.setInterval(function(){
					this.minimapmvl.style.left=this.minimapmvl.offsetLeft-2+'px';
				}.bind(this),20);
			}
			x=r;
			dir++
		}
		if(y<t){
			if(this.minimapmvtm==null){
				this.minimapmvtm=window.setInterval(function(){
					this.minimapmvl.style.top=this.minimapmvl.offsetTop+2+'px';
				}.bind(this),20);
			}
			y=t;
			dir++
		}
		if(y>b){
			if(this.minimapmvtm==null){
				this.minimapmvtm=window.setInterval(function(){
					this.minimapmvl.style.top=this.minimapmvl.offsetTop-2+'px';
				}.bind(this),20);
			}
			y=b;
			dir++
		}
		if(dir!=1 && this.minimapmvtm!=null){
			window.clearInterval(this.minimapmvtm);
			this.minimapmvtm=null;
		}		
		this.minimaplocation.style.left=x+'px';
		this.minimaplocation.style.top=y+'px';
	},
	docmouseup2:function(evt){
		document.onmousemove=null;
		document.onmouseup=null;
		
		if(ie)this.minimaplocation.releaseCapture();
		this.minimap.onmousemove=function(evt){evt.cancelBubble=true;return false;}.bindAsEventListener(this);
		if(!this.opt.ht && !this.gettingposexternal){
			this.ctn.onmousemove=this.ctnmousemove.bindAsEventListener(this);
		}		
		
		if(this.minimapmvtm!=null){
			window.clearInterval(this.minimapmvtm);
			this.minimapmvtm=null;
		}
		
		var x=Math.floor((this.minimaplocation.offsetLeft-this.minimapctn.offsetLeft+this.minimaplocation.offsetWidth/2-this.minimapmvl.offsetLeft)*40*this.opt.z);
		var y=Math.floor((this.minimaplocation.offsetTop-this.minimapctn.offsetTop+this.minimaplocation.offsetHeight/2-this.minimapmvl.offsetTop)*40*this.opt.z);
		
		this.setposanionly(x,y,function(){},onmvend.bind(this));
		
		this.setminimapposani(x,y,onmoving.bind(this));
		
		var ox=this.minimaplocation.offsetLeft-this.minimapmvl.offsetLeft;
		var oy=this.minimaplocation.offsetTop-this.minimapmvl.offsetTop;
		
		function onmoving(){
			this.minimaplocation.style.left=ox+this.minimapmvl.offsetLeft+'px';
			this.minimaplocation.style.top=oy+this.minimapmvl.offsetTop+'px';
		}
		
		function onmvend(){
			this.loadminimap();
			this._loadmap();
		}
	},
	setpos:function(x,y){
		if(x!=null)this._center.x=x;
		if(y!=null)this._center.y=y;
		
		var mvx=Math.floor(this.ctn.offsetWidth/2-this._center.x/this.opt.z);
		var mvy=Math.floor(this.ctn.offsetHeight/2-this._center.y/this.opt.z);
//			var l=Math.floor(this._center.x/oz-this.ctn.offsetWidth/2);
//			var t=Math.floor(this._center.y/oz-this.ctn.offsetHeight/2);
//			var r=l+this.ctn.offsetWidth;
//			var b=t+this.ctn.offsetHeight;
//			this.mvl.style.left=-l+"px";
//			this.mvl.style.top=-t+"px";
//			this.info.style.left=-l+"px";
//			this.info.style.top=-t+"px";

		this.mvl.style.left=mvx+'px';
		this.mvl.style.top=mvy+'px';
		this.info.style.left=mvx+'px';
		this.info.style.top=mvy+'px';
		/*this.adol.style.left=mvx+'px';
		this.adol.style.top=mvy+'px';*/

		this.setminimappos();
	},
	setposanionly:function(x,y,onsetting,onend){
		this.ctn.onmousemove=function(){};
		this.hidehshint();
		this.currhs=null;
		
		//this.hideinfohint();
		//this.hideinfohint2();
		/*this.hideinfohint3();*/
		//this.hideinfohintbs();
		
		this.clearzm();
		
		if(this.mvltimer!=null){
			window.clearInterval(this.mvltimer);
		}
		
		if(x!=null)this._center.x=x;
		if(y!=null)this._center.y=y;
		
		var mvltx=Math.floor(this.ctn.offsetWidth/2-this._center.x/this.opt.z);
		var mvlty=Math.floor(this.ctn.offsetHeight/2-this._center.y/this.opt.z);
		var mvlstepx=(mvltx-this.mvl.offsetLeft)/5;
		var mvlstepy=(mvlty-this.mvl.offsetTop)/5;
		var mvlstepi=0;
		
		this.mvltimer=window.setInterval(function(){
			var mvx=Math.floor(this.mvl.offsetLeft+mvlstepx);
			var mvy=Math.floor(this.mvl.offsetTop+mvlstepy);
			
			if(mvlstepi++==5){
				window.clearInterval(this.mvltimer);
				this.mvltimer=null;
				
				if(!this.opt.ht && !this.gettingposexternal){
					this.ctn.onmousemove=this.ctnmousemove.bindAsEventListener(this);
				}
				
				onend();
				
				return;
			}
			
			this.mvl.style.left=mvx+'px';
			this.mvl.style.top=mvy+'px';
			this.info.style.left=mvx+'px';
			this.info.style.top=mvy+'px';
			//this.adol.style.left=mvx+'px';
			//this.adol.style.top=mvy+'px';
			
			onsetting(Math.floor((this.ctn.offsetWidth/2-mvx)*this.opt.z),Math.floor((this.ctn.offsetHeight/2-mvy)*this.opt.z));
			
		}.bind(this),20);
		
	},
	
	setminimappos:function(x,y){
		if(x==null)x=this._center.x;
		if(y==null)y=this._center.y;
		this.minimapmvl.style.left=Math.floor(this.minimapctn.offsetWidth/2-x/this.opt.z/40)+'px';
		this.minimapmvl.style.top=Math.floor(this.minimapctn.offsetHeight/2-y/this.opt.z/40)+'px';
	},
	
	setminimapposani:function(x,y,onsetting){
		if(x==null)x=this._center.x;
		if(y==null)y=this._center.y;
		
		var tx=Math.floor(this.minimapctn.offsetWidth/2-x/this.opt.z/40);
		var ty=Math.floor(this.minimapctn.offsetHeight/2-y/this.opt.z/40);
		
		var stx=(tx-this.minimapmvl.offsetLeft)/5;
		var sty=(ty-this.minimapmvl.offsetTop)/5;
		
		var sti=0;
		
		var tm=setInterval(doani.bind(this),20);
		
		function doani(){
			if(sti++==5){
				clearInterval(tm);
				return;
			}
			var x$=Math.floor(this.minimapmvl.offsetLeft+stx);
			var y$=Math.floor(this.minimapmvl.offsetTop+sty);
			
			this.minimapmvl.style.left=x$+'px';
			this.minimapmvl.style.top=y$+'px';
			
			onsetting();
		}
	},
    _getimage:function()
	{//获取一个IMG对象
		var img =this.cacheimage.shift();
        if(img==null) {img=document.createElement("IMG");}
        return img;
    },
    _getroadimage:function()
	{//获取一个IMG对象
        var imgr =this.roadcacheimage.shift();
        if(imgr==null) {imgr=document.createElement("DIV");}
        return imgr;
    },
	fit:function()
	{
		/*this.tbtype.style.left=this.ctn.offsetWidth-this.tbtype.offsetWidth+'px';*/
		/*this.tbswitch.style.left=this.ctn.offsetWidth-this.tbswitch.offsetWidth+'px';*/
		/*this.tbzoom.style.left=this.ctn.offsetWidth-this.tbzoom.offsetWidth+'px';*/
		/*this.tb.style.width=this.ctn.offsetWidth+'px';*/
		//this.crossol.style.left=Math.floor(this.ctn.offsetWidth/2-10)+'px';
		//this.crossol.style.top=Math.floor(this.ctn.offsetHeight/2-10)+'px';
		//this.loadingol.style.left=Math.floor(this.ctn.offsetWidth/2-70)+'px';
		//this.loadingol.style.top=Math.floor(this.ctn.offsetHeight/2-12)+'px';
		//this.copyr.style.top=Math.floor(this.ctn.offsetHeight-this.copyr.offsetHeight)+'px';
		this.fitminimap();
		this.setpos();
		//this.setinfohtpos();
		//this.setinfoht2pos();
		/*this.setinfoht3pos();*/
		//this.setinfohtbspos();		
		window.setTimeout(function(){
			this.loadminimap();
			this._loadmap();
		}.bind(this),20);
	},
	_fitd:function(){
		/*this.tbtype.style.left=this.ctn.offsetWidth-this.tbtype.offsetWidth+'px';*/
		/*this.tbswitch.style.left=this.ctn.offsetWidth-this.tbswitch.offsetWidth+'px';*/
		/*this.tbzoom.style.left=this.ctn.offsetWidth-this.tbzoom.offsetWidth+'px';*/
		/*this.tb.style.width=this.ctn.offsetWidth+'px';*/
		this.crossol.style.left=Math.floor(this.ctn.offsetWidth/2-10)+'px';
		this.crossol.style.top=Math.floor(this.ctn.offsetHeight/2-10)+'px';
		this.loadingol.style.left=Math.floor(this.ctn.offsetWidth/2-70)+'px';
		this.loadingol.style.top=Math.floor(this.ctn.offsetHeight/2-12)+'px';
		this.copyr.style.top=Math.floor(this.ctn.offsetHeight-this.copyr.offsetHeight)+'px';
		this.fitminimap();
		this.setpos();
		this.setinfohtpos();
		this.setinfoht2pos();
		/*this.setinfoht3pos();*/
		this.setinfohtbspos();
		
		window.setTimeout(function(){
			this.loadminimap();
			this._loadmap();
		}.bind(this),20);
	},	
	fitminimap:function()
	{
		this.minimap.style.left=this.ctn.offsetWidth-this.mini.offsetWidth-5+'px';
		this.minimap.style.top=this.ctn.offsetHeight-this.mini.offsetHeight-5+'px';
		this.minimaplocation.style.width=this.ctn.offsetWidth/20+'px';
		this.minimaplocation.style.height=this.ctn.offsetHeight/20+'px';
		this.minimaplocation.style.left=Math.floor(this.minimaparea.offsetWidth/2-this.minimaplocation.offsetWidth/2)+'px';
		this.minimaplocation.style.top=Math.floor(this.minimaparea.offsetHeight/2-this.minimaplocation.offsetHeight/2-10)+'px';
	    this.minimapbar.style.left= this.minimap.style.left;
	    this.minimapbar.style.top= this.ctn.offsetHeight-this.minimap.offsetHeight-17+'px';
	},
    _resize:function(evt){    //地图resize事件，内部函数            
            this.onresize();
            this._clearmap();
            this._loadmap();
        },
        _mapmousedown:function(evt){
            //记录鼠标操作信息
            this.mouseopt.down=true;
			this.mouseopt.click=true;
            this.mouseopt.ex=evt.clientX;
            this.mouseopt.ey=evt.clientY;
            this.mouseopt.dx=this.mvl.offsetLeft;
            this.mouseopt.dy=this.mvl.offsetTop;
            
            //为了使鼠标移动到浏览器外部，事件依然有效，IE & firefox
            if(this.mvl.setCapture)   
              this.mvl.setCapture();   
            else  if(window.captureEvents)   
              window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);
        },
        _infomousedown:function(evt){
            //记录鼠标操作信息
            this.mouseopt.down=true;
			this.mouseopt.click=true;
            this.mouseopt.ex=evt.clientX;
            this.mouseopt.ey=evt.clientY;
            this.mouseopt.dx=this.info.offsetLeft;
            this.mouseopt.dy=this.info.offsetTop;
            
            //为了使鼠标移动到浏览器外部，事件依然有效，IE & firefox
            if(this.info.setCapture)   
              this.info.setCapture();   
            else  if(window.captureEvents)   
              window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);
        },
        _mapdblclick:function(evt){
			this._zoomIn();
        },
        _mapmove:function(evt){
            if(this.mouseopt.down==true)
            {
                //拖动时记录鼠标拖动过以及设定移动层的位置
                this.mouseopt.move=true;
				if(this.fly)
				{
					this.mvl.style.left=this.mouseopt.dx-(evt.clientX-this.mouseopt.ex)+"px";
					this.mvl.style.top=this.mouseopt.dy-(evt.clientY-this.mouseopt.ey)+"px";
				}
				else
				{
					this.mvl.style.left=this.mouseopt.dx+(evt.clientX-this.mouseopt.ex)+"px";
					this.mvl.style.top=this.mouseopt.dy+(evt.clientY-this.mouseopt.ey)+"px";
				}
				if((evt.clientX-this.mouseopt.ex)==0)
				{
					this.ctn.style.cursor='default';
					this.mouseopt.click=true; 
				}
				else
				{
					this.ctn.style.cursor='move';
					this.tip.style.display = "none";
					this.mouseopt.click=false; 
				}
            }
        },
        _infomove:function(evt){     
            if(this.mouseopt.down==true)
            {
                //拖动时记录鼠标拖动过以及设定移动层的位置
                this.mouseopt.move=true;
				if(this.fly)
				{
					this.info.style.left=this.mouseopt.dx-(evt.clientX-this.mouseopt.ex)+"px";
					this.info.style.top=this.mouseopt.dy-(evt.clientY-this.mouseopt.ey)+"px";
				}
				else
				{
					this.info.style.left=this.mouseopt.dx+(evt.clientX-this.mouseopt.ex)+"px";
					this.info.style.top=this.mouseopt.dy+(evt.clientY-this.mouseopt.ey)+"px";
				}
				if((evt.clientX-this.mouseopt.ex)==0)
				{
					this.mouseopt.click=true; 
				}
				else
				{
					this.tip.style.display = "none";
					this.mouseopt.click=false; 
				}
            }
        },
        _mapmouseup:function(evt){
            //取消事件捕捉
            if(this.mvl.releaseCapture)
              this.mvl.releaseCapture();
            else   if(window.releaseEvents)   
              window.releaseEvents(Event.MOUSEMOVE|Event.MOUSEUP);
              
            if(this.mouseopt.down==true&&this.mouseopt.move==true)
            {
                //重新设定实时中心位置
                this._clearmap();
                this._center.x=(this.ctn.offsetWidth/2-this.mvl.offsetLeft)*this.opt.z;
                this._center.y=(this.ctn.offsetHeight/2-this.mvl.offsetTop)*this.opt.z;
                this._loadmap();
            }
            this.mouseopt.down=false;
            this.mouseopt.move=false;
        },
        _infomouseup:function(evt){
            //取消事件捕捉
            if(this.info.releaseCapture)
              this.info.releaseCapture();
            else   if(window.releaseEvents)   
              window.releaseEvents(Event.MOUSEMOVE|Event.MOUSEUP);
              
            if(this.mouseopt.down==true&&this.mouseopt.move==true)
            {
                //重新设定实时中心位置
                this._clearmap();
                this._center.x=(this.ctn.offsetWidth/2-this.info.offsetLeft)*this.opt.z;
                this._center.y=(this.ctn.offsetHeight/2-this.info.offsetTop)*this.opt.z;
                this._loadmap();
            }
            this.mouseopt.down=false;
            this.mouseopt.move=false;
        },
        _infomouseover:function(evt){
			$("sRes").style.display = "none";
        },
        _Resultmouseover:function(){
			$("sRes").style.display = "";
        },
		_MouseWheel: function(e)//滚轮事件
		{
			var delta=this.GetMouseScrollDelta(e);//得到滚轮是向上滚还是向下滚
			if(delta>=120)//向上
			{
				this._zoomIn();//缩大
			}
			else if(delta<=-120)//向下
			{
				this._zoomOut();//放小
			}
			return false;
		},
        _clearmap:function(){
			this.clearzm();
			this.clearrlm();
			this.clearrnm();
        },
		//得到鼠标滚轮事件的判断
		GetMouseScrollDelta: function(e)
		{
			if(e.wheelDelta)
			{
				return e.wheelDelta;
			}
			else if(e.detail)
			{
				return -e.detail;
			}
			return 0;
		},
		/*以下为按下键盘事件部分*/
		_KeyDown: function(e)
		{
			var _x=0,_y=0,_ps=300;
			var key=CEvent.getCode(e);//键盘码
			if (key==39)//right
			{
				_x=-_ps;
				_y=0;
			}
			else if (key==37)//left
			{
				_x=_ps;
				_y=0;
			}
			else if (key==40)//down
			{
				_x=0;
				_y=-_ps;
			}
			else if (key==38)//up
			{
				_x=0;
				_y=_ps;
			}
			this._Pan(_x,_y);//飘
		},
		_KeyUp: function(e)
		{
			this._EndPan();
		},
		/*以下为漂移事件部分*/
		_Pan: function(x,y)//漂移（x,y）为各个方向的大小
		{
			this._center.x+=x;
			this._center.y+=y;
			this._loadmap();
		},
		_StartPan: function(x,y)//开始漂移（x,y）为方向（0、1、-1）
		{
			this._PanX=x;
			this._PanY=y;
			this._PanOnTimerEvent();
			this._ButtonPan=setInterval(this._PanOnTimerEvent.bind(this),10);
		},
		_EndPan: function()//结束漂移
		{
			clearInterval(this._ButtonPan);//清除Interval
			this._ButtonPan=null;
		},
		_PanOnTimerEvent: function() //漂移事件
		{
			var x=this._PanX;
			var y=this._PanY;
			var _x=0,_y=0;
			var _ps=100;//同缩放一同变化
			if (x==1&&y==0)//right
			{
				_x=-_ps;
				_y=0;
			}
			else if (x==-1&&y==0)//left
			{
				_x=_ps;
				_y=0;
			}
			else if (x==0&&y==1)//down
			{
				_x=0;
				_y=-_ps;
			}
			else if (x==0&&y==-1)//up
			{
				_x=0;
				_y=_ps;
			}
			this._Pan(_x,_y);//飘
		},
		_zoomIn:function()
		{
			if(this.opt.z==1)return false;
		    this._czoom(this.opt.z/2);
		},
		_zoomOut:function()
		{
			if(this.opt.z==8)return false;
			this._czoom(this.opt.z*2);
		},
		_czoom:function(z)
		{
			if(z==this.opt.z)return false;		
			var oz=this.opt.z;
			this.opt.z=z;
			this.clearzm();
			for(var i=0;i<this.mm.length;i++)
			{
				var x1=this.mm[i].x*256+128;
				var y1=this.mm[i].y*256+128;
				if(Math.abs(this._center.x/oz-x1)<this.ctn.offsetWidth/2/oz*z+128 && Math.abs(this._center.y/oz-y1)<this.ctn.offsetHeight/2/oz*z+128)
				{
					this.mtzm(i--,z/oz);
				}
				else
				{
					this.rccmmo(i--);
				}
			}
			if(this.opt.rl)this.clearrlm();		
			if(this.opt.rn)this.clearrnm();		
			this.loadminimap();
			this._loadmap();
		},
		_setMapStyle:function(p)
		{
			this.opt.t=p;	
			this.clearzm();	
			for(var i=0;i<this.mm.length;i++){
				this.mtzm1(i--);
			}
			this._loadmap();
		},
		_BusTo:function(pid,txt,x,y,desc)
		{
			if(this.mouseopt.click)
			{
				this._center.x =x;
				this._center.y =y;
				$("d_WinObj").style.width="310px";
				$("d_WinObj").style.height="100px";				
				$("d_winTitle").innerText="(公交站)"+txt;
				this.tip.style.left = Math.floor(this.ctn.offsetWidth/2);
				this.tip.style.top = Math.floor(this.ctn.offsetHeight/2);
				$("tipP").style.top=8;
				loadObj.loadbus(pid);
				this.setposanionly(x,y,function(){},onmvend.bind(this));
				function onmvend(){
				    $("tipP").style.display="";
				    this.tip.style.display = "";
				    $("d_BaseWin_maptipbx").style.display = "none";
				    $("d_BaseWin_maptipNew").style.display = "none";
				    $("d_BaseWin_maptiperr").style.display = "none";
				    $("d_BaseWin_Content").style.display = "none";
				    $("d_BaseWin_Bus").style.display="";				
			        this.loadminimap();
			        this._loadmap();
				    $("d_BaseWin_loading").style.display="none";
				}
			}
		},
		_pointTo:function(id,pid,txt,pcenter)
		{
			if(this.mouseopt.click)
			{//标注详细信息
			    //if (this.currhs==null)return false;
				this._center =pcenter;
				$("d_WinObj").style.width="310px";
				$("d_winTitle").innerText=txt;
				this.tip.style.left = Math.floor(this.ctn.offsetWidth/2);
				this.tip.style.top = Math.floor(this.ctn.offsetHeight/2-96);
				this.setposanionly(function(){},onmvend.bind(this));
				function onmvend(){
				    this.tip.style.display = "";
				    $("tipP").style.display="";
				    $("tipP").style.top=88;
				    $("d_BaseWin_maptipbx").style.display = "none";
				    $("d_BaseWin_maptipNew").style.display = "none";
				    $("d_BaseWin_maptiperr").style.display = "none";
				    $("d_BaseWin_Tab").style.display = "";				
				    $("d_BaseWin_Content").style.display = "";
				    $("d_BaseWin_Bus").style.display="none";
				    getHotTip(id);
				    getHotAround(pid);				
			        this.loadminimap();
			        this._loadmap();
				    $("d_BaseWin_loading").style.display="none";
				}
			}
		},
		showinfohint:function()
		{
			if(this.mouseopt.click)
			{//标注详细信息
			    if (this.currhs==null)return false;
				var hs=this.currhs;
				this._center.x =hs.x;
				this._center.y =hs.y;
				$("d_WinObj").style.width="310px";
				$("d_winTitle").innerText=hs.n;
				this.tip.style.left = Math.floor(this.ctn.offsetWidth/2);
				this.tip.style.top = Math.floor(this.ctn.offsetHeight/2-96);
				//this._loadmap();
				this.setposanionly(hs.x,hs.y,function(){},onmvend.bind(this));
				function onmvend(){
				this.tip.style.display = "";
				    $("tipP").style.display="";
				    $("tipP").style.top=88;
				    $("d_BaseWin_maptipbx").style.display = "none";
				    $("d_BaseWin_maptipNew").style.display = "none";
				    $("d_BaseWin_maptiperr").style.display = "none";
				    $("d_BaseWin_Tab").style.display = "";				
				    $("d_BaseWin_Content").style.display = "";				
				    $("d_BaseWin_Bus").style.display="none";
				    getHotTip(hs.id);
				    getHotAround(hs.id);				
			        this.loadminimap();
			        this._loadmap();
				    $("d_BaseWin_loading").style.display="none";
				}
			}
		},		
		showinfohint1:function(id,pid,x,y,txt)
		{
			if(this.mouseopt.click)
			{
				this._center.x =x;
				this._center.y =y;
				$("d_WinObj").style.width="310px";
				$("d_winTitle").innerText=txt;
				this.tip.style.left = Math.floor(this.ctn.offsetWidth/2);
				this.tip.style.top = Math.floor(this.ctn.offsetHeight/2-96);
				this.setposanionly(x,y,function(){},onmvend.bind(this));
				function onmvend(){
				    this.tip.style.display = "";
				    $("tipP").style.display="";
				    $("tipP").style.top=88;
				    $("d_BaseWin_maptipbx").style.display = "none";
				    $("d_BaseWin_maptipNew").style.display = "none";
				    $("d_BaseWin_maptiperr").style.display = "none";
				    $("d_BaseWin_Tab").style.display = "";				
				    $("d_BaseWin_Content").style.display = "";
				    $("d_BaseWin_Bus").style.display="none";
				    getHotTip(id);
				    getHotAround(pid);				
			        this.loadminimap();
			        this._loadmap();
				    $("d_BaseWin_loading").style.display="none";
				}
			}
		},		
		showinfohint2:function(x,y,nm,ctt){
			if(this.mouseopt.click)
			{
				this._center.x =x;
				this._center.y =y;
				$("d_WinObj").style.width="310px";
				$("d_winTitle").innerText=nm;
				this.tip.style.left = Math.floor(this.ctn.offsetWidth/2);
				this.tip.style.top = Math.floor(this.ctn.offsetHeight/2-96);
				this.setposanionly(x,y,function(){},onmvend.bind(this));
				function onmvend(){
				    this.tip.style.display = "";
				    $("tipP").style.display="";
				    $("tipP").style.top=88;
				    $("d_BaseWin_maptipbx").style.display = "none";
				    $("d_BaseWin_maptipNew").style.display = "none";
				    $("d_BaseWin_maptiperr").style.display = "none";
				    $("d_BaseWin_Content").style.display = "";
				    $("d_BaseWin_Tab").style.display = "none";
				    $("d_BaseWin_Around").style.display="none";				
				    $("d_BaseWin_Bus").style.display="none";
				    $("d_around").style.display="none";
				    $("d_err").style.display="none";
				    $("d_BaseWin_baseinfo").style.display="";
				    $("d_BaseWin_ctt").innerHTML=ctt;				
			        this.loadminimap();
			        this._loadmap();
				    $("d_BaseWin_loading").style.display="none";
				}
			}
	    },
		showinfohint3:function(x,y){
			this._center.x =x;
			this._center.y =y;
			mx=Math.floor(x/this.opt.z);
			my=Math.floor(y/this.opt.z);
			this.setposimg(3,mx-5,my-10);
			this.setposanionly(x,y,function(){},onmvend.bind(this));
			function onmvend(){				
			    this.loadminimap();
			    this._loadmap();
				$("d_BaseWin_loading").style.display="none";				    
			}			
	    },	    
		_ShowTo:function(id,pid,txt,px,py,pn)
		{//显示标注
		    var l=(px/this.opt.z)
		    var t=(py/this.opt.z-16)
		    if(this.opt.z!=1)t=t+1
			var tipshow="tip"+px+"_"+py;
			this.msg=document.createElement("DIV");
			//alert(pn);
			if(pn==218)
			{
			    var pl=new sinaFlash("images/posflash/218.swf", "ad"+px, 50, 50, "7", "#FFFFFF", false, "High");
				pl.addParam("wmode", "transparent");
			    var mbtxt=pl.getFlashHTML();
			    mbtxt+="<span id="+tipshow+" onmouseout=\"map.hidehshint()\" onmouseover=\"map.showhshint("+px+","+py+",'"+txt+"');\" onclick=\"map.showinfohint1("+id+","+pid+","+px+","+py+",'"+txt+"')\" style=\"cursor:pointer\"><b>"+txt+"</b></span>";
			    this.msg.innerHTML=mbtxt;
			}
			else
			{
		        this.msg.innerHTML="<span id="+tipshow+" onmouseout=\"map.hidehshint()\" onmouseover=\"map.showhshint("+px+","+py+",'"+txt+"');\" onclick=\"map.showinfohint1("+id+","+pid+","+px+","+py+",'"+txt+"')\" style=\"cursor:pointer\"><img src='images/icons/"+pn+".png' border=0 align=absmiddle>"+txt+"</span>";
		     }
			this.msg.style.cssText="position:absolute;left:"+l+"px;top:"+t+"px;border:1px #FFFF00 solid;background-color:#FFFF00;z-index:2;cursor:pointer";
			this.tipshow.appendChild(this.msg);	
		},
		gethsinfobp:function(x,y)
		{
			if(this.hsinfo)
			{
				for(var i=0;i<this.hsinfo.length;i++)
				{
					if(pinf(x,y,this.hsinfo[i].hs))
					{
						return this.hsinfo[i];
					}
				}
			}
			return null;
		},
		_ShowBt:function(pid,txt,px,py,desc)
		{
		    var l=(px/this.opt.z)
		    var t=(py/this.opt.z)
		    if(this.opt.z!=1)t=t+1		
			var Bsshow="Bs"+px+"_"+py;
			this.Bsmsg=document.createElement("DIV");
	        this.Bsmsg.innerHTML="<span id="+Bsshow+" title="+txt+" onclick=\"map._BusTo("+pid+",'"+txt+"',"+px+","+py+",'"+desc+"')\" style=\"cursor:hand\">(公交站)"+txt+"</span>";
			this.Bsmsg.style.cssText="position:absolute;cursor:hand;left:"+l+"px;top:"+t+"px;border:1px #FFFF00 solid;background-color:#FFFF00;z-index:3;cursor:hand";
			this.Bsshow.appendChild(this.Bsmsg);
		},
		showmou:function(evt)
		{
			var evtx=ie?evt.clientX-2:evt.clientX;
			var evty=ie?evt.clientY-2:evt.clientY;
			var ctnx=evtx-this.ctn.offsetLeft;
			var ctny=evty-this.ctn.offsetTop;
			var mx=ctnx-this.mvl.offsetLeft;
			var my=ctny-this.mvl.offsetTop;
			this.showhshint(evtx,evty,"点击鼠标左键定位|右键取消");
		},
		GetTip:function(evt)
		{
			var evtx=ie?evt.clientX-2:evt.clientX;
			var evty=ie?evt.clientY-2:evt.clientY;
			var pos_x=(evtx-this.mvl.offsetLeft-this.ctn.offsetLeft+document.documentElement.scrollLeft)*this.opt.z;
			var pos_y=(evty-this.mvl.offsetTop-this.ctn.offsetTop+document.documentElement.scrollTop)*this.opt.z;
					    
			if(this.mouseopt.click)
			{	
				if(evt.button!=0)
				{				    
					this.hstip.style.display='none';
					this.tip.style.display= "none";
					this.tipxy.style.display='none';
					$("tipP").style.display="";
					this.opt.ht=false;
					this._resize();
				}
				else
				{
					var ctnx=evtx-this.ctn.offsetLeft;
					var ctny=evty-this.ctn.offsetTop;
					var mx=ctnx-this.mvl.offsetLeft-6;
					var my=ctny-this.mvl.offsetTop;	
					$("tipP").style.display="none";
				    this.tip.style.left = Math.floor(this.ctn.offsetWidth/2-44);
				    this.tip.style.top = Math.floor(this.ctn.offsetHeight/2-96);
					switch(this.reportip)
					{
						case 1:
						    this.setposimg(3,mx,my-10);
							$("d_WinObj").style.width="200px";
							$("d_winTitle").innerText="地图便签";
							$("d_BaseWin_maptipbx").style.display = "";
							$("d_BaseWin_maptipNew").style.display = "none";
							$("d_BaseWin_maptiperr").style.display = "none";
							$("d_BaseWin_Content").style.display = "none";
							$("d_BaseWin_Bus").style.display="none";							
							$("txtnotelink").value = "default.aspx?mo="+pos_x+"|"+ pos_y+"|";
							break;
						case 2:
						    this.setposimg(3,mx,my-10);
							$("d_WinObj").style.width="288px";
							$("d_winTitle").innerText="纠错举报";
							$("d_BaseWin_maptipbx").style.display = "none";
							$("d_BaseWin_maptipNew").style.display = "none";
							$("d_BaseWin_maptiperr").style.display = "";
							$("d_BaseWin_Content").style.display = "none";
							$("d_BaseWin_Bus").style.display="none";
			                $("rep_pos_x").value=pos_x;
			                $("rep_pos_y").value=pos_y;
			                $("errRep").onclick=this.submiterrreport.bindAsEventListener(this);						
							break;
						case 3:
						    this.setposimg(3,mx,my-10);
							$("d_WinObj").style.width="300px";
							$("d_winTitle").innerText="报告新标注";
							$("d_BaseWin_maptipbx").style.display = "none";
							$("d_BaseWin_maptipNew").style.display = "";
							$("d_BaseWin_maptiperr").style.display = "none";
							$("d_BaseWin_Content").style.display = "none";
							$("d_BaseWin_Bus").style.display="none";
			                $("rep_pos_x").value=Math.floor(pos_x);
			                $("rep_pos_y").value=Math.floor(pos_y);
			                $("newRep").onclick=this.submitNewObj.bindAsEventListener(this);
							break;
						case 4:
							$("btn_cancel_s").style.display = "none";
							$("link_locates").style.display = "";
							$("link_fincancel_s").style.display = "";
							$("hid_bus_poss").value=pos_x+","+pos_y;
							this.setposimg(1,mx,my-22);
							this.schposaround(pos_x,pos_y,"bs");
							$("link_locates").onclick=function(){map.centerto($("hid_bus_poss").value)};
							$("link_fincancel_s").onclick=function(){map.cancelgetpos(1)};
							break;
						case 5:
							$("btn_cancel_e").style.display = "none";
							$("link_locatee").style.display = "";
							$("link_fincancel_e").style.display = "";
							$("hid_bus_pose").value=pos_x+","+pos_y;
							this.setposimg(2,mx,my-22);
							this.schposaround(pos_x,pos_y,"bs");
							$("link_locatee").onclick=function(){map.centerto($("hid_bus_pose").value)};
							$("link_fincancel_e").onclick=function(){map.cancelgetpos(2)};
							break;
						case 6:
							this.setposimg(3,mx,my-10);							
							window.parent.frmSidebox.getPosExternal(pos_x,pos_y);
							break;
					}
					this.hstip.style.display='none';
					this.tipxy.style.display='none';
					if(this.reportip<4)
					{
						this.tip.style.display = "";
					}
					this.opt.ht=false;
					this.centerto(pos_x+","+pos_y)
				}
			}
		},
	    submiterrreport:function()
	    {
		    if($('txtDes').value=='')
		    {
			    alert('请填写错误描述');
			    $('txtDes').focus();
			    return;
		    }
		    this.ajaxobj.bugReport($('txtDes').value, $('Txt_topic').value, $('FUL_Pic').value, $('txtUsrName').value,$('rep_pos_x').value,$('rep_pos_y').value,cb.bind(this),null,ld.bind(this));
		    function cb(res)
		    {
				if(res.value=='ok'){
						alert('纠错报告已提交,感谢您的支持.');
						this.tip.style.display='none';
				}
				else{
						alert(res.value);
				}
		    }
		    function ld(e)
		    {
				this.welcome.style.display=e?'':'none';
		    }
	    },
	    submitNewObj:function()
	    {
		    if($('txtName').value=='')
		    {
			    alert('请填写单位各称');
			    $('txtName').focus();
			    return;
		    }
		    this.ajaxobj.NewObjReport($('txtName').value, $('txtAdd').value, $('txtPhone').value,$('txtKeyWord').value,$('txtNewDes').value,$('txtURL').value,$('txtNewPic').value,$('txtNewUsrName').value,$('rep_pos_x').value,$('rep_pos_y').value,cb.bind(this),null,ld.bind(this));
		    function cb(res)
		    {
				if(res.value=='ok'){
						alert('新标注已提交,感谢您的支持.');
						this.tip.style.display='none';
				}
				else{
						alert(res.value);
				}
		    }
		    function ld(e)
		    {
				this.welcome.style.display=e?'':'none';
		    }
	    },
	    setinfohtpos:function(x,y){
			this._center.x=Math.floor(x/this.opt.z);
			this._center.y=Math.floor(y/this.opt.z);
			this._loadmap();
	    },		
		centerto:function(xy)
		{
			mxy=xy.split(",")
			this._center.x =mxy[0];
			this._center.y =mxy[1];
			this.setposanionly(mxy[0],mxy[1],function(){},onmvend.bind(this));
			function onmvend(){				
			    this.loadminimap();
                this._loadmap();
            }
		},
		setposimg:function(type,x,y)
		{
			if (type==1)
			{
				if(this.Bsdiv!=null)
				{
					this.Bsshow.removeChild(this.Bsdiv);
					this.Bsdiv=null;
				}
				this.Bsdiv=this.Bsshow.appendChild(document.createElement("DIV"));
				this.Bsdiv.innerHTML="<img src='images/qidian.gif' border=0>"
				this.Bsdiv.style.position='absolute';
				this.Bsdiv.style.left=x;
				this.Bsdiv.style.top=y;
				this.Bsdiv.style.zIndex=1000;
				this.Bsshow.style.display=""
			}
			else if (type==3)
			{
				if(this.Bsadd!=null)
				{
					this.Bsshow.removeChild(this.Bsadd);
					this.Bsadd=null;
				}
				this.Bsadd=this.Bsshow.appendChild(document.createElement("DIV"));
				this.Bsadd.style.position='absolute';
				this.Bsadd.style.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(src=images/cross.png)';
				this.Bsadd.style.width='19px';
				this.Bsadd.style.height='19px';
				this.Bsadd.style.left=x;
				this.Bsadd.style.top=y;
				this.Bsadd.style.zIndex=1000;
				this.Bsshow.style.display=""
			}
			else
			{
				if(this.Bediv!=null)
				{
					this.Bsshow.removeChild(this.Bediv);
					this.Bediv=null;
				}
				this.Bediv=this.Bsshow.appendChild(document.createElement("DIV"));
				this.Bediv.innerHTML="<img src='images/zhongdian.gif' border=0>"
				this.Bediv.style.position='absolute';
				this.Bediv.style.left=x;
				this.Bediv.style.top=y;
				this.Bediv.style.zIndex=1000;
				this.Bsshow.style.display=""
			}
		},
		cancelgetpos:function(type)
		{
			switch (type)
			{
				case 1:
					if(this.Bsdiv!=null)
					{
						this.Bsshow.removeChild(this.Bsdiv);
						this.Bsdiv=null;
					}
					$("btn_locates").style.display = "";
					$("btn_cancel_s").style.display = "none";
					$("link_locates").style.display = "none";
					$("link_fincancel_s").style.display = "none";
					$("hid_bus_poss").value="";
					break;
				case 2:	
					if(this.Bediv!=null)
					{
						this.Bsshow.removeChild(this.Bediv);
						this.Bediv=null;
					}
					$("btn_locatee").style.display = "";
					$("btn_cancel_e").style.display = "none";
					$("link_locatee").style.display = "none";
					$("link_fincancel_e").style.display = "none";
					$("hid_bus_pose").value="";
					break;
				case 3:
					if(this.Bsadd!=null)
					{
						this.Bsshow.removeChild(this.Bsadd);
						this.Bsadd=null;
					}
					$("btn_locatee").style.display = "";
					$("btn_cancel_e").style.display = "none";
					$("link_locatee").style.display = "none";
					$("link_fincancel_e").style.display = "none";
					break;
				case 4:
					this.hstip.style.display='none';
					this.tip.style.visibility = "hidden";
					this.tipxy.style.display='none';
					this._loadmap();
					break;
			}

		},
		_SetTip:function(tid)
		{
			this.reportip=tid
			this.hstip.style.display='';
			this.hstip.style.top=(this.ctn.offsetTop+this.ToolBar.offsetHeight+5)+'px';
			this.hstip.style.left=(this.ctn.offsetWidth-this.hstip.offsetWidth-5)+'px';
			this.hstip.innerHTML="请移动鼠标到目标位置：<br />单击『鼠标左键』获取该点坐标<br />单击『鼠标右键』取消获取坐标";
			this.setalpha(this.hstip,80);
			this.tipxy.style.display='';
			this.opt.ht=true;
			this.tipxy.style.cursor="crosshair";
			this.tipxy.onclick=this.GetTip.bindAsEventListener(this);
			this.tipxy.ondblclick=this.GetTip.bindAsEventListener(this);
			this.ctn.onclick=function(evt){evt.cancelBubble=true;return false;}.bindAsEventListener(this);
			document.oncontextmenu=this.GetTip.bindAsEventListener(this);
			this.tipshow.onclick=function(evt){evt.cancelBubble=true;return false;}.bindAsEventListener(this);
			this._loadmap();
		},
		getpos:function(tid)
		{
			this.reportip=tid
			this.hstip.style.display='';
			this.hstip.style.top=(this.ctn.offsetTop+this.ToolBar.offsetHeight+5)+'px';
			this.hstip.style.left=(this.ctn.offsetWidth-this.hstip.offsetWidth-5)+'px';
			this.hstip.innerHTML="请移动鼠标到目标位置：<br />单击『鼠标左键』获取该点坐标<br />单击『鼠标右键』取消获取坐标";
			this.setalpha(this.hstip,80);
			this.tipxy.style.display='';
			this.opt.ht=true;
			this.tipxy.style.cursor="crosshair";
			this.tipxy.onclick=this.GetTip.bindAsEventListener(this);
			this.tipxy.ondblclick=this.GetTip.bindAsEventListener(this);
			this.ctn.onmousemove=this.mousestyle.bindAsEventListener(this);
			this.ctn.onclick=function(evt){evt.cancelBubble=true;return false;}.bindAsEventListener(this);
			this.tipshow.onclick=function(evt){evt.cancelBubble=true;return false;}.bindAsEventListener(this);
			this._loadmap();
		},
		_ShowObj:function(obj)
		{
			switch(obj)
			{
				case 1:
					this.opt.hr=(this.opt.hr)?false:true;
					$("maproad").innerHTML=(this.opt.hr)?"隐藏路名":"显示路名";
	                if(!this.opt.hr)this._clearmap();
					this._loadmap();
					break;
				case 2:
					viable=this.tipshow.style.display;
					this.tipshow.style.display=(viable=="none")?"":"none";
					$("maptip").innerHTML=(viable=="none")?"隐藏标注":"显示标注";
					break;			
			}
		},
		scharound:function(sid)
		{
			Search_post(sid);
		},
		schposaround:function(posx,posy,sid)
		{
		    sid=posx+"|"+posy+"|"+sid
			Search_post(sid);
		},		
	    getcurrarea:function(){
		    var l=(0-this.mvl.offsetLeft)*this.opt.z;
		    var r=(this.ctn.offsetWidth-this.mvl.offsetLeft)*this.opt.z;
		    var t=(0-this.mvl.offsetTop)*this.opt.z;
		    var b=(this.ctn.offsetHeight-this.mvl.offsetTop)*this.opt.z;
		
		    return [l,t,r,b];
	    },
		getTBLR:function(){
		var l=Math.floor(this._center.x/this.opt.z-this.ctn.offsetWidth/2);
		var t=Math.floor(this._center.y/this.opt.z-this.ctn.offsetHeight/2);
		var r=l+this.ctn.offsetWidth;
		var b=t+this.ctn.offsetHeight;
		return [l,t,r,b];
		},
	loadmm:function(){
		var l=Math.floor(this._center.x/this.opt.z-this.ctn.offsetWidth/2);
		var t=Math.floor(this._center.y/this.opt.z-this.ctn.offsetHeight/2);
		var r=l+this.ctn.offsetWidth;
		var b=t+this.ctn.offsetHeight;
		
		this.rccmm(l,t,r,b);
		
		for(var y=Math.floor(t/256);y<=Math.floor(b/256);y++){
			for(var x=Math.floor(l/256);x<=Math.floor(r/256);x++){
				
				if(this.hasmm(x,y))continue;
			
				this.mm[this.mm.length]={
					x:x,
					y:y,
					objr:this.divimg.appendChild(this.getmmo(x,y))
				};
				
			}
		}
		
	},
	
	loadrlm:function(){
		var l=Math.floor(this._center.x/this.opt.z-this.ctn.offsetWidth/2);
		var t=Math.floor(this._center.y/this.opt.z-this.ctn.offsetHeight/2);
		var r=l+this.ctn.offsetWidth;
		var b=t+this.ctn.offsetHeight;
		
		this.rccrlm(l,t,r,b);
		
		for(var y=Math.floor(t/256);y<=Math.floor(b/256);y++){
			for(var x=Math.floor(l/256);x<=Math.floor(r/256);x++){
				
				if(this.hasrlm(x,y))continue;
			
				this.rlm[this.rlm.length]={
					x:x,
					y:y,
					objr:this.divimg.appendChild(this.getrlmo(x,y))
				};
				
			}
		}
	},
	
	loadrnm:function(){
		var l=Math.floor(this._center.x/this.opt.z-this.ctn.offsetWidth/2);
		var t=Math.floor(this._center.y/this.opt.z-this.ctn.offsetHeight/2);
		var r=l+this.ctn.offsetWidth;
		var b=t+this.ctn.offsetHeight;
		
		this.rccrnm(l,t,r,b);
		
		for(var y=Math.floor(t/256);y<=Math.floor(b/256);y++){
			for(var x=Math.floor(l/256);x<=Math.floor(r/256);x++){
				
				if(this.hasrnm(x,y))continue;
			
				this.rnm[this.rnm.length]={
					x:x,
					y:y,
					objr:this.divimg.appendChild(this.getrnmo(x,y))
				};
				
			}
		}
	},
	loadpos:function(){
	    var a=this.getcurrarea();
	    var hz=Math.floor(8/this.opt.z);
	    this.ajaxobj.getpos(a[0]-512,a[1]-512,a[2]+512,a[3]+512,hz,this.opt.t,cb.bind(this),null,ld.bind(this));
	    function cb(res)
	    {
	        this.hsinfo=eval(res.value);
	        for(var i=0;i<this.hsinfo.length;i++)
	        {
	            var o=this.hsinfo[i];
	            this._ShowTo(o.id,o.id,o.n,o.x,o.y,o.c);
	        }
	        //alert(res.value);
	    }
		function ld(e){
			this.welcome.style.display=e?'':'none';
		}	    
	},
	loadad:function(){
		if(this.opt.t=='2'){
			var a=this.getcurrarea();
			this.ajaxobj.getAD(a[0]-512,a[1]-512,a[2]+512,a[3]+512,cb.bind(this),null,ld.bind(this));
			clearouterad.apply(this);
		}
		else{
			this.adol.innerHTML='';
		}
		function cb(res){
		    //alert(res.value);
			var adswf=eval(res.value);
			for(var i=0;i<adswf.length;i++)
			{
			    var o=adswf[i];
				var l=Math.floor((o.x-o.w/2)/this.opt.z);
				var t=Math.floor((o.y-o.h/2)/this.opt.z);
				var w=Math.floor(o.w/this.opt.z);
				var h=Math.floor(o.h/this.opt.z);
				if(adexists.apply(this,[o.id]))continue;
				var ado=this.adol.appendChild(document.createElement('DIV'));
				ado._id=o.id;
				ado._x=o.x;
				ado._y=o.y;
				ado._z=this.opt.z;
				ado.style.position='absolute';
				ado.style.left=l+'px';
				ado.style.top=t+'px';
				ado.style.zIndex=99;
				var fl=new sinaFlash(SERVER_URL+o.f, "ad"+i, w, h, "7", "#FFFFFF", false, "High");
				fl.addParam("wmode", "transparent");
				var str="<div onmouseover=\"map.zoomad("+o.id+","+o.w+","+o.h+","+w+","+h+","+l+","+t+",'"+o.f+"')\">";
				str+=fl.getFlashHTML();
				str+="</div>";
				ado.innerHTML=str;
		      }
		}
		function ld(e){
			this.welcome.style.display=e?'':'none';
		}
		function adexists(id){
			for(var i=0;i<this.adol.childNodes.length;i++){
				var ado=this.adol.childNodes[i];
				if(ado._id==id)return true;
			}
			return false;
		}
		function clearouterad(){
			for(var i=0;i<this.adol.childNodes.length;i++){
				var ado=this.adol.childNodes[i];
				var a=this.getcurrarea();
				if(ado._x<a[0]-512 || ado._y<a[1]-512 || ado._x>a[2]+512 || ado._y>a[3]+512 || ado._z!=this.opt.z){
					this.adol.removeChild(ado);
				}
			}
		}
	},
    zoomad:function(id,ow,oh,w,h,l,t,f)
    {        
	    this.adzoom.style.display="";
	    this.adzoom.innerHTML="";
		this.adzoom.width=ow+'px';
		this.adzoom.height=oh+'px';
		this.adzoom.style.left=Math.floor(l-(ow-w)/2)+'px';
		this.adzoom.style.top=Math.floor(t-(oh-h)/2)+'px';
		this.adzoom.style.zIndex=999;
		this.showzoomad(id);
		this.adzoom.onmouserover=function(){map.adzoom.style.display=""};
		this.adzoom.onmouseout=function(){map.hidezoomad()};
		var fl=new sinaFlash(SERVER_URL+f, "ads", ow, oh, "7", "#FFFFFF", false, "High");
        fl.addParam("wmode", "transparent");        
        this.adzoom.innerHTML=fl.getFlashHTML();
    },
    showzoomad:function(id){
    	for(var i=0;i<this.adol.childNodes.length;i++)
    	{
			var ado=this.adol.childNodes[i];
			if(ado._id==id)
			{
			    ado.style.display="none";
			}
		}		
    },
    hidezoomad:function(){
		for(var i=0;i<this.adol.childNodes.length;i++)
	    {
			var ado=this.adol.childNodes[i];
			ado.style.display="";
		}
		this.adzoom.innerHTML="";
        this.adzoom.style.display="none";
    },
	getmmo:function(x,y){
		var o=this.mmo.length>0?this.mmo.pop():document.createElement('IMG');
		
		o.onload=function(){this.style.display='';};
		
		if(this.cacheobj){
			o.src=this.cacheobj.QueryMap(this.opt.t, 8/this.opt.z, x, y, 'jpg');
		}
		else{
			o.src=this.burl+'?type='+this.opt.t+'&zoom='+(8/this.opt.z)+'&x='+x+'&y='+y;
		}
		o.style.position='absolute';
		o.style.left=x*256+'px';
		o.style.top=y*256+'px';
		o.style.width='256px';
		o.style.height='256px';
		o.style.zIndex=2;
		
		return o;
	},
	
	getrlmo:function(x,y){
		var o=this.rmo.length>0?this.rmo.pop():document.createElement('IMG');
		
		o.onload=function(){this.style.display='';};
		
		var mapurl;
		if(this.cacheobj){
			mapurl=this.cacheobj.QueryMap('road', 8/this.opt.z, x, y, 'png'  );
		}
		else{
			mapurl=this.burl+'?type=road&zoom='+(8/this.opt.z)+'&x='+x+'&y='+y;
		}
		
		if(ie){
			o.src='images/null.gif';
			if(o.ai==null){
				o.ai=document.createElement('IMG');
			}
			o.ai.onload=function(){
				this.style.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(src="'+this.ai.src+'")';
			}.bindAsEventListener(o);
			o.ai.src=mapurl;
		}
		else{
			o.src=mapurl;	
		}
		o.style.position='absolute';
		o.style.left=x*256+'px';
		o.style.top=y*256+'px';
		o.style.width='256px';
		o.style.height='256px';
		o.style.zIndex=3;
		
		return o;
	},
	
	getrnmo:function(x,y){
		var o=this.rmo.length>0?this.rmo.pop():document.createElement('IMG');
		
		o.onload=function(){this.style.display='';};
		
		var mapurl;
		if(this.cacheobj){
			mapurl=this.cacheobj.QueryMap( 'roadname', 8/this.opt.z, x, y, 'png');
		}
		else{
			mapurl=this.burl+'?type=roadname&zoom='+(8/this.opt.z)+'&x='+x+'&y='+y;
		}
		
		if(ie){
			o.src='images/null.gif';
			if(o.ai==null){
				o.ai=document.createElement('IMG');
			}
			o.ai.onload=function(){
				this.style.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(src="'+this.ai.src+'")';
			}.bindAsEventListener(o);
			o.ai.src=mapurl;
		}
		else{
			o.src=mapurl;	
		}
		o.style.position='absolute';
		o.style.left=x*256+'px';
		o.style.top=y*256+'px';
		o.style.width='256px';
		o.style.height='256px';
		o.style.zIndex=4;
		
		return o;
	},		
		hasmm:function(x,y)
		{
			for(var i=0;i<this.mm.length;i++)
			{
				if(this.mm[i].x==x && this.mm[i].y==y)
				{
					return true;
				}
			}
			return false;
		},
		hasrlm:function(x,y)
		{
			for(var i=0;i<this.rlm.length;i++)
			{
				if(this.rlm[i].x==x && this.rlm[i].y==y){return true;}
			}
			return false;
		},
		hasrnm:function(x,y)
		{
			for(var i=0;i<this.rnm.length;i++)
			{
				if(this.rnm[i].x==x && this.rnm[i].y==y){return true;}
			}
			return false;
		},
		rccmm:function(l,t,r,b)
		{
			for(var i=0;i<this.mm.length;i++)
			{
				if(this.mm[i].x*256+256<l || this.mm[i].x*256>r || this.mm[i].y*256+256<t || this.mm[i].y*256>b)
				{
					this.rccmmo(i--);
				}
			}
		},	
		rccrlm:function(l,t,r,b)
		{
			for(var i=0;i<this.rlm.length;i++)
			{
				if(this.rlm[i].x*256+256<l || this.rlm[i].x*256>r || this.rlm[i].y*256+256<t || this.rlm[i].y*256>b)
				{
					this.rccrlmo(i--);
				}
			}
		},
		rccrnm:function(l,t,r,b)
		{
			for(var i=0;i<this.rnm.length;i++)
			{
				if(this.rnm[i].x*256+256<l || this.rnm[i].x*256>r || this.rnm[i].y*256+256<t || this.rnm[i].y*256>b)
				{
					this.rccrnmo(i--);
				}
			}
		},
		rccht:function(l,t,r,b)
		{
			for(var i=0;i<this.ht.length;i++)
			{
				if(this.ht[i]._x<l || this.ht[i]._x>r || this.ht[i]._y<t || this.ht[i]._y>b)
				{
					this.rcchto(i--);
				}
			}
		},
		rccmmo:function(i)
		{
			var mmtmp=this.mm.splice(i,1)[0];
			mmtmp.objr.style.display='none';
			this.mmo.push(this.divimg.removeChild(mmtmp.objr));
		},
		rcczmo:function(i)
		{
			var zmtmp=this.zm.splice(i,1)[0];
			zmtmp.objr.style.display='none';
			this.mmo.push(this.divimg.removeChild(zmtmp.objr));
		},
		rccrlmo:function(i)
		{
			var rlmtmp=this.rlm.splice(i,1)[0];
			rlmtmp.objr.style.display='none';
			if(ie)
			{
				rlmtmp.objr.style.filter='';
			}
			this.rmo.push(this.divimg.removeChild(rlmtmp.objr));
		},	
		rccrnmo:function(i)
		{
			var rnmtmp=this.rnm.splice(i,1)[0];
			rnmtmp.objr.style.display='none';
			if(ie)
			{
				rnmtmp.objr.style.filter='';
			}
			this.rmo.push(this.divimg.removeChild(rnmtmp.objr));
		},
		rcchto:function(i)
		{
			var httmp=this.ht.splice(i,1)[0];
			this.hto.push(this.htol.removeChild(httmp));
		},	
		mtzm:function(i,zr)
		{
			var mmtmp=this.mm.splice(i,1)[0];
			mmtmp.objr.style.left=mmtmp.x*256/zr+'px';
			mmtmp.objr.style.top=mmtmp.y*256/zr+'px';
			mmtmp.objr.style.width=256/zr+'px';
			mmtmp.objr.style.height=256/zr+'px';
			mmtmp.objr.style.zIndex=1;
			this.zm[this.zm.length]=mmtmp;
		},	
		mtzm1:function(i)
		{
			var mmtmp=this.mm.splice(i,1)[0];
			mmtmp.objr.style.zIndex=1;
			this.zm[this.zm.length]=mmtmp;
		},	
		clearmm:function()
		{
			for(var i=0;i<this.mm.length;i++)
			{
				this.rccmmo(i--);
			}
		},	
		clearzm:function()
		{
			for(var i=0;i<this.zm.length;i++)
			{
				this.rcczmo(i--);
			}
		},	
		clearrlm:function()
		{
			for(var i=0;i<this.rlm.length;i++)
			{
				this.rccrlmo(i--);
			}
		},	
		clearrnm:function()
		{
			for(var i=0;i<this.rnm.length;i++)
			{
				this.rccrnmo(i--);
			}
		},
	showhshint:function(x,y,nm){
		this.hshint.style.left=(x+document.documentElement.scrollLeft+16)+'px';
		this.hshint.style.top=(y+document.documentElement.scrollTop)+'px';
		if(this.hshint.style.display=='none'){
		  this.hshint.innerHTML=nm;
		  this.hshint.style.display='';
		}
	},
	hidehshint:function(){
		this.hshint.style.display='none';
	},
	ctnmousemove:function(evt){
		var evtx=ie?evt.clientX-2:evt.clientX;
		var evty=ie?evt.clientY-2:evt.clientY;
		var ctnx=evtx-this.ctn.offsetLeft;
		var ctny=evty-this.ctn.offsetTop;
		var mx=ctnx-this.mvl.offsetLeft;
		var my=ctny-this.mvl.offsetTop;
		var hs=this.gethsinfobp(mx,my);
		if(hs!=null){
			this.showhshint(evtx,evty,hs.n);
			if(!this.opt.ht)
			{				
				this.currhs=hs;
				this.ctn.style.cursor='pointer';
				this.ctn.onclick=this.showinfohint.bindAsEventListener(this);
			}
			else
			{

				this.ctn.style.cursor='default';
				this.currhs=null;
			}
		}
		else{
			this.hidehshint();
			this.ctn.style.cursor='default';
			this.currhs=null;
		}
		return false;
	},
	
	ctnmouseout:function(evt){
		this.hidehshint();
	},
	mousestyle:function(evt){
		var evtx=ie?evt.clientX-2:evt.clientX;
		var evty=ie?evt.clientY-2:evt.clientY;
		var ctnx=evtx-this.ctn.offsetLeft;
		var ctny=evty-this.ctn.offsetTop;
		var mx=ctnx-this.mvl.offsetLeft-17;
		var my=ctny-this.mvl.offsetTop-16;
		this.hcross.style.display="";
		this.hcross.innerHTML="<img src=images/point1.gif border=0>"
		this.tipxy.appendChild(this.hcross)
		this.hcross.style.left=mx+'px';
		this.hcross.style.top=my+'px';
	},
	mouserightclick:function(evt){
		if(evt.button!==1)
		{
            this.hstip.style.display='none';
			this.tip.style.display = "none";
			this.tipxy.style.display='none';
			this.opt.ht=false;
			return false;			
		}
	},
	loadSideFrame: function(src,con) {
	    //window.clearInterval(this.frmSideBoxItv);
	    src=src+"?"+con;
		this.frmSidebox.src = 'jump2page.htm?' + src;
	    //if (this.frmSidebox) {
	        //this.togSizeBox(true);
	       // this.frmSideBoxItv = setTimeout(function() {
	         //window.parent.frmSidebox.do_list(con);
	        //}.bind(this), 20);
	    //}
	},
	setSideFrameSrc:function(src)
	{
	    window.clearInterval(this.frmSideBoxItv);
	    this.frmSrc = src;
	    if (this.frmSidebox) {
	        //this.togSizeBox(true);
	        this.frmSideBoxItv = setTimeout(function() {
				this.frmSidebox.src = 'jump2page.htm?' + escape(this.frmSrc);
	        }.bind(this), 30);
	    }
	},
    splitClick: function() {
        //this.togSizeBox();
		//document.documentElement.clientWidth
		this.ctn.style.width=this.isShowSideBox ? (document.documentElement.clientWidth-10)+'px':(document.documentElement.clientWidth-450)+'px';
		this.oSideBox.style.width=(document.documentElement.clientWidth-this.ctn.offsetWidth-8)
		this.oSplit.className = this.isShowSideBox ? 'msplitoff1' : 'msplitoff2';
		this.isShowSideBox=(this.isShowSideBox)?false:true;
		this._loadmap();
    },
    splitClick2: function() {
        //this.togSizeBox();
		this.oSideBox.style.width=(document.documentElement.clientWidth-this.ctn.offsetWidth-8)
		this.ctn.style.width=this.isShowSideBox2 ? '0px':'580px';
		this.oSplit.className = this.isShowSideBox2 ? 'msplitoff2' : 'msplitoff1';
		this.isShowSideBox2=(this.isShowSideBox2)?false:true;
		this._loadmap();
    },
	_loadmap:function()
	{
		//svar hz=Math.floor(8/this.opt.z);
		//read_post(Math.floor(this._center.x),Math.floor(this._center.y),hz);		
		//CollectGarbage();
		this.fitminimap();
		this.setpos();
		this.loadmm();
		if(this.opt.hr)
		{
			this.loadrlm();			
			this.loadrnm();
		}		
		this.setminimappos();
		this.loadminimap();
		this.loadpos();
		this.loadad();		
	 }
}
CMap.prototype.init=function(){
        //创建移动层
        this.ctn.style.overflow="hidden";
        this.mvl=document.createElement("DIV");
        this.mvl.style.cssText="position:absolute;left:0;top:0;z-index:1";
        this.ctn.appendChild(this.mvl);
		//底图
		this.divimg=document.createElement("DIV");
		this.divimg.style.cssText="position:absolute;left:0;top:0;z-index:11";
        this.mvl.appendChild(this.divimg);
		///路层
		this.divrdimg=document.createElement("DIV");
		this.divrdimg.style.cssText="position:absolute;left:0;top:0;z-index:3;visibility:hidden;";
        this.mvl.appendChild(this.divrdimg);
        //创建遮盖层
        this.cover=document.createElement("DIV");
        this.cover.innerHTML="&nbsp;";
        this.cover.style.cssText="position:relative;left:0;top:0;z-index:5;width:1000px;overflow:hidden;height:800px;background-color:gray;filter:alpha(opacity=0);opacity:0;";
        this.ctn.appendChild(this.cover);
        //创建信息层
        this.info=document.createElement("DIV");
        this.info.style.cssText="position:absolute;left:0;top:0;z-index:10;";
        this.ctn.appendChild(this.info);
		//显示标注
        this.tipshow=document.createElement("DIV");
        this.tipshow.style.cssText="position:absolute;left:0px;top:0px;z-index:80;overflow:hidden;display:none;width:80000px;height:80000px;";
        this.info.appendChild(this.tipshow);
		//坐标图层
        this.tipxy=document.createElement("DIV");
        this.tipxy.style.cssText="position:absolute;left:0px;top:0px;z-index:100;overflow:hidden;display:none;width:80000px;height:80000px;";
        this.info.appendChild(this.tipxy);
		//显示公交
		
        this.Bsshow=document.createElement("DIV");
		this.Bsshow.id="Bsshow";
        this.Bsshow.style.cssText="position:absolute;left:0px;top:0px;z-index:70;overflow:hidden;display:none;width:80000px;height:80000px;";
        this.info.appendChild(this.Bsshow);
		//显示广告
        this.adol=document.createElement("DIV");
		this.adol.id="ad";
        this.adol.style.cssText="position:absolute;left:0px;top:0px;z-index:60;";
        this.info.appendChild(this.adol);
        
        this.adzoom=document.createElement("DIV");
		this.adzoom.id="adzoom";
        this.adzoom.style.cssText="position:absolute;left:0px;top:0px;z-index:999";
        this.info.appendChild(this.adzoom);        
        //this.areashow=document.createElement("DIV");
		//this.areashow.id="sArea";
        //this.areashow.style.cssText="position:absolute;left:0px;top:0px;z-index:60;overflow:hidden;width:80000px;height:80000px;filter:alpha(opacity=0);opacity:0;";
		//this.info.appendChild(this.areashow);
		//
		this.oSplitButton=document.createElement("DIV");
		this.oSplitButton.style.cssText="position: absolute;left:0px;top:"+(this.ctn.offsetHeight/2-32)+"px;border:none;width:8px;cursor:pointer";
		this.oSplitButton.className = this.isShowSideBox ? 'msplitoff1' : 'msplitoff2';
	    this.oSplit.appendChild(this.oSplitButton);
	    this.oSplitButton.onclick=this.splitClick.bindAsEventListener(this);
	    this.oSplitButton.onmouseover=function(){this.className = map.isShowSideBox ? 'mspliton1' : 'mspliton2';};
	    this.oSplitButton.onmouseout=function(){this.className = map.isShowSideBox ? 'msplitoff1' : 'msplitoff2';};

		//this.oSplitButton2=document.createElement("DIV");
		//this.oSplitButton2.style.cssText="position: absolute;left:0px;top:"+(this.ctn.offsetHeight/2)+"px;border:none;width:8px;cursor:pointer";
		//this.oSplitButton2.className = this.isShowSideBox2 ? 'msplitoff2' : 'msplitoff1';
	    //this.oSplit.appendChild(this.oSplitButton2);
	    //this.oSplitButton2.onclick=this.splitClick2.bindAsEventListener(this);
	    //this.oSplitButton2.onmouseover=function(){this.className = map.isShowSideBox2 ? 'mspliton2' : 'mspliton1';};
	    //this.oSplitButton2.onmouseout=function(){this.className = map.isShowSideBox2 ? 'msplitoff2' : 'msplitoff1';};

	    this.oSideBox.innerHTML='<iframe id="frmSidebox" name="frmSidebox" width="100%" style="background-color:#fff; border: none;height:'+(document.documentElement.clientHeight-$('d_Top').offsetHeight)+'" frameborder="no" marginheight="0" marginwidth="0" border="0" src="" scrolling="yes"></iframe>';
	    this.frmSidebox = $('frmSidebox');
	    this.frmSrc = SIDEBOX_URL;
	    this.frmSideBoxItv = null;
	    this.setSideFrameSrc(SIDEBOX_URL);
			    
		this.ctn.oncontextmenu=function(){return false;}
		//显示查询结果
        this.divSearch=$("getSearch");
		this.divSearch.style.cssText="left:0px;top:"+(this.ctn.offsetTop+this.ToolBar.offsetHeight)+"px";
		this.sPage=document.createElement("DIV");
		this.sPage.id="sPage";
		this.sPage.onmouseover=function(){$("sRes").style.display=""}
        this.divSearch.appendChild(this.sPage);

		this.sRes=document.createElement("DIV");
		this.sRes.id="sRes";
		this.sRes.style.height=this.ctn.offsetHeight-this.sPage.offsetHeight-this.ToolBar.offsetHeight-5;
        this.divSearch.appendChild(this.sRes);
		this._minimapCreate();
		this._minimapTool();
        this._loadmap();
        //事件绑定
		//CEvent.addListener(document, "keydown", this._KeyDown.bindAsEventListener(this));
		//CEvent.addListener(document, "keyup", this._KeyUp.bindAsEventListener(this));		
        CEvent.addListener(this.ctn,"mousewheel",this._MouseWheel.bindAsEventListener(this));
        CEvent.addListener(window,"resize",this._resize.bindAsEventListener(this));
		CEvent.addListener(this.info,"dblclick",this._mapdblclick.bindAsEventListener(this));
        CEvent.addListener(this.ctn,"mousemove",this.ctnmousemove.bindAsEventListener(this));
        CEvent.addListener(this.ctn,"mouseout",this.ctnmouseout.bindAsEventListener(this));
        CEvent.addListener(this.ctn,"mousedown",this._mapmousedown.bindAsEventListener(this));
        CEvent.addListener(this.ctn,"mousemove",this._mapmove.bindAsEventListener(this));
        CEvent.addListener(this.ctn,"mouseup",this._mapmouseup.bindAsEventListener(this));
        CEvent.addListener(this.ctn,"mousedown",this._infomousedown.bindAsEventListener(this));
        CEvent.addListener(this.ctn,"mousemove",this._infomove.bindAsEventListener(this));
        CEvent.addListener(this.ctn,"mouseup",this._infomouseup.bindAsEventListener(this));
        CEvent.addListener(this.ctn,"mouseover",this._infomouseover.bindAsEventListener(this));
        CEvent.addListener(this.ctn,"mousedown",this.mouserightclick.bindAsEventListener(this));                
		//this.ctn.ondragstart=function(){return false;}
		//this.ctn.onselectstart=function(){return false;}
		//this.ctn.onmousemove=this.ctnmousemove.bindAsEventListener(this);
		//this.ctn.onmouseout=this.ctnmouseout.bindAsEventListener(this);
}