var sprites;var sPL;var fldr;var sF=[1,2,4,8];var p1;var sW=200;var sH=200;var wW=601;var wH=401;var cW=wW+sW;var cH=wH+sH;var sPCX=Math.ceil(wW/sW);var sPCY=Math.ceil(wH/sH);var sPC=sPCY*sPCX;var sI;var gX;var gY;var yMax,xMax,normX,normY,tmpX,tmpY;var dX=-1;var dY=-1;var xxx=0;var yyy=0;var fl=true;function tS(a){h=Math.ceil(a/sPL[sI]);w=a-((h-1)*sPL[sI]);hT=(sH*(h-1));hB=sH*h;wT=(sW*(w-1));wB=sW*w;ghT=normY+hT;ghB=normY+hB;gwT=normX+wT;gwB=normX+wB;if(((ghT>=wH)||(ghT<=0))&&((ghB>=wH)||(ghB<=0))){return false}if(((gwT>=wW)||(gwT<=0))&&((gwB>=wW)||(gwB<=0))){return false}return true}function dC(){if(sI<sprites.length-1){document.getElementById('mminus').style.backgroundPosition = "-20px 0";}else{document.getElementById('mminus').style.backgroundPosition = "-60px 0";document.getElementById('mplus').style.backgroundPosition = "0 0";}if(sI>0){document.getElementById('mplus').style.backgroundPosition = "0 0";}else{document.getElementById('mminus').style.backgroundPosition = "-20px 0";document.getElementById('mplus').style.backgroundPosition = "-40px 0";}var d="";var a=false;var e=0;if((sprites[sI]/sPL[sI]-sPCY)<0){yMax=-sprites[sI]/sPL[sI]*sH}else{yMax=-(sprites[sI]/sPL[sI]-sPCY)*sH}if((sPL[sI]-sPCX)<0){xMax=-sPL[sI]*sW}else{xMax=-(sPL[sI]-sPCX)*sW}normY=gY;if(gY>0){normY=0}if(gY<yMax){normY=yMax}normX=gX;if(gX>0){normX=0}if(gX<xMax){normX=xMax}if((Math.ceil(gX/200)*200!=dX)||(Math.ceil(gY/200)*200!=dY)){dX=Math.ceil(gX/200)*200;dY=Math.ceil(gY/200)*200;fl=true}var b=Math.abs(Math.ceil((normX*normY)/40000));for(i=b;i<=sprites[sI];i++){if(tS(i)){a=true;e++;d+='<i style="background:url(/m/'+fldr+sF[sI]+"/"+i+'.png);"></i>';if(!(sPC-e)){break}}else{if(a){a=false;i+=(sPL[sI]-sPCX-1);continue}}}$$("mapcanvas").innerHTML=d;if(gX<xMax){tmpX=gX-xMax}else{tmpX=gX-dX}if(gX>=0){tmpX=gX}if(gY<yMax){tmpY=gY-yMax}else{tmpY=gY-dY}if(gY>=0){tmpY=gY}if(fl){if(gX>0){dX1=0}if(tmpX<=0){dX1=dX}if(tmpX<=(-sW)){dX1=Math.ceil(xMax/200)*200}if(gY>0){dY1=0}if(tmpY<=0){dY1=dY}if(tmpY<=(-sH)){dY1=Math.ceil(yMax/200)*200}fl=false;pP()}$$("engine").style.left=tmpX+"px";$$("engine").style.top=tmpY+"px"}function pP(){var d=p1.length;var c="";var b="";var a;for(a=0;a<d;a++){x3=(p1[a].a/sF[sI])+dX1;y3=(p1[a].b/sF[sI])+dY1;if(p1[a].t==0){c+="<div style='left:"+(Math.ceil(x3)-10)+"px;top:"+(Math.ceil(y3)-35)+"px;' class='pntr' i='"+p1[a].i+"'><a href='' title='"+p1[a].n+"'></a></div>"}else{b+="<div style='left:"+(Math.ceil(x3)-98)+"px;top:"+(Math.ceil(y3)-227)+"px;' class='pan'><div><p><img class='panclose' /><a href='"+p1[a].h+"'>"+p1[a].n+"</a></p><img class='panfoto' src='/m/org/"+p1[a].m+"'><p>"+p1[a].d+"</p></div></div>"}}$$("layorg").innerHTML=(c+b);cL=$$("layorg").childNodes.length;for(a=0;a<cL;a++){$$("layorg").childNodes.item(a).childNodes.item(0).onclick=dPa}}function dPa(){var a=p1.length;var b=this.parentNode.getAttribute("i");for(i=0;i<a;i++){if((p1[i].i)==b){p1[i].t=1}else{p1[i].t=0}}pP();return false}function $$(a){return document.getElementById(a)}function test1(a){$$("test1").innerHTML=a}function test(a){$$("test").innerHTML=a}function getStyle(a,c){var d="";if(document.defaultView&&document.defaultView.getComputedStyle){var b=document.defaultView.getComputedStyle(a,null);d=b?b.getPropertyValue(c):null}else{if(a.currentStyle){c=c.replace(/\-(\w)/g,function(e,f){return f.toUpperCase()});d=a.currentStyle[c]}}return d}function Draggable(b,k){var d=0,j=0;var f=0,l=0;function c(){document.onmouseup=null;document.onmousemove=a;$$("mapcont").className="freehand"}function e(m){m=m||window.event;d=f-parseInt(m.clientX);j=l-parseInt(m.clientY);f=parseInt(m.clientX);l=parseInt(m.clientY);gX-=d;gY-=j;dC()}function a(m){xxx=parseInt(m.clientX);yyy=parseInt(m.clientY)}function g(m){m=m||window.event;f=parseInt(m.clientX);l=parseInt(m.clientY);b.style.top=parseInt(getStyle(b,"top"))+"px";b.style.left=parseInt(getStyle(b,"left"))+"px";document.onmouseup=c;document.onmousemove=e;$$("mapcont").className="busyhand";return false}document.onmousemove=a;k.onmousedown=g}function handle(a){fl=true;if(a<0){if(sI<sprites.length-1){sI++;gX=(gX/2)+((xxx-document.getElementById("mapcont").offsetLeft)/2);gY=(gY/2)+((yyy-document.getElementById("mapcont").offsetTop+gBST())/2);dC()}}else{if(sI>0){sI--;gX=(gX*2)-(xxx-document.getElementById("mapcont").offsetLeft);gY=(gY*2)-(yyy-document.getElementById("mapcont").offsetTop+gBST());dC()}}}function wheel(a){var b=0;if(!a){a=window.event}if(a.wheelDelta){b=a.wheelDelta/120;if(window.opera){b=-b}}else{if(a.detail){b=-a.detail/3}}if(b){handle(b)}if(a.preventDefault){a.preventDefault()}a.returnValue=false}function wh(){if(window.addEventListener){window.addEventListener("DOMMouseScroll",wheel,false)}window.onmousewheel=document.onmousewheel=wheel}function nwh(){if(window.addEventListener){window.removeEventListener("DOMMouseScroll",wheel,false)}window.onmousewheel=document.onmousewheel=0};function gBST(){return self.pageYOffset || (document.documentElement && document.documentElement.scrollTop) || (document.body && document.body.scrollTop);}function gBSL(){return self.pageXOffset || (document.documentElement && document.documentElement.scrollLeft) || (document.body && document.body.scrollLeft);}

function mpMinus () {
	fl=true;
	if(sI<sprites.length-1){
		sI++;
		gX=(gX/2)+(wW/4);
		gY=(gY/2)+(wH/4);
		dC();
	}
}

function mpPlus () {
	fl=true;
	if(sI>0){
		sI--;
		gX=(gX*2)-(wW/2);
		gY=(gY*2)-(wH/2);
		dC();
	}
}



