function SUtil(){
}
SUtil.isUndefined=function(_1){
return (typeof _1=="undefined");
};
SUtil.indexOf=function(_2,_3){
for(var i=0;i<_2.length;i++){
if(_2[i]===_3){
return i;
}
}
return -1;
};
SUtil.inArray=function(_5,_6){
return (-1!=SUtil.indexOf(_5,_6));
};
SUtil.compressArray=function(_7){
var _8=new Array();
for(var i=0;i<_7.length;i++){
if(_7[i]!=null){
_8.push(_7[i]);
}
}
return _8;
};
SUtil.callback=function(_a,_b){
return (function(){
return _b.apply(_a,arguments);
});
};
SUtil.callbackWithArgs=function(_c,_d){
var _e=new Array();
for(var i=2;i<arguments.length;i++){
_e[_e.length]=arguments[i];
}
return (function(){
var _10=new Array();
for(var i=0;i<_e.length;i++){
_10[_10.length]=_e[i];
}
for(var i=0;i<arguments.length;i++){
_10[_10.length]=arguments[i];
}
return _d.apply(_c,_10);
});
};
SUtil.objPos=function(obj,_13){
var _14=new SPoint();
if(this.log){
var _15=new Array();
}
while(obj&&(obj!=_13)){
if(!SUtil.isUndefined(obj.offsetLeft)&&!SUtil.isUndefined(obj.offsetTop)){
if(this.log){
_15[_15.length]=obj.nodeName+":"+obj.id+"("+obj.offsetLeft+","+obj.offsetTop+")";
}
_14.x+=obj.offsetLeft;
_14.y+=obj.offsetTop;
}
obj=obj.offsetParent;
if(obj){
var _16=SUtil.getComputedStyle(obj);
var _17=parseInt(_16.borderLeftWidth);
var top=parseInt(_16.borderTopWidth);
_14.x+=(isNaN(_17))?0:_17;
_14.y+=(isNaN(top))?0:top;
}
}
if(this.log){
SLog.log("objPos:"+_14+" hierarchy:"+_15.join("->"));
}
return _14;
};
SUtil.pageBottomRight=function(){
var _19=document.documentElement;
var _1a=document.body;
var _1b=new SPoint();
if(SUtil.isUndefined(_19.clientLeft)){
_1b.x=_19.clientWidth;
_1b.y=self.innerHeight;
if(SUtil.isStandardsMode()){
var _1c=SUtil.getComputedStyle(_19);
_1b.x-=parseInt(_1c.marginLeft)+parseInt(_1c.marginRight);
_1b.x-=parseInt(_1c.borderLeftWidth)+parseInt(_1c.borderRightWidth);
}
}else{
if((window.ActiveXObject)&&!(window.XMLHttpRequest)){
if(SUtil.isStandardsMode()){
_1b.x=_19.clientWidth+_19.scrollLeft;
_1b.y=_19.clientHeight+_19.scrollTop;
}else{
_1b.x=_1a.clientWidth+_1a.scrollLeft;
_1b.y=_1a.clientHeight+_1a.scrollTop;
}
}else{
if((window.ActiveXObject)&&(window.XMLHttpRequest)){
if(SUtil.isStandardsMode()){
_1b.x=_19.clientWidth;
_1b.y=_19.clientHeight;
}else{
_1b.x=_1a.clientWidth;
_1b.y=_1a.clientHeight;
}
}else{
if(!SUtil.isUndefined(self.innerWidth)&&!SUtil.isUndefined(_19.clientLeft)){
_1b.x=_1a.clientWidth;
_1b.y=_1a.clientHeight;
var _1d=self.innerWidth-_1a.clientWidth;
if((_1d>0)&&(_19.clientHeight>_1a.clientHeight)){
_1b.y=_19.clientHeight;
_1b.y+=_1a.offsetTop;
}
}
}
}
}
return _1b;
};
SUtil.isStandardsMode=function(){
return (document.compatMode&&(document.compatMode=="CSS1Compat"));
};
SUtil.getDocumentBody=function(){
var doc;
if(!SUtil.isUndefined(self.innerWidth)&&!SUtil.isUndefined(document.documentElement.clientLeft)){
doc=document.body;
}else{
doc=(SUtil.isStandardsMode())?document.documentElement:document.body;
}
return doc;
};
SUtil.getComputedStyle=function(_1f){
var _20;
if(document.defaultView&&document.defaultView.getComputedStyle){
_20=document.defaultView.getComputedStyle(_1f,null);
}else{
if(_1f.currentStyle){
_20=_1f.currentStyle;
}
}
return _20;
};
SUtil.evtPgPos=function(_21){
var _22=document.documentElement;
var _23=document.body;
var _24=new SPoint();
if(!SUtil.isUndefined(_21.pageX)){
_24.x=_21.pageX;
_24.y=_21.pageY;
if(SUtil.isUndefined(_21.offsetX)){
_24.x+=_22.offsetLeft;
_24.y+=_22.offsetTop;
var _25=SUtil.getComputedStyle(_22);
_24.x-=parseInt(_25.marginLeft);
_24.y-=parseInt(_25.marginTop);
}
}else{
if(!SUtil.isUndefined(_21.clientX)){
_24.x=_21.clientX;
_24.y=_21.clientY;
if(_22&&_23){
if(SUtil.isStandardsMode()){
if(_22.clientLeft){
_24.x-=_22.clientLeft;
}
if(_22.clientTop){
_24.y-=_22.clientTop;
}
if(_22.scrollLeft){
_24.x+=_22.scrollLeft;
}
if(_22.scrollTop){
_24.y+=_22.scrollTop;
}
}else{
if(_23.offsetLeft){
_24.x-=_23.offsetLeft;
}
if(_23.offsetTop){
_24.y-=_23.offsetTop;
}
if(_23.clientLeft){
_24.x-=_23.clientLeft;
}
if(_23.clientTop){
_24.y-=_23.clientTop;
}
if(_23.scrollLeft){
_24.x+=_23.scrollLeft;
}
if(_23.scrollTop){
_24.y+=_23.scrollTop;
}
}
}
}
}
return _24;
};
SUtil.evtPos=function(_26,_27){
var tg=(_26.target)?_26.target:_26.srcElement;
if(!_27){
_27=tg;
}
var _29;
if(!SUtil.isUndefined(_26.pageX)){
var _2a=SUtil.evtPgPos(_26);
var _2b=SUtil.objPos(_27);
_29=SPoint.subtract(_2a,_2b);
if(this.log){
SLog.log("evtPgPos:"+_2a+" - ctnrPgPos:"+_2b+" = "+_29);
}
}else{
if(!SUtil.isUndefined(_26.offsetX)){
var _2c=new SPoint(_26.offsetX,_26.offsetY);
var _2d=SUtil.objPos(tg,_27);
_29=SPoint.add(_2c,_2d);
if(this.log){
SLog.log("evtLyrPos:"+_2c+" + evtTgtPos:"+_2d+" = "+_29);
}
}else{
_29=new SPoint();
}
}
if(this.log){
SLog.log(" target:"+(_26.target?_26.target.id:"undef"));
SLog.log(" srcElement:"+(_26.srcElement?_26.srcElement.id:"undef"));
SLog.log(" clientX:"+_26.clientX+" clientY:"+_26.clientY);
SLog.log(" pageX:"+_26.pageX+" pageY:"+_26.pageY);
SLog.log(" layerX:"+_26.layerX+" layerY:"+_26.layerY);
SLog.log(" offsetX:"+_26.offsetX+" offsetY:"+_26.offsetY);
SLog.log(" x:"+_26.x+" y:"+_26.y);
}
return _29;
};
SUtil.pixels=function(_2e){
return Math.round(_2e)+"px";
};
SUtil.parseInt=function(s){
if(s){
var _30=parseInt(s);
if(isNaN(_30)){
_30=Math.floor(parseFloat(s));
}
return _30;
}else{
return 0;
}
};
SUtil.createChildElement=function(_31,_32,id){
var e=document.createElement(_32);
e.id=id;
if(_31){
_31.appendChild(e);
}
return e;
};
SUtil.createPanel=function(_35,id,_37){
var _38=SUtil.createChildElement(_35,"div",id);
var _39=_38.style;
_39.display="none";
_39.position="absolute";
_39.zIndex=_37;
return _38;
};
SUtil.createDropShadowPanel=function(_3a,id,_3c){
var _3d;
var _3e=SUtil.createPanel(_3a,id,_3c);
_3d=_3e.style;
_3d.margin="4px 0 0 4px";
var _3f=SUtil.prependImagePath("shadow.png");
_3d.background="url("+_3f+") repeat";
var _40=SUtil.createChildElement(_3e,"div",_3e.id+"ShadowContent");
_3d=_40.style;
_3d.position="relative";
_3d.top="-3px";
_3d.left="-3px";
_3d.backgroundColor="#ffffff";
_3d.border="1px solid #000000";
_3d.padding="3px";
return {"panel":_3e,"shadowContent":_40};
};
SUtil.prependImagePath=function(_41){
if(WMT_IMAGE_PATH[WMT_IMAGE_PATH.length-1]!="/"){
_41="/"+_41;
}
return WMT_IMAGE_PATH+_41;
};
SUtil.reduce=function(fn,a,_44){
var _45=_44;
for(var i=0;i<a.length;i++){
_45+=fn(a[i],i);
}
return _45;
};
SUtil.precacheImage=function(_47,_48){
var img=new Image();
if(_48){
img.onload=_48;
}
img.src=_47;
};
function SPoint(x,y){
this.x=x||0;
this.y=y||0;
}
SPoint.add=function(p1,p2){
return new SPoint(p1.x+p2.x,p1.y+p2.y);
};
SPoint.subtract=function(p1,p2){
return new SPoint(p1.x-p2.x,p1.y-p2.y);
};
SPoint.prototype.toString=function(){
return "SPoint("+this.x+","+this.y+")";
};
function SError(){
}
SError.ILLEGAL_ARGUMENT_EXCEPTION="IllegalArgumentException";
SError.create=function(msg,_51){
var err=new Error(msg);
if(!err.message){
err.message=msg;
}
if(_51){
err.name=_51;
}
return err;
};
SError.format=function(e){
return e.name+": "+e.message;
};
function SHashMap(){
this.values=new Object();
this.keys=new Array();
}
SHashMap.maskKey=function(key){
if(!(typeof key=="string"||typeof key=="number")){
throw SError.create("key must be of type string|number but was: "+typeof key,SError.ILLEGAL_ARGUMENT_EXCEPTION);
}
return ":"+key;
};
SHashMap.prototype.keySet=function(){
return SUtil.compressArray(this.keys);
};
SHashMap.prototype.containsKey=function(key){
return (this.get(key)!=null);
};
SHashMap.prototype.get=function(key){
var _57=SHashMap.maskKey(key);
return (this.values[_57])?this.values[_57]:null;
};
SHashMap.prototype.put=function(key,_59){
var _5a=SHashMap.maskKey(key);
var _5b=true;
if(!this.values[_5a]){
_5b=false;
this.keys.push(key);
}
var _5c=_5b?this.values[_5a]:null;
this.values[_5a]=_59;
return _5c;
};
SHashMap.prototype.remove=function(key){
var _5e=SHashMap.maskKey(key);
var v=this.values[_5e];
delete this.keys[SUtil.indexOf(this.keys,key)];
delete this.values[_5e];
return (v)?v:null;
};
function SEventListener(_60,_61,fn){
this.id=SEventListener.MASK+SEventListener.nextId++;
this.source=_60;
this.type=_61;
this.fn=fn;
}
SEventListener.MASK="_sel:";
SEventListener.isId=function(str){
return str.indexOf(SEventListener.MASK)==0;
};
SEventListener.nextId=0;
function SEvent(){
}
SEvent.cache=new SHashMap();
SEvent.MASK="_se:";
SEvent.key=function(_64){
return "_se:"+_64;
};
SEvent.addListener=function(_65,_66,fn){
var _68=new SEventListener(_65,_66,fn);
return SEvent.addListenerObject(_68);
};
SEvent.addListenerObject=function(_69){
if(!_69){
return null;
}
var id=_69.id;
var _6b=_69.source;
var _6c=_69.type;
var fn=_69.fn;
if(_6b.addEventListener){
_6b.addEventListener(_6c,fn,false);
}else{
if(_6b.attachEvent){
_6b.attachEvent("on"+_6c,fn);
}else{
var _6e=_6b[SEvent.key(_6c)];
if(!_6e){
_6e=_6b[SEvent.key(_6c)]=[];
}
_6e[id]=fn;
}
}
SEvent.cache.put(id,_69);
return _69;
};
SEvent.removeListener=function(_6f){
if(!_6f){
return null;
}
var _70=_6f.source;
var _71=_6f.type;
var fn=_6f.fn;
if(_70.addEventListener){
_70.removeEventListener(_71,fn,false);
}else{
if(_70.detachEvent){
_70.detachEvent("on"+_71,fn);
}else{
var _73=_70[SEvent.key(_71)];
if(_73){
delete _73[_6f.id];
}
}
}
return SEvent.cache.remove(_6f.id);
};
SEvent.countListeners=function(_74,_75){
var _76=0;
var _77=_74[SEvent.key(_75)];
if(_77){
for(var id in _77){
if(SEventListener.isId(id)&&typeof _77[id]=="function"){
_76++;
}
}
}
return _76;
};
SEvent.fire=function(_79,_7a){
if(SEvent.log){
SLog.log("firing event for "+_7a);
}
var _7b=_79[SEvent.key(_7a)];
if(_7b){
for(var id in _7b){
if(SEventListener.isId(id)&&typeof _7b[id]=="function"){
var fn=_7b[id];
fn.apply(_79,arguments);
}
}
}
};
SEvent.flush=function(){
var _7e=SEvent.cache.keySet();
for(var i=0;i<_7e.length;i++){
var _80=SEvent.cache.get(_7e[i]);
if((_80)&&(_80.source!=window)&&(_80.type!="unload")){
SEvent.removeListener(_80);
delete _80;
}
}
};
SEvent.consumeEvent=function(_81,_82,_83){
if(_82){
if(_81.stopPropagation){
_81.stopPropagation();
}else{
_81.cancelBubble=true;
}
}
if(_83){
if(_81.preventDefault){
_81.preventDefault();
}else{
_81.returnValue=false;
}
return false;
}else{
return true;
}
};
SEvent.createPsuedoEvent=function(_84){
var evt=new Object();
for(var p in _84){
evt[p]=_84[p];
}
var _87=""+_84;
evt.toString=function(){
return "SEvent psuedoEvent for"+_87;
};
return evt;
};
SEvent.nonPropagatingCallback=function(_88,_89){
return (function(_8a){
_89.apply(_88,arguments);
SEvent.consumeEvent(_8a,true,true);
});
};
SEvent.getTarget=function(e){
var _8c;
if(!e){
var e=window.event;
}
if(e.target){
_8c=e.target;
}else{
if(e.srcElement){
_8c=e.srcElement;
}
}
if(_8c.nodeType==3){
_8c=_8c.parentNode;
}
return _8c;
};
SEvent.addListener(window,"unload",SEvent.flush);
function SRemoteConnection(){
this.responseHandlers=new SHashMap();
this.isWildcardSet=false;
this.cache=false;
this.showAlerts=true;
this.async=true;
this.recurseOnChildren=false;
this.setResponseHandler(SRemoteConnection.HANDLER_NAME_JS_EVAL,SRemoteConnection.jsEvalHandler);
}
SRemoteConnection.HANDLER_NAME_WILDCARD="*";
SRemoteConnection.HANDLER_NAME_JS_EVAL="jsEval";
SRemoteConnection.EVENT_ERROR="remoteConn_error";
SRemoteConnection.createXMLHttp=function(){
var _8d;
if(window.XMLHttpRequest){
try{
_8d=new XMLHttpRequest();
if(this.log){
SLog.log("SRemoteConnection using transport: window.XMLHttpRequest");
}
}
catch(e){
_8d=false;
}
}else{
if(window.ActiveXObject){
try{
_8d=new ActiveXObject("Msxml2.XMLHTTP");
if(this.log){
SLog.log("SRemoteConnection using transport: Msxml2.XMLHTTP");
}
}
catch(e){
try{
_8d=new ActiveXObject("Microsoft.XMLHTTP");
if(this.log){
SLog.log("SRemoteConnection using transport: Microsoft.XMLHTTP");
}
}
catch(e){
_8d=false;
}
}
}else{
if(this.showAlerts){
alert("Remote connections are not supported by your browser.");
}
return null;
}
}
if(!_8d){
if(this.showAlerts){
alert("Error creating remote connection.");
}
}
return _8d;
};
SRemoteConnection.jsEvalHandler=function(_8e){
var _8f=SHandlerUtil.getBodyAsString(_8e);
try{
if(this.log){
SLog.log("eval("+_8f+")");
}
eval(_8f);
return true;
}
catch(e){
if(this.showAlerts){
alert("Error evaluating: "+_8f+"\nReason "+SError.format(e));
}
return false;
}
};
SRemoteConnection.prototype.setResponseHandler=function(_90,_91){
if(_90==SRemoteConnection.HANDLER_NAME_WILDCARD){
this.isWildcardSet=(_91)?true:false;
}
if(_91){
return this.responseHandlers.put(_90,_91);
}else{
return this.responseHandlers.remove(_90);
}
};
SRemoteConnection.prototype.request=function(url,_93,_94){
if(!_94){
_94=null;
}
if(_93){
_93=_93.toUpperCase();
}else{
_93="GET";
}
var _95=SRemoteConnection.createXMLHttp();
if(_95){
if(this.log){
SLog.log("method:"+_93+" url:"+url+"\npostData:"+_94);
}
try{
if(this.async){
_95.onreadystatechange=SUtil.callbackWithArgs(this,this.handle,_95);
}
_95.open(_93,url,this.async);
if("POST"==_93){
_95.setRequestHeader("Content-Type","application/x-www-form-urlencoded");
}
if(!this.cache){
_95.setRequestHeader("Cache-Control","no-cache");
_95.setRequestHeader("Pragma","no-cache");
}
_95.send(_94);
if(!this.async){
this.handle(_95);
}
}
catch(e){
if(this.log){
SLog.log("Error processing request!\nReason "+SError.format(e));
}
SEvent.fire(this,SRemoteConnection.EVENT_ERROR,"Error processing request!\nReason "+SError.format(e));
}
return true;
}else{
return false;
}
};
SRemoteConnection.prototype.handle=function(_96){
try{
if(this.log&&_96){
SLog.log("request readyState:"+_96.readyState+" status:"+_96.status);
}
}
catch(e){
}
try{
if(_96!=null&&_96.readyState==4){
SRemoteConnection.cleanup(_96);
if(_96.status==200||_96.status==0){
if(this.log){
SLog.log("request.statusText:"+_96.statusText);
SLog.log("request.responseText:"+typeof _96.responseText);
SLog.log("request.responseXML:"+typeof _96.responseXML);
}
if(_96.status==0&&window.ActiveXObject){
var _97=new ActiveXObject("Msxml2.DOMDocument");
_97.loadXML(_96.responseText);
this.parseResponse(_97);
}else{
this.parseResponse(_96.responseXML);
}
}else{
SEvent.fire(this,SRemoteConnection.EVENT_ERROR,_96);
}
}
}
catch(e){
if(this.log){
SLog.log("request error occurred: "+SError.format(e));
}
SEvent.fire(this,SRemoteConnection.EVENT_ERROR,{statusText:"Unable to handle connection response",responseText:SError.format(e)});
}
};
SRemoteConnection.cleanup=function(_98){
try{
_98.onreadystatechange=null;
}
catch(e){
_98.onreadystatechange=function(){
};
}
};
SRemoteConnection.prototype.parseResponse=function(_99){
if(!_99){
return;
}
if(!_99.hasChildNodes()){
return;
}
var _9a=_99.childNodes;
for(var i=0;i<_9a.length;i++){
var _9c=_9a[i];
if(_9c.nodeType==1){
var _9d=_9c.nodeName;
if(this.responseHandlers.containsKey(_9d)){
this.handleResponse(_9d,_9c);
}else{
if(this.isWildcardSet&&("#document"!=_99.nodeName)){
this.handleResponse(SRemoteConnection.HANDLER_NAME_WILDCARD,_9c);
}else{
this.parseResponse(_9c);
}
}
}
}
};
SRemoteConnection.prototype.handleResponse=function(_9e,_9f){
var _a0=this.responseHandlers.get(_9e);
if(this.log){
SLog.log("found handler:"+_9e+" for element:"+_9f.nodeName);
}
_a0(_9f);
if(this.recurseOnChildren){
this.parseResponse(_9f);
}
};
function SHandlerUtil(){
}
SHandlerUtil.getBodyAsString=function(_a1){
var _a2="";
var _a3=_a1.childNodes;
for(var i=0;i<_a3.length;i++){
var _a5=_a3.item(i);
if(this.log){
SLog.log("child["+i+"] type="+_a5.nodeType+":"+_a5.nodeValue+" length="+_a5.nodeValue.length);
}
if(_a5.nodeType==3||_a5.nodeType==4){
_a2+=_a5.nodeValue;
}
}
return _a2;
};
SHandlerUtil.parseFeatureResults=function(_a6){
if(!_a6||_a6.nodeType!=1&&_a6.tagName!="featureResults"){
return null;
}
var _a7=new Array();
if(_a6.childNodes&&_a6.childNodes.length>0){
for(var i=0;i<_a6.childNodes.length;i++){
var _a9=SHandlerUtil.createFeature(_a6.childNodes[i]);
if(_a9){
_a7.push(_a9);
}
}
}
return _a7;
};
SHandlerUtil.createFeature=function(_aa){
var _ab=null;
if(_aa.nodeType==1&&_aa.tagName=="feature"){
var id=_aa.getAttributeNode("id").value;
var _ad=_aa.getAttributeNode("type").value;
var _ae=_aa.getAttributeNode("name").value;
var _af=_aa.getAttributeNode("layerName").value;
var sel;
if(_aa.getAttributeNode("selected")){
sel=("true"==_aa.getAttributeNode("selected").value.toLowerCase());
}
_ab=new SFeature(id,_ad,_ae,_af,sel);
if(!_aa.childNodes){
return _ab;
}
for(var i=0;i<_aa.childNodes.length;i++){
var _b2=_aa.childNodes[i];
if(_b2.nodeType==1&&_b2.tagName=="attribute"){
var _b3=SHandlerUtil.getBodyAsString(_b2);
_ab.addAttribute(_b2.getAttributeNode("key").value,SUtil.isUndefined(_b3)?"":_b3);
}
}
}
return _ab;
};
function SFeature(id,_b5,_b6,_b7,_b8){
this.id=id;
this.type=_b5;
this.name=_b6;
this.layerName=_b7;
this.selected=_b8;
}
SFeature.prototype.attrs;
SFeature.prototype.addAttribute=function(_b9,_ba){
if(!this.attrs){
this.attrs=new SHashMap();
}
return this.attrs.put(_b9,_ba);
};
SFeature.prototype.getAttribute=function(_bb){
return this.attrs?this.attrs.get(_bb):null;
};
SFeature.prototype.getAttributeNames=function(){
return this.attrs?this.attrs.keySet():[];
};
function SXSLTProcessor(){
this.styleSheet=null;
this.xsltSupported=false;
if(window.XSLTProcessor){
this.processor=new XSLTProcessor();
this.xsltSupported=true;
}else{
if(window.ActiveXObject){
this.xsltSupported=true;
}
}
}
SXSLTProcessor.prototype.importStylesheet=function(_bc){
this.styleSheet=_bc;
if(this.processor){
this.processor.importStylesheet(_bc);
}
};
SXSLTProcessor.prototype.transformToFragment=function(_bd,_be){
if(!this.xsltSupported){
return null;
}
if(this.processor){
return this.processor.transformToFragment(_bd,_be);
}else{
var _bf=_bd.transformNode(this.styleSheet);
var div=_be.createElement("div");
div.innerHTML=_bf;
return div;
}
};
SXSLTProcessor.getXML=function(_c1){
var _c2=SRemoteConnection.createXMLHttp();
_c2.open("GET",_c1,false);
_c2.send(null);
if(_c2.status==200||_c2.status==0){
if(_c2.status==0&&window.ActiveXObject){
var _c3=new ActiveXObject("Msxml2.DOMDocument");
_c3.loadXML(_c2.responseText);
return _c3;
}else{
return _c2.responseXML;
}
}else{
return null;
}
};
SXSLTProcessor.getProcessor=function(_c4){
var _c5=new SXSLTProcessor();
var _c6=SXSLTProcessor.getXML(_c4);
_c5.importStylesheet(_c6);
return _c5;
};
function SLog(){
var win;
var out;
function show(){
if(!win||win.closed){
open();
}
out=win.document.getElementById("SLogOut");
}
function open(){
var top=0;
var _ca=0;
var _cb="<html><head><title>SLog Console</title></head><body>";
_cb+="<input type=\"button\" value=\"Clear\" onclick=\"document.getElementById('SLogOut').value=''\">";
_cb+="<br><textarea id=\"SLogOut\" style=\"width:100%; height:90%;\"></textarea>";
_cb+="</body></html>";
win=window.open("","SLogWin","width=300,height=200,top="+top+",left="+_ca+",location=no,menubar=no,resizable=yes,scrollbars=no,status=yes,toolbar=no");
win.document.open();
win.document.writeln(_cb);
win.document.close();
win.focus();
}
this.clear=function(){
out.value="";
};
this.log=function(msg){
show();
out.value+=msg+"\n";
out.scrollTop=out.scrollHeight;
};
this.logObj=function(obj,_ce){
if(!_ce){
_ce="object";
}
var nl="\n";
var msg="--- Properties for "+_ce+" ---"+nl;
msg+="typeof="+typeof obj+nl;
if(obj){
for(var _d1 in obj){
msg+=_d1;
try{
if(typeof obj[_d1]=="function"){
msg+="()";
}else{
msg+="="+obj[_d1];
}
}
catch(e){
msg+="=error accessing property value";
}
msg+=nl;
}
msg+="--- End properties for "+_ce+" ---";
}
this.log(msg);
};
}
var SLog=new SLog();
function SNameValuePair(_d2,_d3){
if(!_d2){
SError.create("name is required",SError.ILLEGAL_ARGUMENT_EXCEPTION);
}
this.name=_d2;
this.value=_d3;
}
SNameValuePair.prototype.toString=function(){
var _d4="";
var _d5=this.value;
if(!SUtil.isUndefined(_d5)){
if(_d5 instanceof Array){
_d4=SUtil.reduce(function(_d6,_d7){
var _d8=SNameValuePair.escapeProtocolString(_d6);
if(_d7!=(_d5.length-1)){
_d8+=SNameValueParser.PARAM_SEPARATOR;
}
return _d8;
},_d5,"");
}else{
_d4=SNameValuePair.escapeProtocolString(_d5);
}
}
return this.name+SNameValueParser.VALUE_START+_d4+SNameValueParser.VALUE_END;
};
SNameValuePair.escapeProtocolString=function(_d9){
if(_d9==null){
return "";
}
if(typeof (_d9)=="string"){
return _d9.replace(/[(|)|,|\\]/g,"\\$&");
}else{
return _d9.toString();
}
};
function SCharacterIterator(str){
this.str=str;
this.index=0;
}
SCharacterIterator.prototype.current=function(){
return this.charAt(this.index);
};
SCharacterIterator.prototype.next=function(){
this.index=this.index+1;
return this.charAt(this.index);
};
SCharacterIterator.prototype.charAt=function(_db){
var c=null;
if(_db<this.str.length){
c=this.str.charAt(_db);
}
return c;
};
function SNameValueParser(){
}
SNameValueParser.VALUE_START="(";
SNameValueParser.VALUE_END=")";
SNameValueParser.PARAM_SEPARATOR=",";
SNameValueParser.ESCAPE_CHARACTER="\\";
SNameValueParser.parse=function(_dd){
return SNameValueParser.parseIter(new SCharacterIterator(_dd));
};
SNameValueParser.parseIter=function(_de){
var _df=null;
var _e0=null;
var _e1=null;
var sb=new Array();
var c=_de.current();
var _e4=false;
while(null!=c){
if(_e4){
sb[sb.length]=c;
_e4=false;
}else{
if(SNameValueParser.VALUE_START==c){
_df=sb.join("");
sb=new Array();
_de.next();
_e0=SNameValueParser.parseIter(_de);
}else{
if(SNameValueParser.VALUE_END==c){
break;
}else{
if(SNameValueParser.PARAM_SEPARATOR==c){
if(null==_e1){
_e1=new Array();
}
if(null!=_df){
_e1[_e1.length]=new SNameValuePair(_df,_e0);
}else{
_e1[_e1.length]=sb.join("");
sb=new Array();
}
}else{
if(SNameValueParser.ESCAPE_CHARACTER==c){
_e4=true;
}else{
sb[sb.length]=c;
}
}
}
}
}
c=_de.next();
}
if(0<sb.length){
if(null!=_e1){
_e1[_e1.length]=sb.join("");
return _e1;
}
return sb.join("");
}else{
if(null!=_df){
if(null==_e0){
_e0="";
}
var _e5=new SNameValuePair(_df,_e0);
if(null!=_e1){
_e1[_e1.length]=_e5;
return _e1;
}else{
return _e5;
}
}else{
return _e1;
}
}
};
function SMapViewState(_e6){
var _e7=SMapViewState.PARAMS_TO_PROPS.keySet();
for(var i=0;i<_e7.length;i++){
this[SMapViewState.PARAMS_TO_PROPS.get(_e7[i])]="";
}
this.queries=new SHashMap();
if(_e6){
var _e9=SNameValueParser.parse(_e6);
for(var i=0;i<_e9.length;i++){
var _ea=_e9[i];
if("lc"==_ea.name){
var val=_ea.value;
if(!(val instanceof Array&&2==val.length)){
throw SError.create("Invalid query: "+val,SError.ILLEGAL_ARGUMENT_EXCEPTION);
}
var _ec=val[0];
if(!(_ec instanceof SNameValuePair)){
throw SError.create("Invalid layerNameValue: "+_ec,SError.ILLEGAL_ARGUMENT_EXCEPTION);
}
var _ed=val[1];
if(!(_ed instanceof SNameValuePair)){
throw SError.create("Invalid filter: "+_ed,SError.ILLEGAL_ARGUMENT_EXCEPTION);
}
var _ee=_ed.value;
if(!(_ed.value instanceof Array)){
_ee=new Array();
_ee.push(_ed.value);
}
this.setCriteria(_ec.value,_ee);
}else{
this[SMapViewState.PARAMS_TO_PROPS.get(_ea.name)]=_ea.value;
}
}
}
}
SMapViewState.prototype.mapViewName="";
SMapViewState.prototype.scaleFactor="";
SMapViewState.prototype.displayDPI="";
SMapViewState.prototype.minScaleFactor="";
SMapViewState.prototype.maxScaleFactor="";
SMapViewState.prototype.mapScaleFactors="";
SMapViewState.prototype.centerLonX="";
SMapViewState.prototype.centerLatY="";
SMapViewState.prototype.width="";
SMapViewState.prototype.height="";
SMapViewState.PROP_NAMES=["mapViewName","scaleFactor","displayDPI","minScaleFactor","maxScaleFactor","mapScaleFactors","centerLonX","centerLatY","width","height","ppdx","ppdy","cypx","queries","copyrights"];
SMapViewState.PARAM_NAMES=["mvn","sf","ddpi","mnsf","mxsf","msf","clx","cly","w","h","ppdx","ppdy","cypx","lc","cr"];
SMapViewState.PARAMS_TO_PROPS=(function(){
var p2p=new SHashMap();
for(var i=0;i<SMapViewState.PARAM_NAMES.length;i++){
p2p.put(SMapViewState.PARAM_NAMES[i],SMapViewState.PROP_NAMES[i]);
}
return p2p;
})();
SMapViewState.copy=function(mvs){
var _f2=new SMapViewState();
for(var i=0;i<SMapViewState.PROP_NAMES.length;i++){
_f2[SMapViewState.PROP_NAMES[i]]=mvs[SMapViewState.PROP_NAMES[i]];
}
var _f4=mvs.queries.keySet();
for(var q=0;q<_f4.length;q++){
_f2.queries.put(_f4[q],mvs.queries.get(_f4[q]));
}
return _f2;
};
SMapViewState.prototype.setCriteria=function(_f6,_f7){
if(!_f7){
return;
}
return this.queries.put(_f6,_f7);
};
SMapViewState.prototype.getCriteria=function(_f8){
if(!_f8){
return;
}
return this.queries.get(_f8);
};
SMapViewState.prototype.removeCriteria=function(_f9){
if(!_f9){
return;
}
return this.queries.remove(_f9);
};
SMapViewState.prototype.toNameValuePairs=function(){
var _fa=new Array();
var _fb;
var _fc=SMapViewState.PARAMS_TO_PROPS.keySet();
for(var i=0;i<_fc.length;i++){
var _fe=_fc[i];
_fb=SMapViewState.PARAMS_TO_PROPS.get(_fe);
if(_fe=="lc"){
if(this[_fb].keySet().length>0){
_fa.push(SMapViewState.parametersToParams(_fe,this[_fb]));
}
}else{
if(_fe!="cr"){
_fa.push(new SNameValuePair(_fe,this[_fb]));
}
}
}
return _fa;
};
SMapViewState.prototype.toParameters=function(){
return this.toNameValuePairs().join(SNameValueParser.PARAM_SEPARATOR);
};
SMapViewState.parametersToParams=function(_ff,_100){
var _101=new Array();
var _102=_100.keySet();
for(var i=0;i<_102.length;i++){
var _104=new SNameValuePair("ln",_102[i]);
_101.push(_104);
var _105=_100.get(_102[i]);
if(_105){
_101.push(new SNameValuePair("criteria",_105));
}
}
return new SNameValuePair(_ff,_101);
};
function SMapOperation(_106,_107){
this.opId=""+SMapOperation.nextId++;
this.opName=_106;
this.parameters=new Array(new SNameValuePair("opId",this.opId));
if(!SUtil.isUndefined(_107)){
if(_107 instanceof Array){
this.parameters=this.parameters.concat(_107);
}else{
throw SError.create("parameters must be an Array of SNameValuePair",SError.ILLEGAL_ARGUMENT_EXCEPTION);
}
}
this.layerCriteria=new SHashMap();
}
SMapOperation.nextId=0;
SMapOperation.SET_LAYER_CRITERIA="wmt.slc";
SMapOperation.REMOVE_LAYER_CRITERIA="wmt.rlc";
SMapOperation.FIND_AT_POINT="wmt.fpt";
SMapOperation.FIND_FIRST_AT_POINT="wmt.ffpt";
SMapOperation.SELECT_AT_POINT="wmt.spt";
SMapOperation.CLEAR_SELECTION="wmt.cs";
SMapOperation.TOOLTIP="wmt.tt";
SMapOperation.LOAD="wmt.ld";
SMapOperation.REFRESH="wmt.rf";
SMapOperation.PAN_DEGREES="wmt.pd";
SMapOperation.PAN_LON_LAT="wmt.pl";
SMapOperation.PAN_POINT="wmt.pp";
SMapOperation.RESIZE="wmt.rz";
SMapOperation.SCALE="wmt.sc";
SMapOperation.ZOOM_IN="wmt.zi";
SMapOperation.ZOOM_OUT="wmt.zo";
SMapOperation.ZOOM_IN_POINT="wmt.zip";
SMapOperation.ZOOM_OUT_POINT="wmt.zop";
SMapOperation.prototype.toString=function(){
var _108=SUtil.compressArray(this.parameters);
var keys=this.layerCriteria.keySet();
for(var _10a=0;_10a<keys.length;_10a++){
var _10b=keys[_10a];
_108.push(new SNameValuePair("lc",new Array(new SNameValuePair("ln",_10b),new SNameValuePair("criteria",this.layerCriteria.get(_10b)))));
}
return "op="+new SNameValuePair(this.opName,_108);
};
SMapOperation.prototype.addParameter=function(_10c,_10d){
if(SUtil.isUndefined(_10c)){
throw SError.create("paramName is required",SError.ILLEGAL_ARGUMENT_EXCEPTION);
}
if(SUtil.isUndefined(_10d)){
throw SError.create("value is required",SError.ILLEGAL_ARGUMENT_EXCEPTION);
}
if("opId"==_10c){
throw SError.create("paramName 'opId' is reserved",SError.ILLEGAL_ARGUMENT_EXCEPTION);
}
this.parameters.push(new SNameValuePair(_10c,_10d));
};
SMapOperation.prototype.addLayerCriteria=function(_10e,key,_110){
var _111=this.layerCriteria.get(_10e);
if(null==_111){
_111=new Array();
this.layerCriteria.put(_10e,_111);
}
_111.push(new SNameValuePair(key,_110));
};
function SSlideAnimation(_112,_113){
this.stepFactor=_112||15;
this.delay=_113||30;
this.animating=false;
this.timeoutId=null;
this.refDraggable=null;
this.draggables=null;
this.steps=0;
this.x=0;
this.y=0;
}
SSlideAnimation.EVENT_START="start";
SSlideAnimation.EVENT_END="end";
SSlideAnimation.prototype.isAnimating=function(){
return this.animating;
};
SSlideAnimation.prototype.cancelAnimation=function(){
this.animating=false;
clearTimeout(this.timeoutId);
this.timeoutId=null;
};
SSlideAnimation.prototype.slideTo=function(_114,_115,x,y){
if(this.animating){
this.cancelAnimation();
}
this.refDraggable=_114;
this.draggables=_115;
this.x=x;
this.y=y;
var left=parseInt(this.refDraggable.obj.style.left);
var top=parseInt(this.refDraggable.obj.style.top);
var _11a=Math.round(Math.max(Math.abs(left),Math.abs(top))/this.stepFactor);
this.steps=Math.max(3,_11a);
this.animating=true;
SEvent.fire(this,SSlideAnimation.EVENT_START);
this.animate();
};
SSlideAnimation.prototype.animate=function(){
var mvX=(this.x-parseInt(this.refDraggable.obj.style.left))/this.steps;
var mvY=(this.y-parseInt(this.refDraggable.obj.style.top))/this.steps;
if(this.log){
SLog.log("SSlideAnimation.slideTo() mvX: "+mvX+" mvY: "+mvY);
}
for(var i=0;i<this.draggables.length;i++){
var _11e=this.draggables[i];
if(!_11e){
continue;
}
var _11f=parseInt(_11e.obj.style.left);
var _120=parseInt(_11e.obj.style.top);
_11e.moveTo(_11f+mvX,_120+mvY);
}
this.steps--;
if(this.steps>0){
if(this.isAnimating()){
this.timeoutId=setTimeout(SUtil.callback(this,this.animate),this.delay);
}
}else{
this.animating=false;
SEvent.fire(this,SSlideAnimation.EVENT_END);
}
};
function SMap(_121,_122){
this.container=_121;
if(!_122){
_122=new SMapViewState();
}
this.webMapUrl=_122.webMapUrl||SMap.defaultWebMapUrl;
this.webMapUrl+="?";
this.mvid=_122.mapViewerId||_121.id;
this.mvsToken=null;
this.lastToken=null;
this.lastMvs=null;
this.initMvs=SMapViewState.copy(_122);
this.initMvs.width=_121.offsetWidth;
this.initMvs.height=_121.offsetHeight;
this.mvs=SMapViewState.copy(this.initMvs);
this.panPercent=50;
this.actionMap=null;
this.fgImg=null;
this.bgImg=null;
this.altImg=null;
this.dragging=false;
this.animatePanEnabled=true;
this.slideAnimation=null;
this.rconn=null;
this.opQueue=new Array();
this.busy=false;
this.extensions=new SHashMap();
this.init();
}
SMap.HANDLER_NAME_WILDCARD=SRemoteConnection.HANDLER_NAME_WILDCARD;
SMap.EVENT_PAN="pan";
SMap.EVENT_RESIZE="resize";
SMap.EVENT_UPDATE="update";
SMap.EVENT_IMAGE_LOADED="imageloaded";
SMap.EVENT_ZOOMIN="zoomin";
SMap.EVENT_ZOOMOUT="zoomout";
SMap.EVENT_ZOOMIN_POINT="zoominpt";
SMap.EVENT_ZOOMOUT_POINT="zoomoutpt";
SMap.EVENT_CLICK="click";
SMap.EVENT_DBLCLICK="dblclick";
SMap.EVENT_CLEAR_SELECTION="clearSelection";
SMap.EVENT_ERROR="error";
SMap.DEGREES_TO_RADIANS=Math.PI/180;
SMap.POPUP_LAYER="POPUP_LAYER";
SMap.operations;
SMap.prototype.init=function(){
var am=new SHashMap();
am.put("panN",SUtil.callbackWithArgs(this,this.pan,0,null,null));
am.put("panNE",SUtil.callbackWithArgs(this,this.pan,45,null,null));
am.put("panE",SUtil.callbackWithArgs(this,this.pan,90,null,null));
am.put("panSE",SUtil.callbackWithArgs(this,this.pan,135,null,null));
am.put("panS",SUtil.callbackWithArgs(this,this.pan,180,null,null));
am.put("panSW",SUtil.callbackWithArgs(this,this.pan,225,null,null));
am.put("panW",SUtil.callbackWithArgs(this,this.pan,270,null,null));
am.put("panNW",SUtil.callbackWithArgs(this,this.pan,315,null,null));
am.put("clearSelection",SUtil.callback(this,this.clearSelection));
am.put("zoomIn",SUtil.callback(this,this.zoomIn));
am.put("zoomOut",SUtil.callback(this,this.zoomOut));
am.put("refresh",SUtil.callback(this,this.refresh));
am.put("reload",SUtil.callback(this,this.load));
this.actionMap=am;
this.mapDiv=SUtil.createChildElement(this.container,"div",this.container.id+"_SMap");
var _124=this.computeMapSize();
var _125=this.mapDiv.style;
_125.position="relative";
_125.overflow="hidden";
_125.width=SUtil.pixels(_124.width);
_125.height=SUtil.pixels(_124.height);
this.mapImages=SUtil.createChildElement(this.mapDiv,"div",this.mapDiv.id+"_Images");
_125=this.mapImages.style;
_125.position="absolute";
_125.width="100%";
_125.height="100%";
_125.zIndex=0;
this.fgImg=SUtil.createChildElement(this.mapImages,"img",this.container.id+"_SMapImg0");
this.fgImg.setAttribute("galleryImg",false);
this.fgImg.style.visibility="visible";
this.fgImg.style.zIndex=2;
this.bgImg=SUtil.createChildElement(this.mapImages,"img",this.container.id+"_SMapImg1");
this.bgImg.setAttribute("galleryImg",false);
this.bgImg.style.visibility="hidden";
this.bgImg.style.zIndex=1;
this.altImg=SUtil.createChildElement(this.mapImages,"img",this.container.id+"_SMapImg2");
this.altImg.setAttribute("galleryImg",false);
this.altImg.style.visibility="hidden";
this.altImg.style.zIndex=0;
this.rconn=new SRemoteConnection();
this.setResponseHandler("mapViewState",SUtil.callback(this,this.handleMapViewState));
this.setResponseHandler("error",SUtil.callback(this,this.handleOperationError));
SEvent.addListener(this.rconn,SRemoteConnection.EVENT_ERROR,SUtil.callback(this,this.handleRequestError));
SErrorPanel.precacheImages();
SEvent.addListener(window,SMap.EVENT_RESIZE,SUtil.callback(this,this.onResize));
this.mouseAdapter=new SMouseAdapter(this.mapDiv.id,this.mapDiv);
this.mouseAdapter.mouseMoveEnabled=true;
this.mouseAdapter.hoverEnabled=true;
this.mouseAdapter.dragEnabled=true;
SEvent.addListener(this.mouseAdapter,SMouseAdapter.EVENT_MOUSE_CLICK,SUtil.callback(this,this.onClick));
SEvent.addListener(this.mouseAdapter,SMouseAdapter.EVENT_MOUSE_DBLCLICK,SUtil.callback(this,this.onDblClick));
SEvent.addListener(this.mouseAdapter,SMouseAdapter.EVENT_MOUSE_DOWN,SUtil.callback(this,this.onMouseDown));
SMap.addLogoCopyrightLayer(this,SLayer.RIGHT,SLayer.BOTTOM,5,5);
SEvent.addListener(this.fgImg,"load",SUtil.callback(this,this.onMapImageLoad));
SEvent.addListener(this.bgImg,"load",SUtil.callback(this,this.onMapImageLoad));
SEvent.addListener(this.altImg,"load",SUtil.callback(this,this.onMapImageLoad));
this.fgImg.draggable=new SDraggable(this.fgImg,this.mouseAdapter);
this.bgImg.draggable=new SDraggable(this.bgImg,this.mouseAdapter);
this.altImg.draggable=new SDraggable(this.altImg,this.mouseAdapter);
SEvent.addListener(this.fgImg.draggable,SMouseAdapter.EVENT_DRAG_START,SUtil.callback(this,this.onDragStart));
SEvent.addListener(this.bgImg.draggable,SMouseAdapter.EVENT_DRAG_START,SUtil.callback(this,this.onDragStart));
SEvent.addListener(this.altImg.draggable,SMouseAdapter.EVENT_DRAG_START,SUtil.callback(this,this.onDragStart));
SEvent.addListener(this.fgImg.draggable,SMouseAdapter.EVENT_DRAG_END,SUtil.callback(this,this.onDragEnd));
SEvent.addListener(this.bgImg.draggable,SMouseAdapter.EVENT_DRAG_END,SUtil.callback(this,this.onDragEnd));
SEvent.addListener(this.altImg.draggable,SMouseAdapter.EVENT_DRAG_END,SUtil.callback(this,this.onDragEnd));
this.slideAnimation=new SSlideAnimation();
SEvent.addListener(this.slideAnimation,SSlideAnimation.EVENT_END,SUtil.callback(this,this.swapImages));
};
SMap.prototype.destroy=function(){
this.container.removeChild(this.mapDiv);
this.mouseAdapter.removeListeners();
};
SMap.prototype.onMouseDown=function(_126,type,_128){
if(this.slideAnimation.isAnimating()){
var _129=this.fgImg.draggable.mouseAdapter;
var dt=_129.dragThreshold;
_129.dragThreshold=0;
_129.dragStart(_128);
_129.drag(_128);
_129.dragThreshold=dt;
}
};
SMap.prototype.onClick=function(_12b,type,_12d){
var _12e=SUtil.evtPos(_12d,this.mapDiv);
this.click(this,type,_12d,_12e);
SEvent.fire(this,SMap.EVENT_CLICK,_12e,_12d);
};
SMap.prototype.click=function(_12f,type,_131,_132){
if(this.log){
SLog.log("source.mvid:"+_12f.mvid+" type:"+type+" point:"+_132);
}
this.panToPoint(_132.x,_132.y);
};
SMap.prototype.onDblClick=function(_133,type,_135){
var _136=SUtil.evtPos(_135,this.mapDiv);
this.dblclick(this,type,_135,_136);
SEvent.fire(this,SMap.EVENT_DBLCLICK,_136,_135);
};
SMap.prototype.dblclick=function(_137,type,_139,_13a){
if(this.log){
SLog.log("source.mvid:"+_137.mvid+" type:"+type+" point:"+_13a);
}
this.zoomInToPoint(_13a.x,_13a.y);
};
SMap.prototype.onResize=function(){
if(this.resizeTimeoutId){
clearTimeout(this.resizeTimeoutId);
}
this.resizeTimeoutId=setTimeout(SUtil.callback(this,this.resize),250);
};
SMap.prototype.resize=function(){
if(this.resizeTimeoutId){
this.resizeTimeoutId=null;
}
var _13b=this.computeMapSize();
var w=_13b.width;
var h=_13b.height;
if(this.mvs.width!=w||this.mvs.height!=h){
if(this.log){
SLog.log(this.mvid+" resizing to: "+w+", "+h);
}
this.mvs.width=w;
this.mvs.height=h;
this.mapDiv.style.height=SUtil.pixels(h);
this.mapDiv.style.width=SUtil.pixels(w);
var _13e=new SMapOperation(SMapOperation.RESIZE);
_13e.addParameter("w",w);
_13e.addParameter("h",h);
this.executeOperation(_13e);
SEvent.fire(this,SMap.EVENT_RESIZE);
}else{
if(this.log){
SLog.log(this.mvid+" got resize, but doing nothing");
}
}
};
SMap.prototype.computeMapSize=function(){
var _13f=this.container.offsetWidth;
var _140=this.container.offsetHeight;
var _141=SUtil.getComputedStyle(this.container);
var _142=SUtil.parseInt(_141["borderLeftWidth"])||0;
var _143=SUtil.parseInt(_141["borderRightWidth"])||0;
var _144=SUtil.parseInt(_141["borderTopWidth"])||0;
var _145=SUtil.parseInt(_141["borderBottomWidth"])||0;
var _146=_142+_143;
var _147=_144+_145;
var _148=SUtil.parseInt(_141["paddingLeft"])||0;
var _149=SUtil.parseInt(_141["paddingRight"])||0;
var _14a=SUtil.parseInt(_141["paddingTop"])||0;
var _14b=SUtil.parseInt(_141["paddingBottom"])||0;
var _14c=_148+_149;
var _14d=_14a+_14b;
if(this.log){
SLog.log("container ow: "+_13f+" oh: "+_140);
SLog.log("container bw: "+_146+" bh: "+_147);
SLog.log("container pw: "+_14c+" ph: "+_14d);
}
var _14e=_13f-_146-_14c;
var _14f=_140-_147-_14d;
return {"width":_14e,"height":_14f};
};
SMap.NON_EXISTENT_MAP_VIEW_ERR_CODE=1011;
SMap.prototype.handleOperationError=function(_150){
if(_150.nodeType==1&&_150.tagName=="error"){
var code=_150.getAttributeNode("code").value;
if(code==SMap.NON_EXISTENT_MAP_VIEW_ERR_CODE){
return;
}
var _152;
var _153;
var _154;
for(var i=0;i<_150.childNodes.length;i++){
_152=_150.childNodes[i];
if(_152.nodeType==1){
if(_152.tagName=="message"){
_153=SHandlerUtil.getBodyAsString(_152);
}else{
if(_152.tagName=="stackTrace"){
_154=SHandlerUtil.getBodyAsString(_152);
}
}
}
}
this.errorHandler("Operation Error",code,_153,_154);
this.cancelOperations();
SEvent.fire(this,SMap.EVENT_ERROR);
SEvent.fire(this,SMap.EVENT_UPDATE);
}
};
SMap.prototype.handleRequestError=function(_156,type,_158){
var _159;
if(_158){
if(typeof (_158)=="string"){
this.errorHandler("Request Failed",0,_158);
}else{
this.errorHandler("Request Failed",_158.status,_158.statusText,_158.responseText);
}
}else{
this.errorHandler("Request Failed",-1,"An unknown request error occured.");
}
this.cancelOperations();
SEvent.fire(this,SMap.EVENT_ERROR);
SEvent.fire(this,SMap.EVENT_UPDATE);
};
SMap.prototype.cancelOperations=function(){
this.busy=false;
this.opQueue=new Array();
this.mvsToken=this.lastToken;
};
SMap.prototype.errorHandler=function(_15a,_15b,_15c,_15d){
if(this.errorPanel){
this.errorPanel.dismiss();
delete this.errorPanel;
}
var _15e="";
if(_15b){
_15e+="Code: "+_15b+"<br/>";
}
if(_15c){
_15e+="Message: "+_15c+"<br/>";
}
this.errorPanel=new SErrorPanel(SUtil.getDocumentBody(),_15a,_15e,_15d);
};
SMap.prototype.handleMapViewState=function(_15f){
var _160=_15f.getAttribute("opIds");
var _161=_160.split(",");
if(SUtil.indexOf(_161,this.currentOperation.opId)<0){
return;
}
var _162=_15f.getAttribute("token");
if(this.mvsToken){
if(this.lastToken==null){
this.lastToken=this.mvsToken;
}
}else{
this.lastToken=_162;
}
this.mvsToken=_162;
var _163=SHandlerUtil.getBodyAsString(_15f);
if(this.log){
SLog.log("handleMapViewState mvid:"+this.mvid+" mvs:"+_163);
}
var _164=new SMapViewState(_163);
if(this.lastMvs==null){
this.lastMvs=this.mvs;
}
this.mvs=_164;
this.updateMapImage(this.currentOperation.opId);
this.busy=false;
if(this.opQueue.length!=0){
this.executeOperation();
}
};
SMap.prototype.updateMapImage=function(opId){
var _166=this.getMementoParams("image");
var url=this.webMapUrl+_166+"&opId="+opId;
url+="&ts="+new Date().getTime();
this.currentOperation.imgSrc=url;
if(this.log){
SLog.log("updateMapImage url:"+url);
}
var img=(this.currentOperation.useAltImage)?this.altImg:this.bgImg;
img.width=this.mvs.width;
img.height=this.mvs.height;
img.src=url;
SEvent.fire(this,SMap.EVENT_UPDATE);
};
SMap.prototype.getMementoParams=function(_169){
var _16a=new Array();
_16a.push("method="+_169);
_16a.push("mvid="+this.mvid);
_16a.push("mvn="+this.mvs.mapViewName);
if(this.mvsToken){
_16a.push("mvst="+this.mvsToken);
}
return _16a.join("&");
};
SMap.prototype.queueUpdateOperation=function(_16b){
this.opQueue=this.opQueue.concat(_16b);
};
SMap.prototype.executeOperation=function(_16c){
if(SUtil.isUndefined(_16c)||SMap.containsUpdateOp(_16c)){
this.sendUpdate(_16c);
}else{
this.send(_16c);
}
};
SMap.containsUpdateOp=function(_16d){
var _16e=false;
if(_16d instanceof Array){
for(var i=0;i<_16d.length;i++){
var _170=_16d[i];
if(_170){
_16e=SMap.containsUpdateOp(_170)||_16e;
}
}
}else{
var _171=SMap.operations[_16d.opName];
if(!SUtil.isUndefined(_171)){
return _171;
}else{
throw SError.create("Unknown operation \""+_16d.opName+"\"");
}
}
return _16e;
};
SMap.prototype.sendUpdate=function(_172){
if(_172&&!this.dragging){
this.opQueue=this.opQueue.concat(_172);
}
if(!this.busy){
this.busy=true;
var _173=this.opQueue;
this.opQueue=new Array();
this.currentOperation=_173[_173.length-1];
if(this.log){
SLog.log("map NOT busy...sending "+_173.length+" ops");
}
this.send(_173);
}else{
if(this.log){
SLog.log("map IS busy...adding "+_172);
}
}
};
SMap.prototype.send=function(_174){
var _175=(_174 instanceof Array)?_174.join("&"):_174;
var url=this.webMapUrl+this.getMementoParams("operation")+"&"+_175;
url+="&ts="+new Date().getTime();
this.rconn.request(url);
};
SMap.prototype.load=function(mvs){
var _178=this.initMvs;
if(mvs){
if(typeof mvs=="string"){
_178=new SMapViewState(mvs);
}else{
if(mvs instanceof SMapViewState){
_178=mvs;
}
}
}
_178.width=this.mapDiv.offsetWidth;
_178.height=this.mapDiv.offsetHeight;
var _179=new SMapOperation(SMapOperation.LOAD,_178.toNameValuePairs());
this.executeOperation(_179);
};
SMap.prototype.refresh=function(){
var _17a=new SMapOperation(SMapOperation.REFRESH,this.mvs.toNameValuePairs());
this.executeOperation(_17a);
};
SMap.prototype.zoomIn=function(){
this.executeOperation(new SMapOperation(SMapOperation.ZOOM_IN));
SEvent.fire(this,SMap.EVENT_ZOOMIN);
};
SMap.prototype.zoomOut=function(){
this.executeOperation(new SMapOperation(SMapOperation.ZOOM_OUT));
SEvent.fire(this,SMap.EVENT_ZOOMOUT);
};
SMap.prototype.zoomInToPoint=function(x,y){
var op=new SMapOperation(SMapOperation.ZOOM_IN_POINT);
op.addParameter("x",x);
op.addParameter("y",y);
this.executeOperation(op);
SEvent.fire(this,SMap.EVENT_ZOOMIN_POINT);
};
SMap.prototype.zoomOutToPoint=function(x,y){
var op=new SMapOperation(SMapOperation.ZOOM_OUT_POINT);
op.addParameter("x",x);
op.addParameter("y",y);
this.executeOperation(op);
SEvent.fire(this,SMap.EVENT_ZOOMOUT_POINT);
};
SMap.prototype.getMapViewState=function(){
return SMapViewState.copy(this.mvs);
};
SMap.prototype.getCenter=function(){
return new SPoint(parseFloat(this.mvs.centerLonX),parseFloat(this.mvs.centerLatY));
};
SMap.prototype.getScaleFactor=function(){
if(this.mvs.scaleFactor){
return parseFloat(this.mvs.scaleFactor);
}else{
return null;
}
};
SMap.prototype.setCenterAndScale=function(lonX,latY,_183,_184){
var _185=new SMapOperation(SMapOperation.SCALE);
_185.addParameter("sf",_183);
if(_184){
_185.addParameter("ddpi",_184);
}
this.queueUpdateOperation([_185]);
this.panToLonLat(lonX,latY);
};
SMap.prototype.findAtPoint=function(x,y,_188,_189,_18a){
var _18b=null;
if(_18a){
_18b=this.rconn.setResponseHandler(SMapOperation.FIND_AT_POINT,_18a);
}
var op=new SMapOperation(SMapOperation.FIND_AT_POINT);
op.addParameter("x",x);
op.addParameter("y",y);
if(_188){
op.addParameter("st",_188);
}
if(_189){
op.addParameter("layerNames",_189);
}
this.executeOperation(op);
return _18b;
};
SMap.prototype.findFirstAtPoint=function(x,y,_18f,_190,_191){
var _192=null;
if(_191){
_192=this.rconn.setResponseHandler(SMapOperation.FIND_FIRST_AT_POINT,_191);
}
var op=new SMapOperation(SMapOperation.FIND_FIRST_AT_POINT);
op.addParameter("x",x);
op.addParameter("y",y);
if(_18f){
op.addParameter("st",_18f);
}
if(_190){
op.addParameter("layerNames",_190);
}
this.executeOperation(op);
return _192;
};
SMap.prototype.selectAtPoint=function(x,y,_196,_197,_198){
var _199=null;
if(_198){
_199=this.rconn.setResponseHandler(SMapOperation.FIND_FIRST_AT_POINT,_198);
}
var _19a=new SMapOperation(SMapOperation.SELECT_AT_POINT);
_19a.addParameter("x",x);
_19a.addParameter("y",y);
if(_196){
_19a.addParameter("st",_196);
}
if(_197){
_19a.addParameter("layerNames",_197);
}
this.executeOperation(_19a);
return _199;
};
SMap.prototype.clearSelection=function(){
var _19b=new SMapOperation(SMapOperation.CLEAR_SELECTION);
_19b.addParameter("layerNames","");
this.executeOperation(_19b);
SEvent.fire(this,SMap.EVENT_CLEAR_SELECTION);
};
SMap.prototype.setLayerCriteria=function(_19c,key,_19e){
var op=new SMapOperation(SMapOperation.SET_LAYER_CRITERIA);
op.addLayerCriteria(_19c,key,_19e);
this.executeOperation(op);
};
SMap.prototype.removeLayerCriteria=function(_1a0){
var op=new SMapOperation(SMapOperation.REMOVE_LAYER_CRITERIA);
op.addParameter("ln",_1a0);
this.executeOperation(op);
};
SMap.prototype.setScale=function(_1a2,_1a3){
if(_1a2==this.mvs.scaleFactor&&(!_1a3||this.mvs.displayDPI==_1a3)){
return;
}
var _1a4=new SMapOperation(SMapOperation.SCALE);
_1a4.addParameter("sf",_1a2);
if(_1a3){
_1a4.addParameter("ddpi",_1a3);
}
var _1a5;
if(_1a2>this.getScaleFactor()){
_1a5=SMap.EVENT_ZOOMOUT;
}else{
_1a5=SMap.EVENT_ZOOMIN;
}
this.executeOperation(_1a4);
SEvent.fire(this,_1a5);
};
SMap.prototype.panToLonLat=function(lonX,latY){
var plOp=new SMapOperation(SMapOperation.PAN_LON_LAT);
plOp.addParameter("lonX",lonX);
plOp.addParameter("latY",latY);
this.executeOperation(plOp);
SEvent.fire(this,SMap.EVENT_PAN);
};
SMap.prototype.pan=function(_1a9,_1aa,_1ab){
if(SUtil.isUndefined(_1a9)||_1a9==null){
return;
}
var pct=_1aa||this.panPercent;
var _1ad=(90-_1a9)*SMap.DEGREES_TO_RADIANS;
var _1ae=pct/100;
var _1af=Math.round(this.mvs.width/2);
var _1b0=Math.round(this.mvs.height/2);
var x=_1af+Math.round(Math.cos(_1ad)*_1ae*this.mvs.width);
var y=_1b0-Math.round(Math.sin(_1ad)*_1ae*this.mvs.height);
this.panToPoint(x,y,_1ab);
};
SMap.prototype.panToPoint=function(x,y,_1b5){
if(this.slideAnimation.isAnimating()){
return;
}
var ppOp=new SMapOperation(SMapOperation.PAN_POINT);
ppOp.addParameter("x",x);
ppOp.addParameter("y",y);
if(this.currentOperation&&this.currentOperation.cancelImageLoad){
ppOp.useAltImage=true;
}
this.executeOperation(ppOp);
if(this.animatePanEnabled&&!_1b5){
var ctrX=Math.round(this.mvs.width/2);
var ctrY=Math.round(this.mvs.height/2);
var mvX=x-ctrX;
var mvY=y-ctrY;
this.bgImg.draggable.moveTo(mvX,mvY);
var _1bb=[this.bgImg.draggable,this.fgImg.draggable];
var _1bc=this.extensions.keySet();
for(var i=0;i<_1bc.length;i++){
var _1be=this.extensions.get(_1bc[i]);
if(_1be.draggables){
_1bb=_1bb.concat(_1be.draggables);
}
}
this.slideAnimation.slideTo(this.bgImg.draggable,_1bb,0,0);
}
SEvent.fire(this,SMap.EVENT_PAN);
};
SMap.prototype.onDragStart=function(){
if(this.lastToken!=null&&this.lastMvs!=null){
this.mvsToken=this.lastToken;
this.mvs=this.lastMvs;
}
this.dragging=true;
this.currentOperation.cancelImageLoad=true;
this.opQueue=new Array();
if(this.slideAnimation.isAnimating()){
this.slideAnimation.cancelAnimation();
}
};
SMap.prototype.onDragEnd=function(_1bf,type,_1c1){
if(_1bf!=this.fgImg.draggable){
return;
}
this.dragging=false;
var _1c2=SUtil.objPos(this.fgImg,this.mapDiv);
var _1c3=Math.floor(this.mvs.width/2);
var _1c4=Math.floor(this.mvs.height/2);
var _1c5=new SPoint(_1c3,_1c4);
var _1c6=SPoint.subtract(_1c5,_1c2);
if(this.log){
SLog.log("onDragEnd... 'pan-to' point is = "+_1c6);
}
this.panToPoint(_1c6.x,_1c6.y,true);
};
SMap.prototype.onMapImageLoad=function(_1c7){
var _1c8=(_1c7.currentTarget)?_1c7.currentTarget:_1c7.srcElement;
if(_1c8.src!=this.currentOperation.imgSrc||this.currentOperation.imageLoaded){
return;
}
if(this.log){
SLog.log("("+this.mvid+") mapImg loaded");
}
this.currentOperation.imageLoaded=true;
if(_1c8==this.bgImg&&(this.slideAnimation.isAnimating()||this.dragging)){
this.bgImg.style.visibility="visible";
}
this.swapImages();
};
SMap.prototype.swapImages=function(){
if(this.slideAnimation.isAnimating()||!this.currentOperation.imageLoaded||this.currentOperation.cancelImageLoad){
return;
}
this.lastToken=null;
this.lastMvs=null;
if(this.currentOperation.useAltImage){
var tmp=this.altImg;
this.altImg=this.fgImg;
this.fgImg=tmp;
}else{
var tmp=this.bgImg;
this.bgImg=this.fgImg;
this.fgImg=tmp;
}
this.altImg.style.visibility="hidden";
this.altImg.draggable.moveTo(0,0);
this.altImg.style.zIndex=0;
this.bgImg.style.visibility="hidden";
this.bgImg.draggable.moveTo(0,0);
this.bgImg.style.zIndex=1;
this.fgImg.style.visibility="visible";
this.fgImg.draggable.moveTo(0,0);
this.fgImg.style.zIndex=2;
SEvent.fire(this,SMap.EVENT_IMAGE_LOADED);
};
SMap.prototype.convertToScreen=function(lon,lat){
var _1cc=parseInt(this.mvs.width);
var _1cd=_1cc/2;
var _1ce=parseFloat(this.mvs.centerLonX);
var _1cf=parseFloat(this.mvs.centerLatY);
var _1d0=Math.round(_1cd+((lon-_1ce)*this.mvs.ppdx));
var _1d1=lon;
if(_1ce>0){
_1d1+=360;
}else{
_1d1-=360;
}
var _1d2=Math.round(_1cd+((_1d1-_1ce)*this.mvs.ppdx));
if((_1d2>=0&&_1d2<_1cc)&&(_1d0<0||_1d0>_1cc)){
_1d0=_1d2;
}
var _1d3=Math.round(parseInt(this.mvs.cypx)+((_1cf-lat)*this.mvs.ppdy));
return new SPoint(_1d0,_1d3);
};
SMap.prototype.convertEventToLonLat=function(_1d4){
var pt=SUtil.evtPos(_1d4,this.mapDiv);
return this.convertToLonLat(pt.x,pt.y);
};
SMap.prototype.convertToLonLat=function(x,y){
var _1d8=parseInt(this.mvs.width)>>>1;
var xx=parseFloat(this.mvs.centerLonX)+((x-_1d8)/this.mvs.ppdx);
var yy=parseFloat(this.mvs.centerLatY)-((y-this.mvs.cypx)/this.mvs.ppdy);
if(xx>180){
xx=xx-360;
}else{
if(xx<-180){
xx=360+xx;
}
}
if(yy>90){
yy=Math.min(90,yy);
}else{
if(yy<-90){
yy=Math.max(-90,yy);
}
}
return new SPoint(xx,yy);
};
SMap.addLogoCopyrightLayer=function(map,_1dc,_1dd,_1de,_1df,_1e0){
var _1e1=SUtil.createChildElement(SUtil.getDocumentBody(),"div","logoCRLayer");
_1e1.style.textAlign=(_1dc==SLayer.RIGHT)?"right":"left";
_1e1.style.cursor="default";
var img=SUtil.createChildElement(_1e1,"img","logoImage");
img.src=_1e0||SUtil.prependImagePath("ofxlogo.gif");
var _1e3=SUtil.createChildElement(_1e1,"div","copyright");
var _1e4=_1e3.style;
_1e4.fontFamily="Arial, Helvetica, sans-serif";
_1e4.fontSize="8pt";
var _1e5=function(){
_1e3.innerHTML=map.mvs.copyrights;
if(_1e3.innerHTML&&_1e3.innerHTML!=""){
_1e4.display="block";
}else{
_1e4.display="none";
}
};
_1e5();
SEvent.addListener(map,SMap.EVENT_UPDATE,_1e5);
map.logoLayer=new SLayer(map.mapDiv,_1e1,_1dc,_1dd,_1de,_1df,2);
};
SMap.prototype.setResponseHandler=function(_1e6,_1e7){
return this.rconn.setResponseHandler(_1e6,_1e7);
};
SMap.prototype.getLayerCriteria=function(_1e8,key){
var _1ea=this.mvs.getCriteria(_1e8);
if(_1ea){
for(var i=0;i<_1ea.length;i++){
if(_1ea[i].name==key){
return _1ea[i].value;
}
}
}
return null;
};
function SLayer(_1ec,_1ed,_1ee,_1ef,_1f0,_1f1,_1f2){
this.container=_1ec;
this.layerId=_1ec.id+"_SLayer"+SLayer.nextId++;
this.layerDiv=SUtil.createPanel(this.container,this.layerId,_1f2);
this.layerDiv.appendChild(_1ed);
var _1f3=this.layerDiv.style;
var xOff=(_1f0)?_1f0:0;
if(SLayer.RIGHT==_1ee){
_1f3.right=SUtil.pixels(xOff);
}else{
_1f3.left=SUtil.pixels(xOff);
}
var yOff=(_1f1)?_1f1:0;
if(SLayer.BOTTOM==_1ef){
_1f3.bottom=SUtil.pixels(yOff);
}else{
_1f3.top=SUtil.pixels(yOff);
}
_1f3.display="block";
}
SLayer.nextId=0;
SLayer.LEFT="left";
SLayer.RIGHT="right";
SLayer.TOP="top";
SLayer.BOTTOM="bottom";
function SKeyControls(map,_1f7){
this.map=map;
this.keyMapping=_1f7||SKeyControls.createDefaultKeyMapping(this.map);
this.keyListener=SEvent.addListener(window.document,"keydown",SUtil.callback(this,this.keyDown));
}
SKeyControls.createDefaultKeyMapping=function(map){
var km=new SHashMap();
var am=map.actionMap;
km.put(12,am.get("reload"));
km.put(37,am.get("panW"));
km.put(38,am.get("panN"));
km.put(39,am.get("panE"));
km.put(40,am.get("panS"));
km.put(33,am.get("panNE"));
km.put(34,am.get("panSE"));
km.put(35,am.get("panSW"));
km.put(36,am.get("panNW"));
km.put(187,am.get("zoomIn"));
km.put(189,am.get("zoomOut"));
km.put(43,am.get("zoomIn"));
km.put(45,am.get("zoomOut"));
km.put(61,am.get("zoomIn"));
km.put(107,am.get("zoomIn"));
km.put(109,am.get("zoomOut"));
return km;
};
SKeyControls.prototype.keyDown=function(_1fb){
if(this.ignoreKey(_1fb)){
return true;
}
if(this.log){
SLog.log("keyDown event.keyCode:"+_1fb.keyCode+" alt:"+_1fb.altKey+" ctrl:"+_1fb.ctrlKey+" shift:"+_1fb.shiftKey);
}
var _1fc=this.keyMapping.get(_1fb.keyCode);
if(_1fc){
_1fc(_1fb);
return SEvent.consumeEvent(_1fb);
}
return true;
};
SKeyControls.prototype.ignoreKey=function(_1fd){
if(this.map.dragging||_1fd.altKey||_1fd.ctrlKey||_1fd.shiftKey){
return true;
}
var _1fe=(_1fd.target)?_1fd.target:_1fd.srcElement;
if(_1fe){
if(_1fe.nodeName=="INPUT"){
if(_1fe.getAttribute("type").toUpperCase()!="BUTTON"){
return true;
}
}else{
if(_1fe.nodeName=="TEXTAREA"||_1fe.nodeName=="SELECT"){
return true;
}
}
}
return false;
};
SKeyControls.prototype.dispose=function(){
SEvent.removeListener(this.keyListener);
delete this.keyListener;
};
function SMapControl(map,_200,_201,_202){
this.map=map;
this.showCompass=SUtil.isUndefined(_200)?1:_200;
this.railHeight=_201||0;
this.controlDiv=SUtil.createPanel(this.map.container,this.map.mapDiv.id+"_control",3);
this.isDraggable=_202||0;
this.slider=null;
this.railDiv=null;
this.sliderThumbDiv=null;
this.thumbHeight=10;
this.numScales=0;
this.init();
}
SMapControl.prototype.init=function(){
var _203=this.map.mapDiv.id;
var _204=this.controlDiv.style;
_204.position="absolute";
_204.top="2px";
_204.left="2px";
if(this.isDraggable){
SMapControl.createDragButton(this.controlDiv);
}
if(this.showCompass){
var _205=SUtil.createChildElement(this.controlDiv,"div",_203+"_Compass");
_205.style.position="absolute";
this.createButton(_205,"panN","Pan North",{left:"14px",height:"22px",width:"22px"});
this.createButton(_205,"panW","Pan West",{top:"15px",height:"22px",width:"22px"});
this.createButton(_205,"reload","Reload Map",{top:"21px",left:"20px",height:"10px",width:"10px"});
this.createButton(_205,"panE","Pan East",{top:"15px",left:"28px",height:"22px",width:"22px"});
this.createButton(_205,"panS","Pan South",{top:"29px",left:"14px",height:"22px",width:"22px"});
}
var _206=SUtil.createChildElement(this.controlDiv,"div",_203+"_ZoomControl");
_206.style.position="absolute";
_206.style.top=this.showCompass?"53px":"0px";
var _207=this.showCompass?"18px":"0px";
this.createButton(_206,"zoomIn","Zoom In",{left:_207,height:"15px",width:"15px"});
if(this.railHeight){
this.slider=this.createSliderControl(_206,this.railHeight);
this.slider.setValue(this.map.getScaleFactor());
SEvent.addListener(this.map,SMap.EVENT_UPDATE,SUtil.callback(this,this.updateSliderScales));
SEvent.addListener(this.slider,SSlider.EVENT_SLIDER_STOP,SUtil.callback(this,this.submitScaleChange));
}
this.createButton(_206,"zoomOut","Zoom Out",{top:SUtil.pixels(16+this.railHeight+4),left:_207,height:"15px",width:"15px"});
this.controlDiv.style.display="block";
};
SMapControl.prototype.createButton=function(_208,_209,_20a,_20b){
var _20c=SUtil.createChildElement(_208,"img",_208+"_actionBtn");
_20c.src=SUtil.prependImagePath("controls/button_"+_209+".gif");
_20c.title=_20a;
var _20d=_20c.style;
_20d.position="absolute";
_20d.top=_20b.top||"0px";
_20d.left=_20b.left||"0px";
_20d.width=_20b.width;
_20d.height=_20b.height;
var _20e=new SMouseAdapter(_20c.id,_20c,true);
_20e.stopMouseUpPropagation=false;
SEvent.addListener(_20e,SMouseAdapter.EVENT_MOUSE_CLICK,this.map.actionMap.get(_209));
return _20c;
};
SMapControl.createDragButton=function(_20f){
var _210=SUtil.createChildElement(_20f,"img",_20f.id+"_dragHandle");
_210.src=SUtil.prependImagePath("controls/button_drag.gif");
var _211=_210.style;
_211.position="absolute";
_211.top="2px";
_211.left="2px";
_211.width="6px";
_211.height="6px";
_211.cursor="move";
var _212=new SMouseAdapter(_210.id,_210,true);
_212.stopMouseUpPropagation=false;
_212.dragEnabled=true;
new SDraggable(_20f,_212);
};
SMapControl.prototype.createSliderControl=function(_213,_214){
var _215=this.showCompass?17:0;
var _216=SUtil.createChildElement(_213,"div","");
var _217=_216.style;
_217.position="absolute";
_217.padding="0px 3px 0px 3px";
_217.height=SUtil.pixels(_214);
_217.left=SUtil.pixels(_215+5);
_217.top="17px";
_217.border="1px solid #999999";
_217.backgroundColor="#999999";
this.railDiv=SUtil.createChildElement(_213,"div",_213.id+"_Rail");
var _218=this.railDiv.style;
_218.position="absolute";
_218.padding="0px 3px 0px 3px";
_218.height=SUtil.pixels(_214);
_218.left=SUtil.pixels(_215+4);
_218.top="16px";
_218.border="1px solid #333333";
_218.backgroundImage="url("+SUtil.prependImagePath("controls/zoomrailfill.gif")+")";
_218.backgroundRepeat="repeat-y";
this.sliderThumbDiv=SUtil.createChildElement(this.railDiv,"div",_213.id+"_Thumb");
var _219=this.sliderThumbDiv.style;
_219.position="absolute";
_219.overflow="hidden";
_219.width="19px";
_219.height=SUtil.pixels(this.thumbHeight);
_219.zIndex=2;
_219.left="-6px";
_219.backgroundImage="url("+SUtil.prependImagePath("controls/zoom_thumb.gif")+")";
var _21a=this.computeSliderState();
var _21b=_21a["scaleFactors"];
var _21c=_21a["isDiscrete"];
var _21d=!_21c;
this.numScales=_21b.length;
return new SSlider(this.railDiv.id,this.sliderThumbDiv.id,SSlider.AXIS_VERTICAL,_21b,_21c,_21d);
};
SMapControl.prototype.computeSliderState=function(){
var _21e=false;
var _21f=SMapControl.toSortedFloatArray(this.map.mvs.mapScaleFactors);
if(SUtil.isUndefined(_21f)){
_21f=[parseFloat(this.map.mvs.minScaleFactor),parseFloat(this.map.mvs.maxScaleFactor)];
}else{
_21e=true;
}
return {"scaleFactors":_21f,"isDiscrete":_21e};
};
SMapControl.prototype.updateSliderScales=function(){
this.controlDiv.style.display="block";
var _220=this.computeSliderState();
this.slider.values=_220["scaleFactors"];
this.slider.setValue(this.map.getScaleFactor());
this.numScales=this.slider.values.length;
var _221=_220["isDiscrete"];
this.slider.isDiscrete=_221;
if(_221){
this.createTickMarks();
}else{
this.slider.exponential=true;
}
};
SMapControl.prototype.submitScaleChange=function(){
this.map.setScale(Math.round(this.slider.getValue()));
};
SMapControl.prototype.createTickMarks=function(){
var _222=this.railDiv.childNodes;
if(this.numScales!=_222.length-1&&this.numScales>1){
for(var i=_222.length-1;i>0;i--){
this.railDiv.removeChild(_222[i]);
}
var _224=null;
var _225=null;
var dist=Math.ceil((this.railHeight-this.thumbHeight)/(this.numScales-1));
var _227=this.thumbHeight/2;
for(var i=0;i<this.numScales;i++){
_224=SUtil.createChildElement(this.railDiv,"div",this.railDiv.id+"_"+i);
_225=_224.style;
_225.position="absolute";
_225.top=SUtil.pixels(_227+i*dist);
_225.left="1px";
_225.width="4px";
_225.height="2px";
_225.overflow="hidden";
_225.backgroundImage="url("+SUtil.prependImagePath("/controls/tick_mark.gif")+")";
_225.backgroundRepeat="repeat";
_225.zIndex=this.railDiv.style.zIndex+1;
}
}
};
SMapControl.toSortedFloatArray=function(_228){
if(_228){
var _229=new Array(_228.length);
for(var i=0;i<_229.length;i++){
_229[i]=parseFloat(_228[i]);
}
return _229[0]>_229[_229.length-1]?_229.reverse():_229;
}
};
function SSlider(_22b,_22c,axis,_22e,_22f,_230,_231){
this.railId=_22b;
this.thumbId=_22c;
this.axis=axis;
this.values=_22e;
this.isDiscrete=_22f;
this.values=_22e||new Array(0,1);
this.min=0;
this.max=1;
this.invert=false;
this.exponential=_230||0;
this.exponentialMultiplier=_231||15;
this.value=null;
this.thumbNode=document.getElementById(this.thumbId);
this.thumbSize=0;
this.halfThumb=0;
this.railNode=document.getElementById(this.railId);
this.railOffset=0;
this.slideMax=0;
this.slideValue=0;
this.slideDist=0;
this.thumbMouseAdapter=new SMouseAdapter(this.thumbId,this.thumbNode);
this.thumbMouseAdapter.dragEnabled=true;
var _232=SUtil.callback(this,this.slideMove);
var _233=SUtil.callback(this,this.slideStart);
var _234=SUtil.callback(this,this.slideStop);
SEvent.addListener(this.thumbMouseAdapter,SMouseAdapter.EVENT_MOUSE_DOWN,_233);
SEvent.addListener(this.thumbMouseAdapter,SMouseAdapter.EVENT_DRAG,_232);
SEvent.addListener(this.thumbMouseAdapter,SMouseAdapter.EVENT_DRAG_END,_234);
this.railMouseAdapter=new SMouseAdapter(this.railId,this.railNode,true);
this.railMouseAdapter.stopMouseUpPropagation=false;
SEvent.addListener(this.railMouseAdapter,SMouseAdapter.EVENT_MOUSE_DOWN,_233);
SEvent.addListener(this.railMouseAdapter,SMouseAdapter.EVENT_MOUSE_UP,_234);
}
SSlider.AXIS_VERTICAL=0;
SSlider.AXIS_HORIZONTAL=1;
SSlider.EVENT_SLIDER_START="sliderStart";
SSlider.EVENT_SLIDER_MOVE="sliderMove";
SSlider.EVENT_SLIDER_STOP="sliderStop";
SSlider.EVENT_SLIDER_VALUE_CHANGED="sliderValueChange";
SSlider.prototype.recomputeLayoutValues=function(){
if(this.values[0]<this.values[this.values.length-1]){
this.min=this.values[0]||0;
this.max=this.values[this.values.length-1]||this.min+1;
this.invert=false;
}else{
this.min=this.values[this.values.length-1]||0;
this.max=this.values[0]||this.min+1;
this.invert=true;
}
if(this.thumbNode.nodeType==3){
this.thumbNode=this.thumbNode.parentNode;
}
this.thumbSize=(this.axis==SSlider.AXIS_HORIZONTAL)?this.thumbNode.clientWidth:this.thumbNode.clientHeight;
this.halfThumb=this.thumbSize/2;
this.railOffset=0;
var op=this.thumbNode.offsetParent;
while(op){
this.railOffset+=(this.axis==SSlider.AXIS_HORIZONTAL)?op.offsetLeft:op.offsetTop;
op=op.offsetParent;
}
if(this.railNode.nodeType==3){
this.railNode=this.railNode.parentNode;
}
this.slideMax=(this.axis==SSlider.AXIS_HORIZONTAL)?this.railNode.clientWidth:this.railNode.clientHeight;
this.slideMax-=this.thumbSize;
this.slideDist=Math.ceil(this.slideMax/(this.values.length-1));
};
SSlider.prototype.slideStart=function(_236,type,_238){
this.recomputeLayoutValues();
this.slide(_238);
SEvent.fire(this,SSlider.EVENT_SLIDER_START);
};
SSlider.prototype.slideMove=function(_239,type,_23b){
this.slide(_23b);
SEvent.fire(this,SSlider.EVENT_SLIDER_MOVE);
};
SSlider.prototype.slideStop=function(_23c,type,_23e){
SEvent.fire(this,SSlider.EVENT_SLIDER_STOP);
};
SSlider.prototype.slide=function(_23f){
var _240=(this.axis==SSlider.AXIS_HORIZONTAL)?_23f.clientX:_23f.clientY;
_240-=this.railOffset;
var body=SUtil.getDocumentBody();
_240+=(this.axis==SSlider.AXIS_HORIZONTAL)?body.scrollLeft:body.scrollTop;
var _242=Math.max(Math.min(_240-this.halfThumb,this.slideMax),0);
if(this.isDiscrete){
_242=Math.round(_242/this.slideDist)*this.slideDist;
}
this.slideValueChange(_242);
};
SSlider.prototype.slideValueChange=function(_243){
if(this.axis==SSlider.AXIS_HORIZONTAL){
this.thumbNode.style.left=SUtil.pixels(Math.round(_243));
}else{
this.thumbNode.style.top=SUtil.pixels(Math.round(_243));
}
this.slideValue=_243;
this.value=null;
SEvent.fire(this,SSlider.EVENT_SLIDER_VALUE_CHANGED);
};
SSlider.prototype.getValue=function(){
if(!this.value){
if(this.isDiscrete){
this.value=this.values[Math.min((this.slideValue/this.slideDist),this.values.length-1)];
}else{
var pct=this.slideValue/this.slideMax;
var _245=this.max-this.min;
if(this.exponential){
if(pct==0){
this.value=this.min;
}else{
var exp=(1-pct)*this.exponentialMultiplier;
this.value=this.min+(_245/(Math.pow(2,exp)));
}
}else{
this.value=this.min+(_245*pct);
}
if(this.invert){
this.value=this.max-this.value+this.min;
}
}
}
return this.value;
};
SSlider.prototype.setValue=function(_247){
if(!SUtil.isUndefined(_247)){
this.recomputeLayoutValues();
if(this.isDiscrete){
var prev=this.values[0];
var _249=0;
for(var i=1;i<this.values.length;i++){
var curr=this.values[i];
if(_247<=(prev+(curr-prev)/2)){
break;
}
_249=i;
}
this.slideValueChange(_249*(this.slideDist));
}else{
var _24c=this.max-this.min;
var _24d=Math.min(Math.max(_247,this.min),this.max);
if(this.invert){
_24d=this.max-_24d+this.min;
}
if(this.exponential){
var exp=Math.LOG2E*Math.log(_24c/(_24d-this.min));
var pct=1-(exp/this.exponentialMultiplier);
if(pct<0){
pct=0;
}
this.slideValueChange(pct*this.slideMax);
}else{
this.slideValueChange((_24d-this.min)*(this.slideMax/_24c));
}
}
}
};
function SMouseAdapter(id,obj,_252){
this.id=id;
this.obj=obj;
this.stopMouseDownPropagation=_252;
this.stopMouseUpPropagation=_252;
this.stopMouseClickPropagation=_252;
this.stopMouseOverPropagation=_252;
this.stopMouseMovePropagation=_252;
this.stopMouseOutPropagation=_252;
this.stopDragPropagation=_252;
this.preventDefault=true;
this.mouseMoveEnabled=false;
this.dragEnabled=false;
this.dragStartEvent=null;
this.dragThreshold=3;
this.dragging=false;
this.clickTimeoutId=null;
this.dblClickThreshold=350;
this.dblClickTime=0;
this.delayAfterDblClick=10;
this.hoverEnabled=false;
this.hoverDelay=500;
this.hoverDelayTimeoutId;
this.hoverDuration=5000;
this.hoverDurationTimeoutId=null;
this.lnMouseDown=SEvent.addListener(this.obj,"mousedown",SUtil.callback(this,this.mouseDown));
this.lnMouseUp=SEvent.addListener(this.obj,"mouseup",SUtil.callback(this,this.mouseUp));
this.lnMouseClick=SEvent.addListener(this.obj,"click",SUtil.callback(this,this.mouseClick));
this.lnMouseDblClick=SEvent.addListener(this.obj,"dblclick",SUtil.callback(this,this.mouseDblClick));
this.lnMouseOver=SEvent.addListener(this.obj,"mouseover",SUtil.callback(this,this.mouseOver));
this.lnMouseMove;
this.lnMouseOut=SEvent.addListener(this.obj,"mouseout",SUtil.callback(this,this.mouseOut));
this.lnDragStart=SEvent.addListener(this.obj,"mousedown",SUtil.callback(this,this.dragStart));
this.lnDragEnd;
this.lnDrag;
}
SMouseAdapter.EVENT_MOUSE_DOWN="mousedown";
SMouseAdapter.EVENT_MOUSE_UP="mouseup";
SMouseAdapter.EVENT_MOUSE_CLICK="click";
SMouseAdapter.EVENT_MOUSE_DBLCLICK="dblclick";
SMouseAdapter.EVENT_MOUSE_OVER="mouseover";
SMouseAdapter.EVENT_MOUSE_MOVE="mousemove";
SMouseAdapter.EVENT_MOUSE_OUT="mouseout";
SMouseAdapter.EVENT_DRAG_START="dragstart";
SMouseAdapter.EVENT_DRAG="drag";
SMouseAdapter.EVENT_DRAG_END="dragend";
SMouseAdapter.EVENT_HOVER_START="hoverstart";
SMouseAdapter.EVENT_HOVER_END="hoverend";
SMouseAdapter.prototype.mouseDown=function(_253){
this.logInternalEvent(SMouseAdapter.EVENT_MOUSE_DOWN,_253);
this.downSrc=SEvent.getTarget(_253);
SEvent.fire(this,SMouseAdapter.EVENT_MOUSE_DOWN,_253);
SEvent.consumeEvent(_253,this.stopMouseDownPropagation,this.preventDefault);
};
SMouseAdapter.prototype.mouseUp=function(_254){
this.logInternalEvent(SMouseAdapter.EVENT_MOUSE_UP,_254);
this.upSrc=SEvent.getTarget(_254);
SEvent.fire(this,SMouseAdapter.EVENT_MOUSE_UP,_254);
SEvent.consumeEvent(_254,this.stopMouseUpPropagation,this.preventDefault);
};
SMouseAdapter.prototype.mouseClick=function(_255){
this.logInternalEvent(SMouseAdapter.EVENT_MOUSE_CLICK,_255);
if(!this.dragging&&this.upSrc==this.downSrc){
if(SEvent.countListeners(this,SMouseAdapter.EVENT_MOUSE_DBLCLICK)>0){
var _256=(new Date()).getTime()-this.dblClickTime;
if((this.clickTimeoutId==null)&&(this.delayAfterDblClick<_256)){
var evt=SEvent.createPsuedoEvent(_255);
var _258=SUtil.callbackWithArgs(this,this.delayedMouseClick,evt);
this.clickTimeoutId=setTimeout(_258,this.dblClickThreshold);
}
}else{
SEvent.fire(this,SMouseAdapter.EVENT_MOUSE_CLICK,_255);
}
}
this.downSrc=null;
this.upSrc=null;
SEvent.consumeEvent(_255,this.stopMouseClickPropagation,this.preventDefault);
};
SMouseAdapter.prototype.delayedMouseClick=function(_259){
this.clickTimeoutId=null;
SEvent.fire(this,SMouseAdapter.EVENT_MOUSE_CLICK,_259);
};
SMouseAdapter.prototype.mouseDblClick=function(_25a){
clearTimeout(this.clickTimeoutId);
this.clickTimeoutId=null;
this.dblClickTime=(new Date()).getTime();
this.logInternalEvent(SMouseAdapter.EVENT_MOUSE_DBLCLICK,_25a);
SEvent.fire(this,SMouseAdapter.EVENT_MOUSE_DBLCLICK,_25a);
SEvent.consumeEvent(_25a,this.stopMouseClickPropagation,this.preventDefault);
};
SMouseAdapter.prototype.dragStart=function(_25b){
this.logInternalEvent(SMouseAdapter.EVENT_DRAG_START,_25b);
if(this.dragEnabled){
if(this.lnDrag){
SEvent.removeListener(this.lnDrag);
SEvent.addListenerObject(this.lnDrag);
}else{
this.lnDrag=SEvent.addListener(document,"mousemove",SUtil.callback(this,this.drag));
}
if(this.lnDragEnd){
SEvent.removeListener(this.lnDragEnd);
SEvent.addListenerObject(this.lnDragEnd);
}else{
this.lnDragEnd=SEvent.addListener(document,"mouseup",SUtil.callback(this,this.dragEnd));
}
this.dragStartEvent=SEvent.createPsuedoEvent(_25b);
}
SEvent.consumeEvent(_25b,this.stopDragPropagation,this.preventDefault);
};
SMouseAdapter.prototype.drag=function(_25c){
this.logInternalEvent(SMouseAdapter.EVENT_DRAG,_25c);
if(!this.dragging&&(Math.abs(_25c.screenX-this.dragStartEvent.screenX)>=this.dragThreshold||Math.abs(_25c.screenY-this.dragStartEvent.screenY)>=this.dragThreshold)){
this.dragging=true;
SEvent.fire(this,SMouseAdapter.EVENT_DRAG_START,this.dragStartEvent);
}
if(this.dragging){
SEvent.fire(this,SMouseAdapter.EVENT_DRAG,_25c);
}
SEvent.consumeEvent(_25c,this.stopDragPropagation,this.preventDefault);
};
SMouseAdapter.prototype.dragEnd=function(_25d){
this.logInternalEvent(SMouseAdapter.EVENT_DRAG_END,_25d);
SEvent.removeListener(this.lnDrag);
SEvent.removeListener(this.lnDragEnd);
if(this.dragging){
SEvent.fire(this,SMouseAdapter.EVENT_DRAG_END,_25d);
var _25e=this;
setTimeout(function(){
_25e.dragging=false;
},10);
}
SEvent.consumeEvent(_25d,this.stopDragPropagation,this.preventDefault);
};
SMouseAdapter.prototype.mouseOver=function(_25f){
this.logInternalEvent(SMouseAdapter.EVENT_MOUSE_OVER,_25f);
SEvent.fire(this,SMouseAdapter.EVENT_MOUSE_OVER,_25f);
if(this.mouseMoveEnabled){
if(this.lnMouseMove){
SEvent.addListenerObject(this.lnMouseMove);
}else{
this.lnMouseMove=SEvent.addListener(this.obj,"mousemove",SUtil.callback(this,this.mouseMove));
}
}
SEvent.consumeEvent(_25f,this.stopMouseOverPropagation,this.preventDefault);
};
SMouseAdapter.prototype.mouseMove=function(_260){
this.logInternalEvent(SMouseAdapter.EVENT_MOUSE_MOVE,_260);
SEvent.fire(this,SMouseAdapter.EVENT_MOUSE_MOVE,_260);
if(this.hoverEnabled){
clearTimeout(this.hoverDelayTimeoutId);
this.hoverEnd();
if(!this.dragging){
var _261=SEvent.createPsuedoEvent(_260);
var _262=SUtil.callbackWithArgs(this,this.hoverStart,_261);
this.hoverDelayTimeoutId=setTimeout(_262,this.hoverDelay);
}
}
SEvent.consumeEvent(_260,this.stopMouseMovePropagation,this.preventDefault);
};
SMouseAdapter.prototype.hoverStart=function(_263){
this.logInternalEvent(SMouseAdapter.EVENT_HOVER_START,_263);
var _264=SUtil.callback(this,this.hoverEnd);
this.hoverDurationTimeoutId=setTimeout(_264,this.hoverDuration);
SEvent.fire(this,SMouseAdapter.EVENT_HOVER_START,_263);
};
SMouseAdapter.prototype.hoverEnd=function(){
this.logInternalEvent(SMouseAdapter.EVENT_HOVER_END);
if(this.hoverDurationTimeoutId!=null){
clearTimeout(this.hoverDurationTimeoutId);
this.hoverDurationTimeoutId=null;
SEvent.fire(this,SMouseAdapter.EVENT_HOVER_END);
}
};
SMouseAdapter.prototype.mouseOut=function(_265){
this.logInternalEvent(SMouseAdapter.EVENT_MOUSE_OUT,_265);
var tg=(_265.target)?_265.target:_265.srcElement;
var _267=(_265.relatedTarget)?_265.relatedTarget:_265.toElement;
while(_267){
if(_267==this.obj){
return;
}
_267=_267.parentNode;
}
if(this.log){
SLog.log("Mouse Out "+this.obj.id);
}
SEvent.removeListener(this.lnMouseMove);
SEvent.fire(this,SMouseAdapter.EVENT_MOUSE_OUT,_265);
if(this.hoverEnabled){
clearTimeout(this.hoverDelayTimeoutId);
this.hoverEnd();
}
SEvent.consumeEvent(_265,this.stopMouseOutPropagation,this.preventDefault);
};
SMouseAdapter.prototype.removeListeners=function(){
SEvent.removeListener(this.lnMouseDown);
SEvent.removeListener(this.lnMouseUp);
SEvent.removeListener(this.lnMouseClick);
SEvent.removeListener(this.lnMouseDblClick);
SEvent.removeListener(this.lnMouseOver);
SEvent.removeListener(this.lnMouseMove);
SEvent.removeListener(this.lnMouseOut);
SEvent.removeListener(this.lnDragStart);
SEvent.removeListener(this.lnDragEnd);
SEvent.removeListener(this.lnDrag);
};
SMouseAdapter.prototype.logInternalEvent=function(type,_269){
if(!this.log){
return;
}
if(!_269){
SLog.log(type+"("+this.obj.id+")");
return;
}
var tg=(_269.target)?_269.target:_269.srcElement;
var _26b=" tg="+tg.nodeName+":"+tg.id;
var _26c="";
var _26d=(type==SMouseAdapter.EVENT_MOUSE_OVER);
var _26e=(type==SMouseAdapter.EVENT_MOUSE_OUT);
if(_26d||_26e){
var _26f;
if(_269.relatedTarget){
_26f=_269.relatedTarget;
}else{
if(_26d&&_269.fromElement){
_26f=_269.fromElement;
}else{
if(_26e&&_269.toElement){
_26f=_269.toElement;
}
}
}
var _270=false;
if(_26e&&_270){
var hier=new Array();
while(_26f){
hier[hier.length]=_26f.nodeName+":"+_26f.id;
_26f=_26f.parentNode;
}
_26c=" toTg="+hier.join("-> ");
}else{
if(_26f){
_26c=(_26d?" from":" to")+"Tg="+_26f.nodeName+":"+_26f.id;
}
}
}
SLog.log(type+"("+this.obj.id+")"+":"+SUtil.evtPgPos(_269)+_26b+_26c);
};
function SDraggable(obj,_273,minX,maxX,minY,maxY){
this.obj=obj;
this.mouseAdapter=_273;
this.lastPos=new SPoint();
this.minX=SUtil.isUndefined(minX)?null:minX;
this.minY=SUtil.isUndefined(minY)?null:minY;
this.maxX=SUtil.isUndefined(maxX)?null:maxX;
this.maxY=SUtil.isUndefined(maxY)?null:maxY;
this.enabled=true;
this.obj.style.position="absolute";
try{
var _278=SUtil.objPos(this.obj,this.obj.offsetParent);
if(isNaN(parseInt(this.obj.style.left))){
this.obj.style.left=SUtil.pixels(_278.x);
}
if(isNaN(parseInt(this.obj.style.top))){
this.obj.style.top=SUtil.pixels(_278.y);
}
}
catch(e){
}
this.mouseAdapters=new SHashMap();
this.addMouseAdapter(this.mouseAdapter);
}
SDraggable.prototype.addMouseAdapter=function(_279){
this.removeMouseAdapter(_279.id);
var _27a=new Array();
_27a[0]=SEvent.addListener(_279,SMouseAdapter.EVENT_DRAG_START,SUtil.callback(this,this.dragStart));
_27a[1]=SEvent.addListener(_279,SMouseAdapter.EVENT_DRAG,SUtil.callback(this,this.drag));
_27a[2]=SEvent.addListener(_279,SMouseAdapter.EVENT_DRAG_END,SUtil.callback(this,this.dragEnd));
this.mouseAdapters.put(_279.id,_27a);
};
SDraggable.prototype.removeMouseAdapter=function(id){
var _27c=this.mouseAdapters.get(id);
if(!_27c){
return;
}
for(var i=0;i<_27c.length;i++){
SEvent.removeListener(_27c[i]);
}
this.mouseAdapters.remove(id);
};
SDraggable.prototype.removeAllMouseAdapters=function(){
var ids=this.mouseAdapters.keySet();
for(var i=0;i<ids.length;i++){
this.removeMouseAdapter(ids[i]);
}
};
SDraggable.prototype.dragStart=function(_280,type,_282){
if(!this.enabled){
return;
}
this.lastPos=SUtil.evtPgPos(_282);
SEvent.fire(this,SMouseAdapter.EVENT_DRAG_START,_282);
};
SDraggable.prototype.drag=function(_283,type,_285){
if(!this.enabled){
return;
}
var _286=SUtil.evtPgPos(_285);
var _287=SPoint.subtract(_286,this.lastPos);
this.moveBy(_287.x,_287.y);
this.lastPos=_286;
SEvent.fire(this,SMouseAdapter.EVENT_DRAG,_285);
};
SDraggable.prototype.dragEnd=function(_288,type,_28a){
if(!this.enabled){
return;
}
SEvent.fire(this,SMouseAdapter.EVENT_DRAG_END,_28a);
};
SDraggable.prototype.moveBy=function(x,y){
if(this.log){
SLog.log("SDraggable.moveBy("+x+","+y+")");
}
var nx=parseInt(this.obj.style.left)+x;
var ny=parseInt(this.obj.style.top)+y;
this.moveTo(nx,ny);
};
SDraggable.prototype.moveTo=function(x,y){
if(this.log){
SLog.log("SDraggable.moveTo("+x+","+y+")");
}
var nx=x;
var ny=y;
if(this.minX!=null){
nx=Math.max(nx,this.minX);
}
if(this.maxX!=null){
nx=Math.min(nx,this.maxX);
}
if(this.minY!=null){
ny=Math.max(ny,this.minY);
}
if(this.maxY!=null){
ny=Math.min(ny,this.maxY);
}
this.obj.style.left=SUtil.pixels(nx);
this.obj.style.top=SUtil.pixels(ny);
};
SDraggable.prototype.moveToPoint=function(_293){
this.moveTo(_293.x,_293.y);
};
function SCoordinateReadout(smap,_295,_296){
this.smap=smap;
this.lonXDiv=_295;
this.latYDiv=_296;
if(!this.lonXDiv||!this.latYDiv){
this.defaultLayout=true;
}
this.init();
}
SCoordinateReadout.FORMAT_DECIMAL="dec";
SCoordinateReadout.FORMAT_SEXAGESIMAL="dms";
SCoordinateReadout.style={fontFamily:"Arial, Helvetica, sans-serif",fontSize:"8pt",width:"130px"};
SCoordinateReadout.prototype.decimalPrecision=6;
SCoordinateReadout.prototype.format=SCoordinateReadout.FORMAT_DECIMAL;
SCoordinateReadout.prototype.init=function(){
this.moveListener=SEvent.addListener(this.smap.mouseAdapter,SMouseAdapter.EVENT_MOUSE_MOVE,SUtil.callback(this,this.mouseMoved));
this.outListener=SEvent.addListener(this.smap.mouseAdapter,SMouseAdapter.EVENT_MOUSE_OUT,SUtil.callback(this,this.mouseOut));
if(this.defaultLayout){
this.createDivs();
}
this.updateDisplay("","");
};
SCoordinateReadout.prototype.createDivs=function(){
this.coordsDiv=SUtil.createChildElement(this.smap.mapDiv,"div","coords");
var _297=SCoordinateReadout.createLabelDiv(document,"lonDiv","Lon: ");
_297.style.width=SCoordinateReadout.style.width;
var _298=SCoordinateReadout.createFieldDiv(document,_297.id+"_Field");
_297.appendChild(_298);
this.coordsDiv.appendChild(_297);
this.lonXDiv=_298;
var _299=SCoordinateReadout.createLabelDiv(document,"latDiv","Lat: ");
_299.style.width=SCoordinateReadout.style.width;
_299.style.left=SCoordinateReadout.style.width;
var _29a=SCoordinateReadout.createFieldDiv(document,_299.id+"_Field");
_299.appendChild(_29a);
this.coordsDiv.appendChild(_299);
this.latYDiv=_29a;
var _29b=this.coordsDiv.style;
_29b.cursor="default";
_29b.fontFamily=SCoordinateReadout.style.fontFamily;
_29b.fontSize=SCoordinateReadout.style.fontSize;
this.coordsDiv.style.height=SUtil.pixels(this.coordsDiv.childNodes[0].offsetHeight);
new SLayer(this.smap.mapDiv,this.coordsDiv,SLayer.LEFT,SLayer.BOTTOM,5,5,3);
};
SCoordinateReadout.createLabelDiv=function(doc,id,_29e){
var _29f=doc.createElement("div");
var _2a0=_29f.style;
_2a0.position="absolute";
_2a0.display="inline";
_29f.id=id;
_29f.appendChild(doc.createTextNode(_29e));
return _29f;
};
SCoordinateReadout.createFieldDiv=function(doc,id){
var _2a3=doc.createElement("div");
_2a3.id=id;
var _2a4=_2a3.style;
_2a4.position="relative";
_2a4.display="inline";
return _2a3;
};
SCoordinateReadout.prototype.mouseOut=function(_2a5,type,_2a7){
this.updateDisplay("","");
};
SCoordinateReadout.prototype.mouseMoved=function(_2a8,type,_2aa){
var _2ab=this.smap.convertEventToLonLat(_2aa);
var x=_2ab.x;
var y=_2ab.y;
if(this.format==SCoordinateReadout.FORMAT_DECIMAL){
x=x.toFixed(this.decimalPrecision);
y=y.toFixed(this.decimalPrecision);
}else{
if(this.format==SCoordinateReadout.FORMAT_SEXAGESIMAL){
var dms=SCoordinateReadout.getSexagesimalFields(x,true);
x=this.toSexagesimal(dms[0],dms[1],dms[2],dms[3]);
dms=SCoordinateReadout.getSexagesimalFields(y,false);
y=this.toSexagesimal(dms[0],dms[1],dms[2],dms[3]);
}
}
this.updateDisplay(x,y);
};
SCoordinateReadout.prototype.updateDisplay=function(x,y){
this.lonXDiv.innerHTML=x;
this.latYDiv.innerHTML=y;
};
SCoordinateReadout.getSexagesimalFields=function(val,_2b2){
var deg=val>0?Math.floor(val):Math.ceil(val);
var tmp=Math.abs(val-deg)*60;
var min=Math.floor(tmp);
var sec=(tmp-min)*60;
var hem=SCoordinateReadout.getHemisphere(deg,_2b2);
return [hem,deg,min,sec];
};
SCoordinateReadout.getHemisphere=function(deg,_2b9){
var hem;
if(_2b9){
deg<0?hem="W":hem="E";
}else{
deg<0?hem="S":hem="N";
}
return hem;
};
SCoordinateReadout.prototype.toSexagesimal=function(hem,deg,min,sec){
return hem+" "+Math.abs(deg)+"&deg; "+min+"' "+sec.toFixed(this.decimalPrecision)+"\"";
};
function STooltip(_2bf,_2c0){
if(arguments.length==0){
return;
}
this.container=_2bf;
this.mouseAdapter=_2c0;
this.offsetX=12;
this.offsetY=21;
this.slideX=true;
this.slideY=false;
SEvent.addListener(this.mouseAdapter,SMouseAdapter.EVENT_HOVER_START,SUtil.callback(this,this.hoverStart));
SEvent.addListener(this.mouseAdapter,SMouseAdapter.EVENT_HOVER_END,SUtil.callback(this,this.hoverEnd));
var _2c1=SUtil.createDropShadowPanel(document.body,this.container.id+"_Tooltip",100);
this.panel=_2c1.panel;
this.contentPanel=_2c1.shadowContent;
}
STooltip.prototype.hoverStart=function(_2c2,type,_2c4){
if(this.log){
SLog.log(type+"("+this.container.id+")");
}
this.getTooltipContent(_2c4);
};
STooltip.prototype.hoverEnd=function(_2c5,type){
if(this.log){
SLog.log(type+"("+this.container.id+")");
}
this.hide();
};
STooltip.prototype.show=function(_2c7,_2c8){
var e=SUtil.evtPgPos(_2c7);
var _2ca=SUtil.pageBottomRight();
var _2cb=this.panel;
var doc=SUtil.getDocumentBody();
this.contentPanel.innerHTML=_2c8;
var _2cd=_2cb.style;
_2cd.left=SUtil.pixels(e.x+this.offsetX);
_2cd.right="";
_2cd.top=SUtil.pixels(e.y+this.offsetY);
_2cd.bottom="";
_2cd.display="block";
var _2ce=_2cb.offsetLeft+_2cb.offsetWidth-doc.scrollLeft;
var _2cf=_2ce-doc.clientWidth;
if(this.log){
SLog.log("(OL+OW-SL=R)>CW:("+_2cb.offsetLeft+"+"+_2cb.offsetWidth+"-"+doc.scrollLeft+"="+_2ce+")>"+doc.clientWidth+":"+(_2cf>0));
}
if(_2cf>0){
if(this.slideX){
_2cd.left=SUtil.pixels(e.x+this.offsetX-_2cf);
}else{
_2cd.left="";
_2cd.right=SUtil.pixels(_2ca.x-e.x+this.offsetX);
}
}
var _2d0=_2cb.offsetTop+_2cb.offsetHeight-doc.scrollTop;
var _2d1=_2d0-doc.clientHeight;
if(this.log){
SLog.log("OT+OH-ST=B)>CW:("+_2cb.offsetTop+"+"+_2cb.offsetHeight+"-"+doc.scrollTop+"="+_2d0+")>"+doc.clientHeight+":"+(_2d1>0));
}
if(_2d1>0){
if(this.slideY){
_2cd.top=SUtil.pixels(e.y+this.offsetY-_2d1);
}else{
_2cd.top="";
_2cd.bottom=SUtil.pixels(_2ca.y-e.y+this.offsetY);
}
}
};
STooltip.prototype.hide=function(){
this.panel.style.display="none";
};
STooltip.prototype.getTooltipContent=function(_2d2){
var _2d3=SUtil.evtPos(_2d2,this.container);
var _2d4="<span style=\"font:normal 8pt sans-serif;\">"+_2d3+"</span>";
this.show(_2d2,_2d4);
};
function SMapTooltip(smap,_2d6){
this.base=STooltip;
this.base(smap.container,smap.mouseAdapter);
delete this.base;
this.smap=smap;
this.smap.setResponseHandler(SMapOperation.TOOLTIP,SUtil.callback(this,this.handleTooltip));
this.event=null;
this.opId=null;
this.layerNameProvider=_2d6||function(){
return [];
};
SEvent.addListener(map,SMap.EVENT_UPDATE,SUtil.callback(this,this.hide));
}
SMapTooltip.prototype=new STooltip;
SMapTooltip.prototype.searchTolerance=3;
SMapTooltip.prototype.getTooltipContent=function(_2d7){
var _2d8=this.layerNameProvider();
if(_2d8&&_2d8.length==0){
return;
}
if(this.isMapBusy()){
return;
}
if(this.eventBlocksHover(_2d7)){
return;
}
this.event=SEvent.createPsuedoEvent(_2d7,this.smap.mapDiv);
var _2d9=SUtil.evtPos(_2d7,this.container);
var _2da=this.getOperation(_2d9,this.searchTolerance,_2d8);
this.opId=_2da.opId;
this.smap.executeOperation(_2da);
};
SMapTooltip.prototype.eventBlocksHover=function(evt){
var tgt=SEvent.getTarget(evt);
while(tgt&&tgt!=this.smap.mouseAdapter.obj){
if(tgt.wmtNoMapTooltip==true){
return true;
}
if(tgt.offsetParent){
tgt=tgt.offsetParent;
}else{
return false;
}
}
};
SMapTooltip.prototype.isMapBusy=function(){
return (this.smap.busy||this.smap.slideAnimation.isAnimating()||this.smap.dragging||(this.smap.currentOperation&&!this.smap.currentOperation.imageLoaded));
};
SMapTooltip.prototype.getOperation=function(_2dd,_2de,_2df){
var _2e0=new SMapOperation(SMapOperation.TOOLTIP);
_2e0.addParameter("x",_2dd.x);
_2e0.addParameter("y",_2dd.y);
if(_2de){
_2e0.addParameter("st",_2de);
}
if(_2df){
_2e0.addParameter("layerNames",_2df);
}
return _2e0;
};
SMapTooltip.prototype.handleTooltip=function(_2e1){
var _2e2=_2e1.getAttributeNode("opId").value;
if(this.opId==_2e2){
this.opId=null;
if(this.event){
var _2e3=this.handleTooltipContent(_2e1);
if(_2e3&&_2e3.length>0){
this.show(this.event,_2e3);
}
this.event=null;
}
}
};
SMapTooltip.prototype.hide=function(){
this.opId=null;
this.panel.style.display="none";
};
SMapTooltip.prototype.handleTooltipContent=function(_2e4){
var _2e5=null;
if(!_2e4.childNodes){
return null;
}
for(var i=0;i<_2e4.childNodes.length;i++){
var node=_2e4.childNodes[i];
if(node.nodeType==1&&node.tagName=="featureResults"){
_2e5=node;
break;
}
}
if(!_2e5){
return null;
}
var _2e8=SHandlerUtil.parseFeatureResults(_2e5);
if(_2e8&&_2e8.length>0){
return _2e8[0].name;
}else{
return null;
}
};
function SPlacement(id,_2ea,_2eb,_2ec,_2ed){
if(arguments.length==0){
return;
}
this.id=id;
this.setLocation(_2ea);
this.content=_2eb;
this.content.wmtNoMapTooltip=true;
var _2ee=new SMouseAdapter(this.id,this.content);
_2ee.dragEnabled=_2ec;
_2ee.stopMouseClickPropagation=true;
_2ee.preventDefault=false;
_2ee.stopDragPropagation=_2ec||_2ed;
this.draggable=new SDraggable(this.content,_2ee);
}
SPlacement.prototype.id=null;
SPlacement.prototype.content=null;
SPlacement.prototype.setDragEnabled=function(_2ef){
this.draggable.mouseAdapter.dragEnabled=_2ef;
};
SPlacement.prototype.isDragEnabled=function(){
return this.draggable.mouseAdapter.dragEnabled;
};
SPlacement.prototype.setLocation=function(loc){
this.location=loc;
};
SPlacement.prototype.setVisible=function(_2f1){
if(_2f1){
this.content.style.display="block";
this.content.style.visibility="visible";
}else{
this.content.style.display="none";
}
};
SPlacement.prototype.isVisible=function(){
return "block"==this.content.style.display;
};
SPlacement.prototype.show=function(){
this.setVisible(true);
};
SPlacement.prototype.hide=function(){
this.setVisible(false);
};
function SIcon(id,_2f3,_2f4,_2f5,_2f6,_2f7,_2f8){
this.id=id+"Icon";
this.imgName=_2f3;
this.tooltipText=_2f6;
this.height=_2f5;
this.width=_2f4;
this.topPx=-(_2f8||(_2f5/2));
this.leftPx=-(_2f7||(_2f4/2));
}
SIcon.prototype.getContent=function(){
var _2f9;
var _2fa;
if(/.[Pp][Nn][Gg]$/.test(this.imgName)&&((window.ActiveXObject)&&!(window.XMLHttpRequest))){
_2f9=SUtil.createChildElement(null,"img",this.id);
_2f9.runtimeStyle.filter="progid:DXImageTransform.Microsoft.AlphaImageLoader"+"(src='"+this.imgName+"', sizingMethod='scale')";
_2f9.src=SUtil.prependImagePath("spacer.gif");
_2fa=_2f9.style;
_2fa.height=SUtil.pixels(this.height);
_2fa.width=SUtil.pixels(this.width);
}else{
_2f9=SUtil.createChildElement(null,"img",this.id);
_2f9.src=this.imgName;
_2fa=_2f9.style;
}
if(this.tooltipText){
_2f9.title=this.tooltipText;
}
_2fa.position="relative";
_2fa.top=SUtil.pixels(this.topPx);
_2fa.left=SUtil.pixels(this.leftPx);
return _2f9;
};
function SMarker(id,loc,icon,_2fe,_2ff,_300){
this.base=SPlacement;
this.base(id,loc,SUtil.createChildElement(null,"div",id+"Content"),_2ff);
delete this.base;
this.mouseAdapter=this.draggable.mouseAdapter;
this.setIcon(icon);
this.setPopup(_300);
this.setLocation(loc);
this.hasFixedLocation=true;
if(_2fe){
this.labelDiv=SUtil.createChildElement(this.content,"div",this.id+"Label");
this.labelDiv.innerHTML=_2fe;
style=this.labelDiv.style;
style.position="relative";
style.cursor="default";
var dy=2+this.icon.height+this.icon.topPx;
style.top=SUtil.pixels(dy);
}
SEvent.addListener(this.mouseAdapter,SMouseAdapter.EVENT_MOUSE_CLICK,SUtil.callback(this,this.onClick));
}
SMarker.prototype=new SPlacement;
SMarker.prototype.labelDiv=null;
SMarker.prototype.mouseAdapter=null;
SMarker.prototype.onClick=function(_302,type,_304){
SEvent.consumeEvent(_304,true,true);
if(this.click){
this.click(this,type,_304);
}
};
SMarker.prototype.click=function(_305,type,_307){
this.togglePopup();
};
SMarker.prototype.togglePopup=function(){
if(this.popup){
this.popup.setVisible(!this.popup.isVisible());
if(this.popup.isVisible()){
this.manager.adjustForOverflow(this.popup,this,this.iconContent.offsetWidth/2,this.iconContent.offsetHeight/2);
}
}
};
SMarker.prototype.setIcon=function(icon){
if(this.iconContent!=null){
this.content.removeChild(this.iconContent);
}
this.icon=icon||new SIcon(this.id,SUtil.prependImagePath("close.gif"),15,15);
this.iconContent=this.icon.getContent();
this.content.appendChild(this.iconContent);
};
SMarker.prototype.setPopup=function(_309){
var _30a=null;
if(this.popup){
_30a=this.popup;
this.content.removeChild(this.popup.content);
}
if(_309){
if(this.manager){
this.manager.removePlacement(_309.id);
}
this.popup=_309;
this.popup.content.style.position="absolute";
this.content.appendChild(this.popup.content);
}
return _30a;
};
function SMessageBox(id,_30c,_30d,_30e){
this.id=id;
this.content=SUtil.createPanel(null,id,1);
this.content.wmtNoMapTooltip=true;
this.style=this.content.style;
this.titleBar=SUtil.createChildElement(this.content,"div",this.id+"TitleBar");
this.titleBar.innerHTML=_30c;
var _30f=this.titleBar.style;
_30f.position="relative";
this.titleButtons=SUtil.createChildElement(this.content,"div",this.id+"TitleButtons");
_30f=this.titleButtons.style;
_30f.position="absolute";
_30f.right="2px";
_30f.top="1px";
var _310=SUtil.createChildElement(this.titleButtons,"img",this.id+"CloseButton");
var _311="close.gif";
_310.src=SUtil.prependImagePath(_311);
SEvent.addListener(_310,"click",SEvent.nonPropagatingCallback(this,this.onClose));
this.messageContent=SUtil.createChildElement(this.content,"div",this.id+"Content");
this.messageContent.innerHTML=_30d;
_30f=this.messageContent.style;
_30f.position="relative";
this.eventCatcher=new SMouseAdapter(this.id+"EventCacher",this.messageContent,true);
this.eventCatcher.preventDefault=false;
this.mouseAdapter=new SMouseAdapter(this.id,this.titleBar);
this.mouseAdapter.stopDragPropagation=true;
this.mouseAdapter.stopMouseClickPropagation=true;
this.draggable=new SDraggable(this.content,this.mouseAdapter);
this.mouseAdapter.dragEnabled=_30e;
SMessageBox.applyStyles(this);
}
SMessageBox.prototype=new SPlacement;
SMessageBox.prototype.content=null;
SMessageBox.prototype.titleBar=null;
SMessageBox.prototype.titleButtons=null;
SMessageBox.prototype.titleContent=null;
SMessageBox.prototype.messageContent=null;
SMessageBox.prototype.mouseAdapter=null;
SMessageBox.applyStyles=function(_312){
var _313=_312.content.style;
_313.border="1px solid #38F";
_313.backgroundColor="#FFF";
_313=_312.titleBar.style;
_313.backgroundColor="#38F";
_313.color="#FFF";
_313.whiteSpace="nowrap";
_313.font="normal 10pt Arial, Helvetica, sans-serif";
_313.cursor="default";
_313.padding="1px 2px 1px 0px";
_313=_312.messageContent.style;
_313.padding="4px";
};
SMessageBox.prototype.onClose=function(_314){
this.close();
};
SMessageBox.prototype.close=function(_315){
this.hide();
};
SMessageBox.prototype.setVisible=function(){
SPlacement.prototype.setVisible.apply(this,arguments);
this.titleBar.style.width=SUtil.pixels(this.messageContent.offsetWidth);
};
function SPlacementManager(map){
this.map=map;
this.placements=new SHashMap();
this.draggables=new Array();
this.init();
}
SPlacementManager.PLACEMENT_LAYER="placement_layer";
SPlacementManager.prototype.init=function(){
this.map.extensions.put(typeof (this),this);
SEvent.addListener(this.map,SMap.EVENT_IMAGE_LOADED,SUtil.callback(this,this.refreshPlacements));
var _317=this.map.mapDiv;
this.placementLayer=SUtil.createChildElement(_317,"div",_317.id+"_"+SPlacementManager.PLACEMENT_LAYER);
this.placementLayer.style.zIndex=2;
};
SPlacementManager.prototype.addPlacement=function(_318){
if(!_318){
return;
}
if(!(_318 instanceof SPlacement)){
throw SError.create("content must be of type SPlacement, but was: "+typeof _318,SError.ILLEGAL_ARGUMENT_EXCEPTION);
}
var _319=null;
_319=this.removePlacement(_318.id);
_318.manager=this;
this.placements.put(_318.id,_318);
this.placementLayer.appendChild(_318.content);
_318.draggable.addMouseAdapter(this.map.mouseAdapter);
SEvent.addListener(_318.draggable.mouseAdapter,SMouseAdapter.EVENT_DRAG_END,SUtil.callback(this,this.onDragEnd));
this.draggables.push(_318.draggable);
if(_318.labelDiv){
var _31a=_318.labelDiv.offsetWidth;
var _31b=Math.min(200,_31a);
_318.labelDiv.style.width=SUtil.pixels(_31b);
_318.labelDiv.style.position="absolute";
var _31c=_31b>>>1;
_318.labelDiv.style.left=SUtil.pixels(-_31c);
}
var _31d=this.map.convertToScreen(_318.location.x,_318.location.y);
_318.draggable.moveToPoint(_31d);
this.adjustForOverflow(_318);
return _319;
};
SPlacementManager.prototype.onDragEnd=function(_31e,type,_320){
var p=this.getPlacement(_31e.id);
if(p){
var pt=SUtil.objPos(p.content,this.map.mapDiv);
p.setLocation(this.map.convertToLonLat(pt.x,pt.y));
}
};
SPlacementManager.prototype.getPlacement=function(id){
return this.placements.get(id);
};
SPlacementManager.prototype.removePlacement=function(id,_325){
var p=this.placements.remove(id);
if(p){
this.placementLayer.removeChild(p.content);
p.draggable.removeAllMouseAdapters();
for(var i=0;i<this.draggables.length;++i){
var d=this.draggables[i];
if(d==p.draggable){
delete this.draggables[i];
}
}
if(!_325){
this.draggables=SUtil.compressArray(this.draggables);
}
}
return p;
};
SPlacementManager.prototype.removeAllPlacements=function(){
var keys=this.placements.keySet();
for(var i=0;i<keys.length;i++){
var p=this.removePlacement(keys[i],true);
}
this.draggables=new Array();
};
SPlacementManager.prototype.refreshPlacements=function(){
var keys=this.placements.keySet();
for(var i=0;i<keys.length;i++){
var p=this.placements.get(keys[i]);
var _32f=this.map.convertToScreen(p.location.x,p.location.y);
p.draggable.moveToPoint(_32f);
}
};
SPlacementManager.prototype.adjustForOverflow=function(_330,_331,_332,_333){
if(_330.hasFixedLocation){
return;
}
var _334=this.map.container.style;
var _335=SUtil.parseInt(_334["borderLeftWidth"])||0;
var _336=SUtil.parseInt(_334["borderBottomWidth"])||0;
var _337=this.map.computeMapSize();
var loc=_331?_331.location:_330.location;
var _339=this.map.convertToScreen(loc.x,loc.y);
var _33a=_330.content.style;
if(_33a.display=="none"){
_33a.visibility="hidden";
_33a.display="block";
}
var _33b=_330.content.offsetWidth;
var _33c=_332||0;
var _33d=false;
if((_337.width-(_339.x+_33b)-_335)<0){
_33d=true;
if(_331){
_33a.left=SUtil.pixels(-(_33b+_33c));
}else{
_33a.left=SUtil.pixels(_339.x-_33b-_335);
}
}else{
if(_331){
_33a.left=SUtil.pixels(_33c);
}else{
_33a.left=SUtil.pixels(_339.x);
}
}
var _33e=_330.content.offsetHeight;
var _33f=_333||0;
if((_337.height-(_339.y+_33e)-_336)<0){
_33d=true;
if(_331){
_33a.top=SUtil.pixels(-(_33e+_33f));
}else{
_33a.top=SUtil.pixels(_339.y-_33e-_336);
}
}else{
if(_331){
_33a.top=SUtil.pixels(_33f);
}else{
_33a.top=SUtil.pixels(_339.y);
}
}
};
function SErrorPanel(_340,_341,_342,_343){
this.container=_340;
this.title=_341||"";
this.content=_342||"";
this.additionalDetail=_343;
this.errorDiv=null;
this.mouseAdapter=null;
this.errorCloseListener=null;
this.init();
}
SErrorPanel.prototype.init=function(){
this.errorDiv=SUtil.createPanel(this.container,this.container.id+"_err",1001);
this.mouseAdapter=new SMouseAdapter(this.errorDiv.id,this.errorDiv,this.container!=SUtil.getDocumentBody());
this.mouseAdapter.stopMouseUpPropagation=false;
var _344=this.errorDiv.style;
_344.cssText="-moz-border-radius: 11px;";
_344.visibility="hidden";
_344.display="block";
_344.width="50%";
_344.padding="5px 10px 5px 10px";
_344.color="#eeeeee";
_344.background="#000000";
_344.filter="alpha(opacity=80)";
_344.opacity=0.8;
_344.position="absolute";
_344.fontFamily="Arial, Helvetica, sans-serif";
_344.zIndex="1001";
var _345;
var _346=SUtil.createChildElement(this.errorDiv,"div",this.errorDiv.id+"title");
_345=_346.style;
_345["cssFloat"]="left";
_345["styleFloat"]="left";
_345.textAlign="center";
_345.fontWeight="bold";
_345.fontVariant="small-caps";
_345.position="relative";
_346.innerHTML=this.title;
var _347=SUtil.createChildElement(this.errorDiv,"img",this.errorDiv.id+"closer");
_347.src=SUtil.prependImagePath("error_cancel.gif");
_345=_347.style;
_345["cssFloat"]="right";
_345["styleFloat"]="right";
_345.height="16px";
_345.width="16px";
_345.position="relative";
var bar=SUtil.createChildElement(this.errorDiv,"hr");
_345=bar.style;
_345.width="100%";
_345.height="0px";
_345.clear="both";
_345.border="none 0";
_345.borderTop="1px solid #ccc";
_345.borderBottom="1px solid #efefef";
_345.margin="5px 0 5px 0";
_345.position="relative";
this.errorCloseListener=SEvent.addListener(_347,SMouseAdapter.EVENT_MOUSE_CLICK,SEvent.nonPropagatingCallback(this,this.dismiss));
var _349=SUtil.createChildElement(this.errorDiv,"div",this.errorDiv.id+"content");
_345=_349.style;
_349.innerHTML=this.content;
if(this.additionalDetail){
this.addCollapsibleDiv();
}
_344.top="25%";
_344.left="25%";
_344.visibility="visible";
};
SErrorPanel.prototype.addCollapsibleDiv=function(){
var _34a=SUtil.createChildElement(this.errorDiv,"div",this.errorDiv.id+"detail");
var _34b="error_rightarrow.gif";
var _34c="error_downarrow.gif";
var _34d=SUtil.createChildElement(_34a,"img",this.errorDiv.id+"arrow");
_34d.src=SUtil.prependImagePath(_34b);
var _34e=_34d.style;
_34e.position="relative";
_34e.cssFloat="left";
_34e.styleFloat="left";
_34e.width="16px";
_34e.height="16px";
var _34f=SUtil.createChildElement(_34a,"div",this.errorDiv.id+"detTitle");
_34e=_34f.style;
_34e.cssFloat="left";
_34e.styleFloat="left";
_34e.marginLeft="10px";
_34e.position="relative";
_34f.innerHTML="Details";
var _350=SUtil.createChildElement(_34a,"div",this.errorDiv.id+"detCont");
_34e=_350.style;
_34e.display="none";
_34e.visibility="hidden";
_34e.width="100%";
_34e.height="200px";
_34e.overflow="scroll";
_34e.clear="both";
_34e.position="relative";
_350.innerHTML=this.additionalDetail;
this.collapseListener=SEvent.addListener(_34d,SMouseAdapter.EVENT_MOUSE_CLICK,function(){
var _351=_350.style;
if(_351.visibility=="hidden"){
_34d.src=SUtil.prependImagePath(_34c);
_351.visibility="visible";
_351.display="block";
}else{
_34d.src=SUtil.prependImagePath(_34b);
_351.visibility="hidden";
_351.display="none";
}
});
};
SErrorPanel.prototype.dismiss=function(){
if(!this.dismissed){
this.dismissed=true;
var _352=this.errorDiv;
_352.style.display="none";
_352.style.visibility="hidden";
this.mouseAdapter.removeListeners();
SEvent.removeListener(this.errorCloseListener);
if(this.collapseListener){
SEvent.removeListener(this.collapseListener);
}
try{
this.container.removeChild(_352);
}
catch(e){
}
}
};
SErrorPanel.precacheImages=function(){
SUtil.precacheImage(SUtil.prependImagePath("error_rightarrow.gif"));
SUtil.precacheImage(SUtil.prependImagePath("error_downarrow.gif"));
SUtil.precacheImage(SUtil.prependImagePath("error_cancel.gif"));
};
var SScaleBar=function(map,_354,_355){
this.map=map;
this.measurementSystem=_354||SScaleBar.ENGLISH_SYSTEM;
this.scaleContainer=_355;
this.scaleText=null;
this.init();
};
SScaleBar.ENGLISH_SYSTEM=1;
SScaleBar.METRIC_SYSTEM=2;
SScaleBar.prototype.setMeasurementSystem=function(_356){
this.measurementSystem=_356;
this.drawScale();
};
SScaleBar.prototype.init=function(){
this.currentScaleFactor=0;
this.ppdx=0;
this.scaleChildren=null;
this.mapUpdateListener=SEvent.addListener(this.map,SMap.EVENT_IMAGE_LOADED,SUtil.callback(this,this.onScaleChange));
var _357=!SUtil.isUndefined(this.scaleContainer);
if(!_357){
this.scaleContainer=SUtil.createChildElement(null,"div",this.map.mapDiv.id+"scale");
this.scaleContainer.style.cssFloat="right";
this.scaleLayer=new SLayer(map.mapDiv,this.scaleContainer,SLayer.RIGHT,SLayer.TOP,4,4);
}
var _358=this.scaleContainer.style;
_358.visibility="hidden";
this.scaleText=SUtil.createChildElement(this.scaleContainer,"div","scaleText");
var _359=this.scaleText.style;
if(!_357){
_359.cssFloat="right";
_359.styleFloat="right";
_359.marginLeft="2px";
}
_359.fontFamily="Arial, Helvetica, sans-serif";
_359.fontSize="8pt";
_359.cursor="default";
this.scaleDiv=SUtil.createChildElement(this.scaleContainer,"div","scaleDiv");
if(!_357){
this.scaleDiv.style.cssFloat="right";
this.scaleDiv.style.styleFloat="right";
}
this.scaleBar=SUtil.createChildElement(this.scaleDiv,"div","scaleBar");
var _35a=this.scaleBar.style;
_35a.position="relative";
_35a.top="0px";
_35a.height="2px";
_35a.backgroundColor="black";
_35a.overflow="hidden";
};
SScaleBar.prototype.drawScale=function(){
var _35b=this.scaleContainer.style;
_35b.visibility="hidden";
if(this.currentScaleFactor){
var _35c=this.computeScaleInfo();
var _35d=2;
var _35e=_35c.width;
var _35f=_35c.unitDistance;
var _360=this.map.mvs.width;
if(_35c.width>=_360/2){
_35e=_35c.width/2;
_35f=_35c.unitDistance/2;
}else{
if(_35c.width<_360/8){
_35e=_35d*_35c.width;
_35f=_35d*_35c.unitDistance;
}
}
this.scaleText.innerHTML=_35f+" "+_35c.units;
this.drawTickMarks(_35d,_35e/_35d);
this.scaleBar.style.width=SUtil.pixels(_35e);
_35b.visibility="visible";
}
};
SScaleBar.prototype.drawTickMarks=function(_361,_362){
if(this.scaleChildren){
for(var i=0;i<this.scaleChildren.length;i++){
this.scaleDiv.removeChild(this.scaleChildren[i]);
}
}
this.scaleChildren=new Array();
var _364=null;
var _365=null;
for(var i=0;i<_361+1;i++){
_364=SUtil.createChildElement(this.scaleDiv,"div",this.scaleDiv.id+"_"+i);
_365=_364.style;
_365.position="relative";
_365.left=SUtil.pixels(i*_362-i);
_365.top=SUtil.pixels(-i*8);
_365.width="2px";
_365.height="8px";
_365.backgroundColor="black";
_365.overflow="hidden";
_365.zIndex=1;
this.scaleChildren.push(_364);
}
};
SScaleBar.prototype.computeScaleInfo=function(){
var _366=this.currentScaleFactor;
var _367={width:0,unitDistance:0,units:""};
var _368;
if(this.measurementSystem==SScaleBar.ENGLISH_SYSTEM){
if(_366>=5280*12){
_367.units="mi";
_368=_366/(5280*12);
}else{
if(_366>=12*3){
_367.units="yd";
_368=_366/(12*3);
}else{
if(_366>=12){
_367.units="ft";
_368=_366/12;
}else{
_367.units="in";
_368=_366;
}
}
}
}else{
if(_366>=1000){
_367.units="km";
_368=_366/(1000*39.3700787);
}else{
_367.units="m";
_368=_366/39.3700787;
}
}
var _369=SScaleBar.computeOrderOfMagnitude(_368);
_367.unitDistance=Math.pow(10,_369);
var _36a=this.inverseHaversine(_367.unitDistance,_367.units);
_367.width=this.ppdx*_36a;
return _367;
};
SScaleBar.prototype.inverseHaversine=function(_36b,_36c){
var latr=parseFloat(this.map.mvs.centerLatY)*SMap.DEGREES_TO_RADIANS;
var dr=_36b/SScaleBar.getEarthRadius(_36c,this.measurementSystem);
var x=Math.sin(dr/2)/Math.cos(latr);
var _370;
if(x<1){
_370=2*Math.asin(x);
}else{
_370=Math.PI/2;
}
return _370/SMap.DEGREES_TO_RADIANS;
};
SScaleBar.prototype.onScaleChange=function(){
this.currentScaleFactor=this.map.getScaleFactor();
this.ppdx=parseFloat(map.mvs.ppdx);
this.drawScale();
};
SScaleBar.computeOrderOfMagnitude=function(_371){
if(!_371){
return 0;
}
return Math.round(Math.log(_371)/Math.LN10);
};
SScaleBar.getEarthRadius=function(_372,_373){
if(SScaleBar.ENGLISH_SYSTEM==_373){
var _374=3959.871;
if(_372=="in"){
return _374*5280*12;
}else{
if(_372=="ft"){
return _374*5280;
}else{
if(_372=="yd"){
return _374*1760;
}else{
return _374;
}
}
}
}else{
var _375=6372.795477598;
if(_372=="m"){
return _375*1000;
}else{
return _375;
}
}
};

var WMT_IMAGE_PATH = 'http://demo.objectfx.com/wmt-ext/images/';
SMap.defaultWebMapUrl = 'http://demo.objectfx.com/wmt-ext/servlet/ajaxWebMap;jsessionid=5C4EC6522CB920E94242BDDF935FE37D';
SMap.operations = {'wmt.cs':true,'setModes':true,'wmt.rz':true,'clearDhsSymbols':true,'wmt.spt':true,'wmt.pp':true,'modifyLegend':true,'getLegend':false,'wmt.slc':true,'wmt.zi':true,'wmt.pl':true,'fitToView':true,'wmt.rf':true,'wmt.ld':true,'wmt.zip':true,'wmt.pd':true,'addTransientRaster':true,'createDhsSymbol':true,'selectInRect':true,'loadDhsFont':true,'wmt.zo':true,'wmt.rlc':true,'wmt.tt':false,'wmt.ffpt':false,'wmt.zop':true,'wmt.fpt':false,'wmt.sc':true};