!function(p,k){"function"===typeof define&&"object"===typeof define.amd?define(k):this[p]=k()}("draggable",function(){function p(a){a.draggableListeners={start:[],drag:[],stop:[]};a.whenDragStarts=q(a,"start");a.whenDragging=q(a,"drag");a.whenDragStops=q(a,"stop")}function k(a,b){d=b;var e=b=0;var c=d;do b+=c.offsetTop,e+=c.offsetLeft;while(c=c.offsetParent);if(c=d.currentStyle?d.currentStyle:getComputedStyle(d))e=e-(parseInt(c["margin-left"])||0)-(parseInt(c["border-left"])||0),b=b-(parseInt(c["margin-top"])||0)-(parseInt(c["border-top"])||0);var f=navigator.userAgent;var g=c=null;if(0<=f.indexOf("MSIE")){var h="msie";"BackCompat"==document.compatMode?c=5:document.documentMode?c=document.documentMode:g=/MSIE ([0-9]{1,}[.0-9]{0,})/}else 0<=f.indexOf("Chrome")?(h="chrome",g=/Chrome\/([0-9]{1,}[.0-9]{0,})/):0<=f.indexOf("Firefox")?(h="firefox",g=/Firefox\/([0-9]{1,}[.0-9]{0,})/):0<=f.indexOf("Safari")?(h="safari",g=/Version\/([0-9]{1,}[.0-9]{0,})/):0<=f.indexOf("Opera")?(h="opera",g=/Version\/([0-9]{1,}[.0-9]{0,})/):(h="unknown",c=0);g&&g.exec(f)&&(c=parseFloat(RegExp.$1));f=h;"firefox"===f||"opera"===f||"msie"===f&&7===c||(d.style.left=e+"px",d.style.top=b+"px");d.lastXPosition=a.clientX;d.lastYPosition=a.clientY;r("start",{x:e,y:b,mouseEvent:a})&&(document.addEventListener?(document.addEventListener("selectstart",l),document.addEventListener("mousemove",m),document.addEventListener("mouseup",n)):(document.attachEvent("onselectstart",l),document.attachEvent("onmousemove",m),document.attachEvent("onmouseup",n)))}function q(a,b){return function(e){a.draggableListeners[b].push(e)}}function r(a,b){var e=!0;a=d.draggableListeners[a];for(var c=a.length-1;0<=c;c--)!1===a[c](b)&&(e=!1);return e}function l(a){a.preventDefault&&a.preventDefault();a.stopPropagation&&a.stopPropagation();return a.returnValue=!1}function m(a){var b=d.style,e=parseInt(b.left,10),c=parseInt(b.top,10);e+=a.clientX-d.lastXPosition;c+=a.clientY-d.lastYPosition;b.left=e+"px";b.top=c+"px";d.lastXPosition=a.clientX;d.lastYPosition=a.clientY;r("drag",{x:e,y:c,mouseEvent:a})}function n(a){document.removeEventListener?(document.removeEventListener("selectstart",l),document.removeEventListener("mousemove",m),document.removeEventListener("mouseup",n)):(document.detachEvent("onselectstart",l),document.detachEvent("onmousemove",m),document.detachEvent("onmouseup",n));var b=parseInt(d.style.left,10),e=parseInt(d.style.top,10);r("stop",{x:b,y:e,mouseEvent:a})}var d;return function(a,b){b=b||a;a.style.position="absolute";p(a);b.addEventListener?b.addEventListener("mousedown",function(b){k(b,a)}):b.attachEvent("onmousedown",function(b){k(b,a)})}});