(function(){function e(){o&&f()}var h=/MSIE/.test(navigator.userAgent)&&!window.opera,d=null,f=function(){j.repaintEverything()},o=true,m=null;$(window).bind("resize",function(){m&&clearTimeout(m);m=setTimeout(e,100)});var g={},l=[],s={},r={},y=true,z=[],H=1200,I=function(a,b,c){var i=function(q,t){if(q===t)return true;else if(typeof q=="object"&&typeof t=="object"){var u=true;for(var v in q)if(!i(q[v],t[v])){u=false;break}for(v in t)if(!i(t[v],q[v])){u=false;break}return u}};c=+c||0;for(var p=a.length;c< p;c++)if(i(a[c],b))return c;return-1},E=function(a,b,c){var i=a[b];if(i==null){i=[];a[b]=i}i.push(c)},O=function(a,b){var c=C(a,"id"),i=g[c];if(i){J(c,b);for(var p=l[c],q=z[c],t=0;t=0){delete a[c];a.splice(c,1);return true}}return false},W=function(a,b){var c=C(a,"id");P(c,function(i){i.canvas.style.display=b})},X=function(a){P(a,function(b){b.canvas.style.display="none"==b.canvas.style.display? "block":"none"})},J=function(a,b,c){if(c||b==null){w(a);b=j.CurrentLibrary.getElementObject(a);b=j.CurrentLibrary.getSize(b);z[a]=b;b=j.CurrentLibrary.getElementObject(a);b=j.CurrentLibrary.getOffset(b);l[a]=b}else l[a]=b},K=function(a,b){a=a||function(){};return function(){b.apply(this,arguments);a.apply(this,arguments)}},da=function(a){var b=this;this.x=a.x||0;this.y=a.y||0;var c=a.orientation||[0,0];this.offsets=a.offsets||[0,0];this.compute=function(i,p){return[i[0]+b.x*p[0]+b.offsets[0],i[1]+ b.y*p[1]+b.offsets[1]]};this.getOrientation=function(){return c}},ea=function(a){var b=a.reference,c=0,i=0,p=null;this.compute=function(q){i=c=0;return[q[0],q[1]]};this.getOrientation=function(){if(p)return p;else{var q=b.getOrientation();return[Math.abs(q[0])*c*-1,Math.abs(q[1])*i*-1]}};this.over=function(q){p=q.getOrientation()};this.out=function(){p=null}},Y=function(a){var b=this;this.source=w(a.source);this.target=w(a.target);this.sourceId=C(this.source,"id");this.targetId=C(this.target,"id"); this.endpointsOnTop=a.endpointsOnTop!=null?a.endpointsOnTop:true;this.endpoints=[];this.endpointStyles=[];var c=function(q,t,u){if(q)b.endpoints[t]=q;else{if(!u.endpoints)u.endpoints=[null,null];q=u.endpoints[t]||u.endpoint||j.Defaults.Endpoints[t]||j.Defaults.Endpoint||new j.Endpoints.Dot;if(!u.endpointStyles)u.endpointStyles=[null,null];b.endpoints[t]=new S({style:u.endpointStyles[t]||u.endpointStyle||j.Defaults.EndpointStyles[t]||j.Defaults.EndpointStyle,endpoint:q,connections:[b],anchor:u.anchors? u.anchors[t]:j.Defaults.Anchors[t]||j.Anchors.BottomCenter})}};c(a.sourceEndpoint,0,a);c(a.targetEndpoint,1,a);this.connector=this.endpoints[0].connector||this.endpoints[1].connector||a.connector||j.Defaults.Connector||new j.Connectors.Bezier;this.paintStyle=this.endpoints[0].connectionStyle||this.endpoints[1].connectionStyle||a.paintStyle||j.Defaults.PaintStyle;J(this.sourceId);J(this.targetId);c=l[this.sourceId];var i=z[this.sourceId];c=this.endpoints[0].anchor.compute([c.left,c.top],i);this.endpoints[0].paint(c); c=l[this.targetId];i=z[this.targetId];c=this.endpoints[1].anchor.compute([c.left,c.top],i);this.endpoints[1].paint(c);var p=U(j.connectorClass);this.canvas=p;this.paint=function(q,t,u){d&&d.debug("Painting Connection; element in motion is "+q+"; ui is ["+t+"]; recalc is ["+u+"]");var v=q!=this.sourceId,A=v?this.sourceId:this.targetId,k=v?0:1,F=v?1:0;if(this.canvas.getContext){J(q,t,u);u&&J(A);t=l[q];u=l[A];q=z[q];var G=z[A];A=p.getContext("2d");var x=this.endpoints[F].anchor.compute([t.left,t.top], q,[u.left,u.top],G);this.endpoints[F].anchor.getOrientation();t=this.endpoints[k].anchor.compute([u.left,u.top],G,[t.left,t.top],q);this.endpoints[k].anchor.getOrientation();k=this.connector.compute(x,t,this.endpoints[F].anchor,this.endpoints[k].anchor,this.paintStyle.lineWidth);j.sizeCanvas(p,k[0],k[1],k[2],k[3]);j.extend(A,this.paintStyle);if(this.paintStyle.gradient&&!h){v=v?A.createLinearGradient(k[4],k[5],k[6],k[7]):A.createLinearGradient(k[6],k[7],k[4],k[5]);for(F=0;F=0&&b.connections.splice(n,1)};this.isConnectedTo=function(n){var D=false;if(n)for(var B=0;B=t};this.paint=function(n,D,B){d&&d.debug("Painting Endpoint with elementId ["+q+"]; anchorPoint is ["+n+"]");if(n==null){n=l[q];var M=z[q];if(n==null||M==null){J(q);n=l[q];M=z[q]}n=b.anchor.compute([n.left,n.top],M)}c.paint(n,b.anchor.getOrientation(),B||b.canvas,i,D||i)};if(a.isSource&&j.CurrentLibrary.isDragSupported(p)){var A=null,k=null,F=false,G=null,x=a.dragOptions||{},N=j.extend({},j.CurrentLibrary.defaultDragOptions);x=j.extend(N, x);N=j.CurrentLibrary.dragEvents.start;var Z=j.CurrentLibrary.dragEvents.stop,aa=j.CurrentLibrary.dragEvents.drag;x[N]=K(x[N],function(){A=document.createElement("div");document.body.appendChild(A);var n=""+new String((new Date).getTime());Q(w(A),"id",n);J(n);Q(w(b.canvas),"dragId",n);Q(w(b.canvas),"elId",q);var D=new ea({reference:b.anchor});v=new S({style:i,endpoint:c,anchor:D,source:A});k=b.connections.length==0||b.connections.length=4)c.orientation=[arguments[2],arguments[3]];if(arguments.length==6)c.offsets=[arguments[4],arguments[5]]}return new da(c)},repaint:function(a){var b=function(i){i=w(i);O(i)};if(typeof a=="object")for(var c=0;c1&&alert("poo");e.draggable(h)},isDragSupported:function(e){return e.draggable},setDraggable:function(e,h){e.draggable("option","disabled",!h)},initDroppable:function(e,h){e.droppable(h)},isDropSupported:function(e){return e.droppable},animate:function(e,h,d){e.animate(h,d)},getUIPosition:function(e){e=e[1];return e.absolutePosition||e.offset},getDragObject:function(e){return e[1].draggable}}})(); (function(){jsPlumb.Anchors.TopCenter=jsPlumb.makeAnchor(0.5,0,0,-1);jsPlumb.Anchors.BottomCenter=jsPlumb.makeAnchor(0.5,1,0,1);jsPlumb.Anchors.LeftMiddle=jsPlumb.makeAnchor(0,0.5,-1,0);jsPlumb.Anchors.RightMiddle=jsPlumb.makeAnchor(1,0.5,1,0);jsPlumb.Anchors.Center=jsPlumb.makeAnchor(0.5,0.5,0,0);jsPlumb.Anchors.TopRight=jsPlumb.makeAnchor(1,0,0,-1);jsPlumb.Anchors.BottomRight=jsPlumb.makeAnchor(1,1,0,1);jsPlumb.Anchors.TopLeft=jsPlumb.makeAnchor(0,0,0,-1);jsPlumb.Anchors.BottomLeft=jsPlumb.makeAnchor(0, 1,0,1);jsPlumb.Connectors.Straight=function(){this.compute=function(e,h,d,f,o){d=Math.abs(e[0]-h[0]);f=Math.abs(e[1]-h[1]);var m=0.45*d,g=0.45*f;d*=1.9;f*=1.9;var l=Math.min(e[0],h[0])-m,s=Math.min(e[1],h[1])-g;if(d<2*o){d=2*o;l=e[0]+(h[0]-e[0])/2-o;m=(d-Math.abs(e[0]-h[0]))/2}if(f<2*o){f=2*o;s=e[1]+(h[1]-e[1])/2-o;g=(f-Math.abs(e[1]-h[1]))/2}return[l,s,d,f,e[0]l)l=o;if(f<0){r+=f;f=Math.abs(f);l+=f;E[0]+=f;z+=f;I+=f;d[0]+=f}f=Math.min(Math.min(H,g),Math.min(E[1], d[1]));o=Math.max(Math.max(H,g),Math.max(E[1],d[1]));if(o>s)s=o;if(f<0){y+=f;f=Math.abs(f);s+=f;E[1]+=f;H+=f;g+=f;d[1]+=f}return[r,y,l,s,z,H,I,g,E[0],E[1],d[0],d[1]]};this.paint=function(d,f){f.beginPath();f.moveTo(d[4],d[5]);f.bezierCurveTo(d[8],d[9],d[10],d[11],d[6],d[7]);f.stroke()}};jsPlumb.Endpoints.Dot=function(e){e=e||{radius:10};var h=this;this.radius=e.radius;var d=0.5*this.radius,f=this.radius/3,o=function(m){try{return parseInt(m)}catch(g){if(m.substring(m.length-1)=="%")return parseInt(m.substring(0, m-1))}};this.paint=function(m,g,l,s,r){var y=s.radius||h.radius;jsPlumb.sizeCanvas(l,m[0]-y,m[1]-y,y*2,y*2);m=l.getContext("2d");l=jsPlumb.extend({},s);if(l.fillStyle==null)l.fillStyle=r.strokeStyle;jsPlumb.extend(m,l);r=/MSIE/.test(navigator.userAgent)&&!window.opera;if(s.gradient&&!r){r=s.gradient;l=d;var z=f;if(r.offset)l=o(r.offset);if(r.innerRadius)z=o(r.innerRadius);r=[l,z];g=m.createRadialGradient(y,y,y,y+(g[0]==1?r[0]*-1:r[0]),y+(g[1]==1?r[0]*-1:r[0]),r[1]);for(r=0;r