/* jquery.event.drag.js ~ v1.4 ~ Copyright (c) 2008, Three Dub Media (http://threedubmedia.com) Liscensed under the MIT License ~ http://threedubmedia.googlecode.com/files/MIT-LICENSE.txt */ (function(h){h.fn.drag=function(k,j,i){if(j){this.bind("dragstart",k)}if(i){this.bind("dragend",i)}return !k?this.trigger("drag"):this.bind("drag",j?j:k)};var d=h.event,b=d.special,f=b.drag={not:":input",distance:0,which:1,setup:function(i){i=h.extend({distance:f.distance,which:f.which,not:f.not},i||{});i.distance=g(i.distance);d.add(this,"mousedown",e,i)},teardown:function(){d.remove(this,"mousedown",e);if(this===f.dragging){f.dragging=f.proxy=null}c(this,true)}};function e(k){var j=this,i,l=k.data||{};if(l.elem){j=k.dragTarget=l.elem;k.dragProxy=f.proxy||j;k.cursorOffsetX=l.pageX-l.left;k.cursorOffsetY=l.pageY-l.top;k.offsetX=k.pageX-k.cursorOffsetX;k.offsetY=k.pageY-k.cursorOffsetY}else{if(f.dragging||(l.which>0&&k.which!=l.which)||h(k.target).is(l.not)){return}}switch(k.type){case"mousedown":h.extend(l,h(j).offset(),{elem:j,target:k.target,pageX:k.pageX,pageY:k.pageY});d.add(document,"mousemove mouseup",e,l);c(j,false);return false;case !f.dragging&&"mousemove":if(g(k.pageX-l.pageX)+g(k.pageY-l.pageY)