﻿/* PoiMan.js */

function _PoiMan() {	
	var PoiMan = Class.create( {
		initialize: function(parent, container) {
			this.container = container;
			this.parent = parent;
			this.PoiLayer = WSpec.getBaseLayer(30, 'PoiLayer');//new Element('DIV'); //여기에 poi전체들 붙어야해
			this.HintBoxLayer = WSpec.getBaseLayer(32, 'HintBoxLayer');
			this.InfoBoxLayer = WSpec.getBaseLayer(31, 'InfoBoxLayer');
			
			//this.container.appendChild(this.PoiLayer);
			
			this.gPoiLayer = new Array(); //그룹별 layer 저장 하는 배열.
			this.gHintLayer = new Array();
			this.gInfoLayer = new Array();
			
			this.PoiBuffer = new Array(); //poi 초기화를 위한 배열 (WSpec.maxpoicnt(180개)만큼 poi 처음에 생성한다.)
										//클래스가 메모리 해제가 안되기 때문에 갯수를 fix.
			this.HintBuffer = new Array();
			this.InfoBuffer = new Array(); 							
										
			
			this.Pois = new Array(); //poi그룹이 들어갈 배열. 2차원배열로 저장.
			this.Hints = new Array(); //hintbox그룹이 들어갈 배열. 2차원배열로 저장.
			this.Infos = new Array(); //Infobox그룹이 들어갈 배열. 2차원배열로 저장.	

			this.setInnerEvent();
			//this.initPoi(WSpec.initlevel);
			
			this.preHintGid = null;
			this.preHintPid = null;
			
			this.preInfoGid = null;
			this.preInfoPid = null;
			this.initAddPoi(); //poi초기화.(180개 미리 생성)

			//this.mizcnt= 0;
			//alert(this.getPoi(0,1).coord.lon); //정상
			//alert('this.PoiLayer.childNodes.length = ' + this.PoiLayer.childNodes.length); //잘 붙어있음 2
		},
		setInnerEvent: function() {			
			EventMan.addListener(this.parent, 'zoomTileLayer', this.resetPosPoi.bindAsEventListener(this));
			EventMan.addListener(this.parent, 'moveLevelBarLayer', this.resetPosPoi.bindAsEventListener(this));

			//Event.observe(window,'resize',function() {alert('window-resize')});
			//Event.observe($(windowLayer),'resize',function() {alert('windowLayer-resize')});
		},
		initPoi: function(level) { //lon,lat좌표로 pixel구하기 위해서 사전작업 필요
			var xtilecount = WSpec.getXTileCount(level);
			var ytilecount = WSpec.getYTileCount(level);		
			this.PoiLayer.style.width = xtilecount * WSpec.tilesize;
			this.PoiLayer.style.height = ytilecount * WSpec.tilesize;			
		},
		/* Start - 요기는 메모리 해제 때문에 poi미리 생성해놓기 위해 필요한 것들임..*/
		initAddPoi: function() { //poi를 초기화
		//new Poi(this, this.gPoiLayer[gid], this.PoiLayer, gid, pid, icon, text, coord, positiontype, imgw, imgh, hinttitle, hintbody,showtextS, showtextE); 
			for (i=0; i<WSpec.maxpoicnt; i++) {
				//this.PoiBuffer[i]=  new Poi(this,null,this.PoiLayer,0,0,'','0',null,0,0,0,'','',0,0);
				this.PoiBuffer[i]=  new Poi(this,null,this.PoiLayer,0,0,'','0',null,0,0,0,'','',0,0);
				//this.PoiBuffer[i]=  {"gid" : 10, "pid" : 10};
				//new Poi(this,null,this.PoiLayer,0,0,null,'0',null,0,0,0,null,null,0,0);
			}
			this.HintBuffer[0] = new HintBox(this,null,'00','00'); //this.hintbox = new HintBox(this, this.gHintLayer[gid], hinttitle, hintbody);
			this.InfoBuffer[0] = new InfoBox(this,null,0,0,'00','00'); //this.infobox = new InfoBox(this, this.gInfoLayer[gid], gid, pid, title, contents);
			//document.all.a.value = 'poibuffer: '+this.PoiBuffer.length+',  hintbuffer: '+this.HintBuffer.length+', infobuffer: '+this.InfoBuffer.length;
			//this.plusPoiMaxCnt(10);
			
		},
		plusPoiMaxCnt: function(cnt) {
			var maxpoi = this.getPoiMaxCnt();
			for (i=maxpoi; i<maxpoi+cnt; i++) {
				this.PoiBuffer[i] = new Poi(this,null,this.PoiLayer,0,0,'','0',null,0,0,0,'','',0,0);
			}
		},
		getPoiMaxCnt: function() {
			return this.PoiBuffer.length;
		},
		/* End - 요기는 메모리 해제 때문에 poi미리 생성해놓기 위해 필요한 것들임..*/
		
		
		makeGroupLayer: function(gid,kind) {
				var newEle = new Element('DIV');
				newEle.id = 'g' + kind+gid;
				
				newEle.setStyle( {
	        		//'position' : 'absolute',
	        		//'width': 100,
	        		//'height': 100,
	        		'top' : '0px',
	        		'left' : '0px',
	        		'border' : '0px solid red',
	        		'overflow' : 'hidden'
				 });

				if (kind == 'poi') {
					this.gPoiLayer[gid] = newEle;
					this.PoiLayer.appendChild(this.gPoiLayer[gid]); //PoiLayer에 생성하면서 appendChild
				}
				else if (kind == 'hint') {
					this.gHintLayer[gid] = newEle;
					this.HintBoxLayer.appendChild(this.gHintLayer[gid]);
				}
				else if (kind == 'info') {
					this.gInfoLayer[gid] = newEle;
					this.InfoBoxLayer.appendChild(this.gInfoLayer[gid]);
				}
		},	
		
		poiMouseOver: function(val) {
			var gid = val["gid"];
			var pid = val["pid"];
			var layer = val["layer"]; //layer는 this.image	
			WSpec.setCursorHand(layer);
			//EventMan.trigger(this, 'poiMouseover', {"gid":gid, "pid":pid});
			this.hintShow(gid,pid);
		},
		poiMouseMove: function(val) {
			var gid = val["gid"];
			var pid = val["pid"];
			var point = val["point"];
			this.setPosHintBox(gid,pid,point);
		},
		poiMouseOut: function(val) {
			var gid = val["gid"];
			var pid = val["pid"];
			var layer = val["layer"]; //layer는 this.image	
			WSpec.setCursorNormal(layer);
			this.hintboxHide(gid,pid);
		},
		
		poiClick: function(val) {
			//alert("Poiclick" + val["gid"]+ val["pid"]);
			EventMan.trigger(this,'poiClick', val);
		},
		hintShow: function(gid, pid) { //mouseover 했을때 hintbox 생성
			var hinttitle = this.Pois[gid][pid].hinttitle;
			var hintbody = this.Pois[gid][pid].hintbody;
			this.addHint(gid,pid, hinttitle, hintbody);
			this.hintboxShow(gid,pid);
//			this.preHintGid = gid;
//			this.preHintPid = pid;
			
			
		},
		infoShow: function(gid,pid,contents) { //poiClick시 발생하는 일들을 여기서 해야함.. click했을때 infobox생성
			var hinttitle = this.Pois[gid][pid].hinttitle;
			//alert(this.Infos[gid] == null && this.Infos[gid][pid] == null);//&& this.Infos[gid] == null && this.Infos[gid][pid] == null)
			this.addInfo(gid,pid, hinttitle,contents);
			if(this.Hints.length > 0 && this.Hints[gid] != null && this.Hints[gid][pid] != null) {
				this.hintboxHide(gid,pid);
			}
			if (this.preInfoGid != null && this.preInfoPid != null) {
				this.infoboxHide(this.preInfoGid, this.preInfoPid);
			}
			//내용넣기
			//this.Infos[gid][pid].setInfoText(contents);
			
			//위치잡기
			var level = this.parent.getInnerLevel();
			this.setPosInfobox(gid,pid,level); 
			
			//보이기		
			this.infoboxShow(gid,pid);
//			this.preInfoGid = gid;
//			this.preInfoPid = pid;
		},
/*
		laptime: function(id) {
			var now=new Date(); // 현재시간 가져오기
			var sec=now.getSeconds(); // 초 가져오기
			var mils=now.getMilliseconds(); 
			if(id < 999) {
				document.all.a.value += sec + ':' + mils + ' ';
			} else {
				document.all.a.value += sec + ':' + mils + '|';
			}
				
		},
*/
		stickPoi: function() {
			this.drawPoi(this.parent.getInnerLevel());
		},
		
		addPoi: function(gid, pid, icon, text, coord, positiontype, imgw, imgh, hinttitle, hintbody,showtextS, showtextE) { //poi하나당 class 하나. 배열에 class저장 //gid:999는 경로관련된 icon들		
			//alert("add: "+gid+","+pid);
			//poi생성할때 this.PoiLayer에 붙이지 말고, group별 poi만들어서 붙어야함.. 있음 그 layer에 붙이고 없으면 다시 만들고,
			/* Poi 생성 */
			var level = this.parent.getInnerLevel();
			var showtextSlevel = (WSpec.maxlevel+1)-showtextS;
			var showtextElevel = (WSpec.maxlevel+1)-showtextE;
			//alert(showtextSlevel+","+showtextElevel);
			if (!this.gPoiLayer[gid]) { //!this.gPoiLayer[gid]  && !this.gPoiLayer[gid].descendantOf(this.PoiLayer)
				this.makeGroupLayer(gid, 'poi');								
			}
			if (this.Pois[gid] == null) {
					this.Pois[gid] = new Array();
			}
			if (this.Pois[gid][pid] == null) {//this.Pois.length > 0 && this.Pois[gid][pid] == null
				//var poi = new Poi(this, this.gPoiLayer[gid], this.PoiLayer, gid, pid, icon, text, coord, positiontype, imgw, imgh, hinttitle, hintbody,showtextS, showtextE); //this.PoiLayer	
				
				var poi = this.PoiBuffer.pop(); //배열에 빈 poi객체 넣기만 함..!! 값을 넣어야 함.
				//alert(poi);
				poi.setValue(this.gPoiLayer[gid], gid, pid, icon, text, coord, positiontype, imgw, imgh, hinttitle, hintbody,showtextSlevel, showtextElevel); //값넣는 함수
				//document.all.b.value = "add: this.PoiBuffer ---" + this.PoiBuffer.length;
				
				
				//poi.showtextSlevel = showtextSlevel;
				//poi.showtextElevel = showtextElevel;
				//poi.setPos(level);
				if (showtextSlevel <= level&& showtextElevel >= level) {
					poi.showTextLayer();
				}
				poi.show();
				this.Pois[gid][pid] = poi;
				
				if (gid != 999) {
					//this.addHint(gid,pid, hinttitle, hintbody);
					//this.addInfo(gid,pid, hinttitle);
								
					EventMan.addListener(poi, 'poimouseover', this.poiMouseOver.bindAsEventListener(this));
					EventMan.addListener(poi, 'poimousemove', this.poiMouseMove.bindAsEventListener(this));
					EventMan.addListener(poi, 'poimouseout', this.poiMouseOut.bindAsEventListener(this));
					EventMan.addListener(poi, 'poiclick', this.poiClick.bindAsEventListener(this));

				}
				poi = null;
				//document.all.c.value = "add: this.Pois[gid] ---" + this.Pois[gid].length;
				return true;
			}
			else {
				//alert('다른 gid, pid를 선택하여 주십시오');
				return false;
			}

			//alert(this.gPoiLayer[gid].id);
			//alert('this.gPoiLayer['+gid+'].childNodes.length = ' + this.gPoiLayer[gid].childNodes.length);

		},
		addHint: function(gid, pid, hinttitle, hintbody) {
			/* HintBox 생성 */			
			if (!this.gHintLayer[gid]) {
				this.makeGroupLayer(gid, 'hint');				
			}
			if (this.Hints[gid] == null) {
				this.Hints[gid] = new Array();
			}
			if (this.Hints[gid][pid] == null && gid != 999 && hinttitle!="") {
				//this.hintbox = new HintBox(this, this.gHintLayer[gid], hinttitle, hintbody); 
				if (this.HintBuffer.length < 1) {
					this.HintBuffer[0] = new HintBox(this,null,'00','00');
				}
				var hint = this.HintBuffer.pop();
				hint.setValue(this.gHintLayer[gid], hinttitle, hintbody);
				//document.all.b.value += this.HintBuffer.length;
				this.Hints[gid][pid] = hint;
				//document.all.c.value += this.Hints[0].length;
			}
			
		},
		addInfo: function(gid, pid, title, contents) {
			/* InfoBox 생성 */
			if (!this.gInfoLayer[gid]) {
				this.makeGroupLayer(gid, 'info');		
			}
			if (this.Infos[gid] == null) {
				this.Infos[gid] = new Array();
			}
			if (this.Infos[gid][pid] == null && gid != 999) {
				if (this.InfoBuffer.length < 1) {
					this.InfoBuffer[0] = new InfoBox(this,null,0,0,'00','00'); //new InfoBox(this,null,0,0,'00','00'); 
				}
				var infobox = this.InfoBuffer.pop();
				infobox.setValue(this.gInfoLayer[gid], gid, pid, title, contents); 
				//document.all.b.value += this.InfoBuffer.length;
				this.Infos[gid][pid] =infobox;
				//document.all.c.value += this.Infos[0].length;
				//alert(this.Infos[gid][pid].contents)
			
				/*
				this.infobox = new InfoBox(this, this.gInfoLayer[gid], gid, pid, title, contents); //this.gHintLayer[gid]
				this.Infos[gid][pid] =this.infobox;
				*/
				EventMan.addListener(infobox, 'infoclose', this.infoCloseClick.bindAsEventListener(this));	
				EventMan.addListener(infobox, 'infodesticlick', this.infoDestiClick.bindAsEventListener(this));			
			}
			//EventMan.addListener(infobox, 'infoclose', this.infoCloseClick.bindAsEventListener(this));	
			//EventMan.addListener(infobox, 'infodesticlick', this.infoDestiClick.bindAsEventListener(this));			
			
		},
		infoCloseClick: function(val) {
			var gid = val["gid"];
			var pid = val["pid"];
			this.infoboxHide(gid,pid);
			
		},
		infoDestiClick: function(val) {
			var gid = val["gid"];
			var pid = val["pid"];
			var poi = this.getPoi(gid, pid);
			this.parent.setEndCoord(poi.coord);

		},
		
		getPoi: function(gid, pid) {
			return this.Pois[gid][pid];
			
		},
		removePoi: function(gid, pid) {
			//alert("remove"+gid+","+pid);
			//alert(this.Pois[gid][pid] != null && this.Pois[gid][pid].descendantOf(this.gPoiLayer[gid]));
			
			if (this.Pois.length > 0 && this.Pois[gid] != null) {
				if (this.Pois[gid][pid] != null) { 
					this.PoiBuffer.push(this.Pois[gid][pid]);
					this.Pois[gid][pid].remove();
					//document.all.d.value = this.PoiBuffer.length;
					if (gid != 999) {  
						//this.Hints[gid][pid].remove();
						//this.Hints[gid][pid] = null;
						
						if(this.Hints.length > 0 && this.Hints[gid] != null && this.Hints[gid][pid] != null) {
							this.HintBuffer.push(this.Hints[gid][pid]);
							this.Hints[gid][pid].remove();
							this.Hints[gid][pid] = null;
							//document.all.d.value = this.HintBuffer.length;
						}
						
						if(this.Infos.length > 0 && this.Infos[gid] != null && this.Infos[gid][pid] != null) {
							this.InfoBuffer.push(this.Infos[gid][pid]);
							this.Infos[gid][pid].remove();
							this.Infos[gid][pid] = null;
							//document.all.d.value = this.InfoBuffer.length;
						}
					}					
					this.Pois[gid][pid] = null;
					//alert(this.Pois[gid].length); 배열에 값은 null시켰지만 메모리 영역은 그대로 잡고 있는 상태.
				} 
				else {
					//alert('존재하지 않는 gid,pid입니다.');
				}
			}
			else {
				//alert('존재하지 않는 gid,pid입니다.');
			}
			//document.all.e.value = "remove: this.PoiBuffer --- " + this.PoiBuffer.length
	
		},
		removeGroupPoi: function(gid) {		
			if (this.gPoiLayer[gid] != null && this.gPoiLayer[gid].descendantOf(this.PoiLayer)) {
				this.PoiLayer.removeChild(this.gPoiLayer[gid]); //PoiLayer에서 제거
				this.gPoiLayer[gid] = null;						//Layer가 들어있는 배열에서 Layer제거 //그룹별로 따로 레이어 해야하나?
				
				if (gid != 999) { 
					//this.HintBoxLayer.removeChild(this.gHintLayer[gid]);
					//this.gHintLayer[gid] = null;
					
					//this.InfoBoxLayer.removeChild(this.gInfoLayer[gid]);
					//this.gInfoLayer[gid] = null;
					
					if(this.gHintLayer[gid] != null && this.gHintLayer[gid].descendantOf(this.HintBoxLayer)) {
						this.HintBoxLayer.removeChild(this.gHintLayer[gid]);
						this.gHintLayer[gid] = null;
					}
			
					if(this.gInfoLayer[gid] != null && this.gInfoLayer[gid].descendantOf(this.InfoBoxLayer)) {
						this.InfoBoxLayer.removeChild(this.gInfoLayer[gid]);
						this.gInfoLayer[gid] = null;
					}
				}
				for (i=0; i<this.Pois[gid].length; i++) {
					//this.removePoi(gid, i);
					if (this.Pois[gid][i] != null ) {
						//alert(i);
						this.PoiBuffer.push(this.Pois[gid][i]);
						this.Pois[gid][i] = null;
					}
					
					if (gid != 999) { 
						//this.Hints[gid][i] = null;
						//this.Infos[gid][i] = null;
						
						if(this.Hints.length > 0 && this.Hints[gid] != null && this.Hints[gid][i] != null) {
							this.HintBuffer.push(this.Hints[gid][i]);
							this.Hints[gid][i] = null;
							//document.all.d.value = this.HintBuffer.length;
						}
						
						if(this.Infos.length > 0 && this.Infos[gid] != null && this.Infos[gid][i] != null) {
							this.InfoBuffer.push(this.Infos[gid][i]);
							this.Infos[gid][i] = null;
							
						}
						
					}
				}
				this.Pois[gid] = null;
				this.Hints[gid] = null;
				this.Infos[gid] = null;
				//document.all.d.value = "removeGroup: this.PoiBuffer --- " + this.PoiBuffer.length;
				
			}
			else {
				//alert('존재하지 않는 gid입니다.');
			}
			
			
			/*
			if (this.Pois[gid] != null) {
				for (i=0; i<this.Pois[gid].length; i++) {
					this.removePoi(gid, i);
				}
			}
			else {
				alert('존재하지 않는 gid입니다.');
			}*/
		},
		drawPoi: function(level) { 
			EventMan.trigger(this, 'drawPoi', {"level":level, "layer":this.PoiLayer});
			EventMan.trigger(this, 'drawPoi', {"level":level, "layer":this.HintBoxLayer});
			EventMan.trigger(this, 'drawPoi', {"level":level, "layer":this.InfoBoxLayer});

		},
		resetPosPoi: function(level) {		
			//this.initPoi(level);			
			for (i = 0; i < this.Pois.length; i++) { //0
				if (this.Pois[i] != null) {
					for (j=0; j< this.Pois[i].length; j++) { //0 ,1
						if (this.Pois[i][j] != null) {
							if (this.preHintGid != null && this.preHintPid != null) {
								this.hintboxHide(this.preHintGid,this.preHintPid);
							}
							//this.hintboxHide(i,j);
							this.setPosPoi(i,j,level); //poi위치
							if (i != 999) {
							//alert(this.Pois[i][j].showtextSlevel +","+ this.Pois[i][j].showtextElevel)
							//alert(this.Pois[i][j].showtextS +","+ this.Pois[i][j].showtextE + "," + level)
								if (this.Pois[i][j].showtextSlevel <= level&& this.Pois[i][j].showtextElevel >= level) {
									this.Pois[i][j].showTextLayer();
								}
								else {
									this.Pois[i][j].hideTextLayer();
								}
							}
							
							/*
							if (level == 12) { //레벨12일때만 poi-text 보이도록 설정	
								this.poi.showTextLayer();
							}
							else {
								this.poi.hideTextLayer();
								
							}
							*/
							
							//if (this.Infos[i][j] != null) {
								//this.posInfoBox(i,j,level); //infobox위치
							//}
							
							if (this.preInfoGid != null && this.preInfoPid != null) {
								this.posInfoBox(this.preInfoGid, this.preInfoPid, level);
							}
										
							
						}
						
					}
				}

			}	
			this.drawPoi(level);
			
		},
		
		setPosPoi: function(gid,pid,level) {
			this.Pois[gid][pid].setPos(level);
			//this.drawPoi(level);
		},
		setPosHintBox: function(gid,pid,pos) {
			this.Hints[gid][pid].setPos(pos.x, pos.y);	
		},	

		posInfoBox: function(gid, pid, level) { //infobox위치결정
			var infobox = this.Infos[gid][pid];
			//var infoboxWidth = infobox.contentWidth;
			//var infoboxHeight = infobox.contentHeight;
			
			var point = this.Pois[gid][pid].getPos();  //sTileLayer에서의 baseLayer의 위치(point) 
			var positiontype = this.Pois[gid][pid].positiontype;
			var w = this.Pois[gid][pid].imgw;
			var h = this.Pois[gid][pid].imgh;
			var x=0; y=0;
			switch(positiontype) {
				case 0: x = w/2;	y = 0; break;
				case 1: x = 0;		y = 0; break;
				case 2: x = -(w/2);	y = 0; break;
				case 3: x = w/2;	y = h/2; break;
				case 4: x = 0;		y = h/2; break;
				case 5: x = -(w/2);	y = h/2; break;
				case 6: x = w/2;	y = h; break;
				case 7: x = 0;		y = h; break;
				case 8: x = -(w/2);	y = h; break;
			}
			point.x = point.x - (WSpec.infobackw/2) + x; //infobox의 위치 (sTileLayer안에서의 좌표)
			point.y = point.y - y - WSpec.infobackh - 5;///2;// + y + 30;// + this.Pois[gid][pid].imgh; //30은 poi텍스트보이도록 하기위해서
			
			// 위 아래 위치 결정
			var sTileLayerPos = this.parent.getLayerPosition(level); //tileLayer의 위치
			
			var infopoint = new WPoint();
			infopoint.x = point.x + sTileLayerPos.x; //infobox의 위치 (화면에 보여지는 부분의 pixel좌표)
			infopoint.y = point.y + sTileLayerPos.y; //			
			
			//alert("sTileLayer좌표: " + point.x+","+point.y);
			//alert("화면상좌표: " + infopoint.y+","+infopoint.y);
			
			
			//infobox 이미지 결정			
			if (infopoint.y < 0) { //기본은 위에 나오는
				var gap=0;
				if (this.Pois[gid][pid].showtextSlevel <= level&& this.Pois[gid][pid].showtextElevel >= level) { //this.Pois[gid][pid].showtextSlevel <= level&& this.Pois[gid][pid].showtextElevel >= level
					gap=35;
				}
				else {
					gap=15;
				}
				point.y = point.y+WSpec.infobackh+h+gap;//this.Pois[gid][pid].imgh-WSpec.infobackh;
					//this.Infos[gid][pid].changeBackImage(WSpec.infobacktop);
				
			}
			
			
			
			infobox.setPos(point.x, point.y);
			return infopoint;
		},
		moveTileLayer: function(gid, pid, level, infopoint) { //infobox이미지와 infobox가 다 보이도록 sTileLayer이동
			/*sTileLayer의 좌우위치결정(infobox가 보일수있도록)*/
			if (0 > infopoint.x) { 
				this.parent.setLayerPosition(level, infopoint.x, 0);
			}
			else if((infopoint.x+WSpec.infobackw) > WSpec.viewportwidth) {
				this.parent.setLayerPosition(level, (infopoint.x+WSpec.infobackw-WSpec.viewportwidth), 0);
				
			}
		},
		setPosInfobox: function(gid,pid,level) {
			var infopoint = this.posInfoBox(gid,pid,level);
			this.moveTileLayer(gid, pid, level, infopoint);	
		},
		poiShow: function(gid,pid) {
			this.Pois[gid][pid].show();			
		},
		poiHide: function(gid,pid) {
			this.Pois[gid][pid].hide();
		},
		hintboxShow: function(gid, pid) {
			this.preHintGid = gid;
			this.preHintPid = pid;
			this.Hints[gid][pid].show();			
		},
		hintboxHide: function(gid, pid) {
			this.preHintGid = null;
			this.preHintPid = null;
			this.Hints[gid][pid].hide();
		}, 
		infoboxShow: function(gid, pid) {
			this.preInfoGid = gid;
			this.preInfoPid = pid;
			this.Infos[gid][pid].show();			
		},
		infoboxHide: function(gid, pid) {
			this.preInfoGid = null;
			this.preInfoPid = null;
			this.Infos[gid][pid].hide();
		}

	});
	window.PoiMan = PoiMan;
};
_PoiMan();	
