AnnoLayerBox=function(c,b,a,d){this.bounds=new OpenLayers.Bounds();this.bounds.extend(c);this.bounds.extend(new OpenLayers.LonLat((c.lon+100),(c.lat+100)));this.layer=b;this.page=d;this.mousePos=a;this.box=new OpenLayers.Marker.Box(this.bounds,"red",2);this.DOM=this.box.div;this.drag=null;this.resize=null;this.text="";this.infobox=null;this.makeDraggable();this.attachAnnoBox();this.annoSaved=new YAHOO.util.CustomEvent("annoSaved");this.footnoteDestroyed=new YAHOO.util.CustomEvent("footnotedestroyed");this.footnotecancelled=new YAHOO.util.CustomEvent("footnotecancelled");this.box.events.includeXY=true;};AnnoLayerBox.prototype={makeDraggable:function(){if((!(this.drag))&&(!(this.resize))){this.drag=new YAHOO.util.DD(this.DOM.id);this.resize=new YAHOO.util.Resize(this.box.div,{handles:"br"});if(YAHOO.env.ua.ie>0){YAHOO.util.Dom.setStyle(this.box.div,"z-index","1001");YAHOO.util.Dom.setStyle(this.box.div,"background","red");this.handle=document.createElement("div");YAHOO.util.Dom.generateId(this.handle,"hl");this.handle.className="alb_handle";this.box.div.appendChild(this.handle);if(YAHOO.env.ua.ie>6){YAHOO.util.Dom.setStyle(this.box.div,"filter","alpha(opacity=40)");}else{if(YAHOO.env.ua.ie==6){YAHOO.util.Dom.setStyle(this.box.div,"filter","alpha(opacity=40)");}}}this.drag.on("endDragEvent",function(i,g){var a=parseInt(YAHOO.util.Dom.getX(g.box.div))-parseInt(YAHOO.util.Dom.getX(g.layer.map.div));var j=parseInt(YAHOO.util.Dom.getY(g.box.div))-parseInt(YAHOO.util.Dom.getY(g.layer.map.div));var c=a+parseInt(YAHOO.util.Dom.getStyle(g.box.div,"width"));var d=j+parseInt(YAHOO.util.Dom.getStyle(g.box.div,"height"));var b=g.layer.getLonLatFromViewPortPx(new OpenLayers.Pixel(c,d));var f=g.layer.getLonLatFromViewPortPx(new OpenLayers.Pixel(a,j));g.bounds=new OpenLayers.Bounds();g.bounds.extend(f);g.bounds.extend(b);g.box.bounds=g.bounds;},this);this.resize.on("endResize",function(i,g){g.bounds=new OpenLayers.Bounds();var a=parseInt(YAHOO.util.Dom.getX(g.box.div))-parseInt(YAHOO.util.Dom.getX(g.layer.map.div));var j=parseInt(YAHOO.util.Dom.getY(g.box.div))-parseInt(YAHOO.util.Dom.getY(g.layer.map.div));var c=a+parseInt(YAHOO.util.Dom.getStyle(g.box.div,"width"));var d=j+parseInt(YAHOO.util.Dom.getStyle(g.box.div,"height"));var b=g.layer.getLonLatFromViewPortPx(new OpenLayers.Pixel(c,d));var f=g.layer.getLonLatFromViewPortPx(new OpenLayers.Pixel(a,j));g.bounds.extend(f);g.bounds.extend(b);g.box.bounds=g.bounds;},this);}},attachAnnoBox:function(){this.anno=new Annotation();this.anno.saveAnnoCall.subscribe(function(c,b,a){var d={obj:a,box:a.box,bounds:a.bounds,text:a.anno.textInput.value,setId:a.anno.annoId,security:a.anno.publicMode,page:a.page};a.annoSaved.fire(d);},this);this.anno.annoClosed.subscribe(this.removeMarker,this);document.getElementsByTagName("body")[0].appendChild(this.anno.DOM);YAHOO.util.Dom.setStyle(this.anno.DOM,"top","80px");},createMarker:function(a){this.drag.lock();this.resize.destroy();this.dbid=a.id;this.bounds=new OpenLayers.Bounds();this.bounds.extend(new OpenLayers.LonLat(a.left,a.bottom));this.bounds.extend(new OpenLayers.LonLat(a.right,a.top));this.box=new OpenLayers.Marker.Box(this.bounds,"red");this.layer.addMarker(this.box);YAHOO.util.Dom.setStyle(this.box.div,"border","none");YAHOO.util.Dom.setStyle(this.box.div,"background-color","red");if(YAHOO.env.ua.ie==0){YAHOO.util.Dom.setStyle(this.box.div,"opacity","0.55");}if(YAHOO.env.ua.ie>6){YAHOO.util.Dom.setStyle(this.box.div,"filter","alpha(opacity=40)");}else{if(YAHOO.env.ua.ie==6){YAHOO.util.Dom.setStyle(this.box.div,"filter","alpha(opacity=40)");}}document.getElementsByTagName("body")[0].removeChild(this.anno.DOM);this.anno.saveAnnoCall.unsubscribeAll();this.anno.annoClosed.unsubscribeAll();this.anno=null;this.infobox=new InfoPopUp(a.id,a.comment,a.lock,"image");document.getElementsByTagName("body")[0].appendChild(this.infobox.DOM);YAHOO.util.Dom.setStyle(this.infobox.DOM,"top","80px");this.infobox.deleteFootnote.subscribe(this.destroy,this);this.box.events.register("click",this,function(b){this.infobox.showWin(b,this.infobox);});},saveMarker:function(a){this.security=this.anno.publicMode;this.setId=this.anno.annoId;document.getElementsByTagName("body")[0].removeChild(this.anno.DOM);this.saveAnnoCall.fire(this);},changeMarker:function(b,a){this.drag.lock();this.resize.destroy();this.dbid=a.id;YAHOO.util.Dom.setStyle(this.box.div,"border","none");YAHOO.util.Dom.setStyle(this.box.div,"background-color","red");YAHOO.util.Dom.setStyle(this.box.div,"opacity","0.55");if(YAHOO.env.ua.ie>6){YAHOO.util.Dom.setStyle(this.box.div,"filter","alpha(opacity=.40)");}else{if(YAHOO.env.ua.ie==6){YAHOO.util.Dom.setStyle(this.box.div,"filter","alpha(opacity=40)");}}this.text=this.anno.textInput.value;this.infobox=new InfoPopUp(this.dbid,this.text,a.security,"image");YAHOO.util.Dom.setStyle(this.infobox.DOM,"top","80px");document.getElementsByTagName("body")[0].appendChild(this.infobox.DOM);this.box.events.register("click",this,function(c){this.infobox.showWin(c,this.infobox);});this.infobox.deleteFootnote.subscribe(this.destroy,this);document.getElementsByTagName("body")[0].removeChild(this.anno.DOM);this.anno.saveAnnoCall.unsubscribeAll();this.anno.annoClosed.unsubscribeAll();this.anno=null;},removeMarker:function(c,b,a){a.layer.removeMarker(a.box);a.footnotecancelled.fire(a);document.getElementsByTagName("body")[0].removeChild(a.anno.DOM);a.annoSaved.unsubscribeAll();a.anno.saveAnnoCall.unsubscribeAll();a.anno.annoClosed.unsubscribeAll();},destroy:function(c,b,a){a.footnoteDestroyed.fire(a);a.layer.removeMarker(a.box);if(a.infobox){document.getElementsByTagName("body")[0].removeChild(a.infobox.DOM);a.layer.div.removeChild(a.infobox.DOM);}}};