(function(){function y(a,c,b){m=setTimeout(function(){m=null;11>zk.ie&&g&&g.node!=a.node||(g=a)},a.opts.delay);n=b}function t(){g=null;p&&setTimeout(function(){p=null},0)}function u(a){if(g&&!g.dead){var c=jq.Event.zk(a),b=[c.pageX,c.pageY];k&&k[0]==b[0]&&k[1]==b[1]||(k=b,g._updateDrag(b,c),a.stop())}}function v(a){m&&(clearTimeout(m),m=null);var c=jq.Event.zk(a),b=g;b?(k=g=null,b._endDrag(c),c.domStopped&&a.stop(),b._suicide&&(b._suicide=!1,b.destroy())):1==c.which&&(p=null)}function w(a){g&&g._keypress(a)}
function z(a){a=a.node;a._$opacity=jq(a).css("opacity");r[a]=!0;new zk.eff.Opacity(a,{duration:.2,from:a._$opacity,to:.7})}function A(a){var c=a.node;new zk.eff.Opacity(c,{duration:.2,from:.7,to:"number"==typeof c._$opacity?c._$opacity:1,queue:{scope:"_draggable",position:"end"},afterFinish:function(){delete r[c]}})}function B(a,c){var b,d;if((b=c[0])||(d=c[1])){var e=a.node,f=e.style.position;new zk.eff.Move(e,{x:-b,y:-d,duration:.02*Math.sqrt(Math.abs(d^2)+Math.abs(b^2)),queue:{scope:"_draggable",
position:"end"},afterFinish:function(){e.style.position=f}})}}function x(a){return jq.nodeName(a.target,"input","textarea")}var q=[],r={},m,l,g,n,p,k,h;zk.Draggable=zk.$extends(zk.Object,{$init:function(a,c,b){l||(jq(l=jq.newStackup(null,"z_ddstkup")).hide(),document.body.appendChild(l));this.control=a;this.node=c=c?jq(c,zk)[0]:a.node||(a.$n?a.$n():null);if(!c)throw"Handle required for "+a;b=zk.$default(b,{scrollSensitivity:20,scrollSpeed:15,initSensitivity:3,delay:0,fireOnMove:!0});null==b.reverteffect&&
(b.reverteffect=B);null==b.endeffect&&(b.endeffect=A,null==b.starteffect&&(b.starteffect=z));b.handle&&(this.handle=jq(b.handle,zk)[0]);this.handle||(this.handle=c);!b.scroll||b.scroll.scrollTo||b.scroll.outerHTML||(b.scroll=jq(b.scroll,zk)[0],this._isScrollChild=zUtl.isAncestor(b.scroll,c));this.delta=this._currentDelta();this.opts=b;this.dragging=!1;jq(this.handle).bind("zmousedown",this.proxy(this._mousedown)).bind("dragstart",x);0==q.length&&jq(document).bind("zmouseup",v).bind("zmousemove",u).keypress(w);
q.push(this)},destroy:function(){this.dragging?this._suicide=!0:(jq(this.handle).unbind("zmousedown",this.proxy(this._mousedown)).unbind("dragstart",x),q.$remove(this),0==q.length&&jq(document).unbind("zmouseup",v).unbind("zmousemove",u).unbind("keypress",w),g==this&&(g=null),this.node=this.control=this.handle=null,this.dead=!0)},_currentDelta:function(){var a=jq(this.node);return[zk.parseInt(a.css("left")),zk.parseInt(a.css("top"))]},_startDrag:function(a){zWatch.fire("onStartDrag",this,a);zk(document.body).disableSelection();
jq.clearSelection();if(this.opts.overlay){var c=document.createElement("div");document.body.appendChild(c);c.className="z-dd-stackup";zk(c).disableSelection();c=(this.stackup=c).style;c.width=jq.px0(jq(document).width());c.height=jq.px0(jq(document).height())}zk.dragging=this.dragging=!0;var b=this.node;if(c=this.opts.ghosting)if("function"==typeof c){this.delta=this._currentDelta();this.orgnode=this.node;b=zk(this.node);var d=b.cmOffset();this.z_scrl=b.scrollOffset();this.z_scrl[0]-=jq.innerX();
this.z_scrl[1]-=jq.innerY();d[0]-=this.z_scrl[0];d[1]-=this.z_scrl[1];b=this.node=c(this,d,a)}else this._clone=jq(b).clone()[0],this.z_orgpos=b.style.position,"absolute"!=this.z_orgpos&&jq(b).absolutize(),b.parentNode.insertBefore(this._clone,b);this.opts.stackup&&(zk(l).isVisible()?this._stackup=jq.newStackup(b,b.id+"-ddstk"):(this._stackup=l,this._syncStackup(),b.parentNode.insertBefore(l,b)));this.orgZ=-1;if(c=this.opts.zIndex)"function"==typeof c&&(c=c(this)),0<=c&&(this.orgZ=zk.parseInt(jq(b).css("z-index")),
b.style.zIndex=c);this.opts.scroll&&(this.opts.scroll==window?(c=this._getWndScroll(this.opts.scroll),this.orgScrlLeft=c.left,this.orgScrlTop=c.top):(this.orgScrlLeft=this.opts.scroll.scrollLeft,this.orgScrlTop=this.opts.scroll.scrollTop));this.opts.starteffect&&this.opts.starteffect(this,a)},_syncStackup:function(){if(this._stackup){var a=this.node,c=this._stackup.style;c.display="block";c.left=a.offsetLeft+"px";c.top=a.offsetTop+"px";c.width=a.offsetWidth+"px";c.height=a.offsetHeight+"px"}},_updateDrag:function(a,
c){var b;if(!this.dragging){if((b=this.opts.initSensitivity)&&a[0]<=n[0]+b&&a[0]>=n[0]-b&&a[1]<=n[1]+b&&a[1]>=n[1]-b)return;this._startDrag(c)}this._updateInnerOfs();this._draw(a,c);this.opts.change&&this.opts.change(this,a,c);this._syncStackup();if(this.opts.scroll){this._stopScrolling();if(this.opts.scroll==window){b=this._getWndScroll(this.opts.scroll);var d=[b.left,b.top,b.left+b.width,b.top+b.height]}else d=zk(this.opts.scroll).viewportOffset(),d[0]+=this.opts.scroll.scrollLeft+this._innerOfs[0],
d[1]+=this.opts.scroll.scrollTop+this._innerOfs[1],d.push(d[0]+this.opts.scroll.offsetWidth),d.push(d[1]+this.opts.scroll.offsetHeight);var e=[0,0];b=this.opts.scrollSensitivity;a[0]<d[0]+b&&(e[0]=a[0]-(d[0]+b));a[1]<d[1]+b&&(e[1]=a[1]-(d[1]+b));a[0]>d[2]-b&&(e[0]=a[0]-(d[2]-b));a[1]>d[3]-b&&(e[1]=a[1]-(d[3]-b));this._startScrolling(e)}0<navigator.appVersion.indexOf("AppleWebKit")&&window.scrollBy(0,0);c.stop()},_finishDrag:function(a,c){this.dragging=!1;this.stackup&&(jq(this.stackup).remove(),delete this.stackup);
zk(document.body).enableSelection();setTimeout(jq.clearSelection,0);if(c=this._stackup)c==l?jq(c).hide():jq(c).remove(),delete this._stackup;c=this.node;this.opts.ghosting&&("function"==typeof this.opts.ghosting?(this.opts.endghosting&&this.opts.endghosting(this,this.orgnode),c!=this.orgnode&&(jq(c).remove(),this.node=this.orgnode),delete this.orgnode):("absolute"!=this.z_orgpos&&(zk(this.node).relativize(),c.style.position=this.z_orgpos),jq(this._clone).remove(),this._clone=null));var b=[a.pageX,
a.pageY],d=this.opts.revert;d&&"function"==typeof d&&(d=d(this,b,a));b=this._currentDelta();var e=this.delta;d&&this.opts.reverteffect?this.opts.reverteffect(this,[b[0]-this.delta[0],b[1]-this.delta[1]]):this.delta=b;-1!=this.orgZ&&(c.style.zIndex=this.orgZ);this.opts.endeffect&&this.opts.endeffect(this,a);d=this.control;this.opts.fireOnMove&&zk.Widget.isInstance(d)&&(b[0]==e[0]&&b[1]==e[1]||d.fire("onMove",zk.copy({left:c.style.left,top:c.style.top},a.data),{ignorable:!0}));t(this);var f=this;setTimeout(function(){zk.dragging=
!1;zWatch.fire("onEndDrag",f,a)},zk.ios?500:0)},_mousedown:function(a){var c=this.node,b=jq.Event.zk(a),d=a.target;if(!(m||r[c]||1!=b.which||zk.webkit&&jq.nodeName(d,"select")||zk(d).isInput()&&this.control!=zk.Widget.$(d)))if(d=[b.pageX,b.pageY],this.opts.ignoredrag&&this.opts.ignoredrag(this,d,b))b.domStopped&&a.stop();else{b=zk(c).cmOffset();b=[d[0]-b[0],d[1]-b[1]];var e;(e=c.clientWidth)&&b[0]>e&&c.offsetWidth>e+3||(e=c.clientHeight)&&b[1]>e&&c.offsetHeight>e+3||(this.offset=b,y(this,a,d),zk.mobile||
(p=jq.Event.zk(a,this.control)))}},_keypress:function(a){27==a.keyCode&&(this._finishDrag(jq.Event.zk(a),!1),a.stop())},_endDrag:function(a){this.dragging?(this._stopScrolling(),this._finishDrag(a,!0),a.stop()):t(this)},_draw:function(a,c){var b=this.node,d=zk(b),e=d.cmOffset(),f=this.opts;f.ghosting&&(d=d.scrollOffset(),e[0]+=d[0]-this._innerOfs[0],e[1]+=d[1]-this._innerOfs[1]);d=this._currentDelta();var g=f.scroll;e[0]-=d[0];e[1]-=d[1];g&&g!=window&&this._isScrollChild&&(e[0]-=g.scrollLeft-this.orgScrlLeft,
e[1]-=g.scrollTop-this.orgScrlTop);a=[a[0]-e[0]-this.offset[0],a[1]-e[1]-this.offset[1]];(e=f.snap)&&(a="function"==typeof e?e(this,a):e instanceof Array?[Math.round(a[0]/e[0])*e[0],Math.round(a[1]/e[1])*e[1]]:[Math.round(a[0]/e)*e,Math.round(a[1]/e)*e]);this.z_scrl&&(a[0]-=this.z_scrl[0],a[1]-=this.z_scrl[1]);b=b.style;"function"==typeof f.draw?f.draw(this,this.snap_(a,f),c):"function"==typeof f.constraint?((c=f.constraint(this,a,c))&&(a=c),a=this.snap_(a,f),b.left=jq.px(a[0]),b.top=jq.px(a[1])):
(a=this.snap_(a,f),f.constraint&&"horizontal"!=f.constraint||(b.left=jq.px(a[0])),f.constraint&&"vertical"!=f.constraint||(b.top=jq.px(a[1])));"hidden"==b.visibility&&(b.visibility="")},_stopScrolling:function(){this.scrollInterval&&(clearInterval(this.scrollInterval),h=this.scrollInterval=null)},_startScrolling:function(a){if(a[0]||a[1])this.scrollSpeed=[a[0]*this.opts.scrollSpeed,a[1]*this.opts.scrollSpeed],this.lastScrolled=new Date,this.scrollInterval=setInterval(this.proxy(this._scroll),10)},
_scroll:function(){var a=new Date,c=a-this.lastScrolled;this.lastScrolled=a;if(this.opts.scroll==window){if(this.scrollSpeed[0]||this.scrollSpeed[1]){a=this._getWndScroll(this.opts.scroll);var b=c/1E3;this.opts.scroll.scrollTo(a.left+b*this.scrollSpeed[0],a.top+b*this.scrollSpeed[1])}}else this.opts.scroll.scrollLeft+=this.scrollSpeed[0]*c/1E3,this.opts.scroll.scrollTop+=this.scrollSpeed[1]*c/1E3;this._updateInnerOfs();this._isScrollChild&&(h=h||k,h[0]+=this.scrollSpeed[0]*c/1E3,h[1]+=this.scrollSpeed[1]*
c/1E3,0>h[0]&&(h[0]=0),0>h[1]&&(h[1]=0),this._draw(h));this.opts.change&&(c=(c=window.event?jq.event.fix(window.event):null)?jq.Event.zk(c):null,this.opts.change(this,c?[c.pageX,c.pageY]:k,c))},_updateInnerOfs:function(){this._innerOfs=[jq.innerX(),jq.innerY()]},_getWndScroll:function(a){var c=a.document,b=c.documentElement;if(b&&b.scrollTop){var d=b.scrollTop;var e=b.scrollLeft}else a.document.body&&(d=c.body.scrollTop,e=c.body.scrollLeft);if(a.innerWidth){var f=a.innerWidth;a=a.innerHeight}else b&&
b.clientWidth?(f=b.clientWidth,a=b.clientHeight):(f=c.body.offsetWidth,a=c.body.offsetHeight);return{top:d,left:e,width:f,height:a}},snap_:function(a,c){!c.snap&&0>a[1]&&(a[1]=0);return a}},{ignoreMouseUp:function(){return zk.dragging?!0:p},ignoreClick:function(){return zk.dragging},ignoreStop:function(a){return!1}})})();
