var DEFAULT_BUSY_LOADING_IMG_SRC="/golMapWeb/graphics/busy.gif";var DEFAULT_BUSY_LOADING_IMG_WIDTH=110;var DEFAULT_BUSY_LOADING_IMG_HEIGHT=30;function dTitle(b){this.name=b;this.color="black";this.size=1;this.width=0;this.height=0;this.anchor=null;this.container=null;this.canvas=null;this.cursor="crosshair";this.jitter=10;this.x1=this.y1=this.x2=this.y2=-1;this.offsetx=this.offsety=0;this.x=new Array();this.y=new Array();this.length=0;this.area=0;this.graphics;this.waiting=false;this.mouseEnterHandler=null;this.mouseExitHandler=null;this.mouseMoveHandler=null;this.setBoxHandler=null;this.resetHandler=null;this.measureHandler=null;this.areaHandler=null;this.busyMessage=null;this.busyImage=null;var a=this;function d(f,h,e,g){return Math.sqrt(Math.pow(e-f,2)+Math.pow(g-h,2))}function c(e,k){var h=0;for(var g=0;g<e.length;g++){var f=(g+1)%e.length;h+=e[g]*k[f]-e[f]*k[g]}return(h<0?-h/2:h/2)}this.setHandler=function(f,e){if(f==DTITLE_MOUSEENTER){a.mouseEnterHandler=e}else{if(f==DTITLE_MOUSEEXIT){a.mouseExitHandler=e}else{if(f==DTITLE_MOUSEMOVE){a.mouseMoveHandler=e}else{if(f==DTITLE_SETBOX){a.setBoxHandler=e}else{if(f==DTITLE_RESET){a.resetHandler=e}else{if(f==DTITLE_MEASURE){a.measureHandler=e}else{if(f==DTITLE_AREA){a.areaHandler=e}}}}}}}};this.initialize=function(){a.anchor=xGetElementById(a.name);a.width=xWidth(a.anchor);a.height=xHeight(a.anchor);a.container=document.createElement("div");a.container.style.position="absolute";a.container.id=a.name+"_container";document.body.appendChild(a.container);xResizeTo(a.container,a.width,a.height);xMoveTo(a.container,xPageX(a.anchor),xPageY(a.anchor));xClip(a.container,0,a.width,a.height,0);xShow(a.container);a.image=document.createElement("div");a.image.style.position="absolute";a.image.id=a.name+"_text";a.container.appendChild(a.image);a.image.onload=a.reset;xResizeTo(a.image,a.width,a.height);xMoveTo(a.image,0,0);xShow(a.image);a.offsetx=xLeft(a.container);a.offsety=xTop(a.container)};this.sync=function(){xMoveTo(a.container,xPageX(a.anchor),xPageY(a.anchor));a.offsetx=xLeft(a.container);a.offsety=xTop(a.container)};this.reset=function(){a.x1=a.x2=(a.width-1)/2+a.offsetx;a.y1=a.y2=(a.height-1)/2+a.offsety;if(a.resetHandler){a.resetHandler(a.x1,a.y1,a.x1,a.y1)}xMoveTo(a.image,0,0);a.sync();a.waiting=false;if(a.busyMessage||a.busyImage){a.busyOff()}};this.setTitle=function(e){a.waiting=true;if(a.busyMessage||a.busyImage){a.busyOn()}a.x1=a.x2=(a.width-1)/2+a.offsetx;a.y1=a.y2=(a.height-1)/2+a.offsety;a.createTitle(e,a.image)};this.createTitle=function(g,h){var f;try{f=new XMLHttpRequest()}catch(i){try{f=new ActiveXObject("Msxml2.XMLHTTP")}catch(i){try{f=new ActiveXObject("Microsoft.XMLHTTP")}catch(i){alert("Your browser does not support AJAX!");return false}}}f.onreadystatechange=function(){if(f.readyState==4){elem=document.getElementById(h);if(elem){elem.innerHTML="teste"+f.responseText}}};f.open("GET",g,true);f.send(null)};this.useBusyMessage=function(f){if(typeof f=="string"){a.busyMessage=f}else{if(typeof f=="object"&&f.src&&f.src.search(/gif|png|jpg/i)){a.busyImage=f}else{var e=new Image();e.src=DEFAULT_BUSY_LOADING_IMG_SRC;e.width=DEFAULT_BUSY_LOADING_IMG_WIDTH;e.height=DEFAULT_BUSY_LOADING_IMG_HEIGHT;a.busyImage=e}}}}dTitle.prototype.busyImage=null;dTitle.prototype.busyMessage=null;dTitle.prototype.busyOn=function(){var b=xGetElementById("disabled_zone");if(!b){b=document.createElement("div");b.setAttribute("id","disabled_zone");b.style.position="absolute";b.style.zIndex="1000";b.style.left="0px";b.style.top="0px";b.style.width="100%";b.style.height="100%";document.body.appendChild(b);var a=document.createElement("div");a.setAttribute("id","message_zone");a.style.position="absolute";b.appendChild(a);if(this.busyMessage){a.style.top="0px";a.style.right="0px";a.style.padding="4px";a.style.background="red";a.style.color="white";a.style.fontFamily="Arial,Helvetica,sans-serif";var d=document.createTextNode(this.busyMessage);a.appendChild(d)}else{var c=document.createElement("img");c.src=this.busyImage.src;c.width=this.busyImage.width;c.height=this.busyImage.height;xHide(b);a.appendChild(c);xMoveTo(a,((this.width-c.width)/2)+this.offsetx,((this.height-c.height)/2)+this.offsety)}xShow(b)}else{xShow(b)}};dTitle.prototype.busyOff=function(){xHide("disabled_zone")};
