var leftIconOffset=7;var topIconOffset=24;var userCommentsTypeIcon="ICON";var userCommentsTypeRectangle="RECTANGLE";var userCommentsTypePolygon="POLYGON";var userCommentsTypeDiscussion="DISCUSSION";var hotSpotCommentsLib={initializeHotSpot:function(a,f,c,e,b,d){this.catalogID=f;this.recordID=c;this.isIE=e;if($("userCommentTextarea")){$("userCommentTextarea").onkeypress=function(){CantoUtils.adaptHeightTextArea("userCommentTextarea","3.9em",100)}.bind(this)}this.showUserComments(a,b,d);$("previewViewHotSpotBody").setStyle({display:"block"})},initializeSingleHotSpot:function(a,d,c,b){this.catalogID=d;this.recordID=c;this.showUserComments(a,b)},loadUserComment:function(c,b,a){this.currentLoadedUserCommentThreadID=c;$$(".userCommentContainer").each(function(d){d.removeClassName("userCommentSelected")}.bind(this));$("userComment"+c).addClassName("userCommentSelected");if($("userCommentTextarea")){$("userCommentTextarea").value=$("userCommentValue"+c).value}if(a){this.displayTextArea();CantoUtils.adaptHeightTextArea("userCommentTextarea","3.9em",100)}else{this.hideTextArea()}this.highlightUserComment(c,b)},unselectUserComments:function(){this.currentLoadedUserCommentThreadID=undefined;$$(".userCommentContainer").each(function(c){c.removeClassName("userCommentSelected")}.bind(this));this.hideTextArea();var b=this.raphaelContainer.canvas.childNodes;for(var a=0;a<b.length;a++){if(b[a].firstChild!=undefined&&b[a].firstChild.raphael!=undefined){if(b[a].firstChild==undefined||b[a].firstChild.isVertex==undefined||!b[a].firstChild.isVertex){if(b[a].firstChild.raphael.type=="image"){}else{if(b[a].firstChild.isSurroundingRect){b[a].firstChild.raphael.attr({opacity:0})}else{b[a].firstChild.raphael.attr({opacity:0.2})}}}else{b[a].firstChild.raphael.attr({opacity:0})}}}},deleteUserComment:function(b,a){var c="recordView="+app.currentView.getRecordView()+"&singleCatalogID="+this.catalogID+"&recordID="+this.recordID+"&userCommentThreadID="+b+"&action=delete";app.doRequest("usercommenthandler.jspx",c,function(){this.hideTextArea();app.doUpdate("previewviewhotspot.jspx",c,"previewViewHotSpotBody",undefined,true)}.bind(this))},highlightUserComment:function(a,h){var b;var l=new Array();var g=0;var c=this.raphaelContainer.canvas.childNodes;for(var f=0;f<c.length;f++){if(c[f].firstChild!=undefined&&c[f].firstChild.raphael!=undefined){if(c[f].firstChild==undefined||c[f].firstChild.isVertex==undefined||!c[f].firstChild.isVertex){if(c[f].firstChild.id=="svgUserComment"+a){b=c[f]}if(c[f].firstChild.raphael.type=="image"){}else{if(c[f].firstChild.isSurroundingRect){c[f].firstChild.raphael.attr({opacity:0})}else{c[f].firstChild.raphael.attr({opacity:0.2})}}}else{if(c[f].firstChild.id.endsWith(""+a)){l[g]=c[f];g++}c[f].firstChild.raphael.attr({opacity:0})}}}if(h==userCommentsTypeIcon){$("surroundingRect"+a).raphael.attr({opacity:0.6});if(!this.isIE){b.parentNode.appendChild(b.parentNode.removeChild(b))}}else{b.firstChild.raphael.attr({opacity:0.6});if(!this.isIE){this.raphaelContainer.canvas.appendChild(this.raphaelContainer.canvas.removeChild(b));for(var e=0;e<l.length;e++){this.raphaelContainer.canvas.appendChild(this.raphaelContainer.canvas.removeChild(l[e]));l[e].firstChild.raphael.attr({opacity:0.6})}}else{for(var d=0;d<l.length;d++){l[d].firstChild.raphael.attr({opacity:0.6})}}}},saveUserComment:function(){var a=$("userCommentTextarea").value;var b="recordView="+app.currentView.getRecordView()+"&singleCatalogID="+this.catalogID+"&recordID="+this.recordID+"&userCommentThreadID="+this.currentLoadedUserCommentThreadID+"&value="+encodeURIComponent(a)+"&action=modify";app.doRequest("usercommenthandler.jspx",b,function(){$("userCommentValue"+this.currentLoadedUserCommentThreadID).value=a;$("svgUserComment"+this.currentLoadedUserCommentThreadID).raphael.attr("title",a);$("commentValue"+this.currentLoadedUserCommentThreadID).update(a.replace(/\<\r?/g,"&lt;").replace(/\>\r?/g,"&gt;").replace(/\n\r?/g,"<br/>"));this.unselectUserComments()}.bind(this))},displayTextArea:function(){if($("userCommentTextarea")){$("userCommentTextarea").setStyle({display:"block"});$("saveUserComment").setStyle({display:"block"})}},hideTextArea:function(){if($("userCommentTextarea")){$("userCommentTextarea").setStyle({display:"none"});$("saveUserComment").setStyle({display:"none"})}},setupContainer:function(a){var c=$(a);this.containerID=a;this.offsetLeft=c.parentNode.positionedOffset().left;this.offsetTop=c.parentNode.positionedOffset().top+$("popupFrame").positionedOffset().top;this.dimensions=c.getDimensions();this.raphaelContainer=Raphael(a,this.dimensions.width,this.dimensions.height);this.raphaelContainer.canvas.style.position="absolute";this.raphaelContainer.canvas.style.zIndex=999;this.raphaelContainer.safari();var b=this.raphaelContainer.rect(0,0,this.dimensions.width,this.dimensions.height);b.attr("fill","white");b.attr("opacity",0);$(b.node).onclick=function(){if(this.action==undefined){this.unselectUserComments()}}.bind(this);c.ondblclick=function(){if(this.isIE&&this.doubleClick){var d="recordView="+app.currentView.getRecordView()+"&singleCatalogID="+this.catalogID+"&recordID="+this.recordID+"&type="+userCommentsTypePolygon+"&path="+encodeURIComponent(this.polygonPathObject.toString().replace(/,/g," ").toLowerCase())+"&width="+this.dimensions.width+"&height="+this.dimensions.height+"&action=create";app.doRequest("usercommenthandler.jspx",d,function(e){var f=e.responseText;this.insertComment(f);this.deleteDummyPath()}.bind(this));this.action=undefined}}.bind(this);c.onclick=function(d){if(!d){d=window.event}this.offsetLeft=c.parentNode.positionedOffset().left;this.offsetTop=c.parentNode.positionedOffset().top+$("popupFrame").positionedOffset().top;if(this.action=="insertIcon"){var h=(Event.pointerX(d)-this.offsetLeft)/this.dimensions.width;var g=(Event.pointerY(d)-this.offsetTop)/this.dimensions.height;var j="recordView="+app.currentView.getRecordView()+"&singleCatalogID="+this.catalogID+"&recordID="+this.recordID+"&type="+userCommentsTypeIcon+"&path="+h+" "+g+"&action=create";app.doRequest("usercommenthandler.jspx",j,function(n){var o=n.responseText;this.insertComment(o)}.bind(this));this.action=undefined}else{if(this.action=="insertRectangle"){this.fixedX=Event.pointerX(d)-this.offsetLeft;this.fixedY=Event.pointerY(d)-this.offsetTop;this.action="insertRectangleSecondClick"}else{if(this.action=="insertRectangleSecondClick"){var m=(Event.pointerX(d)-this.offsetLeft)/this.dimensions.width;var l=(Event.pointerY(d)-this.offsetTop)/this.dimensions.height;var f=this.fixedX/this.dimensions.width;var e=this.fixedY/this.dimensions.height;var k=undefined;if(m>f){if(l>e){k="recordView="+app.currentView.getRecordView()+"&singleCatalogID="+this.catalogID+"&recordID="+this.recordID+"&type="+userCommentsTypeRectangle+"&path="+f+" "+e+" "+m+" "+l+"&action=create"}else{k="recordView="+app.currentView.getRecordView()+"&singleCatalogID="+this.catalogID+"&recordID="+this.recordID+"&type="+userCommentsTypeRectangle+"&path="+f+" "+l+" "+m+" "+e+"&action=create"}}else{if(l>e){k="recordView="+app.currentView.getRecordView()+"&singleCatalogID="+this.catalogID+"&recordID="+this.recordID+"&type="+userCommentsTypeRectangle+"&path="+m+" "+e+" "+f+" "+l+"&action=create"}else{k="recordView="+app.currentView.getRecordView()+"&singleCatalogID="+this.catalogID+"&recordID="+this.recordID+"&type="+userCommentsTypeRectangle+"&path="+m+" "+l+" "+f+" "+e+"&action=create"}}app.doRequest("usercommenthandler.jspx",k,function(n){var o=n.responseText;this.deleteDummyRect();this.insertComment(o)}.bind(this));this.action=undefined}else{if(this.action=="insertPolygon"){this.fixedX=Event.pointerX(d)-this.offsetLeft;this.fixedY=Event.pointerY(d)-this.offsetTop;this.polygonPathObject=new Array();this.polygonPathObject[this.polygonPathObject.length]=new Array("M",this.fixedX,this.fixedY);this.action="insertPolygonNextClicks"}else{if(this.action=="insertPolygonNextClicks"){if(this.doubleClick){if(this.polygonPathObject.length>2){var i="recordView="+app.currentView.getRecordView()+"&singleCatalogID="+this.catalogID+"&recordID="+this.recordID+"&type="+userCommentsTypePolygon+"&path="+encodeURIComponent(this.polygonPathObject.toString().replace(/,/g," ").toLowerCase())+"&width="+this.dimensions.width+"&height="+this.dimensions.height+"&action=create";app.doRequest("usercommenthandler.jspx",i,function(n){var o=n.responseText;this.insertComment(o);this.deleteDummyPath()}.bind(this));this.action=undefined}}else{this.fixedX=Event.pointerX(d)-this.offsetLeft;this.fixedY=Event.pointerY(d)-this.offsetTop;this.polygonPathObject[this.polygonPathObject.length]=new Array("L",this.fixedX,this.fixedY);this.doubleClick=true;window.setTimeout(function(){this.doubleClick=false}.bind(this),200)}}}}}}}.bind(this);c.onmousemove=function(f){if(!f){f=window.event}if(this.action=="insertPolygonNextClicks"){this.deleteDummyPath();var d=" L "+(Event.pointerX(f)-this.offsetLeft)+" "+(Event.pointerY(f)-this.offsetTop)+" Z";var g=this.raphaelContainer.path(this.polygonPathObject.toString().replace(/,/g," ")+d);g.attr("fill","white");g.attr("opacity",0.2);g.node.id="dummyPath"}else{if(this.action=="insertRectangleSecondClick"){this.deleteDummyRect();var e=undefined;if(Event.pointerX(f)-this.offsetLeft>this.fixedX){if(Event.pointerY(f)-this.offsetTop>this.fixedY){e=this.raphaelContainer.rect(this.fixedX,this.fixedY,Event.pointerX(f)-this.offsetLeft-this.fixedX,Event.pointerY(f)-this.offsetTop-this.fixedY)}else{e=this.raphaelContainer.rect(this.fixedX,Event.pointerY(f)-this.offsetTop,Event.pointerX(f)-this.offsetLeft-this.fixedX,this.fixedY-Event.pointerY(f)+this.offsetTop)}}else{if(Event.pointerY(f)-this.offsetTop>this.fixedY){e=this.raphaelContainer.rect(Event.pointerX(f)-this.offsetLeft,this.fixedY,this.fixedX-Event.pointerX(f)+this.offsetLeft,Event.pointerY(f)-this.offsetTop-this.fixedY)}else{e=this.raphaelContainer.rect(Event.pointerX(f)-this.offsetLeft,Event.pointerY(f)-this.offsetTop,this.fixedX-Event.pointerX(f)+this.offsetLeft,this.fixedY-Event.pointerY(f)+this.offsetTop)}}e.attr("fill","white");e.attr("opacity",0.2);e.node.id="dummyRect"}}}.bind(this)},insertComment:function(a){var b="recordView="+app.currentView.getRecordView()+"&singleCatalogID="+this.catalogID+"&recordID="+this.recordID+"&userCommentThreadID="+a;app.doUpdate("previewviewhotspot.jspx",b,"previewViewHotSpotBody",function(){$(this.containerID).removeClassName("createUserCommentMode")}.bind(this),true)},showUserComments:function(a,b,c){this.hideUserComments();this.setupContainer(a);if(b.length>0){this.createUserCommentsFromArray(CantoUtils.getStringAsXML(b).getElementsByTagName("uc"),c)}},insertIcon:function(){this.action="insertIcon";$(this.containerID).addClassName("createUserCommentMode")},insertRectangle:function(){this.action="insertRectangle";$(this.containerID).addClassName("createUserCommentMode")},insertPolygon:function(){this.action="insertPolygon";$(this.containerID).addClassName("createUserCommentMode")},deleteDummyPath:function(){var b=this.raphaelContainer.canvas.childNodes;for(var a=0;a<b.length;a++){if(b[a].id!=undefined&&b[a].id=="dummyPath"){b[a].parentNode.removeChild(b[a]);break}if(b[a].firstChild!=null&&b[a].firstChild.id=="dummyPath"){b[a].firstChild.parentNode.removeChild(b[a].firstChild);break}}},deleteDummyRect:function(){var b=this.raphaelContainer.canvas.childNodes;for(var a=0;a<b.length;a++){if(b[a].id!=undefined&&b[a].id=="dummyRect"){b[a].parentNode.removeChild(b[a]);break}if(b[a].firstChild!=null&&b[a].firstChild.id=="dummyRect"){b[a].firstChild.parentNode.removeChild(b[a].firstChild);break}}},hideUserComments:function(){var b=$$("svg");if(b!=null){for(var a=0;a<b.length;a++){b[a].parentNode.removeChild(b[a])}}var c=$$(".rvml");if(c[0]!=undefined){$(c[0].parentNode).remove()}},createUserCommentsFromArray:function(h,a){var d=undefined;var b=undefined;for(var e=0;e<h.length;e++){var j=h[e];var c=j.getAttribute("id");var g=j.getAttribute("t");var f=j.getAttribute("c")!=undefined?j.getAttribute("c"):"";var l=j.getAttribute("m")!="false";var k=j.getElementsByTagName("pts")[0].childNodes;this.createElement(c,f,g,k,l);if(a==c){d=g;b=l}}if(a!=undefined&&d!=undefined&&b!=undefined){hotSpotCommentsLib.loadUserComment(a,d,b)}},createElement:function(a,f,h,m,o){if(h==userCommentsTypeIcon){var e=m[0].getAttribute("x");var p=m[0].getAttribute("y");var j=this.dimensions.width*e;var g=this.dimensions.height*p;this.createIcon(a,j,g,f,o)}else{if(h==userCommentsTypeRectangle){var q=m[0].getAttribute("x");var c=m[0].getAttribute("y");var d=m[1].getAttribute("x");var l=m[1].getAttribute("y");var k=this.dimensions.width*q;var i=this.dimensions.height*c;var b=this.dimensions.width*(d-q);var n=this.dimensions.height*(l-c);this.createRectangle(a,k,i,b,n,f,o)}else{if(h==userCommentsTypePolygon){this.createPolygon(a,m,f,o)}}}},createIcon:function(a,j,h,g,k){var e=this.raphaelContainer.rect(j-leftIconOffset-1,h-topIconOffset-2,26,24);e.node.id="surroundingRect"+a;e.node.isSurroundingRect=true;e.attr("fill","white");e.attr("opacity",0);e.attr("title",g);var i=this.raphaelContainer.image(app.currentTheme+"/images/icons/comments/annotation.png",j-leftIconOffset,h-topIconOffset,24,24);i.node.id="svgUserComment"+a;i.attr("title",g);$(i.node).onmousedown=function(){this.loadUserComment(a,userCommentsTypeIcon,k)}.bind(this);$(i.node).onmouseover=function(){document.body.style.cursor="pointer"}.bind(this);$(i.node).onmouseout=function(){document.body.style.cursor="default"}.bind(this);if(k){var b=this;var f=function(){this.ox=this.attr("x");this.oy=this.attr("y");this.oxSurroundingRect=this.ox-1;this.oySurroundingRect=this.oy-2;hotSpotCommentsLib.loadUserComment(a,userCommentsTypeIcon,k)};var c=function(m,l){this.attr({x:this.ox+m,y:this.oy+l});e.attr({x:this.oxSurroundingRect+m,y:this.oySurroundingRect+l})};var d=function(){var n=(this.attr("x")+leftIconOffset)/b.dimensions.width;var l=(this.attr("y")+topIconOffset)/b.dimensions.height;var m="recordView="+app.currentView.getRecordView()+"&singleCatalogID="+b.catalogID+"&recordID="+b.recordID+"&type="+userCommentsTypeIcon+"&userCommentThreadID="+a+"&path="+n+" "+l+"&action=move";app.doRequest("usercommenthandler.jspx",m)};i.drag(c,f,d)}},createRectangle:function(v,m,l,i,r,u,z){var o=this;var n=6;var j=n/2;var D=this.raphaelContainer.rect(m,l,i,r);D.node.id="svgUserComment"+v;D.attr("title",u);D.attr("fill","white");D.attr("opacity",0.2);$(D.node).onmousedown=function(){this.loadUserComment(v,userCommentsTypeRectangle,z)}.bind(this);$(D.node).onmouseover=function(){document.body.style.cursor="pointer"}.bind(this);$(D.node).onmouseout=function(){document.body.style.cursor="default"}.bind(this);if(z){var B=this.createVertex("userCommentTL"+v,m-j,l-j,n,n);var h=this.createVertex("userCommentTR"+v,m+i-j,l-j,n,n);var e=this.createVertex("userCommentBL"+v,m-j,l+r-j,n,n);var A=this.createVertex("userCommentBR"+v,m+i-j,l+r-j,n,n);var p=function(){this.oxTL=B.attr("x");this.oyTL=B.attr("y");this.oxTR=h.attr("x");this.oyTR=h.attr("y");this.oxBL=e.attr("x");this.oyBL=e.attr("y");this.rectx=D.attr("x");this.recty=D.attr("y");this.width=D.attr("width");this.height=D.attr("height");hotSpotCommentsLib.loadUserComment(v,userCommentsTypeRectangle,z)};var f=function(F,E){if(this.width-F>0&&this.height-E>0){D.attr({x:this.rectx+F,y:this.recty+E,width:this.width-F,height:this.height-E});B.attr({x:this.oxTL+F,y:this.oyTL+E});h.attr({y:this.oyTR+E});e.attr({x:this.oxBL+F})}};var x=function(){var G=D.attr("x")/o.dimensions.width;var E=D.attr("y")/o.dimensions.height;var H=(D.attr("x")+D.attr("width"))/o.dimensions.width;var F=(D.attr("y")+D.attr("height"))/o.dimensions.height;var I="recordView="+app.currentView.getRecordView()+"&singleCatalogID="+o.catalogID+"&recordID="+o.recordID+"&type="+userCommentsTypeRectangle+"&userCommentThreadID="+v+"&path="+G+" "+E+" "+H+" "+F+"&action=move";app.doRequest("usercommenthandler.jspx",I)}.bind(this);B.drag(f,p,x);var k=function(){this.oxTL=B.attr("x");this.oyTL=B.attr("y");this.oxTR=h.attr("x");this.oyTR=h.attr("y");this.oxBR=A.attr("x");this.oyBR=A.attr("y");this.rectx=D.attr("x");this.recty=D.attr("y");this.width=D.attr("width");this.height=D.attr("height");hotSpotCommentsLib.loadUserComment(v,userCommentsTypeRectangle,z)};var g=function(F,E){if(this.width+F>0&&this.height-E>0){D.attr({y:this.recty+E,width:this.width+F,height:this.height-E});h.attr({x:this.oxTR+F,y:this.oyTR+E});B.attr({y:this.oyTL+E});A.attr({x:this.oxBR+F})}};var t=function(){var G=D.attr("x")/o.dimensions.width;var E=D.attr("y")/o.dimensions.height;var H=(D.attr("x")+D.attr("width"))/o.dimensions.width;var F=(D.attr("y")+D.attr("height"))/o.dimensions.height;var I="recordView="+app.currentView.getRecordView()+"&singleCatalogID="+o.catalogID+"&recordID="+o.recordID+"&type="+userCommentsTypeRectangle+"&userCommentThreadID="+v+"&path="+G+" "+E+" "+H+" "+F+"&action=move";app.doRequest("usercommenthandler.jspx",I)}.bind(this);h.drag(g,k,t);var d=function(){this.oxTL=B.attr("x");this.oyTL=B.attr("y");this.oxBL=e.attr("x");this.oyBL=e.attr("y");this.oxBR=A.attr("x");this.oyBR=A.attr("y");this.rectx=D.attr("x");this.recty=D.attr("y");this.width=D.attr("width");this.height=D.attr("height");hotSpotCommentsLib.loadUserComment(v,userCommentsTypeRectangle,z)};var y=function(F,E){if(this.width-F>0&&this.height+E>0){D.attr({x:this.rectx+F,width:this.width-F,height:this.height+E});B.attr({x:this.oxTL+F});e.attr({x:this.oxBL+F,y:this.oyBL+E});A.attr({y:this.oyBR+E})}};var C=function(){var G=D.attr("x")/o.dimensions.width;var E=D.attr("y")/o.dimensions.height;var H=(D.attr("x")+D.attr("width"))/o.dimensions.width;var F=(D.attr("y")+D.attr("height"))/o.dimensions.height;var I="recordView="+app.currentView.getRecordView()+"&singleCatalogID="+o.catalogID+"&recordID="+o.recordID+"&type="+userCommentsTypeRectangle+"&userCommentThreadID="+v+"&path="+G+" "+E+" "+H+" "+F+"&action=move";app.doRequest("usercommenthandler.jspx",I)}.bind(this);e.drag(y,d,C);var c=function(){this.oxTR=h.attr("x");this.oyTR=h.attr("y");this.oxBL=e.attr("x");this.oyBL=e.attr("y");this.oxBR=A.attr("x");this.oyBR=A.attr("y");this.width=D.attr("width");this.height=D.attr("height");hotSpotCommentsLib.loadUserComment(v,userCommentsTypeRectangle,z)};var w=function(F,E){if(this.width+F>0&&this.height+E>0){D.attr({width:this.width+F,height:this.height+E});h.attr({x:this.oxTR+F});e.attr({y:this.oyBL+E});A.attr({x:this.oxBR+F,y:this.oyBR+E})}};var b=function(){var G=D.attr("x")/o.dimensions.width;var E=D.attr("y")/o.dimensions.height;var H=(D.attr("x")+D.attr("width"))/o.dimensions.width;var F=(D.attr("y")+D.attr("height"))/o.dimensions.height;var I="recordView="+app.currentView.getRecordView()+"&singleCatalogID="+o.catalogID+"&recordID="+o.recordID+"&type="+userCommentsTypeRectangle+"&userCommentThreadID="+v+"&path="+G+" "+E+" "+H+" "+F+"&action=move";app.doRequest("usercommenthandler.jspx",I)}.bind(this);A.drag(w,c,b);var a=function(){this.ox=this.attr("x");this.oy=this.attr("y");this.oxTL=B.attr("x");this.oyTL=B.attr("y");this.oxTR=h.attr("x");this.oyTR=h.attr("y");this.oxBL=e.attr("x");this.oyBL=e.attr("y");this.oxBR=A.attr("x");this.oyBR=A.attr("y");hotSpotCommentsLib.loadUserComment(v,userCommentsTypeRectangle,z)};var q=function(F,E){this.attr({x:this.ox+F,y:this.oy+E});B.attr({x:this.oxTL+F,y:this.oyTL+E});h.attr({x:this.oxTR+F,y:this.oyTR+E});e.attr({x:this.oxBL+F,y:this.oyBL+E});A.attr({x:this.oxBR+F,y:this.oyBR+E})};var s=function(){var G=D.attr("x")/o.dimensions.width;var E=D.attr("y")/o.dimensions.height;var H=(D.attr("x")+D.attr("width"))/o.dimensions.width;var F=(D.attr("y")+D.attr("height"))/o.dimensions.height;var I="recordView="+app.currentView.getRecordView()+"&singleCatalogID="+o.catalogID+"&recordID="+o.recordID+"&type="+userCommentsTypeRectangle+"&userCommentThreadID="+v+"&path="+G+" "+E+" "+H+" "+F+"&action=move";app.doRequest("usercommenthandler.jspx",I)}.bind(this);D.drag(q,a,s)}},createPolygon:function(a,o,l,p){var d=this;var q=this.raphaelContainer.path();q.pathObject=new Array();q.node.id="svgUserComment"+a;q.vertexArray=new Array();var m=6;var n=m/2;for(var j=0;j<o.length;j++){if(j==0){var c=this.dimensions.width*o[0].getAttribute("y");var k=this.dimensions.height*o[0].getAttribute("x");q.pathObject[j]=new Array("M",c,k);if(p){this.managePolygonNodeDrag(a,q,q.pathObject,j,d,true,q.vertexArray,o,p)}}else{var f=this.dimensions.width*o[j].getAttribute("y");var e=this.dimensions.height*o[j].getAttribute("x");q.pathObject[j]=new Array("L",f,e);if(p){this.managePolygonNodeDrag(a,q,q.pathObject,j,d,false,q.vertexArray,o,p)}}}q.attr("path",q.pathObject.toString().replace(/,/g," ")+" Z");q.attr("fill","white");q.attr("opacity",0.2);q.attr("title",l);$(q.node).onmousedown=function(){this.loadUserComment(a,userCommentsTypePolygon,p)}.bind(this);$(q.node).onmouseover=function(){document.body.style.cursor="pointer"}.bind(this);$(q.node).onmouseout=function(){document.body.style.cursor="default"}.bind(this);if(p){var g=function(){this.oxArray=new Array();this.oyArray=new Array();for(var r=0;r<q.vertexArray.length;r++){this.oxArray[r]=q.vertexArray[r].attr("x");this.oyArray[r]=q.vertexArray[r].attr("y")}hotSpotCommentsLib.loadUserComment(a,userCommentsTypePolygon,p)};var h=function(s,r){for(var t=0;t<q.pathObject.length;t++){if(q.pathObject[t][0]!="Z"){q.pathObject[t]=new Array(q.pathObject[t][0],this.oxArray[t]+s,this.oyArray[t]+r)}else{q.pathObject[t]=new Array("Z")}}for(t=0;t<q.vertexArray.length;t++){q.vertexArray[t].attr({x:this.oxArray[t]+s-n,y:this.oyArray[t]+r-n})}q.attr("path",q.pathObject.toString().replace(/,/g," ")+" Z")};var b=function(){var i=q.pathObject.toString().replace(/,/g," ").toLowerCase();var r="recordView="+app.currentView.getRecordView()+"&singleCatalogID="+d.catalogID+"&recordID="+d.recordID+"&userCommentThreadID="+a+"&type="+userCommentsTypePolygon+"&path="+i+"&width="+d.dimensions.width+"&height="+d.dimensions.height+"&action=move";app.doRequest("usercommenthandler.jspx",r)}.bind(this);q.drag(h,g,b)}},managePolygonNodeDrag:function(b,n,e,i,d,a,c,m){var k=6;var l=k/2;var g=this.createVertex("polygonVertex"+i+"_"+b,e[i][1]-l,e[i][2]-l,k,k);c[i]=g;var f=function(){this.ox=g.attr("x");this.oy=g.attr("y");this.axisX=e[i][1];this.axisY=e[i][2];hotSpotCommentsLib.loadUserComment(b,userCommentsTypePolygon,m)};var h=function(p,o){if(a){e[i]=new Array("M",this.axisX+p,this.axisY+o);g.attr({x:this.ox+p,y:this.oy+o})}else{e[i]=new Array("L",this.axisX+p,this.axisY+o);g.attr({x:this.ox+p,y:this.oy+o})}n.attr("path",e.toString().replace(/,/g," ")+" Z")};var j=function(){var o=e.toString().replace(/,/g," ").toLowerCase();var p="recordView="+app.currentView.getRecordView()+"&singleCatalogID="+d.catalogID+"&recordID="+d.recordID+"&userCommentThreadID="+b+"&type="+userCommentsTypePolygon+"&path="+o+"&width="+d.dimensions.width+"&height="+d.dimensions.height+"&action=move";app.doRequest("usercommenthandler.jspx",p)}.bind(this);g.drag(h,f,j)},createVertex:function(f,b,e,c,a){var d=this.raphaelContainer.rect(b,e,c,a);d.attr("title","");d.attr("fill","white");d.attr("opacity",0);d.node.id=f;d.node.isVertex=true;$(d.node).onmouseover=function(){document.body.style.cursor="pointer"}.bind(this);$(d.node).onmouseout=function(){document.body.style.cursor="default"}.bind(this);return d}};
