var krpanoplugin=function(){function M(){1==arguments.length&&e&&e.trace(3,u+" plugin "+y+": "+arguments[0])}function D(){if(h.debug&&e&&"true"==h.debug.toLowerCase())for(var a=0;a<arguments.length;a++)e.trace(1,arguments[a])}function q(a,l){if(e){var c=e.plugin.getItem(l);c||M(a+" - "+l+" not found!");return c?c:null}}function r(a,l){if(e){var c=a.parent?q("getboundes",a.parent):null,m=a.align.toLowerCase(),k=a.edge?a.edge:m,f="x"==l?a.pixelwidth:a.pixelheight,d=0,g,d=c?"x"==l?c.pixelwidth:c.pixelheight:
"x"==l?e.stagewidth:e.stageheight;f<d?(g=0,c=d-f):(g=d-f,c=0);var b=1;if("x"==l){if("top"==m||"center"==m||"bottom"==m)g-=d/2,c-=d/2;-1<m.indexOf("right")&&(g+=f,c+=f,b=-1);if("top"==k||"center"==k||"bottom"==k)g+=f/2*b,c+=f/2*b;-1<k.indexOf("right")&&(g+=f*b,c+=f*b);a.boundxmax=a.dragxmax?a.dragxmax:c;a.boundxmin=a.dragxmin?a.dragxmin:g;a.boundwidth=d;"true"==a.dragfixedalign.toLowerCase()&&a.pixelwidth<d&&(a.boundxmax=0,a.boundxmin=0,a.boundwidth=0)}else{if("left"==m||"center"==m||"right"==m)g-=
d/2,c-=d/2;-1<m.indexOf("bottom")&&(g+=f,c+=f,b=-1);if("left"==k||"center"==k||"right"==k)g+=f/2*b,c+=f/2*b;-1<k.indexOf("bottom")&&(g+=f*b,c+=f*b);a.boundymax=a.dragymax?a.dragymax:c;a.boundymin=a.dragymin?a.dragymin:g;a.boundheight=d;"true"==a.dragfixedalign.toLowerCase()&&a.pixelheight<d&&(a.boundymax=0,a.boundymin=0,a.boundheight=0)}}}function N(a,l,c,e,b){E("tocenter",a,l,c,e,b)}function O(a,e,c){E("center",a,e,c)}function E(a,l,c,b,k,f){var d=q(a,l);if(d&&e){r(d,"x");r(d,"y");var g=d.align.toLowerCase(),
h=d.edge?d.edge:g,n=Number(c);c=d.boundwidth/2-n;var p=1;if("top"==g||"center"==g||"bottom"==g)c=0-n;-1<g.indexOf("right")&&(c=d.boundwidth/2+n,p=-1);if("top"==h||"center"==h||"bottom"==h)c+=d.pixelwidth/2*p;-1<h.indexOf("right")&&(c+=d.pixelwidth*p);if("all"==d.dragbounds||"x"==d.dragbounds)c<d.boundxmin&&(c=d.boundxmin),c>d.boundxmax&&(c=d.boundxmax);n=Number(b);b=d.boundheight/2-n;p=1;if("left"==g||"center"==g||"right"==g)b=0-n;-1<g.indexOf("bottom")&&(b=d.boundheight/2+n,p=-1);if("left"==h||"center"==
h||"right"==h)b+=d.pixelheight/2*p;-1<h.indexOf("bottom")&&(b+=d.pixelheight*p);if("all"==d.dragbounds||"y"==d.dragbounds)b<d.boundymin&&(b=d.boundymin),b>d.boundymax&&(b=d.boundymax);e.call(d.onmovingstart,d);"tocenter"==a&&(d.isdragging=!0,d.ismovingx=!0,d.ismovingy=!0,k=k?k:"0.8",f=f?f:"easeOutCubic",g="set(plugin["+l+"].ismovingy,false);",e.call("tween(plugin["+l+"].x,"+c+","+k+","+f+","+("set(plugin["+l+"].ismovingx,false);")+")"),e.call("tween(plugin["+l+"].y,"+b+","+k+","+f+","+g+")"),d.calleventsRuning||
(d.calleventsRuning=!0,v(d),clearInterval(d.calleventsInterval),d.calleventsInterval=setInterval(v,10,d)));"center"==a&&(e.call("set(plugin["+l+"].x,"+c+")"),e.call("set(plugin["+l+"].y,"+b+")"),e.call(d.onmoving,d),e.call(d.onmovingend,d))}}function w(a,b,c){if(e){a=q("updatepos",a);var m=0,k=0,f="NO",d="1",k="x"==b?Number(a.x):Number(a.y),g="x"==b?Number(a.boundxmax):Number(a.boundymax),h="x"==b?Number(a.boundxmin):Number(a.boundymin);"x"==b&&(a.ismovingx=!0);"y"==b&&(a.ismovingy=!0);k+=10*c;k>
g&&(m=g,f=" GT ");k<h&&(m=h,f=" LT ");"all"!=a.dragbounds&&a.dragbounds!=b||"all"==a.dragboundselastic||a.dragboundselastic==b||(k>g&&(k=g,f=" GT "),k<h&&(k=h,f=" LT "));"x"==b&&0==a.dragdeltax&&(d="0");"y"==b&&0==a.dragdeltay&&(d="0");0==c&&0==m&&"NO"==f&&(d="0");c="set(plugin["+a.name+"].ismoving"+b+",false);";m="if(plugin["+a.name+"]."+b+f+m+", delayedcall(0.04, "+("tween(plugin["+a.name+"]."+b+","+m+",0.5,easeOutCubic,"+c+")")+"););";"NO"==f&&(m="");"all"!=a.dragbounds&&a.dragbounds!=b&&(m="");
f="tween(plugin["+a.name+"]."+b+","+k+","+d+",easeOutCubic,"+c+","+m+");";e.call("stoptween(plugin["+a.name+"]."+b+")");e.call(f);a.calleventsRuning||(a.calleventsRuning=!0,v(a),clearInterval(a.calleventsInterval),a.calleventsInterval=setInterval(v,10,a))}}function F(a){if(a=q("update",a))G(a),r(a,"x"),r(a,"y"),H(a,a.x,a.y),e.call(a.onmovingstart),"all"!=a.dragaxis&&"x"!=a.dragaxis||w(a.name,"x",0),"all"!=a.dragaxis&&"y"!=a.dragaxis||w(a.name,"y",0)}function I(){if(e){var a;a=e.mouse.x;s=a-z;z=a;
a=e.mouse.y;t=a-A;A=a}}function G(a){a&&(temp=a.dragaxis=a.dragaxis?a.dragaxis.toLowerCase():"all","all"!=temp&&"x"!=temp&&"y"!=temp&&(a.dragaxis="all"),temp=a.draginertia=a.draginertia?a.draginertia.toLowerCase():"all","all"!=temp&&"x"!=temp&&"y"!=temp&&"false"!=temp&&(a.draginertia="all"),temp=a.dragbounds=a.dragbounds?a.dragbounds.toLowerCase():"all","all"!=temp&&"x"!=temp&&"y"!=temp&&"false"!=temp&&(a.dragbounds="all"),temp=a.dragboundselastic=a.dragboundselastic?a.dragboundselastic.toLowerCase():
"all","all"!=temp&&"x"!=temp&&"y"!=temp&&"false"!=temp&&(a.dragboundselastic="all"),temp=a.dragfixedalign=a.dragfixedalign?a.dragfixedalign.toLowerCase():"false","false"!=temp&&"true"!=temp&&(a.dragfixedalign="false"))}function P(a){!B&&(b=q("start",a))&&(G(b),e.call("stoptween(plugin["+a+"].x)"),e.call("stoptween(plugin["+a+"].y)"),b.dragdeltax=b.dragdeltay=0,b.dragmousedeltax=b.dragmousedeltay=0,J=z=e.mouse.x,K=A=e.mouse.y,b.dragoldx=Number(b.x),b.dragoldy=Number(b.y),window.addEventListener(e._isrealdesktop?
"mouseup":"touchend",x,!0),window.addEventListener(e._isrealdesktop?"mousemove":"touchmove",C,!0),t=s=0,I(),L=setInterval(I,18),b.isdragging=!0,"all"!=b.dragaxis&&"x"!=b.dragaxis||r(b,"x"),"all"!=b.dragaxis&&"y"!=b.dragaxis||r(b,"y"),B=!0,e.call(b.onmovingstart,b))}function v(a){a&&e&&(obj=a,obj.dragdeltax=obj.x-obj.dragoldx,obj.dragdeltay=obj.y-obj.dragoldy,obj.ismovingx||obj.ismovingy?e.call(obj.onmoving,obj):(clearInterval(obj.calleventsInterval),obj.calleventsRuning=!1,e.call(obj.onmoving,obj),
e.call(obj.onmovingend,obj),obj.callevents=!1,obj=null))}function x(a){e&&(window.removeEventListener(e._isrealdesktop?"mouseup":"touchend",x,!0),window.removeEventListener(e._isrealdesktop?"mousemove":"touchmove",C,!0),clearInterval(L),b&&(-1<b.align.toLowerCase().indexOf("bottom")&&(t=0-t),-1<b.align.toLowerCase().indexOf("right")&&(s=0-s),"all"!=b.draginertia&&"x"!=b.draginertia&&(s=0),"all"!=b.dragaxis&&"x"!=b.dragaxis||w(b.name,"x",s),"all"!=b.draginertia&&"y"!=b.draginertia&&(t=0),"all"!=b.dragaxis&&
"y"!=b.dragaxis||w(b.name,"y",t),B=!1))}function H(a,b,c){if("all"==a.dragaxis||"x"==a.dragaxis)"all"!=a.dragbounds&&"x"!=a.dragbounds||"all"==a.dragboundselastic||"x"==a.dragboundselastic||(b>a.boundxmax&&(b=a.boundxmax),b<a.boundxmin&&(b=a.boundxmin)),a.x=b;if("all"==a.dragaxis||"y"==a.dragaxis)"all"!=a.dragbounds&&"y"!=a.dragbounds||"all"==a.dragboundselastic||"y"==a.dragboundselastic||(c>a.boundymax&&(c=a.boundymax),c<a.boundymin&&(c=a.boundymin)),a.y=c}function C(a){if(b&&e){a=b;var l=-1<a.align.toLowerCase().indexOf("right")?
-1:1,c=-1<a.align.toLowerCase().indexOf("bottom")?-1:1;a.dragmousedeltax=e.mouse.x-J;a.dragmousedeltay=e.mouse.y-K;var h=a.dragoldx+a.dragmousedeltax*l,k=a.dragoldy+a.dragmousedeltay*c,f=0;if(h>a.boundxmax||h<a.boundxmin)if(h>a.boundxmax&&(f=a.boundxmax),h<a.boundxmin&&(f=a.boundxmin),f=(f-a.dragoldx)*l,"all"==a.dragbounds||"x"==a.dragbounds)h-=(a.dragmousedeltax-f)/1.5*l;f=0;if(k>a.boundymax||k<a.boundymin)if(k>a.boundymax&&(f=a.boundymax),k<a.boundymin&&(f=a.boundymin),f=(f-a.dragoldy)*c,"all"==
a.dragbounds||"y"==a.dragbounds)k-=(a.dragmousedeltay-f)/1.5*c;H(a,h,k);a.dragdeltax=a.x-a.dragoldx;a.dragdeltay=a.y-a.dragoldy;e.call(a.onmoving,a)}}var e=null,h=null,u="draggablelayer",y="v1.0",J=0,K=0,z=0,A=0,s=0,t=0,L,B=!1,b=null;this.registerplugin=function(a,b,c){e=a;null==e.get(u)&&(h=c,h.enabled=!1,h.visible=!1,h.width="100%",h.height="100%",h.start=P,h.stop=x,h.update=F,h.tocenter=N,h.center=O,e[u]=h,D(u+" plugin "+y+" - loaded and ready."))};this.unloadplugin=function(){D(u+" plugin "+y+
" - successfully unloaded.");window.removeEventListener(e._isrealdesktop?"mouseup":"touchend",x,!0);window.removeEventListener(e._isrealdesktop?"mousemove":"touchmove",C,!0);e=h=null};this.onresize=function(){if(e)for(var a=0;a<e.plugin.count;a++){var b=q("onresize",e.plugin.getItem(a).name);b&&(b.dragupdateonresize&&"true"==b.dragupdateonresize.toLowerCase()||b.dragfixedalign&&"true"==b.dragfixedalign.toLowerCase())&&setTimeout(F,50,b.name)}}};