var xOp7Up,xOp6Dn,xIE4Up,xIE4,xIE5,xNN4,xUA=navigator.userAgent.toLowerCase();if(window.opera){var i=xUA.indexOf('opera');if(i!=-1){var v=parseInt(xUA.charAt(i+6));xOp7Up=v>=7;xOp6Dn=v<7}}else if(navigator.vendor!='KDE'&&document.all&&xUA.indexOf('msie')!=-1){xIE4Up=parseFloat(navigator.appVersion)>=4;xIE4=xUA.indexOf('msie 4')!=-1;xIE5=xUA.indexOf('msie 5')!=-1}else if(document.layers){xNN4=true};xMac=xUA.indexOf('mac')!=-1;function xAddEventListener(e,eT,eL,cap){if(!(e=xGetElementById(e)))return;eT=eT.toLowerCase();if((!xIE4Up&&!xOp7Up)&&e==window){if(eT=='resize'){window.xPCW=xClientWidth();window.xPCH=xClientHeight();window.xREL=eL;xResizeEvent();return};if(eT=='scroll'){window.xPSL=xScrollLeft();window.xPST=xScrollTop();window.xSEL=eL;xScrollEvent();return}};var eh='e.on'+eT+'=eL';if(e.addEventListener)e.addEventListener(eT,eL,cap);else if(e.attachEvent)e.attachEvent('on'+eT,eL);else eval(eh)};function xResizeEvent(){if(window.xREL)setTimeout('xResizeEvent()',250);var cw=xClientWidth(),ch=xClientHeight();if(window.xPCW!=cw||window.xPCH!=ch){window.xPCW=cw;window.xPCH=ch;if(window.xREL)window.xREL()}};function xScrollEvent(){if(window.xSEL)setTimeout('xScrollEvent()',250);var sl=xScrollLeft(),st=xScrollTop();if(window.xPSL!=sl||window.xPST!=st){window.xPSL=sl;window.xPST=st;if(window.xSEL)window.xSEL()}};function xAppendChild(oParent,oChild){if(oParent.appendChild)return oParent.appendChild(oChild);else return null};function xClientHeight(){var h=0;if(xOp6Dn)h=window.innerHeight;else if(document.compatMode=='CSS1Compat'&&!window.opera&&document.documentElement&&document.documentElement.clientHeight)h=document.documentElement.clientHeight;else if(document.body&&document.body.clientHeight)h=document.body.clientHeight;else if(xDef(window.innerWidth,window.innerHeight,document.width)){h=window.innerHeight;if(document.width>window.innerWidth)h-=16};if((h<20)&&(xDef(window.innerHeight)))h=window.innerHeight;return h};function xClientWidth(){var w=0;if(xOp6Dn)w=window.innerWidth;else if(document.compatMode=='CSS1Compat'&&!window.opera&&document.documentElement&&document.documentElement.clientWidth)w=document.documentElement.clientWidth;else if(document.body&&document.body.clientWidth)w=document.body.clientWidth;else if(xDef(window.innerWidth,window.innerHeight,document.height)){w=window.innerWidth;if(document.height>window.innerHeight)w-=16};return w};function xClip(e,t,r,b,l){if(!(e=xGetElementById(e)))return;if(e.style){if(xNum(l))e.style.clip='rect('+t+'px '+r+'px '+b+'px '+l+'px)';else e.style.clip='rect(0 '+parseInt(e.style.width)+'px '+parseInt(e.style.height)+'px 0)'}};function xDef(){for(var i=0;i<arguments.length;++i){if(typeof(arguments[i])=='undefined')return false}return true};function xDeg(rad){return rad*(180/Math.PI)};function xDeleteCookie(name,path){if(xGetCookie(name)){document.cookie=name+"="+"; path="+((!path)?"/":path)+"; expires="+new Date(0).toGMTString()}};function xDisableDrag(id,last){if(!window._xDrgMgr)return;var ele=xGetElementById(id);ele.xDraggable=false;ele.xODS=null;ele.xOD=null;ele.xODE=null;xRemoveEventListener(ele,'mousedown',_xOMD,false);if(_xDrgMgr.mm&&last){_xDrgMgr.mm=false;xRemoveEventListener(document,'mousemove',_xOMM,false)}};function xDisplay(e,s){if(!(e=xGetElementById(e)))return null;if(e.style&&xDef(e.style.display)){if(xStr(s))e.style.display=s;return e.style.display};return null};var _xDrgMgr={ele:null,mm:false};function xEnableDrag(id,fS,fD,fE){var ele=xGetElementById(id);ele.xDraggable=true;ele.xODS=fS;ele.xOD=fD;ele.xODE=fE;xAddEventListener(ele,'mousedown',_xOMD,false);if(!_xDrgMgr.mm){_xDrgMgr.mm=true;xAddEventListener(document,'mousemove',_xOMM,false)}};function _xOMD(e){var evt=new xEvent(e);var ele=evt.target;while(ele&&!ele.xDraggable){ele=xParent(ele)};if(ele){xPreventDefault(e);ele.xDPX=evt.pageX;ele.xDPY=evt.pageY;_xDrgMgr.ele=ele;xAddEventListener(document,'mouseup',_xOMU,false);if(ele.xODS){ele.xODS(ele,evt.pageX,evt.pageY)}}};function _xOMM(e){var evt=new xEvent(e);if(_xDrgMgr.ele){xPreventDefault(e);var ele=_xDrgMgr.ele;var dx=evt.pageX-ele.xDPX;var dy=evt.pageY-ele.xDPY;ele.xDPX=evt.pageX;ele.xDPY=evt.pageY;if(ele.xOD){ele.xOD(ele,dx,dy)}else{xMoveTo(ele,xLeft(ele)+dx,xTop(ele)+dy)}}};function _xOMU(e){if(_xDrgMgr.ele){xPreventDefault(e);xRemoveEventListener(document,'mouseup',_xOMU,false);if(_xDrgMgr.ele.xODE){var evt=new xEvent(e);_xDrgMgr.ele.xODE(_xDrgMgr.ele,evt.pageX,evt.pageY)};_xDrgMgr.ele=null}};function xEvent(evt){var e=evt||window.event;if(!e)return;if(e.type)this.type=e.type;if(e.target)this.target=e.target;else if(e.srcElement)this.target=e.srcElement;if(e.relatedTarget)this.relatedTarget=e.relatedTarget;else if(e.type=='mouseover'&&e.fromElement)this.relatedTarget=e.fromElement;else if(e.type=='mouseout')this.relatedTarget=e.toElement;if(xOp6Dn){this.pageX=e.clientX;this.pageY=e.clientY}else if(xDef(e.pageX,e.pageY)){this.pageX=e.pageX;this.pageY=e.pageY}else if(xDef(e.clientX,e.clientY)){this.pageX=e.clientX+xScrollLeft();this.pageY=e.clientY+xScrollTop()}if(xDef(e.offsetX,e.offsetY)){this.offsetX=e.offsetX;this.offsetY=e.offsetY}else if(xDef(e.layerX,e.layerY)){this.offsetX=e.layerX;this.offsetY=e.layerY}else{this.offsetX=this.pageX-xPageX(this.target);this.offsetY=this.pageY-xPageY(this.target)};if(e.keyCode){this.keyCode=e.keyCode}else if(xDef(e.which)&&e.type.indexOf('key')!=-1){this.keyCode=e.which};this.shiftKey=e.shiftKey;this.ctrlKey=e.ctrlKey;this.altKey=e.altKey};function xFirstChild(e,t){var c=e?e.firstChild:null;if(t)while(c&&c.nodeName!=t){c=c.nextSibling}else while(c&&c.nodeType!=1){c=c.nextSibling};return c};function xGetComputedStyle(oEle,sProp,bInt){var s,p='undefined';var dv=document.defaultView;if(dv&&dv.getComputedStyle){s=dv.getComputedStyle(oEle,'');if(s)p=s.getPropertyValue(sProp)}else if(oEle.currentStyle){var a=sProp.split('-');sProp=a[0];for(var i=1;i<a.length;++i){c=a[i].charAt(0);sProp+=a[i].replace(c,c.toUpperCase())};p=oEle.currentStyle[sProp]}else return null;return bInt?(parseInt(p)||0):p};function xGetCookie(name){var value=null,search=name+"=";if(document.cookie.length>0){var offset=document.cookie.indexOf(search);if(offset!=-1){offset+=search.length;var end=document.cookie.indexOf(";",offset);if(end==-1)end=document.cookie.length;value=unescape(document.cookie.substring(offset,end))}};return value};function xGetElementById(e){if(typeof(e)!='string')return e;if(document.getElementById)e=document.getElementById(e);else if(document.all)e=document.all[e];else e=null;return e}function xGetURLArguments(){var idx=location.href.indexOf('?');var params=new Array();if(idx!=-1){var pairs=location.href.substring(idx+1,location.href.length).split('&');for(var i=0;i<pairs.length;i++){nameVal=pairs[i].split('=');params[i]=nameVal[1];params[nameVal[0]]=nameVal[1]}};return params};function xHasPoint(e,x,y,t,r,b,l){if(!xNum(t)){t=r=b=l=0}else if(!xNum(r)){r=b=l=t}else if(!xNum(b)){l=r;b=t};var eX=xPageX(e),eY=xPageY(e);return(x>=eX+l&&x<=eX+xWidth(e)-r&&y>=eY+t&&y<=eY+xHeight(e)-b)};function xHeight(e,h){if(!(e=xGetElementById(e)))return 0;if(xNum(h)){if(h<0)h=0;else h=Math.round(h)}else h=-1;var css=xDef(e.style);if(e==document||e.tagName.toLowerCase()=='html'||e.tagName.toLowerCase()=='body'){h=xClientHeight()}else if(css&&xDef(e.offsetHeight)&&xStr(e.style.height)){if(h>=0){var pt=0,pb=0,bt=0,bb=0;if(document.compatMode=='CSS1Compat'){var gcs=xGetComputedStyle;pt=gcs(e,'padding-top',1);if(pt!==null){pb=gcs(e,'padding-bottom',1);bt=gcs(e,'border-top-width',1);bb=gcs(e,'border-bottom-width',1)}else if(xDef(e.offsetHeight,e.style.height)){e.style.height=h+'px';pt=e.offsetHeight-h}};h-=(pt+pb+bt+bb);if(isNaN(h)||h<0)return;else e.style.height=h+'px'};h=e.offsetHeight}else if(css&&xDef(e.style.pixelHeight)){if(h>=0)e.style.pixelHeight=h;h=e.style.pixelHeight};return h};function xHex(n,digits,prefix){var p='',n=Math.ceil(n);if(prefix)p=prefix;n=n.toString(16);for(var i=0;i<digits-n.length;++i){p+='0'};return p+n};function xHide(e){return xVisibility(e,0)};function xIntersection(e1,e2,o){var ix1,iy2,iw,ih,intersect=true;var e1x1=xPageX(e1);var e1x2=e1x1+xWidth(e1);var e1y1=xPageY(e1);var e1y2=e1y1+xHeight(e1);var e2x1=xPageX(e2);var e2x2=e2x1+xWidth(e2);var e2y1=xPageY(e2);var e2y2=e2y1+xHeight(e2);if(e1x1<=e2x1){ix1=e2x1;if(e1x2<e2x1)intersect=false;else iw=Math.min(e1x2,e2x2)-e2x1}else{ix1=e1x1;if(e2x2<e1x1)intersect=false;else iw=Math.min(e1x2,e2x2)-e1x1};if(e1y2>=e2y2){iy2=e2y2;if(e1y1>e2y2)intersect=false;else ih=e2y2-Math.max(e1y1,e2y1)}else{iy2=e1y2;if(e2y1>e1y2)intersect=false;else ih=e1y2-Math.max(e1y1,e2y1)};if(intersect&&typeof(o)=='object'){o.x=ix1;o.y=iy2-ih;o.w=iw;o.h=ih};return intersect};function xLeft(e,iX){if(!(e=xGetElementById(e)))return 0;var css=xDef(e.style);if(css&&xStr(e.style.left)){if(xNum(iX))e.style.left=iX+'px';else{iX=parseInt(e.style.left);if(isNaN(iX))iX=0}}else if(css&&xDef(e.style.pixelLeft)){if(xNum(iX))e.style.pixelLeft=iX;else iX=e.style.pixelLeft};return iX};function xMoveTo(e,x,y){xLeft(e,x);xTop(e,y)};function xName(e){if(!e)return e;else if(e.id&&e.id!="")return e.id;else if(e.name&&e.name!="")return e.name;else if(e.nodeName&&e.nodeName!="")return e.nodeName;else if(e.tagName&&e.tagName!="")return e.tagName;else return e};function xNextSib(e,t){var s=e?e.nextSibling:null;if(t)while(s&&s.nodeName!=t){s=s.nextSibling}else while(s&&s.nodeType!=1){s=s.nextSibling};return s};function xNum(){for(var i=0;i<arguments.length;++i){if(isNaN(arguments[i])||typeof(arguments[i])!='number')return false};return true};function xOffsetLeft(e){if(!(e=xGetElementById(e)))return 0;if(xDef(e.offsetLeft))return e.offsetLeft;else return 0};function xOffsetTop(e){if(!(e=xGetElementById(e)))return 0;if(xDef(e.offsetTop))return e.offsetTop;else return 0};function xPad(s,len,c,left){if(typeof s!='string')s=s+'';if(left){for(var i=s.length;i<len;++i)s=c+s}else{for(var i=s.length;i<len;++i)s+=c};return s};function xPageX(e){if(!(e=xGetElementById(e)))return 0;var x=0;while(e){if(xDef(e.offsetLeft))x+=e.offsetLeft;e=xDef(e.offsetParent)?e.offsetParent:null};return x};function xPageY(e){if(!(e=xGetElementById(e)))return 0;var y=0;while(e){if(xDef(e.offsetTop))y+=e.offsetTop;e=xDef(e.offsetParent)?e.offsetParent:null};return y};function xParent(e,bNode){if(!(e=xGetElementById(e)))return null;var p=null;if(!bNode&&xDef(e.offsetParent))p=e.offsetParent;else if(xDef(e.parentNode))p=e.parentNode;else if(xDef(e.parentElement))p=e.parentElement;return p};function xParentChain(e,delim,bNode){if(!(e=xGetElementById(e)))return;var lim=100,s="",d=delim||"\n";while(e){s+=xName(e)+', ofsL:'+e.offsetLeft+', ofsT:'+e.offsetTop+d;e=xParent(e,bNode);if(!lim--)break};return s};function xPreventDefault(e){if(e&&e.preventDefault)e.preventDefault();else if(window.event)window.event.returnValue=false};function xPrevSib(e,t){var s=e?e.previousSibling:null;if(t){while(s&&s.nodeName!=t){s=s.previousSibling}}else{while(s&&s.nodeType!=1){s=s.previousSibling}};return s};function xRad(deg){return deg*(Math.PI/180)};function xRemoveEventListener(e,eT,eL,cap){if(!(e=xGetElementById(e)))return;eT=eT.toLowerCase();if((!xIE4Up&&!xOp7Up)&&e==window){if(eT=='resize'){window.xREL=null;return}if(eT=='scroll'){window.xSEL=null;return}};var eh='e.on'+eT+'=null';if(e.removeEventListener)e.removeEventListener(eT,eL,cap);else if(e.detachEvent)e.detachEvent('on'+eT,eL);else eval(eh)};function xResizeTo(e,w,h){xWidth(e,w);xHeight(e,h)};function xScrollLeft(e,bWin){var offset=0;if(!xDef(e)||bWin||e==document||e.tagName.toLowerCase()=='html'||e.tagName.toLowerCase()=='body'){var w=window;if(bWin&&e)w=e;if(w.document.documentElement&&w.document.documentElement.scrollLeft)offset=w.document.documentElement.scrollLeft;else if(w.document.body&&xDef(w.document.body.scrollLeft))offset=w.document.body.scrollLeft}else{e=xGetElementById(e);if(e&&xNum(e.scrollLeft))offset=e.scrollLeft};return offset};function xScrollTop(e,bWin){var offset=0;if(!xDef(e)||bWin||e==document||e.tagName.toLowerCase()=='html'||e.tagName.toLowerCase()=='body'){var w=window;if(bWin&&e)w=e;if(w.document.documentElement&&w.document.documentElement.scrollTop)offset=w.document.documentElement.scrollTop;else if(w.document.body&&xDef(w.document.body.scrollTop))offset=w.document.body.scrollTop}else{e=xGetElementById(e);if(e&&xNum(e.scrollTop))offset=e.scrollTop};return offset};function xSetCookie(name,value,expire,path){document.cookie=name+"="+escape(value)+((!expire)?"":("; expires="+expire.toGMTString()))+"; path="+((!path)?"/":path)};function xSetIETitle(){if(xIE4Up){var i=xUA.indexOf('msie')+1;var v=xUA.substr(i+4,3);document.title='IE '+v+' - '+document.title}};function xShow(e){return xVisibility(e,1)};function xStopPropagation(evt){if(evt&&evt.stopPropagation)evt.stopPropagation();else if(window.event)window.event.cancelBubble=true};function xStr(s){for(var i=0;i<arguments.length;++i){if(typeof(arguments[i])!='string')return false}return true};function xTableCellVisibility(bShow,sec,nRow,nCol){sec=xGetElementById(sec);if(sec&&nRow<sec.rows.length&&nCol<sec.rows[nRow].cells.length){sec.rows[nRow].cells[nCol].style.visibility=bShow?'visible':'hidden'}};function xTop(e,iY){if(!(e=xGetElementById(e)))return 0;var css=xDef(e.style);if(css&&xStr(e.style.top)){if(xNum(iY))e.style.top=iY+'px';else{iY=parseInt(e.style.top);if(isNaN(iY))iY=0}}else if(css&&xDef(e.style.pixelTop)){if(xNum(iY))e.style.pixelTop=iY;else iY=e.style.pixelTop};return iY};var xVersion="4.0";function xVisibility(e,bShow){if(!(e=xGetElementById(e)))return null;if(e.style&&xDef(e.style.visibility)){if(xDef(bShow))e.style.visibility=bShow?'visible':'hidden';return e.style.visibility};return null};function xWalkEleTree(n,f,d,l,b){if(typeof l=='undefined')l=0;if(typeof b=='undefined')b=0;var v=f(n,l,b,d);if(!v)return 0;if(v==1){for(var c=n.firstChild;c;c=c.nextSibling){if(c.nodeType==1){if(!l)++b;if(!xWalkEleTree(c,f,d,l+1,b))return 0}}};return 1};function xWalkTree(n,f){f(n);for(var c=n.firstChild;c;c=c.nextSibling){if(c.nodeType==1)xWalkTree(c,f)}};function xWidth(e,w){if(!(e=xGetElementById(e)))return 0;if(xNum(w)){if(w<0)w=0;else w=Math.round(w)}else w=-1;var css=xDef(e.style);if(e==document||e.tagName.toLowerCase()=='html'||e.tagName.toLowerCase()=='body'){w=xClientWidth()}else if(css&&xDef(e.offsetWidth)&&xStr(e.style.width)){if(w>=0){var pl=0,pr=0,bl=0,br=0;if(document.compatMode=='CSS1Compat'){var gcs=xGetComputedStyle;pl=gcs(e,'padding-left',1);if(pl!==null){pr=gcs(e,'padding-right',1);bl=gcs(e,'border-left-width',1);br=gcs(e,'border-right-width',1)}else if(xDef(e.offsetWidth,e.style.width)){e.style.width=w+'px';pl=e.offsetWidth-w}};w-=(pl+pr+bl+br);if(isNaN(w)||w<0)return;else e.style.width=w+'px'};w=e.offsetWidth}else if(css&&xDef(e.style.pixelWidth)){if(w>=0)e.style.pixelWidth=w;w=e.style.pixelWidth};return w};function xZIndex(e,uZ){if(!(e=xGetElementById(e)))return 0;if(e.style&&xDef(e.style.zIndex)){if(xNum(uZ))e.style.zIndex=uZ;uZ=parseInt(e.style.zIndex)};return uZ};
var jg_ihtm,jg_ie,jg_fast,jg_dom,jg_moz,jg_n4=(document.layers&&typeof document.classes!="undefined");function chkDHTM(x,i){x=document.body||null;jg_ie=x&&typeof x.insertAdjacentHTML!="undefined";jg_dom=(x&&!jg_ie&&typeof x.appendChild!="undefined"&&typeof document.createRange!="undefined"&&typeof(i=document.createRange()).setStartBefore!="undefined"&&typeof i.createContextualFragment!="undefined");jg_ihtm=!jg_ie&&!jg_dom&&x&&typeof x.innerHTML!="undefined";jg_fast=jg_ie&&document.all&&!window.opera;jg_moz=jg_dom&&typeof x.style.MozOpacity!="undefined"};function pntDoc(){this.wnd.document.write(jg_fast?this.htmRpc():this.htm);this.htm=''};function pntCnvDom(){var x=document.createRange();x.setStartBefore(this.cnv);x=x.createContextualFragment(jg_fast?this.htmRpc():this.htm);if(this.cnv)this.cnv.appendChild(x);this.htm=''};function pntCnvIe(){if(this.cnv)this.cnv.insertAdjacentHTML("BeforeEnd",jg_fast?this.htmRpc():this.htm);this.htm=''};function pntCnvIhtm(){if(this.cnv)this.cnv.innerHTML+=this.htm;this.htm=''};function pntCnv(){this.htm=''};function mkDiv(x,y,w,h){this.htm+='<div style="position:absolute;'+'left:'+x+'px;'+'top:'+y+'px;'+'width:'+w+'px;'+'height:'+h+'px;'+'clip:rect(0,'+w+'px,'+h+'px,0);'+'background-color:'+this.color+(!jg_moz?';overflow:hidden':'')+';"><\/div>'};function mkDivIe(x,y,w,h){this.htm+='%%'+this.color+';'+x+';'+y+';'+w+';'+h+';'};function mkDivPrt(x,y,w,h){this.htm+='<div style="position:absolute;'+'border-left:'+w+'px solid '+this.color+';'+'left:'+x+'px;'+'top:'+y+'px;'+'width:0px;'+'height:'+h+'px;'+'clip:rect(0,'+w+'px,'+h+'px,0);'+'background-color:'+this.color+(!jg_moz?';overflow:hidden':'')+';"><\/div>'};function mkLyr(x,y,w,h){this.htm+='<layer '+'left="'+x+'" '+'top="'+y+'" '+'width="'+w+'" '+'height="'+h+'" '+'bgcolor="'+this.color+'"><\/layer>\n'};var regex=/%%([^;]+);([^;]+);([^;]+);([^;]+);([^;]+);/g;function htmRpc(){return this.htm.replace(regex,'<div style="overflow:hidden;position:absolute;background-color:'+'$1;left:$2;top:$3;width:$4;height:$5"></div>\n')};function htmPrtRpc(){return this.htm.replace(regex,'<div style="overflow:hidden;position:absolute;background-color:'+'$1;left:$2;top:$3;width:$4;height:$5;border-left:$4px solid $1"></div>\n')};function mkLin(x1,y1,x2,y2){if(x1>x2){var _x2=x2;var _y2=y2;x2=x1;y2=y1;x1=_x2;y1=_y2};var dx=x2-x1,dy=Math.abs(y2-y1),x=x1,y=y1,yIncr=(y1>y2)?-1:1;if(dx>=dy){var pr=dy<<1,pru=pr-(dx<<1),p=pr-dx,ox=x;while((dx--)>0){++x;if(p>0){this.mkDiv(ox,y,x-ox,1);y+=yIncr;p+=pru;ox=x}else p+=pr};this.mkDiv(ox,y,x2-ox+1,1)}else{var pr=dx<<1,pru=pr-(dy<<1),p=pr-dy,oy=y;if(y2<=y1){while((dy--)>0){if(p>0){this.mkDiv(x++,y,1,oy-y+1);y+=yIncr;p+=pru;oy=y}else{y+=yIncr;p+=pr}};this.mkDiv(x2,y2,1,oy-y2+1)}else{while((dy--)>0){y+=yIncr;if(p>0){this.mkDiv(x++,oy,1,y-oy);p+=pru;oy=y}else p+=pr};this.mkDiv(x2,oy,1,y2-oy+1)}}};function mkLin2D(x1,y1,x2,y2){if(x1>x2){var _x2=x2;var _y2=y2;x2=x1;y2=y1;x1=_x2;y1=_y2};var dx=x2-x1,dy=Math.abs(y2-y1),x=x1,y=y1,yIncr=(y1>y2)?-1:1;var s=this.stroke;if(dx>=dy){if(dx>0&&s-3>0){var _s=(s*dx*Math.sqrt(1+dy*dy/(dx*dx))-dx-(s>>1)*dy)/dx;_s=(!(s-4)?Math.ceil(_s):Math.round(_s))+1}else var _s=s;var ad=Math.ceil(s/2);var pr=dy<<1,pru=pr-(dx<<1),p=pr-dx,ox=x;while((dx--)>0){++x;if(p>0){this.mkDiv(ox,y,x-ox+ad,_s);y+=yIncr;p+=pru;ox=x}else p+=pr};this.mkDiv(ox,y,x2-ox+ad+1,_s)}else{if(s-3>0){var _s=(s*dy*Math.sqrt(1+dx*dx/(dy*dy))-(s>>1)*dx-dy)/dy;_s=(!(s-4)?Math.ceil(_s):Math.round(_s))+1}else var _s=s;var ad=Math.round(s/2);var pr=dx<<1,pru=pr-(dy<<1),p=pr-dy,oy=y;if(y2<=y1){++ad;while((dy--)>0){if(p>0){this.mkDiv(x++,y,_s,oy-y+ad);y+=yIncr;p+=pru;oy=y}else{y+=yIncr;p+=pr}};this.mkDiv(x2,y2,_s,oy-y2+ad)}else{while((dy--)>0){y+=yIncr;if(p>0){this.mkDiv(x++,oy,_s,y-oy+ad);p+=pru;oy=y}else p+=pr};this.mkDiv(x2,oy,_s,y2-oy+ad+1)}}};function mkLinDott(x1,y1,x2,y2){if(x1>x2){var _x2=x2;var _y2=y2;x2=x1;y2=y1;x1=_x2;y1=_y2};var dx=x2-x1,dy=Math.abs(y2-y1),x=x1,y=y1,yIncr=(y1>y2)?-1:1,drw=true;if(dx>=dy){var pr=dy<<1,pru=pr-(dx<<1),p=pr-dx;while((dx--)>0){if(drw)this.mkDiv(x,y,1,1);drw=!drw;if(p>0){y+=yIncr;p+=pru}else p+=pr;++x};if(drw)this.mkDiv(x,y,1,1)}else{var pr=dx<<1,pru=pr-(dy<<1),p=pr-dy;while((dy--)>0){if(drw)this.mkDiv(x,y,1,1);drw=!drw;y+=yIncr;if(p>0){++x;p+=pru}else p+=pr};if(drw)this.mkDiv(x,y,1,1)}};function mkOv(left,top,width,height){var a=width>>1,b=height>>1,wod=width&1,hod=(height&1)+1,cx=left+a,cy=top+b,x=0,y=b,ox=0,oy=b,aa=(a*a)<<1,bb=(b*b)<<1,st=(aa>>1)*(1-(b<<1))+bb,tt=(bb>>1)-aa*((b<<1)-1),w,h;while(y>0){if(st<0){st+=bb*((x<<1)+3);tt+=(bb<<1)*(++x)}else if(tt<0){st+=bb*((x<<1)+3)-(aa<<1)*(y-1);tt+=(bb<<1)*(++x)-aa*(((y--)<<1)-3);w=x-ox;h=oy-y;if(w&2&&h&2){this.mkOvQds(cx,cy,-x+2,ox+wod,-oy,oy-1+hod,1,1);this.mkOvQds(cx,cy,-x+1,x-1+wod,-y-1,y+hod,1,1)}else this.mkOvQds(cx,cy,-x+1,ox+wod,-oy,oy-h+hod,w,h);ox=x;oy=y}else{tt-=aa*((y<<1)-3);st-=(aa<<1)*(--y)}};this.mkDiv(cx-a,cy-oy,a-ox+1,(oy<<1)+hod);this.mkDiv(cx+ox+wod,cy-oy,a-ox+1,(oy<<1)+hod)};function mkOv2D(left,top,width,height){var s=this.stroke;width+=s-1;height+=s-1;var a=width>>1,b=height>>1,wod=width&1,hod=(height&1)+1,cx=left+a,cy=top+b,x=0,y=b,aa=(a*a)<<1,bb=(b*b)<<1,st=(aa>>1)*(1-(b<<1))+bb,tt=(bb>>1)-aa*((b<<1)-1);if(s-4<0&&(!(s-2)||width-51>0&&height-51>0)){var ox=0,oy=b,w,h,pxl,pxr,pxt,pxb,pxw;while(y>0){if(st<0){st+=bb*((x<<1)+3);tt+=(bb<<1)*(++x)}else if(tt<0){st+=bb*((x<<1)+3)-(aa<<1)*(y-1);tt+=(bb<<1)*(++x)-aa*(((y--)<<1)-3);w=x-ox;h=oy-y;if(w-1){pxw=w+1+(s&1);h=s}else if(h-1){pxw=s;h+=1+(s&1)}else pxw=h=s;this.mkOvQds(cx,cy,-x+1,ox-pxw+w+wod,-oy,-h+oy+hod,pxw,h);ox=x;oy=y}else{tt-=aa*((y<<1)-3);st-=(aa<<1)*(--y)}};this.mkDiv(cx-a,cy-oy,s,(oy<<1)+hod);this.mkDiv(cx+a+wod-s+1,cy-oy,s,(oy<<1)+hod)}else{var _a=(width-((s-1)<<1))>>1,_b=(height-((s-1)<<1))>>1,_x=0,_y=_b,_aa=(_a*_a)<<1,_bb=(_b*_b)<<1,_st=(_aa>>1)*(1-(_b<<1))+_bb,_tt=(_bb>>1)-_aa*((_b<<1)-1),pxl=new Array(),pxt=new Array(),_pxb=new Array();pxl[0]=0;pxt[0]=b;_pxb[0]=_b-1;while(y>0){if(st<0){st+=bb*((x<<1)+3);tt+=(bb<<1)*(++x);pxl[pxl.length]=x;pxt[pxt.length]=y}else if(tt<0){st+=bb*((x<<1)+3)-(aa<<1)*(y-1);tt+=(bb<<1)*(++x)-aa*(((y--)<<1)-3);pxl[pxl.length]=x;pxt[pxt.length]=y}else{tt-=aa*((y<<1)-3);st-=(aa<<1)*(--y)};if(_y>0){if(_st<0){_st+=_bb*((_x<<1)+3);_tt+=(_bb<<1)*(++_x);_pxb[_pxb.length]=_y-1}else if(_tt<0){_st+=_bb*((_x<<1)+3)-(_aa<<1)*(_y-1);_tt+=(_bb<<1)*(++_x)-_aa*(((_y--)<<1)-3);_pxb[_pxb.length]=_y-1}else{_tt-=_aa*((_y<<1)-3);_st-=(_aa<<1)*(--_y);_pxb[_pxb.length-1]--}}};var ox=0,oy=b,_oy=_pxb[0],l=pxl.length,w,h;for(var i=0;i<l;i++){if(typeof _pxb[i]!="undefined"){if(_pxb[i]<_oy||pxt[i]<oy){x=pxl[i];this.mkOvQds(cx,cy,-x+1,ox+wod,-oy,_oy+hod,x-ox,oy-_oy);ox=x;oy=pxt[i];_oy=_pxb[i]}}else{x=pxl[i];this.mkDiv(cx-x+1,cy-oy,1,(oy<<1)+hod);this.mkDiv(cx+ox+wod,cy-oy,1,(oy<<1)+hod);ox=x;oy=pxt[i]}};this.mkDiv(cx-a,cy-oy,1,(oy<<1)+hod);this.mkDiv(cx+ox+wod,cy-oy,1,(oy<<1)+hod)}};function mkOvDott(left,top,width,height){var a=width>>1,b=height>>1,wod=width&1,hod=height&1,cx=left+a,cy=top+b,x=0,y=b,aa2=(a*a)<<1,aa4=aa2<<1,bb=(b*b)<<1,st=(aa2>>1)*(1-(b<<1))+bb,tt=(bb>>1)-aa2*((b<<1)-1),drw=true;while(y>0){if(st<0){st+=bb*((x<<1)+3);tt+=(bb<<1)*(++x)}else if(tt<0){st+=bb*((x<<1)+3)-aa4*(y-1);tt+=(bb<<1)*(++x)-aa2*(((y--)<<1)-3)}else{tt-=aa2*((y<<1)-3);st-=aa4*(--y)};if(drw)this.mkOvQds(cx,cy,-x,x+wod,-y,y+hod,1,1);drw=!drw}};function mkRect(x,y,w,h){var s=this.stroke;this.mkDiv(x,y,w,s);this.mkDiv(x+w,y,s,h);this.mkDiv(x,y+h,w+s,s);this.mkDiv(x,y+s,s,h-s)};function mkRectDott(x,y,w,h){this.drawLine(x,y,x+w,y);this.drawLine(x+w,y,x+w,y+h);this.drawLine(x,y+h,x+w,y+h);this.drawLine(x,y,x,y+h)};function jsgFont(){this.PLAIN='font-weight:normal;';this.BOLD='font-weight:bold;';this.ITALIC='font-style:italic;';this.ITALIC_BOLD=this.ITALIC+this.BOLD;this.BOLD_ITALIC=this.ITALIC_BOLD};var Font=new jsgFont();function jsgStroke(){this.DOTTED=-1};var Stroke=new jsgStroke();function jsGraphics(id,wnd){this.setColor=new Function('arg','this.color = arg.toLowerCase();');this.setStroke=function(x){this.stroke=x;if(!(x+1)){this.drawLine=mkLinDott;this.mkOv=mkOvDott;this.drawRect=mkRectDott}else if(x-1>0){this.drawLine=mkLin2D;this.mkOv=mkOv2D;this.drawRect=mkRect}else{this.drawLine=mkLin;this.mkOv=mkOv;this.drawRect=mkRect}};this.setPrintable=function(arg){this.printable=arg;if(jg_fast){this.mkDiv=mkDivIe;this.htmRpc=arg?htmPrtRpc:htmRpc}else this.mkDiv=jg_n4?mkLyr:arg?mkDivPrt:mkDiv};this.setFont=function(fam,sz,sty){this.ftFam=fam;this.ftSz=sz;this.ftSty=sty||Font.PLAIN};this.drawPolyline=this.drawPolyLine=function(x,y,s){for(var i=0;i<x.length-1;i++)this.drawLine(x[i],y[i],x[i+1],y[i+1])};this.fillRect=function(x,y,w,h){this.mkDiv(x,y,w,h)};this.drawPolygon=function(x,y){this.drawPolyline(x,y);this.drawLine(x[x.length-1],y[x.length-1],x[0],y[0])};this.drawEllipse=this.drawOval=function(x,y,w,h){this.mkOv(x,y,w,h)};this.fillEllipse=this.fillOval=function(left,top,w,h){var a=(w-=1)>>1,b=(h-=1)>>1,wod=(w&1)+1,hod=(h&1)+1,cx=left+a,cy=top+b,x=0,y=b,ox=0,oy=b,aa2=(a*a)<<1,aa4=aa2<<1,bb=(b*b)<<1,st=(aa2>>1)*(1-(b<<1))+bb,tt=(bb>>1)-aa2*((b<<1)-1),pxl,dw,dh;if(w+1)while(y>0){if(st<0){st+=bb*((x<<1)+3);tt+=(bb<<1)*(++x)}else if(tt<0){st+=bb*((x<<1)+3)-aa4*(y-1);pxl=cx-x;dw=(x<<1)+wod;tt+=(bb<<1)*(++x)-aa2*(((y--)<<1)-3);dh=oy-y;this.mkDiv(pxl,cy-oy,dw,dh);this.mkDiv(pxl,cy+y+hod,dw,dh);ox=x;oy=y}else{tt-=aa2*((y<<1)-3);st-=aa4*(--y)}};this.mkDiv(cx-a,cy-oy,w+1,(oy<<1)+hod)};this.fillPolygon=function(array_x,array_y){var i;var y;var miny,maxy;var x1,y1;var x2,y2;var ind1,ind2;var ints;var n=array_x.length;if(!n)return;miny=array_y[0];maxy=array_y[0];for(i=1;i<n;i++){if(array_y[i]<miny)miny=array_y[i];if(array_y[i]>maxy)maxy=array_y[i]};for(y=miny;y<=maxy;y++){var polyInts=new Array();ints=0;for(i=0;i<n;i++){if(!i){ind1=n-1;ind2=0}else{ind1=i-1;ind2=i};y1=array_y[ind1];y2=array_y[ind2];if(y1<y2){x1=array_x[ind1];x2=array_x[ind2]}else if(y1>y2){y2=array_y[ind1];y1=array_y[ind2];x2=array_x[ind1];x1=array_x[ind2]}else continue;if((y>=y1)&&(y<y2)){polyInts[ints++]=Math.round((y-y1)*(x2-x1)/(y2-y1)+x1)}else{if((y==maxy)&&(y>y1)&&(y<=y2))polyInts[ints++]=Math.round((y-y1)*(x2-x1)/(y2-y1)+x1)}};polyInts.sort(integer_compare);for(i=0;i<ints;i+=2)this.mkDiv(polyInts[i],y,polyInts[i+1]-polyInts[i]+1,1)}};this.drawString=function(txt,x,y){this.htm+='<div style="position:absolute;white-space:nowrap;'+'left:'+x+'px;'+'top:'+y+'px;'+'font-family:'+this.ftFam+';'+'font-size:'+this.ftSz+';'+'color:'+this.color+';'+this.ftSty+'">'+txt+'<\/div>'};this.drawStringRect=function(txt,x,y,width,halign){this.htm+='<div style="position:absolute;overflow:hidden;'+'left:'+x+'px;'+'top:'+y+'px;'+'width:'+width+'px;'+'text-align:'+halign+';'+'font-family:'+this.ftFam+';'+'font-size:'+this.ftSz+';'+'color:'+this.color+';'+this.ftSty+'">'+txt+'<\/div>'};this.drawImage=function(imgSrc,x,y,w,h,a){this.htm+='<div style="position:absolute;'+'left:'+x+'px;'+'top:'+y+'px;'+'width:'+w+'px;'+'height:'+h+'px;">'+'<img src="'+imgSrc+'" width="'+w+'" height="'+h+'"'+(a?(' '+a):'')+'>'+'<\/div>'};this.clear=function(){this.htm="";if(this.cnv)this.cnv.innerHTML=this.defhtm};this.mkOvQds=function(cx,cy,xl,xr,yt,yb,w,h){this.mkDiv(xr+cx,yt+cy,w,h);this.mkDiv(xr+cx,yb+cy,w,h);this.mkDiv(xl+cx,yb+cy,w,h);this.mkDiv(xl+cx,yt+cy,w,h)};this.setStroke(1);this.setFont('verdana,geneva,helvetica,sans-serif',String.fromCharCode(0x31,0x32,0x70,0x78),Font.PLAIN);this.color='#000000';this.htm='';this.wnd=wnd||window;if(!(jg_ie||jg_dom||jg_ihtm))chkDHTM();if(typeof id!='string'||!id)this.paint=pntDoc;else{this.cnv=document.all?(this.wnd.document.all[id]||null):document.getElementById?(this.wnd.document.getElementById(id)||null):null;this.defhtm=(this.cnv&&this.cnv.innerHTML)?this.cnv.innerHTML:'';this.paint=jg_dom?pntCnvDom:jg_ie?pntCnvIe:jg_ihtm?pntCnvIhtm:pntCnv};this.setPrintable(false)};function integer_compare(x,y){return(x<y)?-1:((x>y)*1)};
var _isIEmodel=false;var _isMOZmodel=false;var _isOP8model=false;var _isKonqmodel=false;var _isSafarimodel=false;if((document.all)&&(document.getElementById)&&(window.XMLDocument))_isIEmodel=true;if((!document.all)&&(document.getElementById)&&(window.XMLDocument))_isMOZmodel=true;if((navigator.userAgent.indexOf("Opera")>-1)&&(document.implementation.createLSParser)&&(document.implementation.createLSSerializer))_isOP8model=true;var kxstest=null;try{kxstest=new XMLSerializer()}catch(e){}if((navigator.userAgent.indexOf('KHTML')>-1)&&(document.loadXML)&&(typeof(kxstest)=="object"))_isKonqmodel=true;if((navigator.userAgent.indexOf('AppleWebKit')>-1)&&(navigator.userAgent.indexOf('Safari')>-1)&&(typeof(kxstest)=="object"))_isSafarimodel=true;document.sharedinstances=new Object();if(_isSafarimodel){document.sharedinstances.domparser=new DOMParser();document.sharedinstances.xmlserializer=new XMLSerializer()}if(_isOP8model){document.sharedinstances.domparser=document.implementation.createLSParser(document.implementation.MODE_SYNCHRONOUS,'http://www.w3.org/TR/REC-xml');document.sharedinstances.xmlserializer=document.implementation.createLSSerializer()}if(_isKonqmodel){document.sharedinstances.xmlserializer=new XMLSerializer()}if((_isMOZmodel)&&(!_isOP8model)){if(!Document.prototype.loadXML){document.sharedinstances.domparser=new DOMParser();XMLDocument.prototype.loadXML=Document.prototype.loadXML=function(s){var doc2=document.sharedinstances.domparser.parseFromString(s,"text/xml");while(this.hasChildNodes())this.removeChild(this.lastChild);childNodeCount=doc2.childNodes.length;for(var i=0;i<childNodeCount;i++){this.appendChild(this.importNode(doc2.childNodes[i],true))}}}if(!Document.prototype.xml){document.sharedinstances.xmlserializer=new XMLSerializer();if(window.navigator.userAgent.search(/FireFox/g)!=-1){XMLDocument.prototype.__defineGetter__("xml",function(){return document.sharedinstances.xmlserializer.serializeToString(this)})}Element.prototype.__defineGetter__("xml",function(){return document.sharedinstances.xmlserializer.serializeToString(this)});Document.prototype.__defineGetter__("xml",function(){return document.sharedinstances.xmlserializer.serializeToString(this)})}};function getControlPrefix(){if(getControlPrefix.prefix)return getControlPrefix.prefix;var prefixes=["MSXML2","Microsoft","MSXML","MSXML3"];var o,o2;for(var i=0;i<prefixes.length;i++){try{o=new ActiveXObject(prefixes[i]+".XmlHttp");o2=new ActiveXObject(prefixes[i]+".XmlDom");delete o;delete o2;return getControlPrefix.prefix=prefixes[i]}catch(ex){}}throw new Error("Could not find an installed XML parser")};function XmlHttp(){}XmlHttp.create=function(){try{if(window.XMLHttpRequest){var req=new XMLHttpRequest();if(req.readyState==null){req.readyState=1;req.addEventListener("load",function(){req.readyState=4;if(typeof req.onreadystatechange=="function")req.onreadystatechange()},false)}return req}if(window.ActiveXObject){return new ActiveXObject(getControlPrefix()+".XmlHttp")}}catch(ex){}return null};XmlHttp.loadSync=function(sUri){var xmlHttp=XmlHttp.create();var async=false;xmlHttp.open("GET",sUri,async);xmlHttp.send(null);if(_isOP8model){xmlHttp.responseXML.loadXML=XmlDocument.loadXML;xmlHttp.responseXML.xml=XmlDocument.xml}if(_isKonqmodel)xmlHttp.responseXML.xml=XmlDocument.xml;return(xmlHttp.responseXML)};XmlHttp.loadAsync=function(sUri,callback){var xmlHttp=XmlHttp.create();var async=true;xmlHttp.open("GET",sUri,async);xmlHttp.onreadystatechange=function(){if(xmlHttp.readyState==4){if(_isOP8model){xmlHttp.responseXML.loadXML=XmlDocument.loadXML;xmlHttp.responseXML.xml=XmlDocument.xml}if(_isKonqmodel)xmlHttp.responseXML.xml=XmlDocument.xml;callback(xmlHttp.responseXML);delete xmlHttp}};xmlHttp.send(null)};XmlHttp.loadTextAsync2=function(sUri,newCallback,request_type){var xmlHttp=XmlHttp.create();var async=true;xmlHttp.open("GET",sUri,async);xmlHttp.onreadystatechange=function(){if(xmlHttp.readyState==4){if(DataTypeOf(newCallback)=='function')newCallback(xmlHttp.responseText,request_type);else newCallback.callback(xmlHttp.responseText);delete xmlHttp}};xmlHttp.send(null)};XmlHttp.postSync=function(sUri,xmlDoc){var xmlHttp=XmlHttp.create();var async=false;xmlHttp.open("POST",sUri,async);if(_isSafarimodel)xmlHttp.setRequestHeader('Content-Type','text/xml');xmlHttp.send(xmlDoc);if(_isOP8model){xmlHttp.responseXML.loadXML=XmlDocument.loadXML;xmlHttp.responseXML.xml=XmlDocument.xml}if(_isKonqmodel)xmlHttp.responseXML.xml=XmlDocument.xml;return(xmlHttp.responseXML)};XmlHttp.postAsync=function(sUri,xmlDoc,newCallback,request_type){var xmlHttp=XmlHttp.create();var async=true;xmlHttp.open("POST",sUri,async);if(_isSafarimodel)xmlHttp.setRequestHeader('Content-Type','text/xml');xmlHttp.onreadystatechange=function(){if(xmlHttp.readyState==4){if(_isOP8model){xmlHttp.responseXML.loadXML=XmlDocument.loadXML;xmlHttp.responseXML.xml=XmlDocument.xml}if(_isKonqmodel)xmlHttp.responseXML.xml=XmlDocument.xml;if(DataTypeOf(newCallback)=='function')newCallback(xmlHttp.responseXML,request_type);else newCallback.callback(xmlHttp.responseXML,request_type);delete xmlHttp}};xmlHttp.send(xmlDoc)};XmlHttp.postAsync_=function(sUri,xmlDoc,newCallback){var xmlHttp=XmlHttp.create();var async=true;xmlHttp.open("POST",sUri,async);if(_isSafarimodel)xmlHttp.setRequestHeader('Content-Type','text/xml');xmlHttp.onreadystatechange=function(){if(xmlHttp.readyState==4){if(_isOP8model){xmlHttp.responseXML.loadXML=XmlDocument.loadXML;xmlHttp.responseXML.xml=XmlDocument.xml}if(_isKonqmodel)xmlHttp.responseXML.xml=XmlDocument.xml;newCallback(xmlHttp.responseXML);delete xmlHttp}};xmlHttp.send(xmlDoc)};XmlHttp.loadTextSync=function(sUri){var xmlHttp=XmlHttp.create();var async=false;xmlHttp.open("GET",sUri,async);xmlHttp.send(null);return(xmlHttp.responseText)};XmlHttp.loadTextASync=function(sUri,callback){var xmlHttp=XmlHttp.create();var async=true;xmlHttp.open("GET",sUri,async);xmlHttp.onreadystatechange=function(){if(xmlHttp.readyState==4){callback(xmlHttp.responseText)}};xmlHttp.send(null)};XmlHttp.postTextSync=function(sUri,xmlDoc){var xmlHttp=XmlHttp.create();var async=false;xmlHttp.open("POST",sUri,async);xmlHttp.send(xmlDoc);return(xmlHttp.responseText)};function XmlDocument(){};XmlDocument.loadXML=function(xmlstr){var xinput=document.implementation.createLSInput();xinput.stringData=xmlstr;var doc2=document.sharedinstances.domparser.parse(xinput);if(this.documentElement)this.removeChild(this.documentElement);var childNodeCount=doc2.childNodes.length;for(var i=0;i<childNodeCount;i++){this.appendChild(this.importNode(doc2.childNodes[i],true))}};XmlDocument.xml=function(){if(arguments.length==1){this.loadXML(arguments[0])}else{if(_isOP8model)return(document.sharedinstances.xmlserializer.writeToString(this));if(_isKonqmodel||_isSafarimodel){var timpstr=document.sharedinstances.xmlserializer.serializeToString(this);return(timpstr)}}};XmlDocument.create=function(){try{if(document.implementation&&document.implementation.createDocument){var doc=document.implementation.createDocument("","",null);if(doc.readyState==null){doc.readyState=1;doc.addEventListener("load",function(){doc.readyState=4;if(typeof doc.onreadystatechange=="function")doc.onreadystatechange()},false)}if(_isOP8model){doc.loadXML=XmlDocument.loadXML;doc.xml=XmlDocument.xml}if(_isKonqmodel)doc.xml=XmlDocument.xml;if(_isSafarimodel){if(typeof(doc.loadXML)=='undefined'){doc.loadXML=function(s){var doc2=document.sharedinstances.domparser.parseFromString(s,"text/xml");while(this.hasChildNodes())this.removeChild(this.lastChild);childNodeCount=doc2.childNodes.length;for(var i=0;i<childNodeCount;i++){this.appendChild(this.importNode(doc2.childNodes[i],true))}}}if(typeof(doc.xml)=='undefined')doc.xml=XmlDocument.xml}return doc}else if(window.ActiveXObject){return new ActiveXObject(getControlPrefix()+".XmlDom")}}catch(ex){alert('XmlDocument.create error: '+ex)}return null};
Freeance_Extension_Manager=new(function(){var $_this=this;var extensions=[];var id_lookup={};this.add_extension=function(id,filename){id_lookup[id]=extensions.length;extensions.push({id:id,file:filename,requested:false,loaded:false,registered:false,initialized:false,initfcn:null})};this.load_all=function(callback){for(var i=0;i<extensions.length;i++){if(!extensions[i].requested){(function(idx){loadJavaScript(extensions[idx].file,function(){extensions[idx].loaded=true;$_this.load_all_callback(callback)})})(i);extensions[i].requested=true}}};this.load_all_callback=function(callback){for(var i=0;(i<extensions.length)&&(extensions[i].loaded);i++);if(i==extensions.length)callback()};this.initialize_all=function(maxtimeout,callback){var ready=true;for(var i=0;(i<extensions.length)&&(ready);i++)if(!extensions[i].registered)ready=false;if((ready)||(maxtimeout==0)){for(var i=0;(i<extensions.length);i++){if((!extensions[i].initialized)&&(typeof(extensions[i].initfcn)=='function'))extensions[i].initialized=extensions[i].initfcn()}if(typeof(callback)=='function')callback()}else{window.setTimeout(function(){$_this.initialize_all(parseInt(maxtimeout)/2,callback)},parseInt(maxtimeout)/2)}};this.register=function(extid,initfcn){var idx=id_lookup[extid];if(idx!=null){if(extensions[idx].registered)return false;else{extensions[idx].registered=true;extensions[idx].initfcn=initfcn}}else return false};this.get_unregistered=function(){var returnval=[];for(var i=0;(i<extensions.length);i++)if(!extensions[i].registered)returnval.push(extensions[i].id);return returnval};this.get_uninitialized=function(){var returnval=[];for(var i=0;(i<extensions.length);i++)if(!extensions[i].initialized)returnval.push(extensions[i].id);return returnval}})();
RightPanel_State_Manager=new(function(){var $_this=this;var labels=[];var labelLookup={};var panels=[];var panelLookup={};var activePanelType='';var oldActivePanelType='';this.addLabel=function(labelID,panelType,labelText){if(labelLookup[labelID]!=null)return(false);var ele=document.createElement('DIV');ele.id=labelID;ele.className='controlPanelButton';ele.innerHTML='<div class="controlPanelButtonText">'+labelText+'</div>';$('rightControlPanelContainer').appendChild(ele);xAddEventListener(ele,'click',function(){$_this.showPanel(panelType)});labelLookup[labelID]=labels.length;labels.push({labelID:labelID,panelType:panelType,labelText:labelText,labelEle:ele});return(true)};this.addPanel=function(panelType,panelID){var vis_fcn=function(newstate){panelEle.style.display=(newstate?'block':'none')};if(panelLookup[panelType])return(false);var visibilityFunction=(arguments.length>2)?arguments[2]:vis_fcn;if(!visibilityFunction){visibilityFunction=vis_fcn};var panelHTML=(arguments.length>3)?arguments[3]:null;var panelURL=(arguments.length>4)?arguments[4]:null;var panelEle=$(panelID);if(!panelEle){panelEle=document.createElement('DIV');panelEle.id=panelID;panelEle.style.display='none';if(panelHTML)panelEle.innerHTML=panelHTML;else if(panelURL)XmlHttp.loadTextAsync(panelURL,function(htmlcode){panelEle.innerHTML=htmlcode});$('rightPanelBody').appendChild(panelEle)}panelLookup[panelType]=panels.length;panels.push({panelID:panelID,panelType:panelType,setVisible:visibilityFunction,panelEle:$(panelID)});return(panelEle)};this.showPanel=function(newPanelType){if(panelLookup[newPanelType]==null)return(false);if((activePanelType!='')&&(activePanelType!=newPanelType))panels[panelLookup[activePanelType]].setVisible(false,panels[panelLookup[activePanelType]]['panelEle']);oldActivePanelType=activePanelType;activePanelType=newPanelType;panels[panelLookup[newPanelType]].setVisible(true,panels[panelLookup[newPanelType]]['panelEle'])};this.getActivePanel=function(){return activePanelType};this.getPreviousActivePanel=function(){return oldActivePanelType};this.getPanelElement=function(panelType){return panelLookup[newPanelType]?panels[panelLookup[newPanelType]]['panelEle']:null}})();
_PageHeaderHeight=30;_RightPanelWidth=250;_MapToolBarWidth=30;_MapToolOptionHeight=100;_VicinityMapWidthOpen=130;_VicinityMapExists=false;_VicinityMapWidthClosed=0;_ExpandSearchPanel=false;_DefaultActivePanel='userIntro';GUI_THEME_PATH='./themes';GUI_THEME='';window.resize_functions=[];function formatBaseLayout(){var clientWidth=xClientWidth();var clientHeight=xClientHeight();var panelWidth=0;if(_ExpandSearchPanel)var rightPanelHeight=xHeight($('rightPanel'),clientHeight-_PageHeaderHeight-_MapToolOptionHeight);else var rightPanelHeight=xHeight($('rightPanel'),clientHeight-_PageHeaderHeight);var homeLinkHeight=xHeight($('homeLink'));var rightPanelToolbarHeight=xHeight($('rightPanelToolbar'));xHeight($('rightPanelBody'),rightPanelHeight-homeLinkHeight-rightPanelToolbarHeight);xWidth($('homeLink'),_RightPanelWidth);xHeight($('pageHeader'),_PageHeaderHeight);xTop($('rightPanel'),_PageHeaderHeight);xWidth($('rightPanel'),_RightPanelWidth);xWidth($('rightPanelBody'),_RightPanelWidth);xHeight($('searchResultPanel'),_MapToolOptionHeight);xHeight($('searchResultPanel'),_MapToolOptionHeight);xHeight($('geocodeResultPanel'),_MapToolOptionHeight);xHeight($('mapToolOptionPanel'),_MapToolOptionHeight);xHeight($('mapToolOptionPanelBody'),_MapToolOptionHeight-xHeight($('mapToolOptionPanelHeader')));if(_VicinityMapExists){xLeft($('mapToolOptionPanel'),_VicinityMapWidthOpen);xLeft($('searchResultPanel'),_VicinityMapWidthOpen);xLeft($('geocodeResultPanel'),_VicinityMapWidthOpen);if(_ExpandSearchPanel){panelWidth=clientWidth-_VicinityMapWidthOpen;xWidth($('mapToolOptionPanel'),panelWidth);xWidth($('searchResultPanel'),panelWidth);xWidth($('geocodeResultPanel'),panelWidth)}else{panelWidth=clientWidth-_RightPanelWidth-_VicinityMapWidthOpen;xWidth($('mapToolOptionPanel'),panelWidth);xWidth($('searchResultPanel'),panelWidth);xWidth($('geocodeResultPanel'),panelWidth)}}else{xLeft($('mapToolOptionPanel'),_VicinityMapWidthClosed);xLeft($('searchResultPanel'),_VicinityMapWidthClosed);xLeft($('geocodeResultPanel'),_VicinityMapWidthClosed);if(_ExpandSearchPanel){xWidth($('mapToolOptionPanel'),clientWidth);xWidth($('searchResultPanel'),clientWidth);xWidth($('geocodeResultPanel'),clientWidth)}else{panelWidth=clientWidth-_RightPanelWidth;xWidth($('mapToolOptionPanel'),panelWidth);xWidth($('searchResultPanel'),panelWidth);xWidth($('geocodeResultPanel'),panelWidth)}}var printPopup=$('printPopup');var printFrame=$('printFrame');var printWidth=0.75*clientWidth;var printHeight=0.75*clientHeight;var printLeft=0.125*clientWidth;var printTop=0.125*clientHeight;xLeft(printPopup,printLeft);xTop(printPopup,printTop);xWidth(printPopup,printWidth);xHeight(printPopup,printHeight);xWidth(printFrame,printWidth);xHeight(printFrame,printHeight-20);var pwindow=$('printwindow_inline');var iframe_ele=$('printwindow_inline_frame');var iframe_offsety=xHeight($('printwindow_inline_titlebar'));xLeft(pwindow,printLeft);xTop(pwindow,printTop);xWidth(pwindow,printWidth);xHeight(pwindow,printHeight);xWidth(iframe_ele,printWidth);xHeight(iframe_ele,printHeight-iframe_offsety)};function winOnResize(){formatBaseLayout();if(window.resize_functions)for(var i=0;i<window.resize_functions.length;i++)window.resize_functions[i](xClientWidth(),xClientHeight())};function initGuiLib(guiTheme){GUI_THEME=guiTheme;GuiWidget.THEME_PATH='./themes';GuiWidget.THEME=GUI_THEME;document.addStylesheet(GuiWidget.THEME_PATH+'/'+GuiWidget.THEME+'/guilib.css');document.addStylesheet(GuiWidget.THEME_PATH+'/'+GuiWidget.THEME+'/freeance.css');document.addStylesheet(GuiWidget.THEME_PATH+'/'+GuiWidget.THEME+'/templateStyles.css');GuiWidget.tooltipOffset=new Array(5,5);GuiWidget_onLoad()};function setBottomPanel(panelName){xHide($('geocodeResultPanel'));xHide($('searchResultPanel'));xHide($('mapToolOptionPanel'));xShow($(panelName));document.currentBottomPanel=panelName};function clearSearchResultPanel(){var templateObject=document.templateConfig;var resultPanel=$('searchResultPanel');if(resultPanel.scrollHandler!=null)resultPanel.scrollHandler.cleanup();resultPanel.innerHTML=templateObject['EmptySearch']};document.rotateBottomPanel=function(){switch(document.currentBottomPanel){case'mapToolOptionPanel':setBottomPanel('searchResultPanel');break;case'searchResultPanel':if(document.geocodeControl!=null){if(document.extensionConfig.geocode.enabled)setBottomPanel('geocodeResultPanel');else setBottomPanel('mapToolOptionPanel')}else setBottomPanel('mapToolOptionPanel');break;case'geocodeResultPanel':setBottomPanel('mapToolOptionPanel');break;default:setBottomPanel('mapToolOptionPanel');break}};function showQueryIndexPanel(){document.queryControl.currentQueryForm=null;hideSearchForms();$('queryBookmarkContainer').style.display='none';$('searchIndexContainer').style.display='block';$('queryContainer').style.display='block'};function hideSearchIndexPanel(){$('searchIndexContainer').style.display='none'};function hideSearchForms(){document.queryControl.hideAllForms();if(document.geocodeControl)document.geocodeControl.hideAllForms();if(document.proximitySearchControl)document.proximitySearchControl.hideAllForms();$('proximitySearchFormContainer').style.display='none';$('queryBookmarkContainer').style.display='none';$('searchFormContainer').style.display='none'};document.hideSearchForms=hideSearchForms;function showSearchFormContainer(){$('searchFormContainer').style.display='block'}
_MapAutoRedraw=true;_ZoomBarPresent=false;_SchemeButtonRowHeight=25;_MAP_INITIALIZED=false;_FIRST_INITIALIZE=true;_CustomLegendURL='';_ZoomBarWidth=17;_ZoomBarCellHeight=8;_ZoomBarStartColor='#FFFFFF';_ZoomBarEndColor='#0000FF';_ZoomBarActiveColor='#00FF00';_ZoomBarRatio=0.01;function pageformat_mapTop(){return _PageHeaderHeight+((document.mapObject.config.mapSchemeConfig.mapSchemes.length>0)?_SchemeButtonRowHeight:2)};function pageformat_mapLeft(){return _MapToolBarWidth};function pageformat_mapWidth(){return xClientWidth()-_MapToolBarWidth-_RightPanelWidth-((xIE4Up)?0:2)};function pageformat_mapHeight(){return xClientHeight()-_PageHeaderHeight-_MapToolOptionHeight-((document.mapObject.config.mapSchemeConfig.mapSchemes.length>0)?_SchemeButtonRowHeight:4)};function create_map_interface(){var cw=xClientWidth(),ch=xClientHeight();var pageContainer=$('pageContainer');var mapTop=_PageHeaderHeight+((document.mapObject.config.mapSchemeConfig.mapSchemes.length>0)?_SchemeButtonRowHeight:2);var mapLeft=_MapToolBarWidth;var mapWidth=cw-_MapToolBarWidth-_RightPanelWidth-((xIE4Up)?0:2);var mapHeight=ch-_PageHeaderHeight-_MapToolOptionHeight-((document.mapObject.config.mapSchemeConfig.mapSchemes.length>0)?_SchemeButtonRowHeight:4);document.mapObject.mapImage=new MapImage('scriptedMapImage',pageContainer,mapLeft,mapTop,0,mapWidth,mapHeight,true,document.mapObject,'MASTER');document.mapObject.mapImage.setMouseMode('ZoomWindow');if(document.mapObject.vmapPresent){document.mapObject.vmapImage=new MapImage('scriptedVmapImage',pageContainer,3,xClientHeight()-_MapToolOptionHeight,0,124,_MapToolOptionHeight-5,true,document.mapObject,'SLAVE');_VicinityMapExists=true}var mapToolbar=document.mapToolbar=new ToolBar('mapToolbar',pageContainer,0,mapTop,0,_MapToolBarWidth,mapHeight,true,'',ToolBar.ALIGN_VERTICAL);var mapCursorRadioButtonGroup=mapToolbar.mapCursorRadioButtonGroup=new RadioButtonGroup('mapCursorRadioButtonGroup');var zoomInButton=mapToolbar.addButton('zoomInButton',ToolBar.BUTTON_RADIO,ToolBar.ADD_BUTTON_LAST,null,25,25,true,'zoomIn.png','Zoom In',mapCursorRadioButtonGroup,'');var zoomOutButton=mapToolbar.addButton('zoomOutButton',ToolBar.BUTTON_RADIO,ToolBar.ADD_BUTTON_LAST,null,25,25,true,'zoomOut.png','Zoom Out',mapCursorRadioButtonGroup,'');var panButton=mapToolbar.addButton('panButton',ToolBar.BUTTON_RADIO,ToolBar.ADD_BUTTON_LAST,null,25,25,true,'pan.png','Pan/Recenter',mapCursorRadioButtonGroup,'');var selectButton=mapToolbar.addButton('selectButton',ToolBar.BUTTON_RADIO,ToolBar.ADD_BUTTON_LAST,null,25,25,false,'select.png','Identify Features',mapCursorRadioButtonGroup,'');var bufferButton=mapToolbar.addButton('bufferButton',ToolBar.BUTTON_RADIO,ToolBar.ADD_BUTTON_LAST,null,25,25,false,'buffer.png','Buffer Features',mapCursorRadioButtonGroup,'');var measureButton=mapToolbar.addButton('measureButton',ToolBar.BUTTON_RADIO,ToolBar.ADD_BUTTON_LAST,null,25,25,false,'measure.png','Measure',mapCursorRadioButtonGroup,'');var latLonButton=mapToolbar.addButton('latLonButton',ToolBar.BUTTON_RADIO,ToolBar.ADD_BUTTON_LAST,null,25,25,false,'coordConv.png','Find Lat - Lon<br />Coordinates',mapCursorRadioButtonGroup,'');var redrawButton=mapToolbar.addButton('redrawButton',ToolBar.BUTTON_IMAGE,ToolBar.ADD_BUTTON_LAST,null,25,25,true,'redraw.png','Redraw Map');var backButton=mapToolbar.addButton('backButton',ToolBar.BUTTON_IMAGE,ToolBar.ADD_BUTTON_LAST,null,25,25,true,'zoomPrev.png','Zoom Previous');var homeButton=mapToolbar.addButton('zoomInitialButton',ToolBar.BUTTON_IMAGE,ToolBar.ADD_BUTTON_LAST,null,25,25,true,'zoomInitial.png','Initial Extent');var printButton=mapToolbar.addButton('printMapButton',ToolBar.BUTTON_IMAGE,ToolBar.ADD_BUTTON_LAST,null,25,25,false,'printMap.png','Print');var saveMapButton=mapToolbar.addButton('saveMapButton',ToolBar.BUTTON_IMAGE,ToolBar.ADD_BUTTON_LAST,null,25,25,false,'saveMap.png','Save Map Image');var bottomPanelSwitchOMatic=new ImageButton('bottomPanelSwitchOMatic',mapToolbar.element,2,mapToolbar.height()-30,0,25,25,true,'togglePanel.png','Change Bottom Panel Mode');zoomInButton.clickEvent=function(){document.mapObject.mapImage.setMouseMode('ZoomWindow');setActiveMapTool('ZoomIn');$('mapToolPanelNameField').innerHTML='Zoom In'};zoomOutButton.clickEvent=function(){document.mapObject.mapImage.setMouseMode('ZoomOut');setActiveMapTool('ZoomOut');$('mapToolPanelNameField').innerHTML='Zoom Out'};panButton.clickEvent=function(){document.mapObject.mapImage.setMouseMode('DragMap');setActiveMapTool('Pan');$('mapToolPanelNameField').innerHTML='Pan / Recenter'};redrawButton.clickEvent=function(e){if(_MAP_INITIALIZED)document.mapObject.redraw()};backButton.clickEvent=function(){if(_MAP_INITIALIZED)document.mapObject.zoomToPrevious()};homeButton.clickEvent=function(e){if(_MAP_INITIALIZED)document.mapObject.zoomInitialExtent()};bottomPanelSwitchOMatic.clickEvent=function(e){document.rotateBottomPanel()};window.setTimeout(function(){mapCursorRadioButtonGroup.setActiveButton('zoomInButton')},1000);if(_CustomLegendURL!=''){document.mapObject.customLegendImage=_CustomLegendURL;$('map0legend').src=_CustomLegendURL}document.mapObject.setLegendImage($('map0legend'),false);if(document.mapObject.config.mapSchemeConfig){_SchemeButtonRowHeight=xHeight($('rightPanelToolbar'));if(document.mapObject.config.mapSchemeConfig.mapSchemes.length>0){xHeight($('mapSchemeButtonContainer'),_SchemeButtonRowHeight);xWidth($('mapSchemeButtonContainer'),xClientWidth()-_RightPanelWidth);xTop($('mapSchemeButtonContainer'),_PageHeaderHeight);xLeft($('mapSchemeButtonContainer'),0);$('mapSchemeButtonContainer').style.display='block';drawMapSchemeToolbar(document.mapObject.config.mapSchemeConfig.defaultMapScheme)}else $('mapSchemeButtonContainer').style.display='none'}formatBaseLayout();window.resize_functions.push(function(cw,ch){var mapWidth=pageformat_mapWidth();var mapHeight=pageformat_mapHeight();if(document.mapObject){document.mapObject.mapImage.resizeTo(mapWidth,mapHeight);if(document.mapObject.vmapImage)document.mapObject.vmapImage.moveTo(3,ch-_MapToolOptionHeight)}mapToolbar.resizeTo(_MapToolBarWidth,mapHeight);bottomPanelSwitchOMatic.moveTo(0,mapToolbar.height()-30);if(_MAP_INITIALIZED&&_MapAutoRedraw)document.mapObject.redraw()})};function drawMapSchemeToolbar(){var mapConfig=document.mapObject.config;if(arguments.length>0)activeScheme=parseInt(arguments[0]);else activeScheme=0;var htmlString='';if(mapConfig.mapSchemeConfig!=null){for(var currentScheme=0;currentScheme<mapConfig.mapSchemeConfig.mapSchemes.length;currentScheme++){var isActive=(mapConfig.mapSchemeConfig.mapSchemes[currentScheme]["id"]==activeScheme);htmlString+='<table cellpadding="0" cellspacing="0" id="mapScheme'+currentScheme+'Container" class="schemeButtonTable" onclick="setActiveMapScheme(\''+currentScheme+'\');">'+'<tr><td class="schemeButtonLeft'+(isActive?'_active':'')+'">&nbsp;</td>'+'<td class="schemeButtonCenter'+(isActive?'_active':'')+'"><span>'+escapeHTML(mapConfig.mapSchemeConfig.mapSchemes[currentScheme].name).replace(/ /g,'&nbsp;')+'</span></td>'+'<td class="schemeButtonRight'+(isActive?'_active':'')+'">&nbsp;</td></tr></table>'}}$('mapSchemeButtonContainer').innerHTML=htmlString};function setActiveMapScheme(newScheme){if(document.mapObject.sessionID!=null){document.mapObject.setMapScheme(newScheme);drawMapSchemeToolbar(newScheme)}};function setActiveMapTool(toolId){var oldToolDescription=$('mapToolDetail'+document.currentMapTool);var newToolDescription=$('mapToolDetail'+toolId);oldToolDescription.setAttribute((xIE4Up?("className"):("class")),"mapToolDetailFromHidden");newToolDescription.setAttribute((xIE4Up?("className"):("class")),"mapToolDetailForm");document.currentMapTool=toolId;setBottomPanel('mapToolOptionPanel')};function toggleSelectionOptionDisplay(){var currentStyle=$("selectionOptionsPanel").style.display;switch(currentStyle.toLowerCase()){case'block':$("selectionOptionsPanel").style.display='none';break;case'none':$("selectionOptionsPanel").style.display='block';break;default:alert('document.toggleSelectionOptionDisplay()\nAttempting to process unknown display state "'+currentStyle+'"');break}};document.toggleSelectionOptionDisplay=toggleSelectionOptionDisplay;
document.templateFunctions=new Array();document.getTemplateHTML=function(templateName){var templateObject=document.templateConfig;var templateString=templateObject[templateName];var _TemplateSearchString=/-!CURRENT_THEME!-/g;var _TemplateReplaceWith=document.applicationConfig.stylesheet;templateString=templateString.replace(_TemplateSearchString,_TemplateReplaceWith);return templateString};document.getTemplate=function(templateName,noBuild,specialRequestOptions){var js=null;if(typeof noBuild=="undefined")noBuild=false;if(noBuild==null)noBuild=false;if((typeof specialRequestOptions=="undefined")||(specialRequestOptions==null))specialRequestOptions=Array();if(document.templateFunctions[templateName])return(document.templateFunctions[templateName]);var templateObject=document.templateConfig;var templateString=templateObject[templateName];var _TemplateSearchString=/-!CURRENT_THEME!-/g;var _TemplateReplaceWith=document.applicationConfig.stylesheet;templateString=templateString.replace(_TemplateSearchString,_TemplateReplaceWith);templateString=templateString.replace(/document\.getGuiControl\('map0'\)/g,'document.mapObject');templateString=templateString.replace(/document\.getGuiControl\('rightPanelQueryControl'\)/g,'document.queryControl');templateString=templateString.replace(/document\.getGuiControl\('queryControl'\)/g,'document.queryControl');if(templateString){var _TemplateReplaceWith='img style="display:none;"';var _TemplateSearchFor='img template_enabled="y" template_type="" template_visibility_eval="..OBJECT_MANAGER.getGuiValueById..extensions....email...enabled. && .OBJECT_MANAGER.getGuiValueById..emailConfig...allowSearchResults.."';var _TemplateSearchString=new RegExp(_TemplateSearchFor,"");templateString=templateString.replace(_TemplateSearchString,_TemplateReplaceWith);var _TemplateReplaceWith='img style="display:none;"';var _TemplateSearchFor='img template_enabled="y" template_type="" template_visibility_eval="..OBJECT_MANAGER.getGuiValueById..extensions....email...enabled. && .OBJECT_MANAGER.getGuiValueById..emailConfig...allowBufferResults.."';var _TemplateSearchString=new RegExp(_TemplateSearchFor,"");templateString=templateString.replace(_TemplateSearchString,_TemplateReplaceWith);var includeExportBufferToCSV=false;if((typeof specialRequestOptions["includeExportBufferToCSV"]=="boolean")&&(specialRequestOptions["includeExportBufferToCSV"]==true))includeExportBufferToCSV=true;if(includeExportBufferToCSV){var _TemplateReplaceWith='img '}else{var _TemplateReplaceWith='img style="display:none;"'};var _TemplateSearchFor='img template_enabled="y" template_type="" template_visibility_eval=".OBJECT_MANAGER.getGuiValueById..extensions....exportBufferToCSV...enabled."';var _TemplateSearchString=new RegExp(_TemplateSearchFor,"");templateString=templateString.replace(_TemplateSearchString,_TemplateReplaceWith)};if(noBuild){js=new Object();js.html=templateString}else js=TW.templateToJS(templateString);document.templateFunctions[templateName]=js;return(js)};document.toClipboard=function(txt){var ta=document.createElement('TEXTAREA');ta.innerText=txt;var tr=ta.createTextRange();tr.execCommand("Copy")};document.clipDebug=function(desc,txt){document.toClipboard(txt);alert(desc+txt)};document.getPrintTarget=function(){element=$("scratchpad");return element};document.setScratchpadData=function(newData){$("scratchpad").innerHTML=newData};document.printCurrentData=function(){$('printPopup').style.display='block'};
var hexcase=0;var b64pad="";var chrsz=8;function hex_md5(s){return binl2hex(core_md5(str2binl(s),s.length*chrsz))};function b64_md5(s){return binl2b64(core_md5(str2binl(s),s.length*chrsz))};function hex_hmac_md5(key,data){return binl2hex(core_hmac_md5(key,data))};function b64_hmac_md5(key,data){return binl2b64(core_hmac_md5(key,data))};function calcMD5(s){return binl2hex(core_md5(str2binl(s),s.length*chrsz))};function md5_vm_test(){return hex_md5("abc")=="900150983cd24fb0d6963f7d28e17f72"};function core_md5(x,len){x[len>>5]|=0x80<<((len)%32);x[(((len+64)>>>9)<<4)+14]=len;var a=1732584193;var b=-271733879;var c=-1732584194;var d=271733878;for(var i=0;i<x.length;i+=16){var olda=a;var oldb=b;var oldc=c;var oldd=d;a=md5_ff(a,b,c,d,x[i+0],7,-680876936);d=md5_ff(d,a,b,c,x[i+1],12,-389564586);c=md5_ff(c,d,a,b,x[i+2],17,606105819);b=md5_ff(b,c,d,a,x[i+3],22,-1044525330);a=md5_ff(a,b,c,d,x[i+4],7,-176418897);d=md5_ff(d,a,b,c,x[i+5],12,1200080426);c=md5_ff(c,d,a,b,x[i+6],17,-1473231341);b=md5_ff(b,c,d,a,x[i+7],22,-45705983);a=md5_ff(a,b,c,d,x[i+8],7,1770035416);d=md5_ff(d,a,b,c,x[i+9],12,-1958414417);c=md5_ff(c,d,a,b,x[i+10],17,-42063);b=md5_ff(b,c,d,a,x[i+11],22,-1990404162);a=md5_ff(a,b,c,d,x[i+12],7,1804603682);d=md5_ff(d,a,b,c,x[i+13],12,-40341101);c=md5_ff(c,d,a,b,x[i+14],17,-1502002290);b=md5_ff(b,c,d,a,x[i+15],22,1236535329);a=md5_gg(a,b,c,d,x[i+1],5,-165796510);d=md5_gg(d,a,b,c,x[i+6],9,-1069501632);c=md5_gg(c,d,a,b,x[i+11],14,643717713);b=md5_gg(b,c,d,a,x[i+0],20,-373897302);a=md5_gg(a,b,c,d,x[i+5],5,-701558691);d=md5_gg(d,a,b,c,x[i+10],9,38016083);c=md5_gg(c,d,a,b,x[i+15],14,-660478335);b=md5_gg(b,c,d,a,x[i+4],20,-405537848);a=md5_gg(a,b,c,d,x[i+9],5,568446438);d=md5_gg(d,a,b,c,x[i+14],9,-1019803690);c=md5_gg(c,d,a,b,x[i+3],14,-187363961);b=md5_gg(b,c,d,a,x[i+8],20,1163531501);a=md5_gg(a,b,c,d,x[i+13],5,-1444681467);d=md5_gg(d,a,b,c,x[i+2],9,-51403784);c=md5_gg(c,d,a,b,x[i+7],14,1735328473);b=md5_gg(b,c,d,a,x[i+12],20,-1926607734);a=md5_hh(a,b,c,d,x[i+5],4,-378558);d=md5_hh(d,a,b,c,x[i+8],11,-2022574463);c=md5_hh(c,d,a,b,x[i+11],16,1839030562);b=md5_hh(b,c,d,a,x[i+14],23,-35309556);a=md5_hh(a,b,c,d,x[i+1],4,-1530992060);d=md5_hh(d,a,b,c,x[i+4],11,1272893353);c=md5_hh(c,d,a,b,x[i+7],16,-155497632);b=md5_hh(b,c,d,a,x[i+10],23,-1094730640);a=md5_hh(a,b,c,d,x[i+13],4,681279174);d=md5_hh(d,a,b,c,x[i+0],11,-358537222);c=md5_hh(c,d,a,b,x[i+3],16,-722521979);b=md5_hh(b,c,d,a,x[i+6],23,76029189);a=md5_hh(a,b,c,d,x[i+9],4,-640364487);d=md5_hh(d,a,b,c,x[i+12],11,-421815835);c=md5_hh(c,d,a,b,x[i+15],16,530742520);b=md5_hh(b,c,d,a,x[i+2],23,-995338651);a=md5_ii(a,b,c,d,x[i+0],6,-198630844);d=md5_ii(d,a,b,c,x[i+7],10,1126891415);c=md5_ii(c,d,a,b,x[i+14],15,-1416354905);b=md5_ii(b,c,d,a,x[i+5],21,-57434055);a=md5_ii(a,b,c,d,x[i+12],6,1700485571);d=md5_ii(d,a,b,c,x[i+3],10,-1894986606);c=md5_ii(c,d,a,b,x[i+10],15,-1051523);b=md5_ii(b,c,d,a,x[i+1],21,-2054922799);a=md5_ii(a,b,c,d,x[i+8],6,1873313359);d=md5_ii(d,a,b,c,x[i+15],10,-30611744);c=md5_ii(c,d,a,b,x[i+6],15,-1560198380);b=md5_ii(b,c,d,a,x[i+13],21,1309151649);a=md5_ii(a,b,c,d,x[i+4],6,-145523070);d=md5_ii(d,a,b,c,x[i+11],10,-1120210379);c=md5_ii(c,d,a,b,x[i+2],15,718787259);b=md5_ii(b,c,d,a,x[i+9],21,-343485551);a=safe_add(a,olda);b=safe_add(b,oldb);c=safe_add(c,oldc);d=safe_add(d,oldd)}return Array(a,b,c,d)};function md5_cmn(q,a,b,x,s,t){return safe_add(bit_rol(safe_add(safe_add(a,q),safe_add(x,t)),s),b)};function md5_ff(a,b,c,d,x,s,t){return md5_cmn((b&c)|((~b)&d),a,b,x,s,t)};function md5_gg(a,b,c,d,x,s,t){return md5_cmn((b&d)|(c&(~d)),a,b,x,s,t)};function md5_hh(a,b,c,d,x,s,t){return md5_cmn(b^c^d,a,b,x,s,t)};function md5_ii(a,b,c,d,x,s,t){return md5_cmn(c^(b|(~d)),a,b,x,s,t)};function core_hmac_md5(key,data){var bkey=str2binl(key);if(bkey.length>16)bkey=core_md5(bkey,key.length*chrsz);var ipad=Array(16),opad=Array(16);for(var i=0;i<16;i++){ipad[i]=bkey[i]^0x36363636;opad[i]=bkey[i]^0x5C5C5C5C}var hash=core_md5(ipad.concat(str2binl(data)),512+data.length*chrsz);return core_md5(opad.concat(hash),512+128)};function safe_add(x,y){var lsw=(x&0xFFFF)+(y&0xFFFF);var msw=(x>>16)+(y>>16)+(lsw>>16);return(msw<<16)|(lsw&0xFFFF)};function bit_rol(num,cnt){return(num<<cnt)|(num>>>(32-cnt))};function str2binl(str){var bin=Array();var mask=(1<<chrsz)-1;for(var i=0;i<str.length*chrsz;i+=chrsz)bin[i>>5]|=(str.charCodeAt(i/chrsz)&mask)<<(i%32);return bin};function binl2hex(binarray){var hex_tab=hexcase?"0123456789ABCDEF":"0123456789abcdef";var str="";for(var i=0;i<binarray.length*4;i++){str+=hex_tab.charAt((binarray[i>>2]>>((i%4)*8+4))&0xF)+hex_tab.charAt((binarray[i>>2]>>((i%4)*8))&0xF)}return str};function binl2b64(binarray){var tab="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";var str="";for(var i=0;i<binarray.length*4;i+=3){var triplet=(((binarray[i>>2]>>8*(i%4))&0xFF)<<16)|(((binarray[i+1>>2]>>8*((i+1)%4))&0xFF)<<8)|((binarray[i+2>>2]>>8*((i+2)%4))&0xFF);for(var j=0;j<4;j++){if(i*8+j*6>binarray.length*32)str+=b64pad;else str+=tab.charAt((triplet>>6*(3-j))&0x3F)}}return str};
String.replaceStr=function(orig,lookfor,replacewith,ignorecase){var str=new String();str+=orig;var type='g';if(ignorecase)type+='i';var re=new RegExp(lookfor,type);return(str.replace(re,replacewith))};stripWhitespace=String.prototype.stripWhitespace=function(){return((arguments.length>0)?((typeof(arguments[0])=='string')?arguments[0]:arguments[0].toString()):this).replace(/[\s\t\r\n]/g,'')};escapeHTML=String.prototype.escapeHTML=function(){return((arguments.length>0)?((typeof(arguments[0])=='string')?arguments[0]:arguments[0].toString()):this).replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;').replace(/\"/g,'&quot;')};unescapeHTML=String.prototype.unescapeHTML=function(){return((arguments.length>0)?((typeof(arguments[0])=='string')?arguments[0]:arguments[0].toString()):this).replace(/&lt;/g,'<').replace(/&gt;/g,'>').replace(/&quot;/g,'"').replace(/&amp;/g,'&')};stripQuotes=String.prototype.stripQuotes=function(){return((arguments.length>0)?((typeof(arguments[0])=='string')?arguments[0]:arguments[0].toString()):this).replace(/['"]/g,'')};escapeQuotes=String.prototype.escapeQuotes=function(){var newString=((arguments.length>0)?((typeof(arguments[0])=='string')?arguments[0]:arguments[0].toString()):this);newString=newString.replace(/\\/g,'\\\\');newString=String.replaceStr(newString,'\'','\\\'',false);newString=String.replaceStr(newString,'"','&quot;',false);return newString};unescapeQuotes=String.prototype.unescapeQuotes=function(){var newString=((arguments.length>0)?((typeof(arguments[0])=='string')?arguments[0]:arguments[0].toString()):this);newString=newString.replace(/\\\\/g,'\\');newString=String.replaceStr(newString,'\\\'','\'',false);newString=String.replaceStr(newString,'&quot;','"',false);return newString};String.prototype.ltrim=function(){return this.replace(/^\s+/,'')};String.prototype.rtrim=function(){return this.replace(/\s+$/,'')};String.prototype.strtrim=function(){return this.replace(/^\s+/,'').replace(/\s+$/,'')};function getArrayLength(arr){var count=0;for(var idx in arr){if(idx=='toJSONString')continue;if((typeof(arr[idx])!='undefined')&&(arr[idx]!=null))count++}return(count)};function describeObject(stringPrefix,object){var totalString='';var lineTerminator=((arguments.length>=3)?(arguments[2]):("<br>"));var depth=((arguments.length>=4)?(arguments[3]):(-1));var objectType=typeof(object);if(objectType.toLowerCase()=="object")for(var i in object){if(i=='toJSONString')continue;var currentPrefix=stringPrefix+'['+i+']';if(depth>0)totalString=totalString+describeObject(currentPrefix,object[i],lineTerminator,depth-1);else if(depth==-1)totalString=totalString+describeObject(currentPrefix,object[i],lineTerminator,-1)}else totalString=totalString+stringPrefix+' = '+object+lineTerminator;return totalString};function DataTypeOf(o){var type=typeof(o);type=type.toLowerCase();switch(type){case"number":if(Math.round(o)==o)type="i4";else type="double";break;case"object":var con=o.constructor;if(con==Date)type="date";else if(con==Array)type="array";else type="struct";break}return type};function duplicateNodeTreeEmbeddingStyles(theNode){var newNode=theNode.cloneNode(false);if(theNode.nodeType==1){if(theNode.getAttribute('action_button'))return(null);if(theNode.currentStyle){for(var attribName in theNode.currentStyle){if(attribName=='toJSONString')continue;var attribValue=theNode.currentStyle[attribName];if((attribValue!='')&&(attribValue!='undefined')&&(attribValue!='none')&&(attribValue!='normal')&&(attribValue!='auto'))newNode.style[attribName]=attribValue}}else if(window.getComputedStyle){var newStyles=window.getComputedStyle(theNode,null);for(var lcv=0;lcv<newStyles.length;lcv++){var attribName=newStyles.item(lcv);var attribValue=newStyles.getPropertyValue(attribName);if(attribValue.indexOf('-moz')>=0){}else if((attribValue!='')&&(attribValue!='undefined')&&(attribValue!='none')&&(attribValue!='normal')&&(attribValue!='auto'))newNode.style.setProperty(attribName,attribValue,null)}}}for(var lcv=0;lcv<theNode.childNodes.length;lcv++){var cNode=duplicateNodeTreeEmbeddingStyles(theNode.childNodes[lcv]);if(cNode!=null)newNode.appendChild(cNode)}return(newNode)};function duplicateNodeTreeEmbeddingStylesSubset(theNode){var newNode=theNode.cloneNode(false);if(theNode.nodeType==1){if(theNode.getAttribute('action_button'))return(null);try{newNode.removeAttribute('class');newNode.removeAttribute('className')}catch(e){}if(theNode.currentStyle){var copyAttribs=Array('margin','borderColor','borderStyle','borderWidth','backgroundColor','color','fontStyle','fontFamily','fontSize','fontWeight','padding','width','height','textAlign','textDecoration','cursor','visibility');for(var lcv=0;lcv<copyAttribs.length;lcv++){var attribName=copyAttribs[lcv];var attribValue=theNode.currentStyle.getAttribute(attribName);if((attribValue!=null)&&(attribValue!='')&&(attribValue!='undefined')&&(attribValue!='none')&&(attribValue!='normal')&&(attribValue!='auto')&&(attribValue!='transparent')&&(attribValue!='visible')&&(attribValue!='inherit'))try{newNode.style[attribName]=attribValue}catch(e){}}}else if(window.getComputedStyle){var copyAttribs=Array('margin','border-bottom-color','border-bottom-width','border-bottom-style','border-top-color','border-top-width','border-top-style','border-left-color','border-left-width','border-left-style','border-right-color','border-right-width','border-right-style','background-color','color','font-family','font-size','font-weight','padding','width','height','text-align','text-decoration','cursor','visibility');var newStyles=window.getComputedStyle(theNode,null);for(var lcv=0;lcv<copyAttribs.length;lcv++){var attribName=copyAttribs[lcv];var attribValue=newStyles.getPropertyValue(attribName);if((attribValue!=null)&&(attribValue!='')&&(attribValue!='undefined')&&(attribValue!='none')&&(attribValue!='normal')&&(attribValue!='auto')&&(attribValue!='transparent')&&(attribValue!='visible')&&(attribValue!='inherit'))newNode.style.setProperty(attribName,attribValue,null)}}}for(var lcv=0;lcv<theNode.childNodes.length;lcv++){var cNode=duplicateNodeTreeEmbeddingStylesSubset(theNode.childNodes[lcv]);if(cNode!=null)newNode.appendChild(cNode)}return(newNode)};document.addStylesheet=function(url){var callback=(arguments.length>1)?arguments[1]:null;var ele=document.createElement('LINK');ele.setAttribute('type','text/css');ele.setAttribute('href',url);ele.setAttribute('rel','stylesheet');ele.setAttribute('disabled','false');if(typeof(callback)=='function'){if(ele.readyState==null){ele.addEventListener("load",function(){callback(url)},false)}else{ele.onreadystatechange=function(){if((ele.readyState=='loaded')||(ele.readyState=='complete')){setTimeout("",0);callback(url)}}}};document.getElementsByTagName('head')[0].appendChild(ele);ele.disabled=false};function cloneObject(originalObject){if(originalObject==null)newObject=null;else{var newObject=null;var objectType=typeof(originalObject);objectType=objectType.toLowerCase();if(objectType=="object"){var con=originalObject.constructor;if(con==Date)objectType="date";else if(con==Array)objectType="array";else type="object"}switch(objectType){case"object":newObject=new Object;for(var i in originalObject){if(i=='toJSONString')continue;try{newObject[i]=cloneObject(originalObject[i])}catch(e){dprintf('Warning: attribute "'+i+'" could not be duplicated by cloneNode.',false,"logWarning");newObject[i]=null}}break;case"array":newObject=new Array;for(var i=0;i<originalObject.length;i++)newObject[i]=cloneObject(originalObject[i]);break;default:newObject=originalObject}}return newObject};var CSSClass={};CSSClass.is=function(e,c){if(typeof e=="string")e=document.getElementById(e);var classes=e.className;if(!classes)return false;if(classes==c)return true;return e.className.search("\\b"+c+"\\b")!=-1};CSSClass.add=function(e,c){if(typeof e=="string")e=document.getElementById(e);if(CSSClass.is(e,c))return;if(e.className)c=" "+c;e.className+=c};CSSClass.remove=function(e,c){if(typeof e=="string")e=document.getElementById(e);e.className=e.className.replace(new RegExp("\\b"+c+"\\b\\s*","g"),"")};CSSClass.set=function(elementId,newClass){var elementReference=((typeof(elementId)=='object')?(elementId):(document.getElementById(elementId)));while((elementReference!=null)&&(elementReference.nodeName=='#text'))elementReference=elementReference.parentNode;if(elementReference!=null)elementReference.className=newClass};setClass=CSSClass.set;function convertDistance(dist,srcUnit,destUnit){if(srcUnit==destUnit)return(dist);var newdist=dist;switch(srcUnit.toLowerCase()){case'mm':newdist=dist/1000.0;break;case'cm':newdist=dist/100.0;break;case'm':newdist=dist;break;case'km':newdist=dist*1000;break;case'in':newdist=dist*0.0254;break;case'ft':newdist=dist*0.3048;break;case'yd':newdist=dist*0.9144;break;case'mi':newdist=dist*1609.344;break}switch(destUnit.toLowerCase()){case'mm':newdist=newdist*1000;break;case'cm':newdist=newdist*100;break;case'in':newdist=newdist*39.37007874;break;case'ft':newdist=newdist*3.2808399;break;case'yd':newdist=newdist*1.0936133;break;case'mi':newdist=newdist*0.00062137;break;case'm':break;case'km':newdist=newdist*.001;break}return(newdist)};Freeance_Communication=function(){};Freeance_Communication.javascript_load=function(scriptURL){if(document.jsload_setwait)document.jsload_setwait(true);var callback=(arguments.length>1)?arguments[1]:null;var ele=document.createElement('SCRIPT');if(ele.readyState==null){ele.addEventListener("load",function(e){if(document.jsload_setwait)document.jsload_setwait(false);if(typeof(callback)=='function')callback()},false)}else{ele.onreadystatechange=function(){if((ele.readyState=='loaded')||(ele.readyState=='complete')){if(document.jsload_setwait)document.jsload_setwait(false);setTimeout("",0);if(typeof(callback)=='function')callback()}}};ele.setAttribute('type','text/javascript');ele.setAttribute('language','JavaScript');ele.setAttribute('src',scriptURL);document.getElementsByTagName('head')[0].appendChild(ele);return true};loadJavaScript=Freeance_Communication.javascript_load;Freeance_Communication.xmlrpc_request=function(){var Callback=arguments[0];var functionName=arguments[1];var returnValue=null;var thisRequest=new XMLRPCMessage(functionName);for(lcv=2;lcv<arguments.length;lcv++)thisRequest.addParameter(arguments[lcv]);var thisRequestDoc=XmlDocument.create();thisRequestDoc.loadXML(thisRequest.xml());if(Callback)returnValue=XmlHttp.postAsync_(FREEANCE_XMLRPC_URL,thisRequestDoc,function(xmlrpc_response){Callback(getXMLRPCResponseObject(xmlrpc_response))});else returnValue=getXMLRPCResponseObject(XmlHttp.postSync(FREEANCE_XMLRPC_URL,thisRequestDoc));return returnValue};freeance_request=Freeance_Communication.xmlrpc_request;Freeance_Error=function(){};Freeance_Error.is_error=function(data){if(data===null)return true;if(data===undefined)return true;if(data['XMLRPC_FAULT'])return true;if(data['FREEANCE_FAULT'])return true;if(data['GUILIB_FAULT'])return true;return false};Freeance_Error.get_message=function(data){if(data===null)return'Value is null';if(data===undefined)return'Value is undefined';if(data['XMLRPC_FAULT'])return data['XMLRPC_FAULT_MESSAGE'];if(data['FREEANCE_FAULT'])return data['FREEANCE_FAULT_MESSAGE'];if(data['GUILIB_FAULT'])return data['GUILIB_FAULT_MESSAGE'];return null};Freeance_Error.get_code=function(data){if(data===null)return-1001;if(data===undefined)return-1002;if(data['XMLRPC_FAULT'])return data['XMLRPC_FAULT_CODE'];if(data['FREEANCE_FAULT'])return data['FREEANCE_FAULT_CODE'];if(data['GUILIB_FAULT'])return data['GUILIB_FAULT_CODE'];return null};Freeance_Error.xmldoc_is_valid=function(xmlDoc){try{if(xmlDoc==null)return false;var xmlstr=(typeof(xmlDoc.xml)=='function')?xmlDoc.xml():xmlDoc.xml;if(xmlstr=='')return false;if(xmlDoc.documentElement.nodeName=='parsererror')return false;return true}catch(e){return false}};Freeance_Event=function(){};Freeance_Event.add=function(ele,type,fcn){type=type.toLowerCase();var cap=(arguments.length>3)?arguments[3]:false;if(!ele.FREEANCE_EVENTS)ele.FREEANCE_EVENTS=[];ele.FREEANCE_EVENTS.push({evt:type,fcn:fcn});if(ele.addEventListener)ele.addEventListener(type,fcn,cap);else if(ele.attachEvent)ele.attachEvent('on'+type,fcn);else return{FREEANCE_FAULT:true,FREEANCE_FAULT_CODE:-1003,FREEANCE_FAULT_MESSAGE:'Browser does not support dynamic addition of events to elements'};return true};Freeance_Event.remove=function(ele,type,fcn){type=type.toLowerCase();var cap=(arguments.length>3)?arguments[3]:false;if(ele.FREEANCE_EVENTS){for(var i=0;i<ele.FREEANCE_EVENTS.length;i++)if(ele.FREEANCE_EVENTS[i])if((ele.FREEANCE_EVENTS[i]['evt']==type)&&(ele.FREEANCE_EVENTS[i]['fcn']==fcn))ele.FREEANCE_EVENTS[i]=null}if(ele.removeEventListener)ele.removeEventListener(type,fcn,cap);else if(ele.detachEvent)ele.detachEvent('on'+type,fcn);else return{FREEANCE_FAULT:true,FREEANCE_FAULT_CODE:-1003,FREEANCE_FAULT_MESSAGE:'Browser does not support dynamic addition of events to elements'};return true};Freeance_Event.remove_all=function(ele){if(ele.FREEANCE_EVENTS!=null){for(var i=0;i<ele.FREEANCE_EVENTS.length;i++){if(ele.removeEventListener)ele.removeEventListener(ele.FREEANCE_EVENTS[i]['evt'],ele.FREEANCE_EVENTS[i]['fcn'],ele.FREEANCE_EVENTS[i]['cap']);else if(ele.detachEvent)ele.detachEvent('on'+ele.FREEANCE_EVENTS[i]['evt'],ele.FREEANCE_EVENTS[i]['fcn']);else return{FREEANCE_FAULT:true,FREEANCE_FAULT_CODE:-1003,FREEANCE_FAULT_MESSAGE:'Browser does not support dynamic addition of events to elements'}}ele.FREEANCE_EVENTS=null}return true};
function TemplateWidget(){this.imethod="var html = new Array();";this.smethod="html.push(";this.emethod=");\n";this.cmethod="return(html.join(''));\n";this.badAttributeCharacters=Array();this.escapeDoubleQuotes=function(str){return(str.replace(/\"/g,'\\"'))};this.modifyBadAttributeCharacters=function(theHTML){for(var lcv=0;lcv<this.badAttributeCharacters.length;lcv++)theHTML=String.replaceStr(theHTML,this.badAttributeCharacters[lcv][0],this.badAttributeCharacters[lcv][1],false);return(theHTML)};this.rebuildNode=function(node){var nodeStrObj={start:'<'+node.nodeName,template:Array()};var attribStr='';for(var key=0;key<node.attributes.length;key++){if(node.attributes[key].specified){var attribName=node.attributes[key].name;var attribValue=node.attributes[key].value;if(attribName.substr(0,9)!='template_')attribStr+=' '+attribName+'="'+attribValue+'"';else nodeStrObj.template[attribName]=attribValue}}nodeStrObj.start+=this.escapeDoubleQuotes(attribStr)+'>';nodeStrObj.end='</'+node.nodeName+'>';return(nodeStrObj)};this.templateToJS=function(theHTML){var thedoc=XmlDocument.create();theHTML=['<span>',this.modifyBadAttributeCharacters(theHTML.replace(/\\/g,'\\\\').replace(/\n/g,'\\n')),'</span>'].join('');thedoc.loadXML(theHTML);node=thedoc.documentElement;var srcCode=this.imethod+"\n"+this.process(node);var JSObj={html:theHTML,srcCode:srcCode,toEval:"JSObj.run = function(data){ "+srcCode+"\n"+this.cmethod+" }"};try{eval(JSObj.toEval)}catch(e){var errstr='';e.sourceHTML=JSObj.html;var xmlstr=(typeof(thedoc.xml)=='function')?thedoc.xml():thedoc.xml;e.postHTML=xmlstr;JSObj.errstr='Invalid Template: '+e.message+' on line '+e.lineNumber+'\n~~~~~~~~~~~~~~~~~~~~~~~~~\nPost HTML: '+e.postHTML+'\n~~~~~~~~~~~~~~~~~~~~~~~~~\nSource HTML: '+e.sourceHTML;JSObj.run=function(data){return('<textarea height="100%" width="100%" style="width:100%;height:100%">'+JSObj.errstr+'\n~~~~~~~~~~~~~~~~~~~~~~~~~\nCode:\n'+JSObj.srcCode+'</textarea>')}}return(JSObj)};this.process=function(node,dataprefix,nestlevel,parentLoop){if(typeof(dataprefix)=='undefined')dataprefix='';if(typeof(nestlevel)=='undefined')nestlevel=0;if(typeof(parentLoop)=='undefined')parentLoop='';var loopnumber=0;var srcCode=[];if(node==null)return('');var okToPreProcess=true;var okToDescend=true;var okToPostProcess=true;var smethod=this.smethod;var emethod=this.emethod;switch(node.nodeType){case 1:var rebuild=this.rebuildNode(node);if((typeof rebuild.template['template_enabled']!='undefined')&&(rebuild.template['template_enabled'].toUpperCase()=='Y')){switch(rebuild.template['template_type'].toLowerCase()){case'dbvalue':okToPreProcess=okToDescend=false;srcCode.push(smethod,'"',rebuild.start.substr(0,rebuild.start.length-1),' datavalue=\\"','"',this.emethod,smethod,'(data',dataprefix,'["',rebuild.template['template_value_field'],'"])?document._JITT_.decodeHTMLEntities(data',dataprefix,'["',rebuild.template['template_value_field'],'"]):""',emethod,smethod,'"\\">"',emethod,smethod,'(data',dataprefix,'["',rebuild.template['template_value_field'],'"])?data',dataprefix,'["',rebuild.template['template_value_field'],'"]:"&nbsp;"',emethod);break;case'block':dataprefix+='["'+rebuild.template['template_value_field']+'"]';srcCode.push('if (typeof(data',dataprefix,')==\'undefined\') data',dataprefix,"=Array();\n");break;case'repeatblock':okToPreProcess=okToDescend=okToPostProcess=false;if(rebuild.template['template_value_field'])dataprefix+='["'+rebuild.template['template_value_field']+'"]';var loopname='loop'+nestlevel+'_'+loopnumber;srcCode.push('for(var ',loopname,' in data',dataprefix,')\n','{\n','if(',loopname,'==\'toJSONString\'){continue;}',smethod,' "',rebuild.start,'"',emethod);loopnumber++;dataprefix+='['+loopname+']';parentLoop=loopname;for(var ilv=0;ilv<node.childNodes.length;ilv++)srcCode.push(this.process(node.childNodes[ilv],dataprefix,++nestlevel,parentLoop));srcCode.push(smethod,' "',rebuild.end,'"',emethod,'}\n');break;case'rownum':var offset=0;if(rebuild.template['template_startwith'])offset=parseInt(rebuild.template['template_startwith']);srcCode.push(smethod);if(offset>0)srcCode.push(offset,'+');else if(offset<0)srcCode.push(offset);srcCode.push('parseInt(',parentLoop,')',emethod);break;case'date':okToDescend=false;var format=(rebuild.template['template_format']?rebuild.template['template_format']:"");srcCode.push(smethod,'document._JITT_.buildDate(null,"',format,'")',emethod);break;case'dbdate':okToDescend=false;var field=rebuild.template['template_value_field']?rebuild.template['template_value_field']:"";if(field!="")srcCode.push(smethod,'document._JITT_.buildDate((data',dataprefix,'["',rebuild.template['template_value_field'],'"])?data',dataprefix,'["',rebuild.template['template_value_field'],'"]:"",',(rebuild.template['template_format']?('"'+rebuild.template['template_format']+'"'):'""'),')',emethod);else srcCode.push(smethod,"&nbsp;",emethod);break;case'time':okToDescend=false;srcCode.push(smethod,'document._JITT_.buildTime(null,"',(rebuild.template['template_format']?rebuild.template['template_format']:""),'")',emethod);break;case'dbtime':okToDescend=false;var field=rebuild.template['template_value_field']?rebuild.template['template_value_field']:"";if(field!="")srcCode.push(smethod,'document._JITT_.buildTime((data',dataprefix,'["',rebuild.template['template_value_field'],'"])?data',dataprefix,'["',rebuild.template['template_value_field'],'"]:"",',(rebuild.template['template_format']?('"'+rebuild.template['template_format']+'"'):'""'),')',emethod);else srcCode.push(smethod,"&nbsp;",emethod);break;case'anchor':okToPreProcess=okToDescend=false;srcCode.push(smethod,'"',rebuild.start.substr(0,rebuild.start.length-1),' href=\\"','"',emethod,smethod,'"',rebuild.template['template_beforeurl'],'"',emethod,smethod,'(data',dataprefix,'["',rebuild.template['template_urlfield'],'"])?document._JITT_.decodeHTMLEntities(data',dataprefix,'["',rebuild.template['template_urlfield'],'"]):""',emethod,smethod,'"',rebuild.template['template_afterurl'],'"',emethod,smethod,'"\\">"',emethod,smethod,'"',rebuild.template['template_beforelabel'],'"',emethod,smethod,'(data',dataprefix,'["',rebuild.template['template_labelfield'],'"])?data',dataprefix,'["',rebuild.template['template_labelfield'],'"]:""',emethod,smethod,'"',rebuild.template['template_afterlabel'],'"',emethod);break;case'dbimage':okToPreProcess=okToDescend=false;srcCode.push(smethod,'"',rebuild.start.substr(0,rebuild.start.length-1),' src=\\"','"',emethod,smethod,'"',rebuild.template['template_beforeurl'],'"',emethod,smethod,'(data',dataprefix,'["',rebuild.template['template_urlfield'],'"])?document._JITT_.decodeHTMLEntities(data',dataprefix,'["',rebuild.template['template_urlfield'],'"]):""',emethod,smethod,'"',rebuild.template['template_afterurl'],'"',emethod,smethod,'"\\""',emethod,smethod,'" alt=\\"','"',emethod,smethod,'"',rebuild.template['template_beforealt'],'"',emethod,smethod,'(data',dataprefix,'["',rebuild.template['template_altfield'],'"])?data',dataprefix,'["',rebuild.template['template_altfield'],'"]:""',emethod,smethod,'"',rebuild.template['template_afteralt'],'"',emethod,smethod,'"\\""',emethod,smethod,'" title=\\"','"',emethod,smethod,'"',rebuild.template['template_beforealt'],'"',emethod,smethod,'(data',dataprefix,'["',rebuild.template['template_altfield'],'"])?data',dataprefix,'["',rebuild.template['template_altfield'],'"]:""',emethod,smethod,'"',rebuild.template['template_afteralt'],'"',emethod,smethod,'"\\">"',emethod);break;case'maplink':okToPreProcess=okToDescend=false;srcCode.push(smethod,'"',rebuild.start.substr(0,rebuild.start.length-1),' datavalue=\\"','"',emethod,smethod,'(data',dataprefix,'["',rebuild.template['template_key_field'],'"])?document._JITT_.decodeHTMLEntities(data',dataprefix,'["',rebuild.template['template_key_field'],'"]):""',emethod,smethod,'"\\">"',emethod,smethod,'(data',dataprefix,'["',rebuild.template['template_value_field'],'"])?data',dataprefix,'["',rebuild.template['template_value_field'],'"]:"&nbsp;"',emethod);break}}if(okToPreProcess)if(rebuild.start)srcCode.unshift(smethod,'"',rebuild.start,'"',emethod);if(okToDescend){for(var ilv=0;ilv<node.childNodes.length;ilv++)srcCode.push(this.process(node.childNodes[ilv],dataprefix,++nestlevel,parentLoop))}if(okToPostProcess)if(rebuild.end)srcCode.push(smethod,'"',rebuild.end,'"',emethod);break;case 3:case 4:okToPreProcess=okToDescend=okToPostProcess=false;srcCode.push(smethod,'"',this.escapeDoubleQuotes(node.nodeValue),'"',emethod);break}return(srcCode.join(''))};this.renderFromHTMLElement=function(sourceElement,targetElement,data){targetElement.innerHTML=this.templateToJS(sourceElement.innerHTML).run(data)};this.renderFromHTMLString=function(sourcehtml,targetElement,data){targetElement.innerHTML=this.templateToJS(sourcehtml).run(data)};this.badAttributeCharacters.push(['<YYYY>','&lt;YYYY&gt;'],['<YY>','&lt;YY&gt;'],['<MMM>','&lt;MMM&gt;'],['<MM>','&lt;MM&gt;'],['<M>','&lt;M&gt;'],['<DDD>','&lt;DDD&gt;'],['<DD>','&lt;DD&gt;'],['<D>','&lt;D&gt;'],['<HH>','&lt;HH&gt;'],['<hh>','&lt;hh&gt;'],['<H>','&lt;H&gt;'],['<h>','&lt;h&gt;'],['<mm>','&lt;mm&gt;'],['<ss>','&lt;ss&gt;'],['<ampm>','&lt;ampm&gt;'],['<AMPM>','&lt;AMPM&gt;'])};document._JITT_={twoDigitStr:function(value){var str=new String(value);if(value<10)str='0'+str;return(str)},buildDate:function(datestr,format){if(datestr=="")return('&nbsp;');if(!document._JITT_.jitstore){if((document.babelfish)&&(document.babelfish.getActiveLanguage()!='EN')){document._JITT_.jitstore={FullMonths:Array(document.babelfish.translateWord('January'),document.babelfish.translateWord('February'),document.babelfish.translateWord('March'),document.babelfish.translateWord('April'),document.babelfish.translateWord('May'),document.babelfish.translateWord('June'),document.babelfish.translateWord('July'),document.babelfish.translateWord('August'),document.babelfish.translateWord('September'),document.babelfish.translateWord('October'),document.babelfish.translateWord('November'),document.babelfish.translateWord('December')),ShortMonths:Array(document.babelfish.translateWord('Jan'),document.babelfish.translateWord('Feb'),document.babelfish.translateWord('Mar'),document.babelfish.translateWord('Apr'),document.babelfish.translateWord('May'),document.babelfish.translateWord('Jun'),document.babelfish.translateWord('Jul'),document.babelfish.translateWord('Aug'),document.babelfish.translateWord('Sep'),document.babelfish.translateWord('Oct'),document.babelfish.translateWord('Nov'),document.babelfish.translateWord('Dec')),FullDOW:Array(document.babelfish.translateWord('Sunday'),document.babelfish.translateWord('Monday'),document.babelfish.translateWord('Tuesday'),document.babelfish.translateWord('Wednesday'),document.babelfish.translateWord('Thursday'),document.babelfish.translateWord('Friday'),document.babelfish.translateWord('Saturday')),ShortDOW:Array(document.babelfish.translateWord('Sun'),document.babelfish.translateWord('Mon'),document.babelfish.translateWord('Tue'),document.babelfish.translateWord('Wed'),document.babelfish.translateWord('Thu'),document.babelfish.translateWord('Fri'),document.babelfish.translateWord('Sat'))}}else{document._JITT_.jitstore={FullMonths:['January','February','March','April','May','June','July','August','September','October','November','December'],ShortMonths:['Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'],FullDOW:['Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'],ShortDOW:['Sun','Mon','Tue','Wed','Thu','Fri','Sat']}}};if(format=='')format='<M> <DD>, <YYYY>';var thedate=(datestr==null)?(new Date()):(new Date(parseInt(datestr)));var year=thedate.getYear();if(year<1900)year+=1900;var shortyear=year%100;return(format.replace(/<YYYY>/g,year).replace(/<YY>/g,document._JITT_.twoDigitStr(shortyear)).replace(/<MMM>/g,document._JITT_.jitstore.ShortMonths[thedate.getMonth()]).replace(/<MM>/g,document._JITT_.twoDigitStr(thedate.getMonth()+1)).replace(/<M>/g,document._JITT_.jitstore.FullMonths[thedate.getMonth()]).replace(/<DDD>/g,document._JITT_.jitstore.ShortDOW[thedate.getDay()]).replace(/<DD>/g,document._JITT_.twoDigitStr(thedate.getDate())).replace(/<D>/g,document._JITT_.jitstore.FullDOW[thedate.getDay()]))},buildTime:function(timestr,format){if(timestr=="")return('&nbsp;');if(!document._JITT_.jitstore){document._JITT_.jitstore=new Object()}if((!document._JITT_.jitstore.am)||(!document._JITT_.jitstore.pm)){if((document.babelfish)&&(document.babelfish.getActiveLanguage()!='EN')){document._JITT_.jitstore.am=document.babelfish.translateWord('am');document._JITT_.jitstore.pm=document.babelfish.translateWord('pm')}else{document._JITT_.jitstore.am='am';document._JITT_.jitstore.pm='pm'}}if(format=='')format='<h>:<mm><ampm>';var timenow=(timestr==null)?(new Date()):(new Date(parseInt(timestr)));var ampm=(timenow.getHours()<=11)?document._JITT_.jitstore.am:document._JITT_.jitstore.pm;var ampmhours=timenow.getHours()%12;if(ampmhours==0)ampmhours=12;format.replace('<HH>',document._JITT_.twoDigitStr(timenow.getHours())).replace(/<hh>/,document._JITT_.twoDigitStr(ampmhours)).replace(/<H>/,timenow.getHours()).replace(/<h>/,ampmhours).replace(/<mm>/,document._JITT_.twoDigitStr(timenow.getMinutes())).replace(/<ss>/,document._JITT_.twoDigitStr(timenow.getSeconds())).replace(/<ampm>/,ampm).replace(/<AMPM>/,ampm.toUpperCase());return(format)},decodeHTMLEntities:function(orig){return orig.toString().replace(/&amp;/g,'&').replace(/&nbsp;/g,' ').replace(/&gt;/g,'>').replace(/&lt;/g,'<').replace(/&quot;/g,'&')}};
DEBUG_TARGET=null;dprintf=function(msg){if(arguments.length>2){if(arguments[2]=='logWarning')console.warn(msg);else if(arguments[2]=='logError')console.error(msg);else console.log(msg)}else console.log(msg)};
function XMLParser(newXmlDoc){return this.init(newXmlDoc)};XMLParser.prototype.init=function(newXmlDoc){this.xmlDoc=newXmlDoc||null;if(this.xmlDoc==null)return(this)};XMLParser.prototype.setDocumentByDoc=function(newXmlDoc){if(!newXmlDoc)return null;else this.xmlDoc=newXmlDoc};XMLParser.prototype.setDocumentByStr=function(XMLParserStr){if(!XMLParserStr)return;if(this.xmlDoc==null)this.xmlDoc=XmlDocument.create();this.xmlDoc.loadXML(XMLParserStr)};XMLParser.decodeSTRING=function(theNode){if(theNode)if(theNode.childNodes.length>0)return(theNode.childNodes[0].nodeValue);return('')};XMLParser.prototype.decodeSTRING=XMLParser.decodeSTRING;XMLParser.prototype.decodeINT=XMLParser.decodeINT=function(theNode){var theSTRING=XMLParser.decodeSTRING(theNode);return(parseInt(theSTRING,10))};XMLParser.prototype.decodeBOOLEAN=XMLParser.decodeBOOLEAN=function(theNode){var theSTRING=this.decodeSTRING(theNode);return(parseInt(theSTRING)==1)};XMLParser.prototype.decodeDOUBLE=XMLParser.decodeDOUBLE=function(theNode){var theSTRING=this.decodeSTRING(theNode);return(parseFloat(theSTRING))};XMLParser.prototype.decodeDATETIME=function(theNode){};XMLParser.prototype.decodeBASE64=function(theNode){};XMLParser.prototype.getNextChildNodeIndex=XMLParser.prototype.__helper__getNextElementChildNode=XMLParser.getNextElementChildNode=function(aNode,firstpos){var foundpos=-1;for(var lcv=firstpos;(lcv<aNode.childNodes.length)&&(foundpos==-1);lcv++)if(aNode.childNodes[lcv].nodeType==1)foundpos=lcv;return(foundpos)};XMLParser.prototype.getNextNamedChildNodeIndex=XMLParser.prototype.getNextElementNamedChildNode=XMLParser.prototype.__helper__getNextElementNamedChildNode=XMLParser.getNextElementNamedChildNode=function(aNode,firstpos,nodeName){for(var lcv=firstpos;lcv<aNode.childNodes.length;lcv++)if((aNode.childNodes[lcv].nodeType==1)&&(aNode.childNodes[lcv].nodeName==nodeName))return(lcv);return(-1)};XMLParser.prototype.getRemainingNamedChildNodes=XMLParser.prototype.__helper__getRemainingNextElementNamedChildNodes=XMLParser.getRemainingNextElementNamedChildNodes=function(aNode,firstpos,nodeName){var nodeCollection=new Array();for(var lcv=firstpos;lcv<aNode.childNodes.length;lcv++)if((aNode.childNodes[lcv].nodeType==1)&&(aNode.childNodes[lcv].nodeName==nodeName))nodeCollection[nodeCollection.length]=aNode.childNodes[lcv];return(nodeCollection)};
FreeanceXMLParser=function(newID){};FreeanceXMLParser.prototype=new XMLParser();FreeanceXMLParser.prototype.constructor=FreeanceXMLParser;FreeanceXMLParser.superclass=XMLParser.prototype;FreeanceXMLParser.prototype.getApplicationConfig=function(){var appNode=this.xmlDoc.getElementsByTagName('applicationConfig')[0];var styleindex=this.getNextNamedChildNodeIndex(appNode,0,"stylesheet");var customLayoutIndex=this.getNextNamedChildNodeIndex(appNode,0,"customOptions");var mapUnitIndex=this.getNextNamedChildNodeIndex(appNode,0,"mapUnits");var nodeIndex=this.getNextNamedChildNodeIndex(appNode,0,"userScripts");return{id:this.decodeSTRING(appNode.childNodes[this.getNextNamedChildNodeIndex(appNode,0,"applicationId")]),organization:this.decodeSTRING(appNode.childNodes[this.getNextNamedChildNodeIndex(appNode,0,"organization")]),title:this.decodeSTRING(appNode.childNodes[this.getNextNamedChildNodeIndex(appNode,0,"title")]),clientType:this.decodeSTRING(appNode.childNodes[this.getNextNamedChildNodeIndex(appNode,0,"clientType")]),stylesheet:(styleindex==-1)?'default':this.decodeSTRING(appNode.childNodes[styleindex]),administrator:this.decodeSTRING(appNode.childNodes[this.getNextNamedChildNodeIndex(appNode,0,"administrator")]),adminEmail:this.decodeSTRING(appNode.childNodes[this.getNextNamedChildNodeIndex(appNode,0,"adminEmail")]),customOptions:((customLayoutIndex!=-1)?(this.parseApplicationCustomOptions(appNode.childNodes[customLayoutIndex])):(null)),mapUnits:(mapUnitIndex>-1)?(this.decodeSTRING(appNode.childNodes[mapUnitIndex])):('FT'),userScripts:(nodeIndex==-1)?(Array()):(this.parseUserScripts(appNode.childNodes[nodeIndex]))}};FreeanceXMLParser.prototype.parseUserScripts=function(parentNode){var config=[];var scriptNodes=parentNode.getElementsByTagName('scriptfile');for(var i=0;i<scriptNodes.length;i++)config.push(scriptNodes[i].getAttribute('url'));return config};FreeanceXMLParser.prototype.parseApplicationCustomOptions=function(customNode){var activepanelindex=this.getNextNamedChildNodeIndex(customNode,0,"defaultActivePanel");var redrawIndex=this.getNextNamedChildNodeIndex(customNode,0,"mapAutoRedraw");var deselectIndex=this.getNextNamedChildNodeIndex(customNode,0,"clickDeselect");var freezeIndex=this.getNextNamedChildNodeIndex(customNode,0,"freezeTableHeader");var legendIndex=this.getNextNamedChildNodeIndex(customNode,0,"customLegendURL");var scriptIndex=this.getNextNamedChildNodeIndex(customNode,0,"customScriptURL");var expandSearchIndex=this.getNextNamedChildNodeIndex(customNode,0,"expandSearch");var childNodes=customNode.childNodes;return{pageHeaderHeight:this.decodeINT(childNodes[this.getNextNamedChildNodeIndex(customNode,0,"pageHeaderHeight")]),rightPanelWidth:this.decodeINT(childNodes[this.getNextNamedChildNodeIndex(customNode,0,"rightPanelWidth")]),mapToolOptionHeight:this.decodeINT(childNodes[this.getNextNamedChildNodeIndex(customNode,0,"mapToolOptionHeight")]),vicinityMapWidthOpen:this.decodeINT(childNodes[this.getNextNamedChildNodeIndex(customNode,0,"vicinityMapWidthOpen")]),homeLinkHeight:this.decodeINT(childNodes[this.getNextNamedChildNodeIndex(customNode,0,"homeLinkHeight")]),defaultActivePanel:(activepanelindex>-1)?(this.decodeSTRING(childNodes[activepanelindex])):('userIntro'),mapAutoRedraw:(redrawIndex==-1)?(true):(this.decodeINT(childNodes[redrawIndex])==1),clickDeselect:(deselectIndex==-1)?(true):(this.decodeINT(childNodes[deselectIndex])==1),expandSearch:(expandSearchIndex==-1)?(false):(this.decodeINT(childNodes[expandSearchIndex])==1),freezeTableHeader:(freezeIndex==-1)?(true):(this.decodeINT(childNodes[freezeIndex])==1),customLegendURL:(legendIndex==-1)?(''):(this.decodeSTRING(childNodes[legendIndex])),customScriptURL:(scriptIndex==-1)?(''):(this.decodeSTRING(childNodes[scriptIndex]))}};FreeanceXMLParser.prototype.getMapConfig=function(){var mapNode=this.xmlDoc.getElementsByTagName('map')[0];var vmapNodes=mapNode.getElementsByTagName('vicinityMap');var loginQueryNodes=mapNode.getElementsByTagName("loginQuery");var printNodes=mapNode.getElementsByTagName("pdfPrintConfig");var exportNodes=mapNode.getElementsByTagName('exportConfig');var proxSearchNodes=mapNode.getElementsByTagName('proximitySearchConfig');var mapSchemeNodes=mapNode.getElementsByTagName('mapSchemeDefinitions');var legendAttributeIndex=this.__helper__getNextElementNamedChildNode(mapNode,0,"legendAttributes");var legendIndex=this.__helper__getNextElementNamedChildNode(mapNode,0,"legend");var legendAttributes=this.parseLegendAttributes(mapNode.childNodes[(legendAttributeIndex>-1)?legendAttributeIndex:legendIndex]);var seamlessPanIdx=this.__helper__getNextElementNamedChildNode(mapNode,0,"seamlessPan");var seamlessPan=false;if(seamlessPanIdx!=-1)seamlessPan=(mapNode.childNodes[seamlessPanIdx].getAttribute('enabled')=='true');var projectionId=0;var projectionIdx=this.__helper__getNextElementNamedChildNode(mapNode,0,'projectionId');if(projectionIdx!=-1)projectionId=(mapNode.childNodes[projectionIdx].getAttribute('value')!=null)?(parseInt(mapNode.childNodes[projectionIdx].getAttribute('value'))):(this.decodeINT(mapNode.childNodes[projectionIdx]));var mapConfig={configNode:mapNode,id:mapNode.getAttribute("id"),resourceId:this.decodeSTRING(mapNode.getElementsByTagName("resourceId")[0]),imsHostname:this.decodeSTRING(mapNode.getElementsByTagName("imsHostname")[0]),previousStates:this.decodeINT(mapNode.getElementsByTagName("previousStates")[0]),vmap:(vmapNodes.length)?this.parseVMapConfig(vmapNodes[0]):null,themes:this.parseThemeDefinitions(mapNode.getElementsByTagName("themeDefinitions")[0]),activeTheme:this.decodeSTRING(mapNode.getElementsByTagName("activeTheme")[0]),themeGroups:this.parseThemeGroups(mapNode),legendAttributes:legendAttributes,labelConfig:null,loginQuery:(loginQueryNodes.length)?this.parseMapLoginQuery(loginQueryNodes[0]):null,printConfig:(printNodes.length)?this.parsePdfPrintConfig(printNodes[0]):{templates:new Array,defaultTemplate:-1},exportConfig:(exportNodes.length)?this.parseExportConfig(exportNodes[0]):null,scalebarConfig:null,geocodeConfig:null,directMappingConfig:null,mapSchemeConfig:(mapSchemeNodes.length)?this.parseMapSchemeConfig(mapSchemeNodes[0]):{mapSchemes:[],defaultMapScheme:0},seamlessPan:seamlessPan,projectionId:projectionId};return mapConfig};FreeanceXMLParser.prototype.parseThemeGroups=function(mapNode){var config=[];var themeGroupDefinitionNodes=mapNode.getElementsByTagName("themeGroupDefinitions");var layerControlNodes=mapNode.getElementsByTagName("layerControl");if(themeGroupDefinitionNodes.length>0){config=this.parseOldThemeGroups(themeGroupDefinitionNodes[0])}else{for(var i=0;i<layerControlNodes[0].childNodes.length;i++)if(layerControlNodes[0].childNodes[i].nodeName=='groupItem')config.push(this.parseThemeGroupItem(layerControlNodes[0].childNodes[i]))};return config};FreeanceXMLParser.prototype.parseThemeGroupItem=function(groupItemNode){var config={type:groupItemNode.getAttribute('type'),name:groupItemNode.getAttribute('name'),layerid:groupItemNode.getAttribute('layerid'),toggle:groupItemNode.getAttribute('toggle')=='on',children:[]};if(config.type=='group')for(var i=0;i<groupItemNode.childNodes.length;i++)if(groupItemNode.childNodes[i].nodeName=='groupItem')config.children.push(this.parseThemeGroupItem(groupItemNode.childNodes[i]));return config};FreeanceXMLParser.prototype.parseOldThemeGroups=function(parentNode){var config=[];var childconfig=[];var groupMemberNodes=null;var groupNodes=parentNode.getElementsByTagName('themeGroup');if(groupNodes.length==1){config.push({type:'label',name:this.decodeSTRING(groupNodes[0].getElementsByTagName('themeGroupName')[0]),toggle:false});groupMemberNodes=groupNodes[0].getElementsByTagName('themeGroupMember');for(var i=0;i<groupMemberNodes.length;i++){config.push({type:'layer',layerid:this.decodeSTRING(groupMemberNodes[i]),toggle:true})}}else{for(var i=0;i<groupNodes.length;i++){childconfig=[];groupMemberNodes=groupNodes[i].getElementsByTagName('themeGroupMember');for(var j=0;j<groupMemberNodes.length;j++){childconfig.push({type:'layer',layerid:this.decodeSTRING(groupMemberNodes[j]),name:'',toggle:true,children:[]})}config.push({type:'group',name:this.decodeSTRING(groupNodes[i].getElementsByTagName('themeGroupName')[0]),layerid:'',toggle:false,children:childconfig})}};return config};FreeanceXMLParser.prototype.parseMapSchemeConfig=function(mapSchemeConfigNode){var mapSchemeTags=this.__helper__getRemainingNextElementNamedChildNodes(mapSchemeConfigNode,0,"mapScheme");var defaultMapSchemeNode=mapSchemeConfigNode.childNodes[this.__helper__getNextElementNamedChildNode(mapSchemeConfigNode,0,"defaultScheme")];var mapSchemes=new Array;if(mapSchemeTags.length>0){for(var i=0;i<mapSchemeTags.length;i++){var currentMapSchemeId=parseInt(mapSchemeTags[i].getAttribute('id'));var themes=new Object;var themeTags=this.__helper__getRemainingNextElementNamedChildNodes(mapSchemeTags[i],0,"theme");for(var currentTheme=0;currentTheme<themeTags.length;currentTheme++){themeId=themeTags[currentTheme].getAttribute('id');themes[themeId]={id:themeId,display:parseInt(themeTags[currentTheme].getAttribute('display')),legend:themeTags[currentTheme].getAttribute('legend')}};mapSchemes.push({id:currentMapSchemeId,name:this.decodeSTRING(mapSchemeTags[i].childNodes[this.__helper__getNextElementNamedChildNode(mapSchemeTags[i],0,"schemeName")]),themes:themes})}};return{mapSchemes:mapSchemes,defaultMapScheme:parseInt(this.decodeSTRING(defaultMapSchemeNode))}};FreeanceXMLParser.prototype.parseVMapConfig=function(vmapNode){return{id:vmapNode.getAttribute("id"),resourceId:this.decodeSTRING(vmapNode.childNodes[this.getNextNamedChildNodeIndex(vmapNode,0,"resourceId")]),slaveType:this.decodeSTRING(vmapNode.childNodes[this.getNextNamedChildNodeIndex(vmapNode,0,"slaveType")]),boundBoxPercentMin:this.decodeDOUBLE(vmapNode.childNodes[this.getNextNamedChildNodeIndex(vmapNode,0,"boundBoxPercentMin")]),styleSheet:this.decodeSTRING(vmapNode.childNodes[this.getNextNamedChildNodeIndex(vmapNode,0,"styleSheet")])}};FreeanceXMLParser.prototype.getTemplateConfig=function(templateRootNode){var templateRootNode=this.xmlDoc.getElementsByTagName('templates')[0];var templates=new Object();var htmlString='';for(var templateIndex=this.getNextNamedChildNodeIndex(templateRootNode,0,"template");templateIndex!=-1;templateIndex=this.getNextNamedChildNodeIndex(templateRootNode,templateIndex+1,"template")){for(var lcv=0;lcv<templateRootNode.childNodes[templateIndex].childNodes.length;lcv++){if(templateRootNode.childNodes[templateIndex].childNodes.item(lcv).nodeType==4)htmlString=templateRootNode.childNodes[templateIndex].childNodes.item(lcv).nodeValue};templates[templateRootNode.childNodes[templateIndex].getAttribute("id")]=htmlString};return templates};FreeanceXMLParser.prototype.getExtensionConfig=function(){var extensionConfigNode=this.xmlDoc.getElementsByTagName('extensionConfig')[0];var extensions=new Object();var extensionNodes=extensionConfigNode.getElementsByTagName('extension');for(var lcv=0;lcv<extensionNodes.length;lcv++){var extension=extensionNodes[lcv];var name=extension.getAttribute('name');var enabled=extension.getAttribute('enabled');var module=extension.getAttribute('module');extensions[name]={enabled:(enabled=='true'),dynamicfile:extension.getAttribute('dynamicfile'),compressedfile:extension.getAttribute('compressedfile'),module:module};if(extensions[name].enabled){var forceLoad=extension.getAttribute('forceLoad');extensions[name].forceLoad=((typeof(forceLoad)=='string')?((forceLoad=='true')?true:false):(false))};extensions[name].loaded=false};return(extensions)};FreeanceXMLParser.prototype.parseThemeDefinitions=function(newNode){var themeDefinitions={};var themeElements=newNode.getElementsByTagName('theme');for(var i=0;i<themeElements.length;i++){themeDefinitions[themeElements[i].getAttribute("id")]=this.parseTheme(themeElements[i])};return themeDefinitions};FreeanceXMLParser.prototype.parseTheme=function(themeNode){var hideThemeValue=themeNode.getAttribute("hideTheme");var selectNodes=themeNode.getElementsByTagName('selectOptions');var bufferNodes=themeNode.getElementsByTagName('bufferOptions');var themeAttributes={id:themeNode.getAttribute("id"),hideTheme:(hideThemeValue==null)?false:(hideThemeValue=='true'),themeName:this.decodeSTRING(themeNode.getElementsByTagName('themeName')[0]),selectOptions:(selectNodes.length>0)?(this.parseThemeSelectOptions(selectNodes[0])):null,bufferOptions:(bufferNodes.length>0)?(this.parseThemeBufferOptions(bufferNodes[0])):null,visibility:false,altLegends:new Array()};var altLegends=themeNode.getElementsByTagName('altLegend');for(var lcv=0;lcv<altLegends.length;lcv++){themeAttributes["altLegends"].push({legendName:this.decodeSTRING(altLegends[lcv].getElementsByTagName("legendName")[0]),legendLabel:this.decodeSTRING(altLegends[lcv].getElementsByTagName("legendLabel")[0])})};return themeAttributes};FreeanceXMLParser.prototype.parseThemeSelectOptions=function(newNode){var keyfieldTypeNodes=newNode.getElementsByTagName('keyFieldType');var zoomRatioNodes=newNode.getElementsByTagName('zoomExtentRatio');var sqlParamNodes=newNode.getElementsByTagName('sqlParams');return{styleSheet:this.decodeSTRING(newNode.getElementsByTagName("styleSheet")[0]),fieldList:this.decodeSTRING(newNode.getElementsByTagName("fieldList")[0]),limit:this.decodeINT(newNode.getElementsByTagName("limit")[0]),tolerance:this.decodeDOUBLE(newNode.getElementsByTagName("tolerance")[0]),idField:this.decodeSTRING(newNode.getElementsByTagName("idField")[0]),keyField:this.decodeSTRING(newNode.getElementsByTagName("keyField")[0]),keyFieldType:(keyfieldTypeNodes.length)?this.decodeINT(keyfieldTypeNodes[0]):12,zoomExtentRatio:(zoomRatioNodes.length)?this.decodeDOUBLE(zoomRatioNodes[0]):1.2,resultTemplate:this.decodeSTRING(newNode.getElementsByTagName("resultTemplate")[0]),sqlParams:(sqlParamNodes.length)?this.parseChainedQuerySqlParams(sqlParamNodes[0]):null}};FreeanceXMLParser.prototype.parseChainedQuerySqlParams=function(sqlParamsNode){var sqlParams=[];var sqlParamNodeList=sqlParamsNode.getElementsByTagName('sqlParam');var currentParam=null;for(var lcv=0;lcv<sqlParamNodeList.length;lcv++){var theNode=sqlParamNodeList[lcv];currentParam={pdqIdentifier:this.decodeSTRING(theNode.getElementsByTagName("pdqIdentifier")[0]),fieldList:[]};var fieldListNode=theNode.getElementsByTagName("fieldList")[0];var fieldNodeList=fieldListNode.getElementsByTagName('field');for(var fieldIndex=0;fieldIndex<fieldNodeList.length;fieldIndex++){currentParam["fieldList"].push({fieldName:this.decodeSTRING(fieldNodeList[fieldIndex].getElementsByTagName("fieldName")[0]),pdqFieldName:this.decodeSTRING(fieldNodeList[fieldIndex].getElementsByTagName("pdqFieldName")[0])})};if(this.getNextNamedChildNodeIndex(theNode,0,"queryType")>-1){currentParam["queryType"]=this.decodeSTRING(theNode.getElementsByTagName("queryType")[0]);currentParam["numRows"]=this.decodeINT(theNode.getElementsByTagName("numRows")[0]);currentParam["startAt"]=this.decodeINT(theNode.getElementsByTagName("startAt")[0])}else{currentParam["queryType"]='';currentParam["numRows"]=0;currentParam["startAt"]=0};sqlParams.push(currentParam)};if(sqlParams.length==0)sqlParams=null;return(sqlParams)};FreeanceXMLParser.prototype.parseThemeBufferOptions=function(newNode){var bufferAttributes={styleSheet:this.decodeSTRING(newNode.getElementsByTagName("styleSheet")[0]),fieldList:this.decodeSTRING(newNode.getElementsByTagName("fieldList")[0]),limit:this.decodeINT(newNode.getElementsByTagName("limit")[0]),resultTemplate:this.decodeSTRING(newNode.getElementsByTagName("resultTemplate")[0]),invalidTemplate:this.decodeSTRING(newNode.getElementsByTagName("invalidTemplate")[0]),maxSelect:this.decodeINT(newNode.getElementsByTagName("maxSelect")[0])};var sqlParamsIndex=this.getNextNamedChildNodeIndex(newNode,0,"sqlParams");bufferAttributes["sqlParams"]=(sqlParamsIndex>-1)?this.parseChainedQuerySqlParams(newNode.childNodes[sqlParamsIndex]):null;if(this.getNextNamedChildNodeIndex(newNode,0,"filterQueries")!=-1){var queryListNode=newNode.childNodes[this.getNextNamedChildNodeIndex(newNode,0,"filterQueries")];bufferAttributes["filterQueries"]=new Object;for(var queryIndex=this.getNextNamedChildNodeIndex(queryListNode,0,"query");queryIndex!=-1;queryIndex=this.getNextNamedChildNodeIndex(queryListNode,queryIndex+1,"query")){bufferAttributes["filterQueries"][this.decodeSTRING(queryListNode.childNodes[queryIndex])]=null}}else bufferAttributes["filterQueries"]=null;if(this.getNextNamedChildNodeIndex(newNode,0,"export_csv")!=-1){if(!bufferAttributes["export"])bufferAttributes["export"]=new Object;bufferAttributes["export"].csv=new Object;if(this.decodeSTRING(newNode.childNodes[this.getNextNamedChildNodeIndex(newNode,0,"export_csv")])=='true'){bufferAttributes["export"].csv.enabled=true;bufferAttributes["export"].csv.delim=this.decodeSTRING(newNode.childNodes[this.getNextNamedChildNodeIndex(newNode,0,"export_csv_delim")]);if(this.decodeSTRING(newNode.childNodes[this.getNextNamedChildNodeIndex(newNode,0,"export_csv_includefieldnames")])=='true')bufferAttributes["export"].csv.includeFieldNames=true;else bufferAttributes["export"].csv.includeFieldNames=false}else bufferAttributes["export"].csv.enabled=false};return bufferAttributes};FreeanceXMLParser.prototype.parseLegendAttributes=function(newNode){return(newNode.nodeName=='legendAttributes')?{width:this.decodeINT(newNode.getElementsByTagName('width')[0].getElementsByTagName('int')[0]),height:this.decodeINT(newNode.getElementsByTagName('height')[0].getElementsByTagName('int')[0]),color:this.decodeSTRING(newNode.getElementsByTagName('color')[0].getElementsByTagName('string')[0]),font:this.decodeSTRING(newNode.getElementsByTagName('font')[0].getElementsByTagName('string')[0]),fontSize:this.decodeINT(newNode.getElementsByTagName('fontSize')[0].getElementsByTagName('int')[0]),valueFontSize:this.decodeINT(newNode.getElementsByTagName('valueFontSize')[0].getElementsByTagName('int')[0]),cellSpacing:this.decodeINT(newNode.getElementsByTagName('cellSpacing')[0].getElementsByTagName('int')[0])}:{width:newNode.getAttribute('width'),height:parseInt(newNode.getAttribute('height')),color:newNode.getAttribute('color'),font:newNode.getAttribute('font'),fontSize:newNode.getAttribute('fontSize'),valueFontSize:parseInt(newNode.getAttribute('valueFontSize')),cellSpacing:parseInt(newNode.getAttribute('cellSpacing'))}};FreeanceXMLParser.prototype.parseMapExportConfig=function(newNode){return{enabled:newNode.getAttribute('enabled')}};FreeanceXMLParser.prototype.parsePdfPrintConfig=function(newNode){var printConfig={templates:[],defaultTemplate:parseInt(newNode.getAttribute('defaultTemplate'))};var templateNodes=newNode.getElementsByTagName('template');for(var i=0;i<templateNodes.length;i++){var tnode=templateNodes[i];var inputNodes=tnode.getElementsByTagName('userinput');var userinput=[];for(var j=0;j<inputNodes.length;j++){var inode=inputNodes[j];userinput.push({id:inode.getAttribute('id'),description:inode.getAttribute('description'),maxlength:parseInt(inode.getAttribute('maxlength'))})};printConfig.templates.push({displayName:this.decodeSTRING(tnode.getElementsByTagName("displayname")[0]),templateName:this.decodeSTRING(tnode.getElementsByTagName("templatename")[0]),orientation:tnode.getAttribute('orientation'),unit:tnode.getAttribute('unit'),width:parseFloat(tnode.getAttribute('width')),height:parseFloat(tnode.getAttribute('height')),mapwidth:parseFloat(tnode.getAttribute('mapwidth')),mapheight:parseFloat(tnode.getAttribute('mapheight')),userinput:userinput})};if((printConfig.templates.length>0)&&(printConfig.defaultTemplate==-1))printConfig.defaultTemplate=0;if(printConfig.templates.length==0)printConfig.defaultTemplate=-1;printConfig.activeTemplate=printConfig.defaultTemplate;return printConfig};FreeanceXMLParser.prototype.parseMapLoginQuery=function(queryNode){return null};FreeanceXMLParser.prototype.parseDefinedQuery=function(queryNode){var requestNode=queryNode.getElementsByTagName('request')[0];var fieldsNode=queryNode.getElementsByTagName('fieldList')[0];var exportNode=queryNode.getElementsByTagName('exportQuery')[0];var templateNode=queryNode.getElementsByTagName('resultTemplates')[0];var fieldList=this.parseQueryFields(fieldsNode);var exportConfig=(!exportNode)?({csv:{enabled:false,delim:',',includeFieldNames:true},xml:{enabled:false}}):({csv:{enabled:(this.decodeSTRING(exportNode.getElementsByTagName('export_csv')[0])=='true'),delim:this.decodeSTRING(exportNode.getElementsByTagName('export_csv_delim')[0]),includeFieldNames:(this.decodeSTRING(exportNode.getElementsByTagName('export_csv_includefieldnames')[0])=='true')},xml:{enabled:(this.decodeSTRING(exportNode.getElementsByTagName('export_xml')[0])=='true')}});var displayIndex=this.getNextElementNamedChildNode(queryNode,0,"display");var dbtypeindex=this.getNextElementNamedChildNode(requestNode,0,"dbtype");var config={id:queryNode.getAttribute('id'),display:(displayIndex>-1)?(this.decodeSTRING(queryNode.childNodes[displayIndex])=='true'):true,title:this.decodeSTRING(queryNode.getElementsByTagName('title')[0]),description:this.decodeSTRING(queryNode.getElementsByTagName('description')[0]),HTMLForm:this.decodeSTRING(queryNode.getElementsByTagName('HTMLForm')[0]),fieldList:fieldList,request:{dbtype:(dbtypeindex>-1)?(this.decodeSTRING(requestNode.childNodes[dbtypeindex])):'',requestMethod:this.decodeSTRING(requestNode.childNodes[this.getNextElementNamedChildNode(requestNode,0,"requestMethod")]),pdqIdentifier:this.decodeSTRING(requestNode.childNodes[this.getNextElementNamedChildNode(requestNode,0,"pdqIdentifier")])},export_:exportConfig,templates:{validTemplate:this.decodeSTRING(templateNode.getElementsByTagName('validTemplate')[0]),invalidTemplate:this.decodeSTRING(templateNode.getElementsByTagName('invalidTemplate')[0]),emptyTemplate:this.decodeSTRING(templateNode.getElementsByTagName('emptyTemplate')[0]),pageRows:this.decodeINT(templateNode.getElementsByTagName('pageRows')[0])},suggestConfig:[],zoomto:{enabled:false,queryfield:'',layerfield:'',layerfieldtype:12,layerid:'',stylesheet:''}};var zoomto=null;var zoomtoNode=null;for(var i=0;i<queryNode.childNodes.length;i++)if(queryNode.childNodes[i].nodeName=='zoomto')zoomtoNode=queryNode.childNodes[i];if(zoomtoNode){config["zoomto"]={enabled:true,queryfield:zoomtoNode.getAttribute("queryfield"),layerfield:zoomtoNode.getAttribute("layerfield"),layerfieldtype:parseInt(zoomtoNode.getAttribute("layerfieldtype")),layerid:zoomtoNode.getAttribute("layerid"),stylesheet:zoomtoNode.getAttribute("stylesheet")}};var suggestNodeIndex=this.getNextElementNamedChildNode(queryNode,0,"suggestConfig");if(suggestNodeIndex!=-1){var suggestConfigNode=queryNode.childNodes[suggestNodeIndex];var suggestNodes=suggestConfigNode.getElementsByTagName('suggestInput');var snode=null;for(var i=0;i<suggestNodes.length;i++){snode=suggestNodes[i];config.suggestConfig.push({pdqfield:snode.getAttribute('pdqfield'),elementId:snode.getAttribute('elementId'),resultElementId:snode.getAttribute('resultElementId'),timeout:parseInt(snode.getAttribute('timeout')),dbid:snode.getAttribute('dbid'),tablename:snode.getAttribute('tablename'),fieldname:snode.getAttribute('fieldname'),resultlimit:parseInt(snode.getAttribute('resultlimit'))})}};return config};FreeanceXMLParser.prototype.parseQueryFields=function(fieldsNode){var fieldsConfig=new Array();for(var fieldIndex=this.__helper__getNextElementChildNode(fieldsNode,0);fieldIndex!=-1;fieldIndex=this.__helper__getNextElementChildNode(fieldsNode,fieldIndex+1)){var currentNode=fieldsNode.childNodes[fieldIndex];var newField={fieldType:currentNode.nodeName,caption:'',fieldName:'',width:0,defaultValue:'',initialValue:'',optionList:[],dynamicList:{dbid:'',table:'',valuefield:'',labelfield:'',whereclause:'',limit:10}};for(var i=0;i<currentNode.childNodes.length;i++){var fieldOptionNode=currentNode.childNodes[i];switch(fieldOptionNode.nodeName){case'caption':case'fieldName':case'defaultValue':case'initialValue':newField[fieldOptionNode.nodeName]=this.decodeSTRING(fieldOptionNode);break;case'width':newField['width']=this.decodeINT(fieldOptionNode);break;case'optionList':newField['optionList']=this.parseOptionList(fieldOptionNode);break;case'dynamicList':newField['dynamicList']['dbid']=fieldOptionNode.getAttribute('dbid');newField['dynamicList']['table']=fieldOptionNode.getAttribute('table');newField['dynamicList']['valuefield']=fieldOptionNode.getAttribute('valuefield');newField['dynamicList']['labelfield']=fieldOptionNode.getAttribute('labelfield');newField['dynamicList']['whereclause']=fieldOptionNode.getAttribute('whereclause');newField['dynamicList']['limit']=parseInt(fieldOptionNode.getAttribute('limit'));break}}fieldsConfig.push(newField)}return fieldsConfig};FreeanceXMLParser.prototype.parseOptionList=function(listParentNode){var optionList=new Array;for(var optionIndex=this.__helper__getNextElementChildNode(listParentNode,0);optionIndex!=-1;optionIndex=this.__helper__getNextElementChildNode(listParentNode,optionIndex+1)){var currentNode=listParentNode.childNodes[optionIndex];switch(currentNode.nodeName){case'option':optionList.push({type:'option',value:currentNode.getAttribute("value"),label:currentNode.getAttribute("label")});break;case'optgroup':optionList.push({type:'optgroup',label:currentNode.getAttribute("label"),value:this.parseOptionList(currentNode)});break;default:break}}return optionList};FreeanceXMLParser.prototype.getQueryConfig=function(){var config={};var queryParentNode=this.xmlDoc.getElementsByTagName('queryConfig')[0];var definedQueryNodes=queryParentNode.getElementsByTagName('definedQuery');for(var i=0;i<definedQueryNodes.length;i++)config[definedQueryNodes[i].getAttribute("id")]=this.parseDefinedQuery(definedQueryNodes[i]);return config};
function XMLRPCMessage(methodname){this.method=methodname||"system.listMethods";this.params=[];return this};XMLRPCMessage.prototype.setMethod=function(methodName){if(!methodName)return;this.method=methodName};XMLRPCMessage.escapeXML=function(srcString){return srcString.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/>/g,'&gt;').replace(/"/g,'&quot;')};XMLRPCMessage.prototype.replaceStr=function(orig,lookfor,replacewith,ignorecase){var str=new String();str+=orig;var type='g';if(ignorecase)type+='i';var re=new RegExp(lookfor,type);return(str.replace(re,replacewith))};XMLRPCMessage.prototype.addParameter=function(data){if(arguments.length==0)return;var type=typeof(data);type=type.toLowerCase();this.params[this.params.length]=data};XMLRPCMessage.prototype.xml=function(){var method=this.method;var xml="";xml+="<?xml version=\"1.0\"?>\n";xml+="<methodCall>\n";xml+="<methodName>"+method+"</methodName>\n";xml+="<params>\n";for(var i=0;i<this.params.length;i++){var data=this.params[i];var paramXML=XMLRPCMessage.getParamXML(XMLRPCMessage.dataTypeOf(data),data);if(paramXML!=null){xml+="<param>\n";xml+="<value>"+paramXML+"</value>\n";xml+="</param>\n"}else alert('Warning:\nAn error occurred when building a request to send to the server\nAttempted to add an undefined value as a parameter.\nSome data may be lost.')}xml+="</params>\n";xml+="</methodCall>";return xml};XMLRPCMessage.dataTypeOf=function(o){var type=typeof(o);type=type.toLowerCase();switch(type){case"number":if(Math.round(o)==o)type="i4";else type="double";break;case"object":try{var con=o.constructor;if(con==Date)type="date";else if(con==Array)type="array";else type="struct"}catch(e){type="struct"}break}return type};XMLRPCMessage.doValueXML=function(type,data){var xml=null;switch(type){case'string':data=this.escapeXML(data);break;case'undefined':data=null;break;default:break}if(data!=null)xml="<"+type+">"+data+"</"+type+">";return xml};XMLRPCMessage.doBooleanXML=function(data){var value=(data==true)?1:0;var xml="<boolean>"+value+"</boolean>";return xml};XMLRPCMessage.doDateXML=function(data){var xml="<dateTime.iso8601>";xml+=dateToISO8601(data);xml+="</dateTime.iso8601>";return xml};XMLRPCMessage.doArrayXML=function(data){var xml="<array><data>\n";for(var i=0;i<data.length;i++){var paramXML=XMLRPCMessage.getParamXML(XMLRPCMessage.dataTypeOf(data[i]),data[i]);if(paramXML!=null)xml+="<value>"+paramXML+"</value>\n"}xml+="</data></array>\n";return xml};XMLRPCMessage.doStructXML=function(data){var xml="<struct>\n";for(var i in data){if(i=='toJSONString')continue;var paramXML=XMLRPCMessage.getParamXML(XMLRPCMessage.dataTypeOf(data[i]),data[i]);if(paramXML!=null){xml+="<member>\n";xml+="<name>"+this.escapeXML(i)+"</name>\n";xml+="<value>"+paramXML+"</value>\n";xml+="</member>\n"}else{alert('Warning:\nAn error occurred when building a request to send to the server\nAttempted to add an undefined member to a Struct.\nSome data may be lost.')}}xml+="</struct>\n";return xml};XMLRPCMessage.getParamXML=function(type,data){var xml;switch(type){case"date":xml=XMLRPCMessage.doDateXML(data);break;case"array":xml=XMLRPCMessage.doArrayXML(data);break;case"struct":xml=XMLRPCMessage.doStructXML(data);break;case"boolean":xml=XMLRPCMessage.doBooleanXML(data);break;default:xml=XMLRPCMessage.doValueXML(type,data);break}return xml};function dateToISO8601(date){var year=new String(date.getYear());var month=leadingZero(new String(date.getMonth()));var day=leadingZero(new String(date.getDate()));var time=leadingZero(new String(date.getHours()))+":"+leadingZero(new String(date.getMinutes()))+":"+leadingZero(new String(date.getSeconds()));var converted=year+month+day+"T"+time;return converted};function leadingZero(n){if(n.length==1)n="0"+n;return n};
function XMLRPCResponse(xmlResponseDoc){this.xmlDoc=xmlResponseDoc||null;if(this.xmlDoc==null)return(this)};XMLRPCResponse.prototype.setResponseByDoc=function(xmlResponseDoc){if(!xmlResponseDoc)return;this.xmlDoc=xmlResponseDoc};XMLRPCResponse.prototype.setResponseByStr=function(xmlResponseStr){if(!xmlResponseStr)return;if(this.xmlDoc==null)this.xmlDoc=XmlDocument.create();this.xmlDoc.loadXML(xmlResponseStr)};XMLRPCResponse.prototype.isFault=function(){if(this.xmlDoc==null)return true;return(this.xmlDoc.getElementsByTagName("fault").length>0)};XMLRPCResponse.prototype.getFaultCode=function(){if(this.xmlDoc==null)return(-1);if(!this.isFault())return(-1);var members=this.xmlDoc.getElementsByTagName("member");for(var lcv=0;lcv<members.length;lcv++){var nameElem=members[lcv].getElementsByTagName("name").item(0);if((nameElem==null)||(nameElem.childNodes.length==0))return(-1);var nameStrNode=nameElem.childNodes.item(0);if(nameStrNode.nodeValue=='faultCode'){var codeNode=members[lcv].getElementsByTagName("int").item(0);if((codeNode==null)||(codeNode.childNodes.length==0))return(-1);return(codeNode.childNodes.item(0).nodeValue)}}return(-1)};XMLRPCResponse.prototype.getFaultString=function(){if(this.xmlDoc==null)return("");if(!this.isFault())return("");var members=this.xmlDoc.getElementsByTagName("member");for(var lcv=0;lcv<members.length;lcv++){var nameElem=members[lcv].getElementsByTagName("name").item(0);if((nameElem==null)||(nameElem.childNodes.length==0))return("");var nameStrNode=nameElem.childNodes.item(0);if(nameStrNode.nodeValue=='faultString'){var codeNode=members[lcv].getElementsByTagName("string").item(0);if((codeNode==null)||(codeNode.childNodes.length==0))return("");return(codeNode.childNodes.item(0).nodeValue)}}return("")};XMLRPCResponse.prototype.getObject=function(){if(this.xmlDoc==null)return null;return(this.getObjectRecurse(this.xmlDoc.getElementsByTagName("value").item(0)))};XMLRPCResponse.prototype.getObjectRecurse=function(theNode){if(this.xmlDoc==null)return null;if(theNode==null)return null;switch(theNode.nodeName){case'value':return(this.getObjectRecurse(theNode.childNodes[0]));break;case'string':return(this.decodeSTRING(theNode));break;case'i4':case'int':return(this.decodeINT(theNode));break;case'boolean':return(this.decodeBOOLEAN(theNode));break;case'double':return(this.decodeDOUBLE(theNode));break;case'dateTime.iso8601':return(this.decodeDATETIME(theNode));break;case'base64':return(this.decodeBASE64(theNode));break;case'array':return(this.decodeARRAY(theNode));break;case'struct':return(this.decodeSTRUCT(theNode));break;default:alert('unknown node type: '+theNode.nodeName);break}};XMLRPCResponse.prototype.unescapeHTML=function(newString){return newString.replace(/&lt;/g,'<').replace(/&gt;/g,'>').replace(/&quot;/g,'"').replace(/&amp;/g,'&')};XMLRPCResponse.prototype.decodeSTRING=function(theNode){if(theNode.childNodes.length>0){try{if(!xIE4Up)theNode.normalize()}catch(e){try{if(!is.ie)theNode.normalize()}catch(e){}}return(this.unescapeHTML(theNode.childNodes[0].nodeValue))}else return('')};XMLRPCResponse.prototype.decodeINT=function(theNode){var theSTRING=this.decodeSTRING(theNode);return(parseInt(theSTRING))};XMLRPCResponse.prototype.decodeBOOLEAN=function(theNode){var theSTRING=this.decodeSTRING(theNode);return(theSTRING=='1')};XMLRPCResponse.prototype.decodeDOUBLE=function(theNode){var theSTRING=this.decodeSTRING(theNode);return(parseFloat(theSTRING))};XMLRPCResponse.prototype.decodeDATETIME=function(theNode){};XMLRPCResponse.prototype.decodeBASE64=function(theNode){};XMLRPCResponse.prototype.decodeSTRUCT=function(theNode){var thisStruct=new Object();for(var lcv=0;lcv<theNode.childNodes.length;lcv++){var memberNode=theNode.childNodes[lcv];if(memberNode.nodeName=="member"){var valueNameNode=memberNode.getElementsByTagName("name").item(0);var valueNameStr=this.decodeSTRING(valueNameNode);thisStruct[valueNameStr]=this.getObjectRecurse(memberNode.getElementsByTagName("value").item(0))}}return(thisStruct)};XMLRPCResponse.prototype.__helper__getNextElementChildNode=function(aNode,firstpos){var foundpos=-1;for(var lcv=firstpos;(lcv<aNode.childNodes.length)&&(foundpos==-1);lcv++)if(aNode.childNodes[lcv].nodeType==1)foundpos=lcv;return(foundpos)};XMLRPCResponse.prototype.__helper__getNextElementNamedChildNode=function(aNode,firstpos,nodeName){for(var lcv=firstpos;lcv<aNode.childNodes.length;lcv++)if((aNode.childNodes[lcv].nodeType==1)&&(aNode.childNodes[lcv].nodeName==nodeName))return(lcv);return(-1)};XMLRPCResponse.prototype.decodeARRAY=function(theNode){var thisArray=new Array();var thisArrayPos=0;var dataNode=theNode.childNodes[this.__helper__getNextElementNamedChildNode(theNode,0,"data")];var valueNodePos=0;while(valueNodePos>=0){valueNodePos=this.__helper__getNextElementNamedChildNode(dataNode,valueNodePos,"value");if(valueNodePos>=0){valueNode=dataNode.childNodes[valueNodePos];thisArray[thisArrayPos]=this.getObjectRecurse(valueNode.firstChild);thisArrayPos++}if(valueNodePos>=0)valueNodePos++}return(thisArray)};function getXMLRPCResponseObject(serverReplyDoc){var clientReply=null;var response={data:null,'XMLRPC_FAULT':false,'XMLRPC_FAULT_CODE':null,'XMLRPC_FAULT_MESSAGE':''};var validDoc=(serverReplyDoc!=null);if(validDoc){var xmlstr=(typeof(serverReplyDoc.xml)=='function')?serverReplyDoc.xml():serverReplyDoc.xml;validDoc=(xmlstr!='')}if(validDoc){if(serverReplyDoc.documentElement.nodeName=='parsererror'){validDoc=false;response.XMLRPC_FAULT_MESSAGE='A response was received from the server but could not be processed - the format was invalid.'}}if(validDoc){clientReply=new XMLRPCResponse();clientReply.setResponseByDoc(serverReplyDoc);if(clientReply.isFault()){response.XMLRPC_FAULT=true;response.XMLRPC_FAULT_CODE=clientReply.getFaultCode();response.XMLRPC_FAULT_MESSAGE=clientReply.getFaultString()}else{response.data=clientReply.getObject()}}else{response.XMLRPC_FAULT=true;response.XMLRPC_FAULT_CODE=-1;if(response.XMLRPC_FAULT_MESSAGE=='')response.XMLRPC_FAULT_MESSAGE='An invalid response was received from the server.\n';return response}return response};
ObjectManager=function(){this.messageBindings=new Array();this.objectList=new Array();this.objectIndex=new Array();this.valueList=new Array();this.valueIndex=new Array();this.controlList=new Array();this.controlIndex=new Array();this.extensions=new Object();this.widgetRegistry=new Object();this.controlRegistry=new Object()};OBJECT_MANAGER=new ObjectManager();ObjectManager.prototype.registerObject=function(objectName,objectPointer){var objectID=this.messageBindings.length;this.messageBindings[this.messageBindings.length]=new Array(objectName,objectPointer);this.objectList[objectName]=objectPointer;this.objectIndex[this.objectIndex.length]=objectName;return objectID};ObjectManager.prototype.registerWidget=function(widgetType,prototype){this.widgetsRegistry[widgetType]=prototype};ObjectManager.prototype.registerExtension=function(extensionId,setActiveState){this.extensions[extensionId]=setActiveState};ObjectManager.prototype.processEvent=function(e){var evt=new xEvent(e);if(!isNaN(parseInt(evt.target.objectManagerId))){switch(evt.type){case'click':this.messageBindings[parseInt(evt.target.objectManagerId)][1].clickCallback(evt);break;case'mousedown':this.messageBindings[parseInt(evt.target.objectManagerId)][1].mouseDownCallback(evt);break;case'mouseup':this.messageBindings[parseInt(evt.target.objectManagerId)][1].mouseUpCallback(evt);break;case'mousemove':this.messageBindings[parseInt(evt.target.objectManagerId)][1].mouseMoveCallback(evt);break;case'mouseover':this.messageBindings[parseInt(evt.target.objectManagerId)][1].mouseOverCallback(evt);break;case'mouseout':this.messageBindings[parseInt(evt.target.objectManagerId)][1].mouseOutCallback(evt);break;case'keypress':this.messageBindings[parseInt(evt.target.objectManagerId)][1].keyPressCallback(evt);break;case'keyup':this.messageBindings[parseInt(evt.target.objectManagerId)][1].keyUpCallback(evt);break;case'keydown':this.messageBindings[parseInt(evt.target.objectManagerId)][1].keyDownCallback(evt);break;case'drag':this.messageBindings[parseInt(evt.target.objectManagerId)][1].dragCallback(evt);break;case'dragStart':this.messageBindings[parseInt(evt.target.objectManagerId)][1].dragStartCallback(evt);break;case'dragEnd':this.messageBindings[parseInt(evt.target.objectManagerId)][1].dragEndCallback(evt);break;case'change':this.messageBindings[parseInt(evt.target.objectManagerId)][1].changeCallback(evt);break;case'focus':this.messageBindings[parseInt(evt.target.objectManagerId)][1].focusCallback(evt);break;default:break}}};ObjectManager.prototype.setGuiValue=function(valueName,newValue){this.valueList[valueName]=newValue;this.valueIndex[this.valueIndex.length]=valueName;return this.valueList[valueName]};ObjectManager.prototype.getGuiValue=function(valueName){switch(valueName){case'_PAGEWIDTH_':return xClientWidth();break;case'_PAGEHEIGHT_':return xClientHeight();break;default:return this.valueList[valueName];break}};ObjectManager.prototype.addControl=function(controlPointer,controlType,controlId){switch(controlType){case'layerControl':case'radioButtonGroup':case'map':case'labelControl':case'queryControl':case'selectionControl':this.controlList[controlId]=new Array(controlPointer,controlType);this.controlIndex[this.controlIndex.length]=new Array(controlId,controlType);break;default:alert('Object Manager Error:\nUnknown control type "'+controlType+'"\nControl id = "'+controlId+'"');break}};ObjectManager.prototype.getControl=function(controlId){if(this.controlList[controlId])return this.controlList[controlId][0];else return null};ObjectManager.prototype.extensionIsRegistered=function(extensionId){if(this.extensions[extensionId])return true;else return false};ObjectManager.prototype.getWidgetAttribute=function(widgetName,attributeName){var widget=this.objectList[widgetName];switch(attributeName){case'width':return widget.width();break;case'height':return widget.height();break;case'left':case'xpos':return widget.left();break;case'top':case'ypos':return widget.top();break;case'right':return widget.left()+widget.width();break;case'bottom':return widget.top()+widget.height();break;case'zpos':return widget.zIndex;break;default:return null}};function EVENT_LISTENER(e){OBJECT_MANAGER.processEvent(e)};ObjectManager.prototype.listGuiValues=function(){listString='<table border = "1"><tr><td colspan = "3" align="center">GUI values:</td></tr>';listString=listString+'<tr><td>Index</td><td>Name</td><td>Value</td></tr>';for(i=0;i<this.valueIndex.length;i++){listString=listString+'<tr><td>'+i+'</td><td>'+this.valueIndex[i]+'</td><td>'+this.valueList[this.valueIndex[i]]+'</td></tr>'}listString=listString+'</table>';return(listString)};ObjectManager.prototype.listGuiWidgets=function(){listString='<table border = "1"><tr><td colspan="2" align="center">GUI Widgets:</td></tr>';listString=listString+'<tr><td>Index</td><td>Name</td></tr>';for(i=0;i<this.objectIndex.length;i++){listString=listString+'<tr><td>'+i+'</td><td>'+this.objectIndex[i]+'</td></tr>'}listString=listString+'</table>';return(listString)};ObjectManager.prototype.listGuiControls=function(){listString='<table border = "1"><tr><td colspan = "3" align="center">GUI Controls:</td></tr>';listString=listString+'<tr><td>Index</td><td>Name</td><td>Type</td></tr>';for(i=0;i<this.controlIndex.length;i++){listString=listString+'<tr><td>'+i+'</td><td>'+this.controlIndex[i][0]+'</td><td>'+this.controlIndex[i][1]+'</td></tr>'}listString=listString+'</table>';return(listString)};document.getWidgetById=function(objectName){return(OBJECT_MANAGER.objectList[objectName])};document.getGuiValue=function(valueName){return OBJECT_MANAGER.getGuiValue(valueName)};document.getGuiControl=function(valueName){return OBJECT_MANAGER.getControl(valueName)};document.getGuiWidgetById=function(objectName){alert('Warning:  getGuiWidgetById has been deprecated.\nUse getWidgetById instead');return document.getWidgetById(objectName)};document.getGuiValueById=function(valueName){alert('Warning:  document.getGuiValueById has been deprecated.\nUse getGuiValue instead');return document.getGuiValue(valueName)};
GuiWidget=function(newID,newParent,newXPosition,newYPosition,newZIndex,newWidth,newHeight,newVisibility,newClass){if(arguments.length>0){this.widgetType='GuiWidget';this.init(newID,newParent,newXPosition,newYPosition,newZIndex,newWidth,newHeight,newVisibility,newClass)}};GuiWidget_onLoad=function(){GuiWidget.ToolTip=document.createElement("DIV");document.getElementsByTagName("body").item(0).appendChild(GuiWidget.ToolTip);xHide(GuiWidget.ToolTip)};GuiWidget.prototype.init=function(newID,newParent,newXPosition,newYPosition,newZIndex,newWidth,newHeight,newVisibility,newClass){this.id=newID;this.parentElement=newParent;this.xPosition=parseInt(newXPosition);this.yPosition=parseInt(newYPosition);this.zIndex=parseInt(newZIndex);this.visibility=false;this.element=document.createElement("DIV");this.element.objectManagerId=OBJECT_MANAGER.registerObject(this.id,this);if(this.parentElement==null){document.getElementsByTagName("body").item(0).appendChild(this.element)}else{this.parentElement.appendChild(this.element)}this.setClass(newClass);this.element.id=this.id;this.moveTo(newXPosition,newYPosition);xZIndex(this.element,newZIndex);this.resizeTo(newWidth,newHeight);this.setVisibility(newVisibility)};GuiWidget.prototype.setVisibility=function(newVisibility){this.visibility=newVisibility;return(newVisibility)?this.show():this.hide()};GuiWidget.prototype.show=function(){this.visibility=true;if(this.element)this.element.style.visibility='inherit';return true};GuiWidget.prototype.hide=function(){this.visibility=false;this.element.style.visibility='hidden';xHide(this.element);return true};GuiWidget.prototype.width=function(){if(arguments.length>0)return xResizeTo(this.element,parseInt(arguments[0]),xHeight(this.element));return xWidth(this.element)};GuiWidget.prototype.height=function(){if(arguments.length>0){return xHeight(this.element,arguments[0])}return xHeight(this.element)};GuiWidget.prototype.left=function(){if(arguments.length>0)return xLeft(this.element,arguments[0]);else return xLeft(this.element)};GuiWidget.prototype.top=function(){if(arguments.length>0)return xTop(this.element,arguments[0]);else return xTop(this.element)};GuiWidget.prototype.resizeTo=function(newWidth,newHeight){xResizeTo(this.element,newWidth,newHeight);if(this.resizeEvent)this.resizeEvent(newWidth,newHeight)};GuiWidget.prototype.moveTo=function(newXPosition,newYPosition){this.xPosition=parseInt(newXPosition);this.yPosition=parseInt(newYPosition);xMoveTo(this.element,this.xPosition,this.yPosition);if(this.moveEvent)this.moveEvent(newXPosition,newYPosition)};GuiWidget.prototype.setClass=function(newClass){this.element.setAttribute((xIE4Up?("className"):("class")),(((newClass=='')||(newClass==null))?(this.widgetType):(newClass)))};GuiWidget.prototype.innerHtml=function(newString){this.element.innerHTML=newString};GuiWidget.prototype.mouseOverCallback=function(e){if(this.mouseOver)this.mouseOver(e);if(this.layoutMouseOverEvent)this.layoutMouseOverEvent(e);if(this.mouseOverEvent)this.mouseOverEvent(e)};GuiWidget.prototype.clickCallback=function(e){if(this.click)this.click(e);if(this.layoutMouseClickEvent)this.layoutMouseClickEvent(e);if(this.clickEvent)this.clickEvent(e)};GuiWidget.prototype.mouseOutCallback=function(e){if(this.mouseOut)this.mouseOut(e);if(this.layoutMouseOutEvent)this.layoutMouseOutEvent(e);if(this.mouseOutEvent)this.mouseOutEvent(e)};GuiWidget.prototype.mouseDownCallback=function(e){if(this.mouseDown)this.mouseDown(e);if(this.layoutMouseDownEvent)this.layoutMouseDownEvent(e);if(this.mouseDownEvent)this.mouseDownEvent(e)};GuiWidget.prototype.mouseMoveCallback=function(e){xMoveTo(GuiWidget.ToolTip,e.clientX,e.clientY);if(this.mouseMove)this.mouseMove(e);if(this.layoutMouseMoveEvent)this.layoutMouseMoveEvent(e);if(this.mouseMoveEvent)this.mouseMoveEvent(e)};GuiWidget.prototype.mouseUpCallback=function(e){if(this.mouseUp)this.mouseUp(e);if(this.layoutMouseUpEvent)this.layoutMouseUpEvent(e);if(this.mouseUpEvent)this.mouseUpEvent(e)};GuiWidget.showTooltip=function(e,tooltipText){if(document.babelfish)tooltipText=document.babelfish.translateWord(tooltipText);xMoveTo(GuiWidget.ToolTip,e.pageX+GuiWidget.tooltipOffset[0],e.pageY+GuiWidget.tooltipOffset[1]);xZIndex(GuiWidget.ToolTip,255);GuiWidget.ToolTip.innerHTML=tooltipText;if(xIE4Up)GuiWidget.ToolTip.setAttribute("className","GuiToolTip");else GuiWidget.ToolTip.setAttribute("class","GuiToolTip");xShow(GuiWidget.ToolTip)};GuiWidget.hideTooltip=function(){xHide(GuiWidget.ToolTip)};
Button=function(newID,newParent,newXPosition,newYPosition,newZIndex,newWidth,newHeight,newVisibility){if(arguments.length>0)this.init(newID,newParent,newXPosition,newYPosition,newZIndex,newWidth,newHeight,newVisibility)};Button.prototype=new GuiWidget();Button.prototype.constructor=Button;Button.superclass=GuiWidget.prototype;Button.prototype.init=function(newID,newParent,newXPosition,newYPosition,newZIndex,newWidth,newHeight,newVisibility){Button.superclass.init.call(this,newID,newParent,newXPosition,newYPosition,newZIndex,newWidth,newHeight,newVisibility);xAddEventListener(this.element,'click',EVENT_LISTENER,false);xAddEventListener(this.element,'mouseover',EVENT_LISTENER,false);xAddEventListener(this.element,'mousedown',EVENT_LISTENER,false);xAddEventListener(this.element,'mouseup',EVENT_LISTENER,false);xAddEventListener(this.element,'mouseout',EVENT_LISTENER,false);this.setClass('GuiButton')};Button.prototype.mouseOver=function(e){this.setClass('GuiButtonHover')};Button.prototype.mouseOut=function(e){this.setClass('GuiButton')};Button.prototype.mouseUp=function(e){this.setClass('GuiButtonHover')};Button.prototype.mouseDown=function(e){this.setClass('GuiButtonDown')};Button.prototype.click=function(e){this.setClass('GuiButtonHover')};
ImageButton=function(newID,newParent,newXPosition,newYPosition,newZIndex,newWidth,newHeight,newVisibility,newimageName,newTooltip){if(arguments.length>0)this.init(newID,newParent,newXPosition,newYPosition,newZIndex,newWidth,newHeight,newVisibility,newimageName,newTooltip)};ImageButton.prototype=new Button();ImageButton.prototype.constructor=ImageButton;ImageButton.superclass=Button.prototype;ImageButton.prototype.init=function(newID,newParent,newXPosition,newYPosition,newZIndex,newWidth,newHeight,newVisibility,newImageName,newTooltip){ImageButton.superclass.init.call(this,newID,newParent,newXPosition,newYPosition,newZIndex,newWidth,newHeight,newVisibility);this.imageName=newImageName;this.tooltip=newTooltip;this.buttonImage=new Image;this.buttonImage.src=GuiWidget.THEME_PATH+'/'+GuiWidget.THEME+'/images/'+this.imageName;this.tooltip=newTooltip;this.imageNode=document.createElement("IMG");this.imageNode.src=this.buttonImage.src;this.imageNode.objectManagerId=this.element.objectManagerId;if(xIE4Up){xWidth(this.imageNode,newWidth*3);xHeight(this.imageNode,newHeight)}this.element.appendChild(this.imageNode);this.setClass('GuiImageButton');this.imageNode.setAttribute(((xIE4Up)?("className"):('class')),"GuiImageButtonImage")};ImageButton.prototype.mouseOver=function(e){xLeft(this.imageNode,0-this.width());this.setClass('GuiImageButtonHover');if(this.tooltip!='')GuiWidget.showTooltip(e,this.tooltip)};ImageButton.prototype.mouseOut=function(e){xLeft(this.imageNode,0);this.setClass('GuiImageButton');GuiWidget.hideTooltip()};ImageButton.prototype.mouseUp=function(e){xLeft(this.imageNode,0-this.width());this.setClass('GuiImageButtonHover');GuiWidget.hideTooltip()};ImageButton.prototype.mouseDown=function(e){xLeft(this.imageNode,0-this.width()*2);this.setClass('GuiImageButtonDown');GuiWidget.hideTooltip()};ImageButton.prototype.click=function(e){xLeft(this.imageNode,0-this.width());this.setClass('GuiImageButtonHover');GuiWidget.hideTooltip()};
function linearGradient(color1,color2,numSteps){var result=new Array();var c1=new Array(parseInt("0x"+color1.substr(1,2)),parseInt("0x"+color1.substr(3,2)),parseInt("0x"+color1.substr(5,2)));var c2=new Array(parseInt("0x"+color2.substr(1,2)),parseInt("0x"+color2.substr(3,2)),parseInt("0x"+color2.substr(5,2)));var dC=new Array(Math.round((c2[0]-c1[0])/numSteps),Math.round((c2[1]-c1[1])/numSteps),Math.round((c2[2]-c1[2])/numSteps));for(i=0;i<numSteps;i++){var R=(dC[0]*i+c1[0]);R=(R>0xff)?0xff:R;R=R.toString(16);var G=(dC[1]*i+c1[1]);G=(G>0xff)?0xff:G;G=G.toString(16);var B=(dC[2]*i+c1[2]);B=(B>0xff)?0xff:B;B=B.toString(16);result[i]="#"+((R.length==1)?("0"+R):R)+((G.length==1)?("0"+G):G)+((B.length==1)?("0"+B):B)}return result};
RadioButton=function(newID,newParent,newXPosition,newYPosition,newZIndex,newWidth,newHeight,newVisibility,newImageRoot,newTooltip,newGroup,newGroupId){if(arguments.length>0)this.init(newID,newParent,newXPosition,newYPosition,newZIndex,newWidth,newHeight,newVisibility,newImageRoot,newTooltip,newGroup,newGroupId)};RadioButton.prototype=new ImageButton();RadioButton.prototype.constructor=RadioButton;RadioButton.superclass=ImageButton.prototype;RadioButton.prototype.init=function(newID,newParent,newXPosition,newYPosition,newZIndex,newWidth,newHeight,newVisibility,newImageRoot,newTooltip,newGroup,newGroupId){RadioButton.superclass.init.call(this,newID,newParent,newXPosition,newYPosition,newZIndex,newWidth,newHeight,newVisibility,newImageRoot,newTooltip);if(newGroupId)this.group=OBJECT_MANAGER.getControl(newGroupId);else this.group=newGroup;this.groupIndex=this.group.addButton(this);this.active=false};RadioButton.prototype.setGroup=function(newGroup){this.group=newGroup;this.groupIndex=newGroup.addButton(this)};RadioButton.prototype.isActive=function(){return this.active};RadioButton.prototype.setActive=function(){this.active=true;xLeft(this.imageNode,0-this.width()*2)};RadioButton.prototype.setInactive=function(){this.active=false;xLeft(this.imageNode,0);if(this.setInactiveEvent)this.setInactiveEvent()};RadioButton.prototype.click=function(e){this.group.setActiveButton(this.groupIndex);this.active=true;xLeft(this.imageNode,0-this.width());this.setClass('GuiImageButtonHover');GuiWidget.hideTooltip()};RadioButton.prototype.mouseOver=function(e){xLeft(this.imageNode,0-this.width());this.setClass('GuiImageButtonHover');if(this.tooltip!='')GuiWidget.showTooltip(e,this.tooltip)};RadioButton.prototype.mouseOut=function(e){xLeft(this.imageNode,this.active?(0-this.width()*2):0);this.setClass('GuiImageButton');GuiWidget.hideTooltip()};RadioButton.prototype.mouseUp=function(e){xLeft(this.imageNode,0-this.width());this.setClass('GuiImageButtonHover');GuiWidget.hideTooltip()};RadioButton.prototype.mouseDown=function(e){xLeft(this.imageNode,0-this.width()*2);this.setClass('GuiImageButtonDown');GuiWidget.hideTooltip()};
RadioButtonGroup=function(newId){if(arguments.length>0)this.init(newId)};RadioButtonGroup.prototype.init=function(newId){this.buttons=new Array();this.buttonLookup={};this.activeButton=-1;this.id=newId;OBJECT_MANAGER.addControl(this,'radioButtonGroup',newId)};RadioButtonGroup.prototype.setActiveButton=function(buttonIndex){if(this.activeButton!=-1){if(this.buttons[this.activeButton].setInactive)this.buttons[this.activeButton].setInactive();else this.buttons[this.activeButton].checked=false}if(typeof(buttonIndex)=='string')buttonIndex=this.buttonLookup[buttonIndex];if(buttonIndex==null)buttonIndex=-1;this.activeButton=buttonIndex;if(buttonIndex!=-1){if(this.buttons[buttonIndex].setActive)this.buttons[buttonIndex].setActive();else this.buttons[buttonIndex].checked=true}};RadioButtonGroup.prototype.getActiveButton=function(){if(this.activeButton!=-1)return(this.buttons[this.activeButton]);else return(null)};RadioButtonGroup.prototype.addButton=function(button){this.buttonLookup[button.id]=this.buttons.length;this.buttons.push(button);return this.buttonLookup[button.id]};
ToolBar=function(newID,parentElement,xPosition,yPosition,zIndex,width,height,visibility,styleClass,alignment){this.widgetType='ToolBar';this.init(newID,parentElement,xPosition,yPosition,zIndex,width,height,visibility,styleClass,alignment)};ToolBar.prototype=new GuiWidget();ToolBar.prototype.constructor=ToolBar;ToolBar.superclass=GuiWidget.prototype;ToolBar.prototype.init=function(newID,parentElement,xPosition,yPosition,zIndex,width,height,visibility,styleClass,alignment){ToolBar.superclass.init.call(this,newID,parentElement,xPosition,yPosition,zIndex,width,height,visibility,styleClass);this.alignment=alignment;this.buttonObjects=[];this.buttonLookup={}};ToolBar.prototype.getButton=function(buttonid){if(this.buttonLookup[buttonid]!=null)return this.buttonObjects[this.buttonLookup[buttonid]];else return null};ToolBar.prototype.showButton=function(buttonid){if(this.buttonLookup[buttonid]!=null){this.buttonObjects[this.buttonLookup[buttonid]].show();this.updateButtons();return true}else return false};ToolBar.prototype.hideButton=function(buttonid){if(this.buttonLookup[buttonid]!=null){this.buttonObjects[this.buttonLookup[buttonid]].hide();this.updateButtons();return true}else return false};ToolBar.prototype.addButton=function(newButtonId,newButtonType,insertionType,insertionReference){var newButtonObjects=[];var newButton=null;var errorcode=null;var errormessage=null;var referenceIdx=-1;if(((insertionType==ToolBar.ADD_BUTTON_BEFORE)||(insertionType==ToolBar.ADD_BUTTON_AFTER))&&typeof(insertionReference=='string')){if(this.buttonLookup[insertionReference]!=null)referenceIdx=this.buttonLookup[insertionReference]};switch(newButtonType){case ToolBar.BUTTON_IMAGE:newButton=new ImageButton(newButtonId,this.element,0,0,0,arguments[4],arguments[5],arguments[6],arguments[7],arguments[8]);break;case ToolBar.BUTTON_RADIO:newButton=new RadioButton(newButtonId,this.element,0,0,0,arguments[4],arguments[5],arguments[6],arguments[7],arguments[8],arguments[9],arguments[10]);break;default:errorcode="0";errormessage='toolbar.addButton:  unknown button type \''+newButtonType+'\'';break};if(newButton){switch(insertionType){case ToolBar.ADD_BUTTON_LAST:this.buttonObjects.push(newButton);break;case ToolBar.ADD_BUTTON_FIRST:newButtonObjects.push(newButton);this.buttonObjects=newButtonObjects.concat(this.buttonObjects);break;case ToolBar.ADD_BUTTON_BEFORE:if(referenceIdx==-1)this.buttonObjects.push(newButton);else{if(referenceIdx==0){newButtonObjects.push(newButton);this.buttonObjects=newButtonObjects.concat(this.buttonObjects)}else{this.buttonObjects=this.buttonObjects.slice(0,referenceIdx).concat(newButton,this.buttonObjects.slice(referenceIdx+1,this.buttonObjects.length))}};break;case ToolBar.ADD_BUTTON_LAST:if(referenceIdx==-1)this.buttonObjects.push(newButton);break;case ToolBar.ADD_BUTTON_FIXED:break};for(var i=0;i<this.buttonObjects.length;i++){this.buttonLookup[(typeof(this.buttonObjects[i])=='string')?this.buttonObjects[i]:this.buttonObjects[i].id]=i};this.updateButtons();returnvalue=newButton}else returnvalue={GUILIB_FAULT:true,GUILIB_FAULT_CODE:errorcode,GUILIB_FAULT_MESSAGE:errormessage};return returnvalue};ToolBar.prototype.removeButton=function(buttonid){var buttonobj=null;var buttonindex=-1;var newbuttons=[];if(this.buttonLookup[buttonid]){buttonindex=this.buttonLookup[buttonid];buttonobj=this.buttonObjects[buttonindex];delete this.buttonLookup[buttonid];for(var i=0;i<this.buttonObjects.length;i++)if(i!=buttonindex)newbuttons.push(this.buttonObjects[i]);this.buttonObjects=newbuttons;if(typeof(buttonobj)!='string')if(buttonobj.parentElement=this.element)this.element.removeChild(buttonobj.element);this.updateButtons()};return buttonobj};ToolBar.prototype.updateButtons=function(){var offset=0;for(var i=0;i<this.buttonObjects.length;i++){if(typeof(this.buttonObjects[i])!='string'){if(this.buttonObjects[i].visibility)switch(this.alignment){case ToolBar.ALIGN_VERTICAL:this.buttonObjects[i].moveTo(0,offset);offset+=this.buttonObjects[i].height();break;case ToolBar.ALIGN_HORIZONTAL:this.buttonObjects[i].moveTo(offset,0);offset+=this.buttonObjects[i].width();break}}}};ToolBar.prototype.addDivider=function(newDividerId,insertionType,insertionReference){};ToolBar.ADD_BUTTON_LAST=0;ToolBar.ADD_BUTTON_FIRST=1;ToolBar.ADD_BUTTON_BEFORE=2;ToolBar.ADD_BUTTON_AFTER=3;ToolBar.ADD_BUTTON_FIXED=4;ToolBar.ALIGN_VERTICAL=0;ToolBar.ALIGN_HORIZONTAL=1;ToolBar.ALIGN_VERTICAL_BOTTOM=2;ToolBar.ALIGN_HORIZONTAL_RIGHT=1;ToolBar.ALIGN_VERTICAL_CENTER=2;ToolBar.ALIGN_HORIZONTAL_CENTER=1;ToolBar.BUTTON_IMAGE=0;ToolBar.BUTTON_RADIO=1;
Map=function(newId){var $_this=this;this.id=newId;this.config=null;this.mapNumber=0;this.clientVersion=null;this.serverVersion=null;this.mapImage=null;this.mapLoadImage=null;this.vmapPresent=false;this.vmapImage=null;this.mapLoadImage=null;this.legendImage=null;this.customLegendImage=null;this.bookmarkControl=null;this.markupControl=null;this.layerControl=null;this.bufferControl=null;this.themeControl=null;this.selectionControl=null;this.coordConvControl=null;this.measureControl=null;this.savedQueryControl=null;this.zoomBar=null;this.scaleBar=null;this.extensionMapClickHandlers=[];this.extensionMapMoveHandlers=[];this.sessionID=null;this.extent=[];this.dragExtent=[0,0,0,0];this.vmapExtent=[];this.bookmarks=[];this.bookmark_redrawmaps=true;this.legendVisible=null;this.legendSync=false;this.numWaitingRequests=0;this.printOptions=null;this.zoomFactor=1.5;this.initialExtent=null;this.activeMapScheme=null;this.firstLoad=true;this.dragTileCounter=0;this.dragTileSessionId=null;this.configDocNode=null;this.getExtent=function(){return[this.extent[0],this.extent[1],this.extent[2],this.extent[3]]};this.eventHandlers={initialize:[],extentChange:[],layerChange:[],imageChange:[],tileLoadStart:[],tileLoadFinish:[]};this.cursorEventHandlers={click:{},move:{},up:{},down:{},out:{},over:{}};this.addEventHandler=function(eventType,callback){console.assert((typeof(callback)=='function'),'MapObject:  attempting to add an invalid "'+eventType+'" event handler');if(this.eventHandlers[eventType]!=null)this.eventHandlers[eventType].push(callback);return this.eventHandlers[eventType].length-1};this.removeEventHandler=function(eventType,index){if(this.eventHandlers[eventType]!=null)this.eventHandlers[eventType][index]=null};this.addCursorEventHandler=function(eventType,mode,callback){console.assert((typeof(callback)=='function'),'MapObject:  attempting to add an invalid cursor "'+eventType+'" event handler for mode "'+mode+'"');if(this.cursorEventHandlers[eventType]){if(this.cursorEventHandlers[eventType][mode]==null)this.cursorEventHandlers[eventType][mode]=new Array();retval=this.cursorEventHandlers[eventType][mode].length;this.cursorEventHandlers[eventType][mode].push(callback);return retval}return null};this.setConfig=function(newConfig){this.config=newConfig;if(this.config.configNode){this.configDocNode=this.config.configNode;this.config.configNode=null};this.selectionsExist=false;var selectionCount=0;this.buffersExist=false;var bufferCount=0;var bufferableThemes=new Array();for(var currentTheme in this.config.themes){if(currentTheme=='toJSONString')continue;if(this.config.themes[currentTheme].selectOptions!=null){this.selectionsExist=true;selectionCount++};if(this.config.themes[currentTheme].bufferOptions!=null){bufferableThemes[bufferableThemes.length]=currentTheme;this.buffersExist=true;bufferCount++}};this.vmapPresent=(this.config["vmap"]["resourceId"]!='');if(this.selectionControl)this.selectionControl.initialize();if(this.bufferControl)this.bufferControl.initialize(bufferableThemes);if(this.coordConvControl)this.coordConvControl.draw();if(this.measureControl)this.measureControl.initialize();if(this.savedQueryControl)this.savedQueryControl.initialize()};Map.prototype.setMapScheme=function(schemeId){var themeArray=[];for(var currentTheme in this.config.mapSchemeConfig.mapSchemes[schemeId].themes){if(currentTheme=='toJSONString')continue;themeArray.push([this.config.mapSchemeConfig.mapSchemes[schemeId].themes[currentTheme].id,(this.config.mapSchemeConfig.mapSchemes[schemeId].themes[currentTheme].display==1),this.config.mapSchemeConfig.mapSchemes[schemeId].themes[currentTheme].legend])};this.setWaiting(true);this.legendSync=false;freeance_request(function(data){$_this.callback(data,'setMapScheme',true)},'GIS.Themes.setScheme',this.sessionID,0,themeArray)};this.initialize=function(sessionID){var useMapScheme=false;if(arguments.length>0)if(arguments[1]!=null)useMapScheme=true;var map_args=[[this.config["resourceId"],this.config["previousStates"],this.mapImage.width(),this.mapImage.height(),false]];if(this.vmapImage!=null)map_args[1]=[this.config["vmap"]["resourceId"],0,this.vmapImage.width(),this.vmapImage.height(),true,0,this.config["vmap"]["slaveType"],this.config["vmap"]["boundBoxPercentMin"],this.config["vmap"]["styleSheet"]];if(this.scalebar!=null)this.scalebar.initialize();this.setWaiting(true);if(useMapScheme){var mapSchemes=this.config.mapSchemeConfig.mapSchemes;var schemeId=arguments[1];var idx=0;for(var i=0;i<mapSchemes.length;i++){if(mapSchemes[i]['id']==schemeId)idx=i}this.activeMapScheme=schemeId;var scheme=mapSchemes[idx];var themeArray=new Array();for(var currentTheme in scheme.themes){if(currentTheme=='toJSONString')continue;var theme=scheme.themes[currentTheme];themeArray.push([theme.id,(theme.display==1),theme.legend])};freeance_request(function(data){$_this.callback(data,'Initialize_withScheme',true)},'GIS.Session.initialize.with.preset.scheme',sessionID,map_args,themeArray)}else freeance_request(function(data){$_this.callback(data,'Initialize',true)},'GIS.Session.initialize',sessionID,map_args)};this.setMapLoadImage=function(newImagePanel){this.mapLoadImage=newImagePanel};this.setVmapLoadImage=function(newImagePanel){this.vmapLoadImage=newImagePanel};this.setVmapImage=function(newMapImage){this.vmapImage=newMapImage};this.setLegendImage=function(newLegendImage,newLegendVisibility){this.legendImage=newLegendImage;this.legendVisible=newLegendVisibility;this.legendSync=false};this.setWaiting=function(state){if(state){if(this.mapImage!=null)this.mapImage.setWaiting(true);if(this.vmapImage!=null)this.vmapImage.setWaiting(true);this.numWaitingRequests++}else{this.numWaitingRequests--;if(this.numWaitingRequests<=0){if(this.mapImage!=null)this.mapImage.setWaiting(false);if(this.vmapImage!=null)this.vmapImage.setWaiting(false)}}};this.getMapDimensions=function(){if(this.vmapImage!=null)return[[this.mapImage.width(),this.mapImage.height()],[this.vmapImage.width(),this.vmapImage.height()]];else return[[this.mapImage.width(),this.mapImage.height()]]};this.loadLegend=function(){if(this.customLegendImage!=null)this.legendImage.src=this.customLegendImage;else{if(_MAP_INITIALIZED){this.setWaiting(true);freeance_request(function(data){$_this.callback(data,'Legend',true)},'GIS.Legend.getImage',this.sessionID,0,this.config["legendAttributes"]["width"],this.config["legendAttributes"]["height"],this.config["legendAttributes"]["color"],this.config["legendAttributes"]["font"],this.config["legendAttributes"]["fontSize"],this.config["legendAttributes"]["valueFontSize"],this.config["legendAttributes"]["cellSpacing"])}}};this.loadLegendSync=function(){if(this.customLegendImage!=null)this.legendImage.src=this.customLegendImage;else{var oldURL=this.legendImage.src;this.setWaiting(true);var result=freeance_request(null,'GIS.Legend.getImage',this.sessionID,0,this.config["legendAttributes"]["width"],this.config["legendAttributes"]["height"],this.config["legendAttributes"]["color"],this.config["legendAttributes"]["font"],this.config["legendAttributes"]["fontSize"],this.config["legendAttributes"]["valueFontSize"],this.config["legendAttributes"]["cellSpacing"]);var data=result.data;if(data!=null){this.legendImage.src=this.correctURL(data);this.legendSync=true};this.setWaiting(false)}};this.mouseMove=function(xPos,yPos,width,height,XPercent,YPercent,clickMode){if(this.extensionMapMoveHandlers[clickMode]){console.warn('deprecated event handler type used for '+clickMode);this.extensionMapMoveHandlers[clickMode](xPos,yPos,width,height,XPercent,YPercent,clickMode)};var eventarr=this.cursorEventHandlers['move'][clickMode];if(eventarr){for(var i=0;i<eventarr.length;i++){if(typeof(eventarr[i])=='function')eventarr[i](xPos,yPos,width,height,XPercent,YPercent,clickMode)}}};this.click=function(xPos,yPos,width,height,XPercent,YPercent,clickMode){switch(clickMode){case'ZoomIn':this.setWaiting(true);freeance_request(function(data){$_this.callback(data,clickMode,true)},'GIS.Zoom.in.byPercent',this.sessionID,0,width,height,1.5,XPercent,YPercent);this.legendSync=false;break;case'ZoomOut':this.setWaiting(true);freeance_request(function(data){$_this.callback(data,clickMode,true)},'GIS.Zoom.out.byPercent',this.sessionID,0,width,height,1.5,XPercent,YPercent);this.legendSync=false;break;case'Center':this.setWaiting(true);freeance_request(function(data){$_this.callback(data,clickMode,true)},'GIS.Center.byPercent',this.sessionID,0,width,height,XPercent,YPercent);break;default:if(this.extensionMapClickHandlers[clickMode]){console.warn('deprecated event handler type used for '+clickMode);this.extensionMapClickHandlers[clickMode](xPos,yPos,width,height,XPercent,YPercent,clickMode)}break}var eventarr=this.cursorEventHandlers['click'][clickMode];if(eventarr){for(var i=0;i<eventarr.length;i++){if(typeof(eventarr[i])=='function')eventarr[i](xPos,yPos,width,height,XPercent,YPercent,clickMode)}}};this.centerOnPoint=function(newMapX,newMapY){this.setWaiting(true);freeance_request(function(data){$_this.callback(data,'CenterOnPoint',true)},'GIS.Center.onPoint',this.sessionID,0,this.mapImage.width(),this.mapImage.height(),newMapX,newMapY)};this.clickVmap=function(xPosition,yPosition,imageWidth,imageHeight){var XPercent=xPosition/imageWidth;var YPercent=1.0-(yPosition/imageHeight);var mapX=(XPercent*(this.vmapExtent[3]-this.vmapExtent[2]))+this.vmapExtent[2];var mapY=(YPercent*(this.vmapExtent[1]-this.vmapExtent[0]))+this.vmapExtent[0];this.setWaiting(true);freeance_request(function(data){$_this.callback(data,'CenterOnPoint',true)},'GIS.Center.onPoint',this.sessionID,0,this.mapImage.width(),this.mapImage.height(),mapX,mapY)};this.pan=function(DirStr){this.setWaiting(true);var mapData=freeance_request(function(data){$_this.callback(data,'Pan',true)},'GIS.Pan.byDirection',this.sessionID,0,this.mapImage.width(),this.mapImage.height(),DirStr,0.4)};this.zoomInitialExtent=function(){this.setWaiting(true);this.legendSync=false;freeance_request(function(data){$_this.callback(data,'ZoomInitialExtent',true)},'GIS.Zoom.to.initialExtent',this.sessionID,0,this.mapImage.width(),this.mapImage.height())};this.zoomFullExtent=function(){this.setWaiting(true);this.legendSync=false;freeance_request(function(data){$_this.callback(data,'ZoomInitialExtent',true)},'GIS.Zoom.to.fullExtent',this.sessionID,0,this.mapImage.width(),this.mapImage.height())};this.zoomPresetExtent=function(newPresetName){this.setWaiting(true);this.legendSync=false;freeance_request(function(data){$_this.callback(data,'ZoomPresetExtent',true)},'GIS.Zoom.to.presetExtent',this.sessionID,0,this.mapImage.width(),this.mapImage.height(),newPresetName)};this.zoomIn=function(){this.setWaiting(true);this.legendSync=false;freeance_request(function(data){$_this.callback(data,'ZoomIn',true)},'GIS.Zoom.in',this.sessionID,0,this.mapImage.width(),this.mapImage.height(),this.zoomFactor)};this.zoomOut=function(){this.setWaiting(true);this.legendSync=false;freeance_request(function(data){$_this.callback(data,'ZoomOut',true)},'GIS.Zoom.out',this.sessionID,0,this.mapImage.width(),this.mapImage.height(),this.zoomFactor)};this.zoomTo=function(themeIndex,SQLstr,select){this.setWaiting(true);this.legendSync=false;if(!this.selectionsExist)select=false;var GIS_stylesheet=this.config.themes[themeIndex].selectOptions.styleSheet;if(select){var requestDetails={request:'newSelection',themeId:themeIndex,deselect:false};if(this.config.themes[themeIndex].selectOptions.sqlParams!=null){var configSQLParams=this.config.themes[themeIndex].selectOptions.sqlParams;var sqlParams=Array();for(var pos=0;pos<configSQLParams.length;pos++){sqlParams[pos]=[configSQLParams[pos].pdqIdentifier];var fieldPairs=Array();for(var lcv=0;lcv<configSQLParams[pos].fieldList.length;lcv++){fieldPairs.push([configSQLParams[pos].fieldList[lcv].fieldName,configSQLParams[pos].fieldList[lcv].pdqFieldName])}sqlParams[pos][1]=fieldPairs;if(configSQLParams[pos].queryType!=''){sqlParams[pos][2]=[configSQLParams[pos].queryType,configSQLParams[pos].numRows,configSQLParams[pos].startAt]}};freeance_request(function(data){$_this.selectionControl.callback_newselection(data,themeIndex)},'GIS.Zoom.to.entities',this.sessionID,0,this.mapImage.width(),this.mapImage.height(),themeIndex,this.config.themes[themeIndex].selectOptions.fieldList,SQLstr,this.config.themes[themeIndex].selectOptions.zoomExtentRatio,1,select,select,false,GIS_stylesheet,sqlParams)}else freeance_request(function(data){$_this.selectionControl.callback_newselection(data,themeIndex)},'GIS.Zoom.to.entities',this.sessionID,0,this.mapImage.width(),this.mapImage.height(),themeIndex,this.config.themes[themeIndex].selectOptions.fieldList,SQLstr,this.config.themes[themeIndex].selectOptions.zoomExtentRatio,1,select,select,false,GIS_stylesheet)}else{freeance_request(function(data){$_this.callback(data,'zoomTo',true)},'GIS.Zoom.to.entities',this.sessionID,0,this.mapImage.width(),this.mapImage.height(),themeIndex,this.config.themes[themeIndex].selectOptions.fieldList,SQLstr,this.config.themes[themeIndex].selectOptions.zoomExtentRatio,1,select,select,false,GIS_stylesheet)}};this.zoomTo_=function(layerid,attrib,fieldtype,value,select){var quote=((fieldtype==8)||(fieldtype==12)||(fieldtype==1)||(fieldtype==91));var sqlstr=attrib+"="+(quote?"'":"")+value+(quote?"\'":"");this.zoomTo(layerid,sqlstr,select)};this.zoomToSelection=function(themeIndex,SQLstr,select){this.setWaiting(true);this.legendSync=false;var GIS_stylesheet=this.config.themes[themeIndex].selectOptions.styleSheet;if(select){if(this.config.themes[themeIndex].selectOptions.sqlParams!=null){var configSQLParams=this.config.themes[themeIndex].selectOptions.sqlParams;var sqlParams=Array();for(var pos=0;pos<configSQLParams.length;pos++){sqlParams[pos]=[configSQLParams[pos].pdqIdentifier];var fieldPairs=[];for(var lcv=0;lcv<configSQLParams[pos].fieldList.length;lcv++){fieldPairs[lcv]=[configSQLParams[pos].fieldList[lcv].fieldName,configSQLParams[pos].fieldList[lcv].pdqFieldName]};sqlParams[pos][1]=fieldPairs;if(configSQLParams[pos].queryType!=''){sqlParams[pos][2]=[configSQLParams[pos].queryType,configSQLParams[pos].numRows,configSQLParams[pos].startAt]}}freeance_request(function(data){$_this.callback(data,'zoomToSelection',true)},'GIS.Zoom.to.entities',this.sessionID,0,this.mapImage.width(),this.mapImage.height(),themeIndex,"*",SQLstr,this.config.themes[themeIndex].selectOptions.zoomExtentRatio,1,select,select,false,GIS_stylesheet,sqlParams)}else freeance_request(function(data){$_this.callback(data,'zoomToSelection',true)},'GIS.Zoom.to.entities',this.sessionID,0,this.mapImage.width(),this.mapImage.height(),themeIndex,"*",SQLstr,this.config.themes[themeIndex].selectOptions.zoomExtentRatio,1,select,select,false,GIS_stylesheet)}else freeance_request(function(data){$_this.callback(data,'zoomToSelection',true)},'GIS.Zoom.to.entities',this.sessionID,0,this.mapImage.width(),this.mapImage.height(),themeIndex,"*",SQLstr,this.config.themes[themeIndex].selectOptions.zoomExtentRatio,1,select,select,false,GIS_stylesheet)};this.zoomToExtent=function(newExtent){this.setWaiting(true);this.legendSync=false;freeance_request(function(data){$_this.callback(data,'ZoomToExtent',true)},'GIS.Zoom.to.extent',this.sessionID,0,this.mapImage.width(),this.mapImage.height(),newExtent)};this.refresh=this.redraw=function(){this.setWaiting(true);freeance_request(function(data){$_this.callback(data,'MapRedraw',true)},'GIS.Map.redraw',this.sessionID,0,this.mapImage.width(),this.mapImage.height())};this.zoomToPrevious=function(){this.setWaiting(true);this.legendSync=false;freeance_request(function(data){$_this.callback(data,'ZoomPrevious',true)},'GIS.Zoom.to.previousExtent',this.sessionID,0,this.mapImage.width(),this.mapImage.height())};this.zoomToWindow=function(bottom,top,left,right){this.setWaiting(true);this.legendSync=false;freeance_request(function(data){$_this.callback(data,'ZoomWindow',true)},'GIS.Zoom.to.windowPercent',this.sessionID,0,this.mapImage.width(),this.mapImage.height(),bottom,top,left,right)};this.zoombar=function(ratio,divnum,numdivs){this.setWaiting(true);this.legendSync=false;freeance_request(function(data){$_this.callback(data,'ZoomBar',true)},'GIS.Zoom.by.bar',this.sessionID,0,this.mapImage.width(),this.mapImage.height(),ratio,divnum,numdivs)};this.setThemes=function(newThemeList){for(var i=0;i<newThemeList.length;i++){this.themeLookup[newThemeList[i][0]]=i;this.themes[i]=new Array(newThemeList[i],"off")}};this.getThemeByName=function(newThemeName){return this.themes[this.themeLookup[newThemeName]]};this.setActiveTheme=function(newActiveTheme){this.config.activeTheme=newActiveTheme;if(this.layerControl)this.layerControl.update()};this.getBookmarkList=function(){if(this.bookmarkControl!=null)freeance_request(function(data){$_this.callback(data,'getBookmarkList',true)},'GIS.Geobookmark.get.list',this.sessionID)};this.addBookmark=function(name){if(name!='')freeance_request(function(data){$_this.callback(data,'addBookmark',true)},'GIS.Geobookmark.add.state',this.sessionID,0,name,false,false)};this.gotoBookmark=function(bookmarkIndex){var name=this.bookmarks[bookmarkIndex];this.setWaiting(true);this.legendSync=false;freeance_request(function(data){$_this.callback(data,'gotoBookmark',true)},'GIS.Geobookmark.restore.state',this.sessionID,0,name,this.bookmark_redrawmaps,true,true,true,false)};this.removeBookmark=function(bookmarkIndex){var name=this.bookmarks[bookmarkIndex];this.setWaiting(true);freeance_request(function(data){$_this.callback(data,'removeBookmark',true)},'GIS.Geobookmark.remove.state',this.sessionID,name)};this.loadThemes=function(){this.setWaiting(true);freeance_request(function(data){$_this.callback(data,'getThemes',true)},'GIS.Themes.getList',this.sessionID,0)};this.setThemeState=function(themeName,visible){var themeArray=[[themeName,visible]];this.config["themes"][themeName]["visibility"]=visible;this.legendSync=false;freeance_request(function(data){$_this.callback(data,'setThemes',true)},'GIS.Themes.setList',this.sessionID,0,themeArray)};this.clearSelection=function(themeIndex,selectionHandle){var requestDetails={request:'clearSelection',themeIndex:themeIndex,handle:selectionHandle};this.setWaiting(true);freeance_request(function(data){$_this.selectionControl.clearSelection_callback(data,themeIndex,selectionHandle)},'GIS.Selection.clear.EntityFromTheme',this.sessionID,0,themeIndex,selectionHandle,this.mapImage.width(),this.mapImage.height())};this.clearDuplicateSelection=function(themeIndex,selectionHandle){this.setWaiting(true);freeance_request(function(data){$_this.selectionControl.clearSelection_callback(data,themeIndex,handle)},'GIS.Selection.clear.EntityFromTheme',this.sessionID,0,themeIndex,selectionHandle,this.mapImage.width(),this.mapImage.height())};this.clearThemeSelections=function(themeIndex){var requestDetails={request:'clearTheme',themeIndex:themeIndex};this.setWaiting(true);freeance_request(function(data){$_this.selectionControl.callback(data,requestDetails)},'GIS.Selection.clear.AllFromTheme',this.sessionID,0,themeIndex)};this.clearSyncSelection=function(themeIndex,selectionHandle){this.setWaiting(true);var mapData=freeance_request(null,'GIS.Selection.clear.EntityFromTheme',this.sessionID,0,this.themes[themeIndex][0][0],selectionHandle,this.mapImage.width(),this.mapImage.height());this.setWaiting(false)};this.callback=function(serverResponse,pendingOperation){var clearMeasurePoints=false;var data=serverResponse.data;if(serverResponse.XMLRPC_FAULT){switch(parseInt(serverResponse.XMLRPC_FAULT_CODE)){case 1018:break;default:console.error('An error occurred in a Map request.\n\nOperation:  '+pendingOperation+'\nError Code: '+serverResponse.XMLRPC_FAULT_CODE+'\nError Message:\n'+serverResponse.XMLRPC_FAULT_MESSAGE);break};this.setWaiting(false)};if(data!=null){switch(pendingOperation){case'Initialize':case'Initialize_withScheme':_MAP_INITIALIZED=true;if(this.firstLoad){this.firstLoad=false;var ext=data[0][1];this.initialExtent=[ext[0],ext[1],ext[2],ext[3]]};this.extent=data[0][1];if(this.mapImage!=null){this.setWaiting(true);var node=this.mapImage.imageNode;node.mapObject=this;node.onload=this.imageLoadCallback;this.setMapImage(data[0][0])};if(this.vmapImage!=null){this.setWaiting(true);var node=this.vmapImage.imageNode;node.mapObject=this;node.onload=this.imageLoadCallback;node.src=this.correctURL(data[1][0])};this.vmapExtent=data[1][1];this.sessionID=data[data.length-1];document.setSessionID(this.sessionID);var ext=data[0][1];this.extent=[ext[0],ext[1],ext[2],ext[3]];var events=this.eventHandlers['extentChange'];for(var i=0;i<events.length;i++){if(events[i]){events[i]()}};this.loadThemes();this.loadLegend();this.getBookmarkList();if(document.savedQueryControl)document.savedQueryControl.initialize();if(this.zoomBar)this.zoomBar.initialize();var events=this.eventHandlers['initialize'];for(var i=0;i<events.length;i++){if(events[i]){events[i]()}};break;case'getThemes':for(i=0;i<data.length;i++){try{this.config["themes"][data[i][0]]["visibility"]=data[i][1]}catch(e){console.warn('Warning:\nUnable to set the visibility for map layer "'+data[i][0]+'"\nThere may be a mismatch between the client configuration and the map resource.')}};if(this.layerControl)this.layerControl.update();break;case'setThemes':var events=this.eventHandlers['layerChange'];for(var i=0;i<events.length;i++){if(events[i]){events[i]()}};break;case'setMapScheme':this.loadThemes();this.redraw();break;case'Legend':if(this.legendImage!=null)this.legendImage.src=this.correctURL(data);this.legendSync=true;break;case'LoadLayers':break;case'getBookmarkList':if(this.bookmarkControl!=null)this.bookmarkControl.callback(data,'getBookmarkList');break;case'addBookmark':if(this.bookmarkControl!=null)this.bookmarkControl.callback(data,'addBookmark');this.getBookmarkList();break;case'removeBookmark':if(this.bookmarkControl!=null)this.bookmarkControl.callback(data,'removeBookmark');this.getBookmarkList();break;case'gotoBookmark':if(this.mapImage!=null){this.setWaiting(true);this.setMapImage(data[0][1])};if(this.vmapImage!=null){this.setWaiting(true);this.vmapImage.imageNode.src=this.correctURL(data[1][1])};var ext=data[0][2];this.extent=Array(ext[0],ext[1],ext[2],ext[3]);var events=this.eventHandlers['extentChange'];for(var i=0;i<events.length;i++){if(events[i]){events[i]()}};this.loadThemes();if(this.legendVisible)this.loadLegend();clearMeasurePoints=true;break;case'Select':break;case'dEmail':break;case'BufferXY':var ext=data[0][0][2];this.extent=Array(ext[0],ext[1],ext[2],ext[3]);var events=this.eventHandlers['extentChange'];for(var i=0;i<events.length;i++){if(events[i]){events[i]()}};if(this.mapImage!=null){this.setWaiting(true);this.setMapImage(data[0][0][1])};if(this.vmapImage!=null){this.setWaiting(true);this.vmapImage.imageNode.src=this.correctURL(data[0][1][1])};break;case'zoomTo':case'zoomToSelection':if(this.mapImage!=null){this.setWaiting(true);this.setMapImage(data[0][0][1])};if(this.vmapImage!=null){this.setWaiting(true);this.vmapImage.imageNode.src=this.correctURL(data[0][1][1])};if(this.legendVisible)this.loadLegend;var ext=data[0][0][2];this.extent=Array(ext[0],ext[1],ext[2],ext[3]);var events=this.eventHandlers['extentChange'];for(var i=0;i<events.length;i++){if(events[i]){events[i]()}};clearMeasurePoints=true;break;case'getExportedMap':this.downloadExportedMap(data);break;case'printMap':document.printMap(result.data);break;default:var ext=data[0][2];this.extent=Array(ext[0],ext[1],ext[2],ext[3]);var events=this.eventHandlers['extentChange'];for(var i=0;i<events.length;i++){if(events[i]){events[i]()}};if(this.mapImage!=null){this.setMapImage(data[0][1]);this.setWaiting(true)};if(this.vmapImage!=null){this.setWaiting(true);this.vmapImage.imageNode.src=this.correctURL(data[1][1])};if(this.legendVisible&&!this.legendSync){this.loadLegend()};clearMeasurePoints=true;break};if((this.measureControl!=null)&&clearMeasurePoints)this.measureControl.distanceReset();if((this.zoomBar!=null)&&(this.zoomBar.initialized))this.zoomBar.highlightNearestDiv();if(this.scalebar)this.scalebar.drawScalebar()};this.setWaiting(false)};this.setMapImage=function(imgURL){this.mapImage.imageNode.src=this.correctURL(imgURL);for(i=0;i<this.mapImage.drawplanes.length;i++){if(this.mapImage.drawplanes[i]){if(this.mapImage.drawplanes[i]["freeance_drag"])xMoveTo(this.mapImage.drawplanes[i],0,0)}}if(this.config.seamlessPan){var extentsMatch=true;for(var i=0;((i<this.extent.length)&&extentsMatch);i++)extentsMatch=(this.extent[i]==this.dragExtent[i]);if(!extentsMatch){this.mapImage.clearDragTiles();this.dragExtent=cloneObject(this.extent);var $_this=this;var extentHeight=this.extent[1]-this.extent[0];var extentWidth=this.extent[3]-this.extent[2];var minLeft=this.extent[2]-extentWidth;var minBottom=this.extent[0]-extentHeight;var maxTop=this.extent[1]+extentHeight;var maxRight=this.extent[3]+extentWidth;var newExtents=[[this.extent[1],maxTop,minLeft,this.extent[2]],[this.extent[1],maxTop,this.extent[2],this.extent[3]],[this.extent[1],maxTop,this.extent[3],maxRight],[this.extent[0],this.extent[1],minLeft,this.extent[2]],[this.extent[0],this.extent[1],this.extent[2],this.extent[3]],[this.extent[0],this.extent[1],this.extent[3],maxRight],[minBottom,this.extent[0],minLeft,this.extent[2]],[minBottom,this.extent[0],this.extent[2],this.extent[3]],[minBottom,this.extent[0],this.extent[3],maxRight]];var $_tileCounter=++this.dragTileCounter;if(this.dragTileSessionId)this.mapTile_initializeCallback({data:[this.dragTileSessionId]},newExtents,$_tileCounter);else freeance_request(function(result){$_this.mapTile_initializeCallback(result,newExtents,$_tileCounter)},'GIS.Session.initialize','',Array(Array(this.config["resourceId"],1,1,1,false)))}}};this.mapTile_initializeCallback=function(result,newExtents,dragTileCounter){var $_this=this;if(this.dragTileCounter==dragTileCounter){var $_sessionId=result['data'][result['data'].length-1];this.dragTileSessionId=$_sessionId;var themeArray=[];for(var i in this.config['themes']){if(i=='toJSONString')continue;themeArray.push([i,this.config['themes'][i]['visibility']])}freeance_request(function(result){$_this.mapTile_setThemesCallback(result,newExtents,dragTileCounter,$_sessionId)},'GIS.Themes.setList',$_sessionId,0,themeArray)}else console.log('map tile request '+dragTileCounter+'['+dragTileCounter+'] cancelled')};this.width=function(){return this.mapImage.width()};this.height=function(){return this.mapImage.height()};this.mapTile_setThemesCallback=function(result,newExtents,dragTileCounter,sessionId){if(this.dragTileCounter==dragTileCounter){var width=this.mapImage.width();var height=this.mapImage.height();for(var tileIndex=0;tileIndex<9;tileIndex++)if(tileIndex!=4)this.mapTile_makeImageRequest(newExtents[tileIndex],dragTileCounter,sessionId,tileIndex,width,height)}else console.log('map tile request '+dragTileCounter+'['+tileIndex+'] cancelled')};this.mapTile_makeImageRequest=function(extent,dragTileCounter,sessionId,tileIndex,width,height){var $_this=this;freeance_request(function(result){$_this.mapTile_imageCallback(result,dragTileCounter,tileIndex)},'GIS.Zoom.to.extent',sessionId,0,width,height,extent)};this.mapTile_imageCallback=function(result,dragTileCounter,tileIndex){if(this.dragTileCounter==dragTileCounter){this.mapImage.dragTiles[tileIndex].setAttribute('src',this.correctURL(result['data'][0][1]))}else console.log('map tile request '+dragTileCounter+'['+tileIndex+'] cancelled')};this.imageLoadCallback=function(){$_this.setWaiting(false)};this.selectionCallback=function(data){var returnValue;if(data){this.setMapImage(data[0][1]);if(this.vmapImage!=null)this.vmapImage.imageNode.src=this.correctURL(data[1][1]);var ext=data[0][2];this.extent=[ext[0],ext[1],ext[2],ext[3]];returnValue=true}else returnValue=null;this.setWaiting(false);if(data!=null)if(this.onSelect)this.onSelect();return returnValue};this.correctURL=function(newURL){var returnValue=newURL;if(typeof(returnValue)!='string'){console.warn('Invalid url type - '+typeof(returnValue)+' :: '+returnValue)}if(returnValue.substr(0,1)=='/'){returnValue='http://'+this.config["imsHostname"]+newURL}else{var url=/(\w+):\/\/([^\/]+)\/(\S*)/;var result=newURL.match(url);if(result==null)returnValue=newURL;else returnValue=result[1]+'://'+this.config["imsHostname"]+'/'+result[3]};return returnValue};this.exportMap=function(){this.setWaiting(true);freeance_request(function(data){$_this.callback(data,'getExportedMap',true)},'ArcIMS.Map.export',this.sessionID,0,this.mapImage.width(),this.mapImage.height())};this.downloadExportedMap=function(url){url=this.correctURL(url);downloadFile(url)};this.print=function(){var extent=[];var scale_config=[];if(arguments.length>2)extent=arguments[2];if(arguments.length>3)scale_config=arguments[3];var placeholderVariables=new Array();if(this.config.printConfig.defaultTemplate==-1){alert('Freeance Internal Error:  Unable to Print.\nReason:  No print configurations have been defined.');console.error('Freeance Internal Error:  Unable to Print.\nReason:  No print configurations have been defined.')}else{this.loadLegendSync();this.setWaiting(true);placeholderVariables[0]=Array('legendImage',this.legendImage.src);if(this.vmapImage!=null)placeholderVariables[1]=Array('vmapImage',this.vmapImage.imageNode.src);else placeholderVariables[1]=Array('vmapImage',GuiWidget.THEME_PATH+'/'+GuiWidget.THEME+'/images/blank.gif');if(arguments.length>0){for(var i=0;i<arguments[0].length;i++){placeholderVariables.push([arguments[0][i][0],arguments[0][i][1]])}};freeance_request(arguments[1],'PDFPrint.Template.Map',this.config.printConfig.templates[this.config.printConfig.activeTemplate].templateName,placeholderVariables,document.sessionID,0,document.mapObject.mapImage.width(),document.mapObject.mapImage.height(),5,extent,scale_config)}}};
MapImage=function(newID,parentElement,newXPosition,newYPosition,newZIndex,newWidth,newHeight,newVisibility,newMapObject,newMapType){var $_this=this;this.drawplanes=[];this.id=newID;this.map=newMapObject;this.mapType=newMapType;this.dragEnabled=false;this.currentCursor='MapImageWait';this.loadImage=null;this.waiting=false;var zoomBoxPending=false;this.mouseDownPosition=Array(0,0);this.dragPending=false;this.cursorPos=[-1,-1];this.eventCallbacks={resize:Array(),click:Array(),mouseOver:Array(),mouseOut:Array(),mouseUp:Array(),mouseDown:Array(),mouseMove:Array(),dragStart:Array(),drag:Array(),dragEnd:Array()};var zoomBox={element:document.createElement('DIV'),xstart:0,ystart:0,xend:0,yend:0,xdelta:0,ydelta:0,setActive:function(x1,y1){this.xstart=x1;this.ystart=y1;xResizeTo(this.element,1,1);xMoveTo(this.element,x1,y1);xShow(this.element)},update:function(x2,y2){this.xend=x2;this.yend=y2;if((this.xend>0)&&(this.xend<$_this.width())&&(this.yend>0)&&(this.yend<$_this.height())){xMoveTo(this.element,(this.xstart<this.xend)?this.xstart:this.xend,(this.ystart<this.yend)?this.ystart:this.yend);xResizeTo(this.element,Math.abs(this.xstart-this.xend),Math.abs(this.ystart-this.yend))}else this.setInactive()},setInactive:function(){xHide(this.element)}};setClass(zoomBox.element,'zoomBox');xHide(zoomBox.element);this.registerEventCallback=function(eventType,callback){if(this.eventCallbacks[eventType]!=null)this.eventCallbacks[eventType].push(callback);return this.eventCallbacks[eventType].length-1};this.unregisterEventCallback=function(eventType,index){if(this.eventCallbacks[eventType]!=null)this.eventCallbacks[eventType][index]=null};this.setMapObject=function(newMapObject){this.map=newMapObject};this.setMapImage=function(newImagePath){this.imageNode.src=newImagePath;this.dragTiles[4].src=newImagePath;this.positionDragTiles()};this.addDrawplane=function(){var retval=this.drawplanes.length;var drawplane=(arguments.length>0)?arguments[0]:document.createElement('DIV');drawplane.style.position='absolute';drawplane.style.left=0;drawplane.style.top=0;drawplane.style.display='block';drawplane.width=this.eventHandlerNode.width;drawplane.height=this.eventHandlerNode.height;this.customDrawPlaneNode.appendChild(drawplane);this.drawplanes.push(drawplane);return retval};this.getDrawplane=function(idx){return this.drawplanes[idx]};this.removeDrawplane=function(idx){var drawplane=this.drawplanes[idx];this.customDrawPlaneNode.removeChild(drawplane);this.drawplanes[idx]=null;return drawplane};this.setMouseMode=function(newMode){this.mouseMode=newMode;switch(newMode){case'DragMap':this.currentCursor='MapImageDrag';this.eventHandlerNode.setAttribute((xIE4Up?("className"):("class")),'MapImageDrag');break;case'ZoomIn':case'ZoomOut':case'ZoomWindow':case'CoordConvSP2LatLon':case'MeasureDistance':case'Markup':this.currentCursor='MapImageZoom';this.eventHandlerNode.setAttribute((xIE4Up?("className"):("class")),'MapImageZoom');this.dragEnabled=false;break;case'Center':this.currentCursor='MapImageCenter';this.eventHandlerNode.setAttribute((xIE4Up?("className"):("class")),'MapImageCenter');break;case'Select':case'SelectWindow':case'BufferXY':this.currentCursor='MapImageSelect';this.eventHandlerNode.setAttribute((xIE4Up?("className"):("class")),'MapImageSelect');break;default:this.dragEnabled=false;break}if(arguments.length>1)this.eventHandlerNode.style.cursor=arguments[1]};this.setWaiting=function(newState){if(newState){if(this.mapType=='MASTER')xShow(this.loadImage)}else{if(this.mapType=='MASTER')xHide(this.loadImage);xMoveTo(this.imageNode,0,0);xShow(this.imageNode)}this.waiting=newState;this.eventHandlerNode.setAttribute((xIE4Up?("className"):("class")),((newState)?('MapImageWait'):(this.currentCursor)))};this.show=function(){xShow(this.element)};this.hide=function(){xHide(this.element)};this.left=function(){return((arguments.length>0)?(xLeft(this.element,arguments[0])):(xLeft(this.element)))};this.top=function(){return((arguments.length>0)?(xTop(this.element,arguments[0])):(xTop(this.imageNode)))};this.moveTo=function(newXPosition,newYPosition){xMoveTo(this.element,newXPosition,newYPosition)};this.width=function(){if(arguments.length>0){var width=arguments[0];var height=this.height();this.resizeTo(width,height)}return xWidth(this.imageNode)};this.height=function(){if(arguments.length>0){var width=this.width();var height=arguments[0];this.resizeTo(width,height)}return xHeight(this.imageNode)};this.resizeTo=function(newWidth,newHeight){var centerX=Math.floor(0.5*newWidth);var centerY=Math.floor(0.5*newHeight);xResizeTo(this.element,newWidth,newHeight);xResizeTo(this.drawPlaneNode,newWidth,newHeight);if(this.measureCanvas){xResizeTo(this.measureCanvas,newWidth,newHeight);this.measureCanvas.width=newWidth;this.measureCanvas.height=newHeight}xResizeTo(this.rasterDrawPlaneNode,newWidth,newHeight);xResizeTo(this.customDrawPlaneNode,newWidth,newHeight);xResizeTo(this.eventHandlerNode,newWidth,newHeight);xResizeTo(this.imageNode,newWidth,newHeight);xMoveTo(this.bufferTargetNode,centerX-25,centerY-25);xMoveTo(this.zoomInTargetNode,centerX-25,centerY-25);xMoveTo(this.zoomOutTargetNode,centerX-25,centerY-25);if((this.mapType=='MASTER')&&(this.loadImage!=null))xMoveTo(this.loadImage,centerX,centerY);this.positionDragTiles(newWidth,newHeight);for(var i=0;i<this.eventCallbacks['resize'].length;i++)if(this.eventCallbacks['resize'][i])this.eventCallbacks['resize'][i](newWidth,newHeight)};this.clickCallback=function(e){var X=e.offsetX;var Y=e.offsetY;this.cursorPos=[X,Y];this.dragPending=false;if((X==this.mouseDownPosition[0])&&(Y==this.mouseDownPosition[1])){if(this.mapType=='SLAVE'){return this.map.centerOnPoint(((X/this.width())*(this.map.vmapExtent[3]-this.map.vmapExtent[2]))+this.map.vmapExtent[2],((1.0-(Y/this.height()))*(this.map.vmapExtent[1]-this.map.vmapExtent[0]))+this.map.vmapExtent[0])}else{var MapWidth=this.width();var MapHeight=this.height();var XPercent=X/MapWidth;var YPercent=1.0-(Y/MapHeight);switch(this.mouseMode){case'SelectWindow':this.map.click(X,Y,MapWidth,MapHeight,XPercent,YPercent,'Select');break;case'ZoomWindow':this.map.click(X,Y,MapWidth,MapHeight,XPercent,YPercent,'ZoomIn');break;case'DragMap':this.map.click(X,Y,MapWidth,MapHeight,XPercent,YPercent,'Center');break;default:this.map.click(X,Y,MapWidth,MapHeight,XPercent,YPercent,this.mouseMode);break}}}for(var i=0;i<this.eventCallbacks['click'].length;i++)if(this.eventCallbacks['click'][i])this.eventCallbacks['click'][i](e)};this.mouseMoveCallback=function(e){var X=e.offsetX;var Y=e.offsetY;if((X==this.cursorPos[0])&&(Y==this.cursorPos[1])){return false};this.cursorPos=[X,Y];if(this.mapType!='SLAVE'){var MapWidth=this.width();var MapHeight=this.height();this.map.mouseMove(X,Y,MapWidth,MapHeight,X/MapWidth,1.0-(Y/MapHeight),this.mouseMode)}for(var i=0;i<this.eventCallbacks['mouseMove'].length;i++)if(this.eventCallbacks['mouseMove'][i])this.eventCallbacks['mouseMove'][i](e)};this.processMapDrag=function(dX,dY){this.dragEnabled=false;var MapWidth=this.width();var MapHeight=this.height();var X=(MapWidth*0.5-dX);var Y=(MapHeight*0.5-dY);return this.map.click(X,Y,MapWidth,MapHeight,X/MapWidth,1.0-(Y/MapHeight),'Center')};this.mouseOverCallback=function(e){this.cursorPos=[-1,-1];for(var i=0;i<this.eventCallbacks['mouseOver'].length;i++)if(this.eventCallbacks['mouseOver'][i])this.eventCallbacks['mouseOver'][i](e)};this.mouseOutCallback=function(e){this.cursorPos=[-1,-1];if((this.mouseMode=='DragMap')&&this.dragEnabled){this.imageNode.src=this.dragTiles[4].src;this.positionDragTiles();for(i=0;i<this.drawplanes.length;i++){if(this.drawplanes[i]){if(this.drawplanes[i]["freeance_drag"])xMoveTo(this.drawplanes[i],0,0)}}};this.dragEnabled=false;var pagex=xPageX(this.imageNode),pagey=xPageY(this.imageNode);if(!((e.pageX>pagex)&&(e.pageX<(pagex+xWidth(this.imageNode)))&&(e.pageY>pagey&&(e.pageY<(pagey+xHeight(this.imageNode))))))zoomBox.setInactive();for(var i=0;i<this.eventCallbacks['mouseOut'].length;i++)if(this.eventCallbacks['mouseOut'][i])this.eventCallbacks['mouseOut'][i](e)};this.mouseUpCallback=function(e){this.cursorPos=[e.offsetX,e.offsetY];for(var i=0;i<this.eventCallbacks['mouseUp'].length;i++)if(this.eventCallbacks['mouseUp'][i])this.eventCallbacks['mouseUp'][i](e)};this.mouseDownCallback=function(e){this.cursorPos=[e.offsetX,e.offsetY];this.mouseDownPosition=Array(e.offsetX,e.offsetY);for(var i=0;i<this.eventCallbacks['mouseDown'].length;i++)if(this.eventCallbacks['mouseDown'][i])this.eventCallbacks['mouseDown'][i](e)};this.dragStartCallback=function(element,xPos,yPos){switch(this.mouseMode){case'ZoomWindow':case'SelectWindow':zoomBoxPending=true;zoomBox.xdelta=zoomBox.ydelta=0;break;case'DragMap':this.dragPending=true;this.element.appendChild(this.dragPlaneNode);this.positionDragTiles();this.dragDelta=Array(0,0);this.dragTiles[4].src=this.imageNode.src;this.imageNode.src=GuiWidget.THEME_PATH+'/'+GuiWidget.THEME+'/images/blank.gif';break;default:break}this.dragEnabled=true;document.mouseUpCallbackObject=this;for(var i=0;i<this.eventCallbacks['dragStart'].length;i++)if(this.eventCallbacks['dragStart'][i])this.eventCallbacks['dragStart'][i](xPos,yPos)};this.dragCallback=function(dx,dy){if(zoomBoxPending){zoomBox.setActive(this.mouseDownPosition[0],this.mouseDownPosition[1]);zoomBoxPending=false}if(((this.mouseMode=='ZoomWindow')||(this.mouseMode=='SelectWindow'))&&(this.dragEnabled)){zoomBox.xdelta+=dx;zoomBox.ydelta+=dy;zoomBox.update(this.mouseDownPosition[0]+zoomBox.xdelta,this.mouseDownPosition[1]+zoomBox.ydelta)}if(this.dragPending){this.dragPending=false}if((this.mouseMode=='DragMap')&&this.dragEnabled){this.dragDelta[0]+=dx;this.dragDelta[1]+=dy;xMoveTo(this.dragPlaneNode,this.dragDelta[0]-this.width(),this.dragDelta[1]-this.height());for(i=0;i<this.drawplanes.length;i++){if(this.drawplanes[i]){if(this.drawplanes[i]["freeance_drag"]){xMoveTo(this.drawplanes[i],this.dragDelta[0],this.dragDelta[1])}}}}for(var i=0;i<this.eventCallbacks['drag'].length;i++)if(this.eventCallbacks['drag'][i])this.eventCallbacks['drag'][i](dx,dy)};this.dragEndCallback=function(evt,xPos,yPos){if(((this.mouseMode=='ZoomWindow')||(this.mouseMode=='SelectWindow'))&&(this.dragEnabled)&&(Math.abs(zoomBox.xdelta)>0)&&(Math.abs(zoomBox.ydelta)>0)){zoomBox.setInactive();this.dragEnabled=false;this.submitZoomWindow()}else if((this.mouseMode=='DragMap')&&(this.dragEnabled)){this.processMapDrag(this.dragDelta[0],this.dragDelta[1])}for(var i=0;i<this.eventCallbacks['dragEnd'].length;i++)if(this.eventCallbacks['dragEnd'][i])this.eventCallbacks['dragEnd'][i](xPos,yPos)};this.submitZoomWindow=function(){var MapWidth=this.width();var MapHeight=this.height();var x1=this.mouseDownPosition[0];var y1=this.mouseDownPosition[1];var x2=this.mouseDownPosition[0]+zoomBox.xdelta;var y2=this.mouseDownPosition[1]+zoomBox.ydelta;if(x1<x2){var left=x1,right=x2}else{var left=x2,right=x1}if(y1<y2){var top=y1,bottom=y2}else{var top=y2,bottom=y1}switch(this.mapType){case'MASTER':var the_bottom=1.0-(bottom/MapHeight);var the_top=1.0-(top/MapHeight);var the_left=left/MapWidth;var the_right=right/MapWidth;switch(this.mouseMode){case'SelectWindow':if(this.map.selectionControl)this.map.selectionControl.selectByWindow(the_bottom,the_top,the_left,the_right);break;case'ZoomWindow':this.map.zoomToWindow(the_bottom,the_top,the_left,the_right);break}break;case'SLAVE':var extent=this.map.vmapExtent;this.map.zoomToExtent([((1.0-(bottom/MapHeight))*(extent[1]-extent[0]))+extent[0],((1.0-(top/MapHeight))*(extent[1]-extent[0]))+extent[0],((left/MapWidth)*(extent[3]-extent[2]))+extent[2],((right/MapWidth)*(extent[3]-extent[2]))+extent[2]]);break}};this.showBufferTarget=function(){this.bufferTargetNode.style.display='block'};this.hideBufferTarget=function(){this.bufferTargetNode.style.display='none'};this.showZoomInTarget=function(){this.zoomInTargetNode.style.display='block'};this.hideZoomInTarget=function(){this.zoomInTargetNode.style.display='none'};this.showZoomOutTarget=function(){this.zoomOutTargetNode.style.display='block'};this.hideZoomOutTarget=function(){this.zoomOutTargetNode.style.display='none'};this.showCompass=function(){this.compassNode.style.display='block'};this.hideCompass=function(){this.compassNode.style.display='none'};this.clearDragTiles=function(){for(var i=0;i<this.dragTiles.length;i++)this.dragTiles[i].src=GuiWidget.THEME_PATH+'/'+GuiWidget.THEME+'/images/blank.gif'};this.positionDragTiles=function(){var width=(arguments.length>0)?arguments[0]:this.width();var height=(arguments.length>1)?arguments[1]:this.height();xLeft(this.dragPlaneNode,-width);xTop(this.dragPlaneNode,-height);xWidth(this.dragPlaneNode,width*3);xHeight(this.dragPlaneNode,height*3);var currentTile=null;for(var x=0;x<3;x++){for(var y=0;y<3;y++){currentTile=this.dragTiles[x+y*3];xLeft(currentTile,x*width);xTop(currentTile,y*height);xWidth(currentTile,width);xHeight(currentTile,height)}}};this.element=document.createElement("DIV");this.element.id=this.id;this.element.objectManagerId=OBJECT_MANAGER.registerObject(this.id,this);if(parentElement==null)parentElement=document.getElementsByTagName("body").item(0);parentElement.appendChild(this.element);xLeft(this.element,newXPosition);xTop(this.element,newYPosition);xZIndex(this.element,newZIndex);xWidth(this.element,newWidth);xHeight(this.element,newHeight);if(newVisibility)xShow(this.element);else xHide(this.element);this.imageNode=document.createElement("IMG");this.dragPlaneNode=document.createElement("DIV");this.dragPlaneNode.setAttribute('id','dragPlaneNode');this.dragTiles=Array();for(var i=0;i<9;i++){var tile=document.createElement("IMG");tile.setAttribute((xIE4Up?("className"):("class")),'MapImage');tile.setAttribute('id','MapImage.dragTiles['+i+']');tile.src=GuiWidget.THEME_PATH+'/'+GuiWidget.THEME+'/images/blank.gif';this.dragPlaneNode.appendChild(tile);this.dragTiles.push(tile)}this.clearDragTiles();this.drawPlaneNode=document.createElement("DIV");this.drawPlaneNode.setAttribute('id',this.id+'.drawPlaneNode');this.drawPlaneNode.appendChild(zoomBox.element);try{var canvasElement=document.createElement("CANVAS");this.element.appendChild(canvasElement);if(typeof(G_vmlCanvasManager)!="undefined"){canvasElement=G_vmlCanvasManager.initElement(canvasElement)}this.measureCanvas=canvasElement;this.measureCanvas.getContext("2d")}catch(e){this.measureCanvas=null}this.customDrawPlaneNode=document.createElement("DIV");this.rasterDrawPlaneNode=document.createElement("DIV");this.eventHandlerNode=document.createElement("IMG");this.bufferTargetNode=document.createElement(((xIE4Up)?('DIV'):('IMG')));this.zoomInTargetNode=document.createElement(((xIE4Up)?('DIV'):('IMG')));this.zoomOutTargetNode=document.createElement(((xIE4Up)?('DIV'):('IMG')));this.compassNode=document.createElement(((xIE4Up)?('DIV'):('IMG')));this.productLogoNode=document.createElement(((xIE4Up)?('DIV'):('IMG')));this.loadImage=document.createElement('IMG');this.element.appendChild(this.imageNode);this.element.appendChild(this.drawPlaneNode);this.element.appendChild(this.customDrawPlaneNode);this.element.appendChild(this.rasterDrawPlaneNode);this.element.appendChild(this.eventHandlerNode);this.rasterDrawPlaneNode.appendChild(this.loadImage);this.rasterDrawPlaneNode.appendChild(this.bufferTargetNode);this.rasterDrawPlaneNode.appendChild(this.zoomInTargetNode);this.rasterDrawPlaneNode.appendChild(this.zoomOutTargetNode);this.rasterDrawPlaneNode.appendChild(this.compassNode);this.rasterDrawPlaneNode.appendChild(this.productLogoNode);this.eventHandlerNode.src=GuiWidget.THEME_PATH+'/'+GuiWidget.THEME+'/images/blank.gif';this.resizeTo(newWidth,newHeight);var centerX=Math.floor(0.5*newWidth);var centerY=Math.floor(0.5*newHeight);this.loadImage.id=this.id+'.loadImage';this.loadImage.src=GuiWidget.THEME_PATH+'/'+GuiWidget.THEME+'/images/mapLoad.gif';this.loadImage.style.position='absolute';this.loadImage.style.width=_MapLoadImageWidth;this.loadImage.style.height=_MapLoadImageHeight;xMoveTo(this.loadImage,centerX-0.5*_MapLoadImageWidth,centerY-0.5*_MapLoadImageHeight);this.loadImage.style.display=((this.mapType=='MASTER')?('block'):('none'));this.bufferTargetNode.style.position=this.zoomInTargetNode.style.position=this.zoomOutTargetNode.style.position=this.compassNode.style.position='absolute';this.bufferTargetNode.style.display=this.zoomInTargetNode.style.display=this.zoomOutTargetNode.style.display='none';this.bufferTargetNode.style.width=50;this.bufferTargetNode.style.height=50;this.zoomInTargetNode.style.width=50;this.zoomInTargetNode.style.height=50;this.zoomOutTargetNode.style.width=50;this.zoomOutTargetNode.style.height=50;this.compassNode.style.display='none';this.compassNode.style.width=_MapNorthArrowWidth;this.compassNode.style.height=_MapNorthArrowHeight;this.compassNode.style.top=5;this.compassNode.style.right=5;this.productLogoNode.style.position='absolute';this.productLogoNode.style.display=((this.mapType=='MASTER')?('block'):('none'));if(xIE4Up){this.productLogoNode.style.width=_MapProductLogoWidth;this.productLogoNode.style.height=_MapProductLogoHeight}this.productLogoNode.style.right=5;this.productLogoNode.style.bottom=5;if(xIE4Up){this.bufferTargetNode.style.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+GuiWidget.THEME_PATH+'/'+GuiWidget.THEME+'/images/bufferTarget.png'+'\', sizingMethod=\'image\')';this.zoomInTargetNode.style.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+GuiWidget.THEME_PATH+'/'+GuiWidget.THEME+'/images/zoomInTarget.png'+'\', sizingMethod=\'image\')';this.zoomOutTargetNode.style.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+GuiWidget.THEME_PATH+'/'+GuiWidget.THEME+'/images/zoomOutTarget.png'+'\', sizingMethod=\'image\')';this.compassNode.style.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+GuiWidget.THEME_PATH+'/'+GuiWidget.THEME+'/images/compass.png'+'\', sizingMethod=\'image\')';this.productLogoNode.style.filter='progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+GuiWidget.THEME_PATH+'/'+GuiWidget.THEME+'/images/mapProductLogo.png'+'\', sizingMethod=\'image\')'}else{this.bufferTargetNode.src=GuiWidget.THEME_PATH+'/'+GuiWidget.THEME+'/images/bufferTarget.png';this.zoomInTargetNode.src=GuiWidget.THEME_PATH+'/'+GuiWidget.THEME+'/images/zoomInTarget.png';this.zoomOutTargetNode.src=GuiWidget.THEME_PATH+'/'+GuiWidget.THEME+'/images/zoomOutTarget.png';this.compassNode.src=GuiWidget.THEME_PATH+'/'+GuiWidget.THEME+'/images/compass.png';this.productLogoNode.src=GuiWidget.THEME_PATH+'/'+GuiWidget.THEME+'/images/mapProductLogo.png'}this.eventHandlerNode.mapImageObject=this;this.imageNode.style.position=this.dragPlaneNode.style.position=this.drawPlaneNode.style.position=this.rasterDrawPlaneNode.style.position=this.customDrawPlaneNode.style.position='absolute';if(this.measureCanvas)this.measureCanvas.style.position='absolute';this.eventHandlerNode.setAttribute((xIE4Up?("className"):("class")),'MapImage');xZIndex(this.dragPlaneNode,0);xZIndex(this.imageNode,1);xZIndex(this.drawPlaneNode,2);xZIndex(this.customDrawPlaneNode,3);xZIndex(this.rasterDrawPlaneNode,4);if(this.measureCanvas)xZIndex(this.measureCanvas,6);xZIndex(this.eventHandlerNode,7);xMoveTo(this.imageNode,0,0);xMoveTo(this.drawPlaneNode,0,0);xMoveTo(this.rasterDrawPlaneNode,0,0);if(this.measureCanvas)xMoveTo(this.measureCanvas,0,0);xMoveTo(this.eventHandlerNode,0,0);var targetX=centerX-25;var targetY=centerY-25;xMoveTo(this.bufferTargetNode,targetX,targetY);xMoveTo(this.zoomInTargetNode,targetX,targetY);xMoveTo(this.zoomOutTargetNode,targetX,targetY);this.eventHandlerNode.mapImage=this;xAddEventListener(this.eventHandlerNode,'click',function(e){$_this.clickCallback(new xEvent(e))},false);xAddEventListener(this.eventHandlerNode,'mouseover',function(e){$_this.mouseOverCallback(new xEvent(e))},false);xAddEventListener(this.eventHandlerNode,'mouseout',function(e){$_this.mouseOutCallback(new xEvent(e))},false);xAddEventListener(this.eventHandlerNode,'mouseup',function(e){$_this.mouseUpCallback(new xEvent(e))},false);xAddEventListener(this.eventHandlerNode,'mousedown',function(e){$_this.mouseDownCallback(new xEvent(e))},false);xAddEventListener(this.eventHandlerNode,'mousemove',function(e){$_this.mouseMoveCallback(new xEvent(e))},false);xEnableDrag(this.eventHandlerNode,function(element,dx,dy){$_this.dragStartCallback(dx,dy)},function(element,dx,dy){$_this.dragCallback(dx,dy)},function(element,dx,dy){$_this.dragEndCallback(dx,dy)});setClass(this.element,'MapImageContainer');if(this.mapType=='SLAVE')this.setMouseMode('ZoomWindow')};
LayerControl=function(htmlTargetEle){var layerInput={};var groupToggleEles=[];var groupContentEles=[];var groupConfigLookup=[];this.mapObject=(arguments.length>1)?arguments[1]:document.mapObject;if(this.mapObject){this.config=this.mapObject.config.themeGroups;this.mapObject.layerControl=this}for(var currentTheme in this.mapObject.config['themes']){if(currentTheme=='toJSONString')continue;layerInput[currentTheme]=[]}this.drawPanel=function(){var $_this=this;var htmlString=this.getGroupHTML(this.config,0);htmlTargetEle.innerHTML=htmlString;var inputEles=htmlTargetEle.getElementsByTagName('input');var attachLayerClick=function(ele,layerid){xAddEventListener(ele,'click',function(){$_this.toggleTheme(layerid)})};var attachGroupClick=function(ele){xAddEventListener(ele,'click',function(){$_this.toggleGroup(parseInt(ele.getAttribute('FREEANCE_GROUP_INDEX')),ele.checked)})};for(var i=0;i<inputEles.length;i++){switch(inputEles[i].getAttribute('FREEANCE_TYPE')){case'LAYER_TOGGLE':var layerid=inputEles[i].getAttribute('FREEANCE_LAYER_ID');if(!layerInput[layerid])layerInput[layerid]=[];layerInput[layerid].push(inputEles[i]);attachLayerClick(inputEles[i],layerid);break;case'GROUP_TOGGLE':attachGroupClick(inputEles[i]);groupToggleEles[parseInt(inputEles[i].getAttribute('FREEANCE_GROUP_INDEX'))]=inputEles[i];break}}var attachHeaderClick=function(spanEle,trEle){xAddEventListener(spanEle,'click',function(){trEle.style.display=(trEle.style.display=='none')?('block'):'none'})};var headers=[];var rows=[];var spanEles=htmlTargetEle.getElementsByTagName('span');var divEles=htmlTargetEle.getElementsByTagName('div');for(var i=0;i<spanEles.length;i++)if(spanEles[i].getAttribute('FREEANCE_TYPE')=='GROUP_LABEL')headers[parseInt(spanEles[i].getAttribute('FREEANCE_GROUP_INDEX'))]=spanEles[i];for(var i=0;i<divEles.length;i++)if(divEles[i].getAttribute('FREEANCE_TYPE')=='LAYER_GROUP_CONTENTS')rows[parseInt(divEles[i].getAttribute('FREEANCE_GROUP_INDEX'))]=divEles[i];for(var i=0;i<rows.length;i++)if((rows[i]!=null)&&(headers[i]!=null))attachHeaderClick(headers[i],rows[i])};this.toggleTheme=function(themeId){if(_MAP_INITIALIZED){this.mapObject.setThemeState(themeId,!this.mapObject.config["themes"][themeId]["visibility"]);this.update()}};this.toggleGroup=function(groupIndex,newState){var activeGroup=groupConfigLookup[groupIndex];if(activeGroup)this.setGroupState(activeGroup,newState);this.update()};this.setGroupState=function(groupConfig,newState){for(var i=0;i<groupConfig.length;i++){switch(groupConfig[i].type){case'layer':this.mapObject.setThemeState(groupConfig[i].layerid,newState);for(var j=0;j<layerInput[groupConfig[i].layerid].length;j++)layerInput[groupConfig[i].layerid][j].checked=newState;break;case'group':if(groupConfig[i].children.length>0)this.setGroupState(groupConfig[i].children,newState);break}}};this.getGroupHTML=function(groupConfig,groupIndex){groupConfigLookup[groupIndex]=groupConfig;groupConfig.groupIndex=groupIndex;var newGroupIndex=groupIndex+1;var htmlString=['<div FREEANCE_TYPE="LAYER_GROUP_CONTENTS" FREEANCE_GROUP_INDEX="'+groupIndex+'"><table width="100%" cellpadding="0" cellspacing="0">'];for(var i=0;i<groupConfig.length;i++){switch(groupConfig[i].type){case'label':htmlString.push('<tr><td colspan="2" class="rightPanelFormHeaderActive" style="margin-bottom: 0px;cursor:default;">'+groupConfig[i].name+'</td></tr>');break;case'layer':htmlString.push('<tr><td width="25px" class="layerControlLeftColumn">');if(groupConfig[i].toggle)htmlString.push('<input type="checkbox"  FREEANCE_TYPE="LAYER_TOGGLE" FREEANCE_LAYER_ID="'+groupConfig[i].layerid+'" />');htmlString.push('&nbsp;</td><td class="layerControlLayerName">'+this.mapObject.config['themes'][groupConfig[i].layerid]['themeName']+'</td></tr>');break;case'group':htmlString.push('<tr><td width="25px" class="layerControlLeftColumn">');if(groupConfig[i].toggle)htmlString.push('<input type="checkbox" FREEANCE_TYPE="GROUP_TOGGLE" FREEANCE_GROUP_INDEX="'+(newGroupIndex)+'" />');htmlString.push('&nbsp;</td><td class="rightPanelFormHeaderActive"><span FREEANCE_TYPE="GROUP_LABEL" FREEANCE_GROUP_INDEX="'+(newGroupIndex)+'">'+groupConfig[i].name+'</span></td><tr>','<tr><td width="25px" class="layerControlLeftColumn"></td><td>',this.getGroupHTML(groupConfig[i].children,newGroupIndex),'</td></tr>');newGroupIndex++;break}}htmlString.push('</table></div>');return htmlString.join('')};this.update=function(){for(var currentTheme in this.mapObject.config['themes']){if(currentTheme=='toJSONString')continue;if(layerInput[currentTheme]){var newvis=this.mapObject.config['themes'][currentTheme]['visibility'];for(var i=0;i<layerInput[currentTheme].length;i++){layerInput[currentTheme][i].checked=newvis}}}};this.drawPanel()};
document.queryControl=new(function(){var $_this=this;this.id='queryControl';this.config=null;this.resultTarget=null;this.currentQueryForm=null;this.currentQueryPage=0;this.currentQueryId=null;this.currentQueryValuePairs=null;this.onDrawIndexForm=new Array();this.onDrawQueryForm=new Array();this.eventHandlers={indexDraw:[],formDraw:[],formShow:[],querySubmit:[],queryReturn:[],templateDraw:[],zoomtoSubmit:[],zoomtoReturn:[],exportSubmit:[],exportReturn:[]};this.setConfig=function(newConfig){this.config=newConfig;this.shownQueries=0;this.totalQueries=0;for(var currentQuery in this.config){if(currentQuery=='toJSONString')continue;this.totalQueries++;if(this.config[currentQuery].display)this.shownQueries++};$('queryBookmarkContainer').style.display='none'};this.setIndexPanel=function(newIndexPanel){this.indexPanel=newIndexPanel};this.drawIndexPanel=function(){if(this.indexPanel==null)return false;this.currentQueryForm=null;if(this.shownQueries>1){var htmlString=[];for(var currentQuery in this.config){if(currentQuery=='toJSONString')continue;var conf=this.config[currentQuery];if(conf.display)htmlString.push('<div class="queryIndexQueryTitle"><span FREEANCE_CONTROL_TYPE="queryformlink" QUERYID="',currentQuery,'" class="pseudolink">',conf['title'],'</span></div><div class="queryIndexDescriptionForm">',conf['description'],'</div>')};this.indexPanel.innerHTML=htmlString.join('');var spanElements=this.indexPanel.getElementsByTagName('SPAN');var clickFcn=function(ele,queryid){xAddEventListener(ele,'click',function(e){$_this.showFormPanel(queryid);$_this.setFocus(queryid)})};for(var i=0;i<spanElements.length;i++){if(spanElements[i].getAttribute('FREEANCE_CONTROL_TYPE')=='queryformlink')clickFcn(spanElements[i],spanElements[i].getAttribute('QUERYID'))};$('queryBookmarkContainer').style.display='none';var events=this.eventHandlers['indexDraw'];for(var i=0;i<events.length;i++){if(events[i]){events[i]()}}}else{if(this.totalQueries!=0){for(var currentQuery in this.config){if(currentQuery=='toJSONString')continue;if(this.config[currentQuery].display){this.showFormPanel(currentQuery);break}}}}};this.setFormPanel=function(newFormPanel){this.formPanel=newFormPanel};this.showFormPanel=function(queryId){$('searchIndexContainer').style.display='none';this.currentQueryForm=queryId;var conf=this.config[queryId];if(conf){if(!conf.formElement){this.createForm(queryId)};if(document.savedQueryControl){document.savedQueryControl.drawSavedQueryList(queryId);$('queryBookmarkContainer').style.display='block'};conf.formElement.style.display='block';this.formPanel.style.display='block';$('searchFormContainer').style.display='block';var events=this.eventHandlers['formShow'];for(var i=0;i<events.length;i++){if(events[i]){events[i](queryId)}}}else alert('attempting to show an invalid query form for query \''+queryId+'\'')};this.setFocus=function(queryId){try{var inputEles=this.config[queryId].formElement.getElementsByTagName('INPUT');if(inputEles.length>0)inputEles[0].focus()}catch(e){}};this.hideAllForms=function(){for(var i in this.config){if(i=='toJSONString')continue;if(this.config[i].formElement)this.config[i].formElement.style.display='none'}this.formPanel.style.display='none'};this.createForm=function(queryId){var $_queryId=queryId;var formElement=document.createElement('DIV');this.formPanel.appendChild(formElement);var query=this.config[queryId];query['formElement']=formElement;var htmlString=[];if(this.shownQueries>1)htmlString.push('<div id="queryIndexToggle" class="selectionDisplayPanelHeader" style="text-align: center;"><span class="pseudolink" FREEANCE_CONTROL_TYPE="show_index">Show All Searches</span></div>');htmlString.push('<div class="rightPanelFormHeader2">'+query['title']+'</div><div class="queryIndexDescriptionForm"><div>'+query['HTMLForm']+'<div></div>');if((query["export_"])&&(query["export_"].csv)&&(query["export_"].csv.enabled==true))htmlString.push('<div style="text-align: center;"><span class="pseudolink" FREEANCE_CONTROL_TYPE="query_csv_export_link">Export Query to CSV</span></div>');if(document.savedQueryControl)htmlString.push('<div style="text-align: center;"><span class="pseudolink" FREEANCE_CONTROL_TYPE="save_query_link">Save Query Values</span></div>');htmlString.push('<div style="width: auto; text-align: center;"><button FREEANCE_TYPE="submit" class="submitButton">Run Search</button></div>');formElement.innerHTML=htmlString.join('');var buttonEles=formElement.getElementsByTagName('BUTTON');for(var i=0;i<buttonEles.length;i++){if(buttonEles[i].getAttribute('FREEANCE_TYPE')=='submit')(function(ele){xAddEventListener(ele,'click',function(){$_this.submitQueryForm(queryId)})})(buttonEles[i])};var spanElements=formElement.getElementsByTagName('span');for(var elementIndex=0;elementIndex<spanElements.length;elementIndex++){switch(spanElements[elementIndex].getAttribute('FREEANCE_CONTROL_TYPE')){case'show_index':xAddEventListener(spanElements[elementIndex],'click',function(){showQueryIndexPanel()});break;case'query_csv_export_link':xAddEventListener(spanElements[elementIndex],'click',function(){$_this.runExportQuery($_queryId,'csv')});break;case'save_query_link':xAddEventListener(spanElements[elementIndex],'click',function(){$_this.saveQuery($_queryId)});break}};var $_queryId=queryId;var inputElements=formElement.getElementsByTagName('input');var keyHandler=function(e){var evt=new xEvent(e);if(evt.keyCode==13){$_this.submitQueryForm($_queryId)}};for(var elementIndex=0;elementIndex<inputElements.length;elementIndex++){xAddEventListener(inputElements[elementIndex],'keypress',keyHandler)};if(query['suggestConfig']){for(var i=0;i<query['suggestConfig'].length;i++){document.SuggestControl.addSuggest(query['suggestConfig'][i])}};for(var i=0;i<this.config[queryId]["fieldList"].length;i++){if(this.config[queryId]["fieldList"][i].fieldType=='dynamicselectField'){this.buildDynamicSelect(queryId,i)}};var events=this.eventHandlers['formDraw'];for(var i=0;i<events.length;i++){if(events[i]){events[i](queryid)}}};this.buildDynamicSelect=function(queryid,fieldid){var fieldName=this.config[queryid]["fieldList"][fieldid]["fieldName"],config=this.config[queryid]["fieldList"][fieldid]["dynamicList"],container=$('sqlQuery.'+queryid+'.'+fieldName+'InputContainer');if(container){container.innerHTML='Loading...';var htmstr=['<select id="sqlQuery.'+queryid+'.'+fieldName+'InputField">'],dbid=config['dbid'],table=config['table'],valuefield=config['valuefield'],labelfield=config['labelfield'],fields=labelfield+','+valuefield,where=config['whereclause'],limit=config['limit'];freeance_request(function(resp){if(resp.XMLRPC_FAULT){htmstr.push('<option value=""></option>')}else{var data=resp['data'];for(var i=0;i<data.length;i++){var opt=data[i];htmstr.push('<option value="',opt[valuefield],'">',opt[labelfield],'</option>')}};htmstr.push('</select>');container.innerHTML=htmstr.join('')},'SQL.query.limitselect',dbid,[labelfield,valuefield].join(','),table,where,limit,0)}};this.runExportQuery=function(queryId,exportType){this.exportQuery(exportType,queryId,this.getFormValues(queryId));var events=this.eventHandlers['exportSubmit'];for(var i=0;i<events.length;i++){if(events[i]){events[i](queryid,exportType)}}};this.setResultTarget=function(newResultTarget){this.resultTarget=newResultTarget};this.getFormValues=function(newQueryId){var queryValuePairs=[];var fieldList=this.config[newQueryId]['fieldList'];for(var i=0;i<fieldList.length;i++){var fieldName=fieldList[i]['fieldName'];var inputElement=$('sqlQuery.'+newQueryId+'.'+fieldName+'InputField');if(fieldList[i]['fieldType']=='selectField'){queryValuePairs.push([fieldName,inputElement.value])}else{if(inputElement)queryValuePairs.push([fieldName,inputElement.value.strtrim()?inputElement.value.strtrim():fieldList[i]['defaultValue']]);else queryValuePairs.push([fieldName,fieldList[i]['defaultValue']])}};return queryValuePairs};this.submitQueryForm=function(newQueryId){this.runQuery(newQueryId,this.getFormValues(newQueryId),1,true)};this.runQuery=function(queryId,newValuePairs,newStartPage,firstRun){this.currentQueryId=queryId;this.currentQuery=this.config[queryId];this.currentSourceValuePairs=newValuePairs;templatehow='elem';this.currentQueryPage=newStartPage;this.currentQueryValuePairs=new Array();var valueIndex=0;for(var currentValue in newValuePairs){if(currentValue=='toJSONString')continue;this.currentQueryValuePairs[valueIndex]=new Array(newValuePairs[currentValue][0],newValuePairs[currentValue][1]);valueIndex++};freeance_request(function(data){$_this.callback(data,$_this.currentQuery.request.requestMethod)},this.currentQuery.request.requestMethod,this.currentQuery.request.pdqIdentifier,this.currentQuery.templates.pageRows,this.currentQueryPage,this.currentQueryValuePairs);if(this.loadImage!=null)xShow(this.loadImage);var events=this.eventHandlers['querySubmit'];for(var i=0;i<events.length;i++){if(events[i]){events[i]()}}};this.exportQuery=function(exportType,queryId,newValuePairs){var queryConfig=this.config[queryId];var request='SQL.export.execute';var exportFormat=[exportType,true];var queryType='definedQuery';switch(exportType){case'csv':exportFormat[2]=queryConfig["export_"].csv.delim;exportFormat[3]=queryConfig["export_"].csv.includeFieldNames;break};freeance_request(function(data){$_this.callback(data,request)},request,exportFormat,queryType,queryConfig.request.pdqIdentifier,newValuePairs);document.mapObject.setWaiting(true)};this.loadNextPage=function(){this.runQuery(this.currentQueryId,this.currentSourceValuePairs,this.currentQueryPage+1,false)};this.loadPreviousPage=function(){this.runQuery(this.currentQueryId,this.currentSourceValuePairs,this.currentQueryPage-1,false)};this.zoomToResults=function(themeId,themeTargetField,queryFieldName,fieldQuotes,stylesheet){var whereClauseArr=Array();var whereClauseStr='';var realData=this.currentResultData[3];if(fieldQuotes)var quotes="'";else var quotes="";if((realData.length==0)||(document.mapObject.markupControl==null)){if(this.loadImage!=null)xShow(this.loadImage);if(realData.length==0)alert('No data to zoom to.');else alert('This requires the markup extension to be enabled in this application.  Please notify your system administrator.');if(this.loadImage!=null)xHide(this.loadImage);return};for(var lcv=0;lcv<realData.length;lcv++)whereClauseArr[whereClauseArr.length]="("+themeTargetField+"="+quotes+realData[lcv][queryFieldName]+quotes+")";whereClauseStr=whereClauseArr.join(" or ");var request='GIS.Zoom.to.queryResults';var requestInfo=new Object();requestInfo.themeID=themeId;requestInfo.request=request;var wantReturnFields=false;var returnFields='';var zoomFactor=1.0;var maxCount=0;document.mapObject.setWaiting(true);freeance_request(function(data){$_this.callback(data,requestInfo)},request,document.mapObject.sessionID,0,document.mapObject.mapImage.width(),document.mapObject.mapImage.height(),themeId,returnFields,whereClauseStr,zoomFactor,maxCount,wantReturnFields,stylesheet);var events=this.eventHandlers['zoomtoSubmit'];for(var i=0;i<events.length;i++){if(events[i]){events[i]()}}};this.addZoomToMarkupToIndex=function(themeID,data){var markupObj={handle:data.handle,themeName:themeID,themeID:themeID,labelName:stripQuotes(escapeHTML('Results: '+document.mapObject.config.themes[themeID].themeName)),markupID:stripQuotes(escapeHTML('Results: '+document.mapObject.config.themes[themeID].themeName)),description:stripQuotes(escapeHTML('Results: '+document.mapObject.config.themes[themeID].themeName)),extent:data.zoomExtent,viewExtent:data.zoomExtent,type:'zoomToResults',style:'0',mode:'zoomToResults'};document.mapObject.markupControl.addToExistingMarkup(markupObj,markupObj.handle);document.mapObject.markupControl.drawMarkupExistingPanel()};this.callback=function(clientReply,requestType){if(this.resultTarget.scrollHandler!=null)this.resultTarget.scrollHandler.cleanup();var noResults=false;if(this.loadImage!=null){xHide(this.loadImage)};if(clientReply.XMLRPC_FAULT){var sqlData=null;if((clientReply.XMLRPC_FAULT_CODE!=2003)&&(clientReply.XMLRPC_FAULT_CODE!=2004)&&(clientReply.XMLRPC_FAULT_CODE!=2005)){alert('An error occurred in the query operation:\n\nError Code:  '+clientReply.XMLRPC_FAULT_CODE+'\nError Message:  '+clientReply.XMLRPC_FAULT_MESSAGE)};if(clientReply.XMLRPC_FAULT_CODE==2003)this.currentQueryPage++;if(clientReply.XMLRPC_FAULT_CODE==2004)this.currentQueryPage--;if(clientReply.XMLRPC_FAULT_CODE==2005){if(requestType!='SQL.export.execute'){templateData=new Array();templateData[0]=new Array();var source=document.getTemplate(this.currentQuery.templates.invalidTemplate);this.resultTarget.innerHTML=source.run(templateData);this.resultTarget.scrollTop=0}};var events=this.eventHandlers['queryReturn'];for(var i=0;i<events.length;i++){if(events[i]){events[i]()}}}else{if(typeof requestType=="object"){var requestInfo=requestType;requestType=requestType.request};switch(requestType){case'GIS.Zoom.to.queryResults':var data=clientReply.data;if(document.mapObject.measureControl!=null)document.mapObject.measureControl.distanceReset();document.mapObject.extent=data.zoomExtent;document.mapObject.mapImage.imageNode.src=document.mapObject.correctURL(data.mapImages[0][1]);if(document.mapObject.vmapPresent)document.mapObject.vmapImage.imageNode.src=document.mapObject.correctURL(data.mapImages[1][1]);if(document.mapObject.legendVisible)document.mapObject.loadLegend();document.mapObject.setWaiting(false);this.addZoomToMarkupToIndex(requestInfo.themeID,data);var events=this.eventHandlers['zoomtoReturn'];for(var i=0;i<events.length;i++){if(events[i]){events[i]()}};break;case'SQL.storedDefinedQuery.save':noResults=true;if(this.savedQueryIndexPanel)this.savedQueryIndexPanel.getList();break;case'SQL.export.execute':noResults=true;var url=clientReply.data;downloadFile(url);var events=this.eventHandlers['exportReturn'];for(var i=0;i<events.length;i++){if(events[i]){events[i](url)}};document.mapObject.setWaiting(false);break;default:var sqlData=clientReply.data;if((sqlData==null)||(sqlData!=false)){this.currentResultData=cloneObject(sqlData);var source=document.getTemplate(this.currentQuery.templates.validTemplate);var resultHTML=source.run(sqlData);if(this.currentQuery.zoomto.enabled){resultHTML+='<div style="text-align: center;"><span class="pseudolink" FREEANCE_TYPE="QUERY_ZOOMTO">Zoom To Result Set</span></div>'};this.resultTarget.innerHTML=resultHTML;var spans=this.resultTarget.getElementsByTagName('SPAN');var zoomto=this.currentQuery.zoomto;for(var i=0;i<spans.length;i++){if(spans[i].getAttribute('FREEANCE_TYPE')=='QUERY_ZOOMTO'){(function(_zoomto){xAddEventListener(spans[i],'click',function(){$_this.zoomToResults(_zoomto["layerid"],_zoomto["layerfield"],_zoomto["queryfield"],((_zoomto["layerfieldtype"]==1)||(_zoomto["layerfieldtype"]==8)||(_zoomto["layerfieldtype"]==12)||(_zoomto["layerfieldtype"]==91)),_zoomto["stylesheet"])})})(zoomto)}};var tables=this.resultTarget.getElementsByTagName('TABLE');if((tables.length>0)&&(!xOp7Up)){var header=new ScrollableTable(tables[0],this.resultTarget,-2)};this.resultTarget.scrollTop=0;this.resultTarget.query=this;var events=this.eventHandlers['templateDraw'];for(var i=0;i<events.length;i++){if(events[i]){events[i](this.currentQuery,this.currentResultData,this.resultTarget)}}};var events=this.eventHandlers['queryReturn'];for(var i=0;i<events.length;i++){if(events[i]){events[i](this.currentQuery.id,sqlData)}}}}};this.redrawTemplate=function(){if(this.resultTarget.scrollHandler!=null)this.resultTarget.scrollHandler.cleanup();if(this.currentResultData!=null){this.currentQuery=this.config[this.currentQueryId];if(this.currentQuery!=null){var source=document.getTemplate(this.currentQuery.templates.validTemplate);try{var resultHTML=source.run(this.currentResultData);if(this.currentQuery.zoomto.enabled){resultHTML+='<div style="text-align: center;"><span class="pseudolink" FREEANCE_TYPE="QUERY_ZOOMTO">Zoom To Result Set</span></div>'};this.resultTarget.innerHTML=resultHTML;var spans=this.resultTarget.getElementsByTagName('SPAN');var zoomto=this.currentQuery.zoomto;for(var i=0;i<spans.length;i++){if(spans[i].getAttribute('FREEANCE_TYPE')=='QUERY_ZOOMTO'){xAddEventListener(spans[i],'click',function(){$_this.zoomToResults(zoomto["layerid"],zoomto["layerfield"],zoomto["queryfield"],((zoomto["layerfieldtype"]==1)||(_zoomto["layerfieldtype"]==8)||(zoomto["layerfieldtype"]==12)||(zoomto["layerfieldtype"]==91)),zoomto["stylesheet"])})}};var tables=this.resultTarget.getElementsByTagName('TABLE');if((tables.length>0)&&(!xOp7Up)){var header=new ScrollableTable(tables[0],this.resultTarget,-2)}}catch(e){this.resultTarget.innerHTML=''};this.resultTarget.scrollTop=0;this.resultTarget.query=this;var events=this.eventHandlers['templateDraw'];for(var i=0;i<events.length;i++){if(events[i]){events[i](this.currentQuery,this.currentResultData,this.resultTarget)}}}else alert('Unable to display result template for query '+this.currentQueryId+'.\nThe query configuration could not be found.')}else alert('Unable to display result template for query '+this.currentQueryId+'.\nNo result data is present.')};this.addEventHandler=function(eventType,callback){if(this.eventHandlers[eventType]!=null)this.eventHandlers[eventType].push(callback);return this.eventHandlers[eventType].length-1};this.removeEventHandler=function(eventType,index){if(this.eventHandlers[eventType]!=null)this.eventHandlers[eventType][index]=null}})();
QuerySuggest=function(inputElement,resultElement,timeout,pdq_dbid,pdq_field,pdq_table,pdq_limit){var keyCounter=0;var typing=false;var focused=false;var last_search='';var useHiddenResults=resultElement.style.display=='none';function hideResults(){if(useHiddenResults)resultElement.style.display='none'};function blurCallback(){keyCounter++;hideResults()};function focusCallback(){keyCounter++;hideResults()};function addResultValueEvents(ele){xAddEventListener(ele,'mousedown',function(evt){inputElement.value=ele.firstChild.nodeValue;hideResults()});xAddEventListener(ele,'mouseover',function(evt){setClass(ele,'querySuggestListRowActive')});xAddEventListener(ele,'mouseout',function(evt){setClass(ele,'querySuggestListRowInactive')})};function keyUpCallback(){keyCounter++;var currentCount=keyCounter;var currentValue=inputElement.value;setTimeout(function(){if((keyCounter==currentCount)&&(currentValue==inputElement.value)){var searchString=inputElement.value;if((searchString.strtrim()!='')&&(searchString!=last_search)){hideResults();last_search=searchString;var whereClause='Upper('+pdq_field+') like \''+searchString.toUpperCase()+'%\'';freeance_request(function(clientReply){if((keyCounter==currentCount)&&(currentValue==inputElement.value)){var currentNode=null;var noResults=false;if(clientReply.XMLRPC_FAULT){if(typeof(console)!='undefined')console.warn(clientReply.XMLRPC_FAULT_MESSAGE);else dprintf(clientReply.XMLRPC_FAULT_MESSAGE)}else{var results=clientReply.data;var nl=resultElement.childNodes.length;for(var n=0;n<nl;n++){resultElement.removeChild(resultElement.childNodes.item(nl-n-1))};for(var currentResult=0;currentResult<results.length;currentResult++){var currentNode=document.createElement('DIV');currentNode.appendChild(document.createTextNode(results[currentResult][pdq_field]));addResultValueEvents(currentNode);resultElement.appendChild(currentNode)};if(useHiddenResults){resultElement.style.display='block'}}}},'SQL.query.limitselect',pdq_dbid,'distinct '+pdq_field,pdq_table,whereClause,pdq_limit,0)}}},timeout)};this.linkElements=function(inele,outele){inputElement=inele;resultElement=outele;inputElement.autocomplete='off';xAddEventListener(inputElement,'keyup',keyUpCallback);xAddEventListener(inputElement,'focus',focusCallback);xAddEventListener(inputElement,'blur',blurCallback)};this.enabled=true;if((!inputElement)||(!resultElement)){this.enabled=false}else{useHiddenResults=resultElement.style.display=='none';this.linkElements(inputElement,resultElement)}};SuggestControl=function(){this.suggestIndex=new Array;this.lookupTable=new Object;this.addSuggest=function(suggestConfigObject){if(this.lookupTable[suggestConfigObject.elementId]==null){var newIndex=this.suggestIndex.length;var newSuggest=this.suggestIndex[newIndex]=new QuerySuggest(document.getElementById(suggestConfigObject.elementId),document.getElementById(suggestConfigObject.resultElementId),suggestConfigObject.timeout,suggestConfigObject.dbid,suggestConfigObject.fieldname,suggestConfigObject.tablename,suggestConfigObject.resultlimit);this.lookupTable[suggestConfigObject.elementId]=newIndex}else{this.suggestIndex[this.lookupTable[suggestConfigObject.elementId]].linkElements(document.getElementById(suggestConfigObject.elementId),document.getElementById(suggestConfigObject.resultElementId))}}};document.SuggestControl=new SuggestControl();
ScrollableTable=function(tableElement){var $_this=this;var scrollFunction=function(){$_this.overlayTable.style.top=$_this.scrollElement.scrollTop};this.sourceTable=tableElement;this.columnOffset=0;if(arguments.length>1){if(arguments[1]!=null)this.scrollElement=arguments[1];if(arguments.length>2)this.columnOffset=arguments[2]}else this.scrollElement=tableElement.parentNode;if(this.scrollElement.scrollHandler!=null)return null;this.initialize=function(){this.scrollElement.scrollHandler=this;this.overlayTable=this.sourceTable.cloneNode(false);this.overlayTable.setAttribute('id','');this.overlayTable.setAttribute('SCROLLTABLE_HEADER','TRUE');this.overlayTable.style.position='absolute';this.overlayTable.style.top=0;this.overlayTable.style.height=this.sourceTable.getElementsByTagName('TH')[0].height;this.overlayTable.style["z-index"]=parseInt(this.sourceTable.getAttribute('z-index'))+1;var newTbody=document.createElement('TBODY');var newTR=this.sourceTable.getElementsByTagName('TR')[0].cloneNode(true);newTbody.appendChild(newTR);this.overlayTable.appendChild(newTbody);this.scrollElement.appendChild(this.overlayTable);var sourceHeaderCells=this.sourceTable.getElementsByTagName('TH');var overlayHeaderCells=this.overlayTable.getElementsByTagName('TH');for(var i=0;i<sourceHeaderCells.length;i++){var newElement=document.createElement('DIV');newElement.style.width=parseInt(sourceHeaderCells[i].clientWidth)+this.columnOffset;newElement.style.height=1;newElement.style.overflow='hidden';newElement.style.display='block';newElement.style.background='transparent';if(overlayHeaderCells[i])overlayHeaderCells[i].appendChild(newElement)};if(this.scrollElement.addEventListener)this.scrollElement.addEventListener('scroll',scrollFunction,true);else if(this.scrollElement.attachEvent)this.scrollElement.attachEvent('onscroll',scrollFunction)};this.cleanup=function(){if(this.scrollElement!=null){try{this.scrollElement.removeChild(this.overlayTable)}catch(e){}finally{if(this.scrollElement.removeEventListener)this.scrollElement.removeEventListener('scroll',scrollFunction,true);else if(this.scrollElement.detachEvent)this.scrollElement.detachEvent('onscroll',scrollFunction);this.scrollElement.scrollHandler=null};this.overlayTable=null;this.scrollElement=null}};this.initialize()}
