/* jquery.event.drag.js ~ v1.5 ~ copyright (c) 2008, three dub media (http://threedubmedia.com) liscensed under the mit license ~ http://threedubmedia.googlecode.com/files/mit-license.txt */ (function(e){e.fn.drag=function(l,k,j){if(k){this.bind("dragstart",l)}if(j){this.bind("dragend",j)}return !l?this.trigger("drag"):this.bind("drag",k?k:l)};var a=e.event,b=a.special,f=b.drag={not:":input",distance:0,which:1,dragging:false,setup:function(j){j=e.extend({distance:f.distance,which:f.which,not:f.not},j||{});j.distance=i(j.distance);a.add(this,"mousedown",h,j);if(this.attachevent){this.attachevent("ondragstart",d)}},teardown:function(){a.remove(this,"mousedown",h);if(this===f.dragging){f.dragging=f.proxy=false}g(this,true);if(this.detachevent){this.detachevent("ondragstart",d)}}};b.dragstart=b.dragend={setup:function(){},teardown:function(){}};function h(l){var k=this,j,m=l.data||{};if(m.elem){k=l.dragtarget=m.elem;l.dragproxy=f.proxy||k;l.cursoroffsetx=m.pagex-m.left;l.cursoroffsety=m.pagey-m.top;l.offsetx=l.pagex-l.cursoroffsetx;l.offsety=l.pagey-l.cursoroffsety}else{if(f.dragging||(m.which>0&&l.which!=m.which)||e(l.target).is(m.not)){return }}switch(l.type){case"mousedown":e.extend(m,e(k).offset(),{elem:k,target:l.target,pagex:l.pagex,pagey:l.pagey});a.add(document,"mousemove mouseup",h,m);g(k,false);f.dragging=null;return false;case !f.dragging&&"mousemove":if(i(l.pagex-m.pagex)+i(l.pagey-m.pagey)