/*
 * Glow JavaScript Library
 * Copyright (c) 2008 British Broadcasting Corporation
 */
/*@cc_on @*//*@if (@_jscript_version > 5.1)@*/;glow.module("glow.tweens","0.3.1",{require:[],implementation:function(){function A(B){return function(C){return 1-B(1-C);};}return{linear:function(){return function(B){return B;};},easeIn:function(B){B=B||2;return function(C){return Math.pow(1,B-1)*Math.pow(C,B);};},easeOut:function(B){return A(this.easeIn(B));},easeBoth:function(B){return this.combine(this.easeIn(B),this.easeOut(B));},overshootIn:function(B){return A(this.overshootOut(B));},overshootOut:function(B){B=B||1.70158;return function(C){if(C==0||C==1){return C;}return((C-=1)*C*((B+1)*C+B)+1);};},overshootBoth:function(B){return this.combine(this.overshootIn(B),this.overshootOut(B));},bounceIn:function(){return A(this.bounceOut());},bounceOut:function(){return function(B){if(B<(1/2.75)){return 7.5625*B*B;}else{if(B<(2/2.75)){return(7.5625*(B-=(1.5/2.75))*B+0.75);}else{if(B<(2.5/2.75)){return(7.5625*(B-=(2.25/2.75))*B+0.9375);}else{return(7.5625*(B-=(2.625/2.75))*B+0.984375);}}}};},bounceBoth:function(){return this.combine(this.bounceIn(),this.bounceOut());},elasticIn:function(B,C){return A(this.elasticOut(B,C));},elasticOut:function(B,C){return function(D){if(D==0||D==1){return D;}if(!C){C=0.3;}if(!B||B<1){B=1;var E=C/4;}else{var E=C/(2*Math.PI)*Math.asin(1/B);}return B*Math.pow(2,-10*D)*Math.sin((D-E)*(2*Math.PI)/C)+1;};},elasticBoth:function(B,C){C=C||0.45;return this.combine(this.elasticIn(B,C),this.elasticOut(B,C));},combine:function(C,B){return function(D){if(D<0.5){return C(D*2)/2;}else{return B((D-0.5)*2)/2+0.5;}};}};}});;glow.module("glow.anim","0.3.1",{require:["glow.tweens","glow.events","glow.dom"],implementation:function(){var manager,events=glow.events,dom=glow.dom,get=dom.get,debug=glow.debug,hasUnits=/width|height|top$|bottom$|left$|right$|spacing$|indent$|font-size/,noNegatives=/width|height|padding|opacity/,usesYAxis=/height|top/,getUnit=/[\d\.]+(\D+)/,testElement=dom.create('<div style="position:absolute;visibility:hidden"></div>');(function(){var queue=[],queueLen=0,intervalTime=1,interval;manager={addToQueue:function(anim){queue[queueLen++]=anim;anim._playing=true;anim._timeAnchor=anim._timeAnchor||new Date().valueOf();if(!interval){this.startInterval();}},removeFromQueue:function(anim){for(var i=0;i<queueLen;i++){if(queue[i]==anim){queue.splice(i,1);anim._timeAnchor=null;anim._playing=false;if(--queueLen==0){this.stopInterval();}return ;}}},startInterval:function(){interval=window.setInterval(this.processQueue,intervalTime);},stopInterval:function(){window.clearInterval(interval);interval=null;},processQueue:function(){var anim,i,now=new Date().valueOf();for(i=0;i<queueLen;i++){anim=queue[i];if(anim.position==anim.duration){manager.removeFromQueue(anim);i--;events.fire(anim,"complete");continue;}if(anim.useSeconds){anim.position=(now-anim._timeAnchor)/1000;if(anim.position>anim.duration){anim.position=anim.duration;}}else{anim.position++;}anim.value=anim.tween(anim.position/anim.duration);events.fire(anim,"frame");}}};})();function convertCssUnit(element,fromValue,toUnit,axis){var elmStyle=testElement[0].style,axisProp=(axis=="x")?"width":"height",startPixelValue,toUnitPixelValue;elmStyle.margin=elmStyle.padding=elmStyle.border="0";startPixelValue=testElement.css(axisProp,fromValue).insertAfter(element)[axisProp]();toUnitPixelValue=testElement.css(axisProp,10+toUnit)[axisProp]()/10;testElement.remove();return startPixelValue/toUnitPixelValue;}function keepWithinRange(num,start,end){if(start!==undefined&&num<start){return start;}if(end!==undefined&&num>end){return end;}return num;}function buildAnimFunction(element,spec){var cssProp,r=["a=(function(){"],rLen=1,fromUnit,unitDefault=[0,"px"],to,from,unit,a;for(cssProp in spec){r[rLen++]='element.css("'+cssProp+'", ';to=spec[cssProp].to;if((from=spec[cssProp].from)===undefined){if(cssProp=="font-size"||cssProp=="background-position"){throw new Error("From value must be set for "+cssProp);}from=element.css(cssProp);}if(hasUnits.test(cssProp)){unit=(getUnit.exec(spec[cssProp].to)||unitDefault)[1];fromUnit=(getUnit.exec(from)||unitDefault)[1];from=parseFloat(from)||0;to=parseFloat(to)||0;if(from&&unit!=fromUnit){if(cssProp=="font-size"){throw new Error("Units must be the same for font-size");}from=convertCssUnit(element,from+fromUnit,unit,usesYAxis.test(cssProp)?"y":"x");}if(noNegatives.test(cssProp)){r[rLen++]="keepWithinRange(("+(to-from)+" * this.value) + "+from+', 0) + "'+unit+'"';}else{r[rLen++]="("+(to-from)+" * this.value) + "+from+' + "'+unit+'"';}}else{if(!(isNaN(from)||isNaN(to))){from=Number(from);to=Number(to);r[rLen++]="("+(to-from)+" * this.value) + "+from;}else{if(cssProp.indexOf("color")!=-1){to=dom.parseCssColor(spec[cssProp].to);if(!glow.lang.hasOwnProperty(from,"r")){from=dom.parseCssColor(from);}r[rLen++]='"rgb(" + keepWithinRange(Math.round('+(to.r-from.r)+" * this.value + "+from.r+'), 0, 255) + "," + keepWithinRange(Math.round('+(to.g-from.g)+" * this.value + "+from.g+'), 0, 255) + "," + keepWithinRange(Math.round('+(to.b-from.b)+" * this.value + "+from.b+'), 0, 255) + ")"';}else{if(cssProp=="background-position"){var vals={},fromTo=["from","to"],unit=(getUnit.exec(from)||unitDefault)[1];vals.fromOrig=from.toString().split(/\s/);vals.toOrig=to.toString().split(/\s/);if(vals.fromOrig[1]===undefined){vals.fromOrig[1]="50%";}if(vals.toOrig[1]===undefined){vals.toOrig[1]="50%";}for(var i=0;i<2;i++){vals[fromTo[i]+"X"]=parseFloat(vals[fromTo[i]+"Orig"][0]);vals[fromTo[i]+"Y"]=parseFloat(vals[fromTo[i]+"Orig"][1]);vals[fromTo[i]+"XUnit"]=(getUnit.exec(vals[fromTo[i]+"Orig"][0])||unitDefault)[1];vals[fromTo[i]+"YUnit"]=(getUnit.exec(vals[fromTo[i]+"Orig"][1])||unitDefault)[1];}if((vals.fromXUnit!==vals.toXUnit)||(vals.fromYUnit!==vals.toYUnit)){throw new Error("Mismatched axis units cannot be used for "+cssProp);}r[rLen++]="("+(vals.toX-vals.fromX)+" * this.value + "+vals.fromX+') + "'+vals.fromXUnit+' " + ('+(vals.toY-vals.fromY)+" * this.value + "+vals.fromY+') + "'+vals.fromYUnit+'"';}}}}r[rLen++]=");";}r[rLen++]="})";return eval(r.join(""));}var r={};r.css=function(element,duration,spec,opts){element=get(element);var anim=new r.Animation(duration,opts),cssProp;events.addListener(anim,"frame",buildAnimFunction(element,spec));return anim;};r.Animation=function(duration,opts){opts=glow.lang.apply({useSeconds:true,tween:glow.tweens.linear()},opts);this._playing=false;this._timeAnchor=null;this.duration=duration;this.useSeconds=opts.useSeconds;this.tween=opts.tween;this.position=0;this.value=0;};r.Animation.prototype={start:function(){if(this._playing){this.stop();}var e=events.fire(this,"start");if(e.defaultPrevented()){return this;}this.position=0;manager.addToQueue(this);return this;},stop:function(){if(this._playing){var e=events.fire(this,"stop");if(e.defaultPrevented()){return this;}manager.removeFromQueue(this);}return this;},resume:function(){if(!this._playing){var e=events.fire(this,"resume");if(e.defaultPrevented()){return this;}this._timeAnchor=new Date().valueOf()-(this.position*1000);manager.addToQueue(this);}return this;},isPlaying:function(){return this._playing;},goTo:function(pos){this._timeAnchor=new Date().valueOf()-((this.position=pos)*1000);this.value=this.tween(this.duration&&this.position/this.duration);events.fire(this,"frame");return this;}};r.Timeline=function(channels,opts){this._channels=(channels[0]&&channels[0].push)?channels:[channels];this._channelPos=[];this._playing=false;this.loop=!!(opts&&opts.loop);var i,j,iLen,jLen,channel,allChannels=this._channels,totalDuration=0,channelDuration;for(i=0,iLen=allChannels.length;i<iLen;i++){channel=allChannels[i];channelDuration=0;for(j=0,jLen=channel.length;j<jLen;j++){if(typeof channel[j]=="number"){channel[j]=new r.Animation(channel[j]);}if(channel[j] instanceof r.Animation){if(!channel[j].useSeconds){throw new Error("Timelined animations must be timed in seconds");}channel[j]._timelineOffset=channelDuration*1000;channelDuration+=channel[j].duration;channel[j]._channelIndex=i;}}totalDuration=Math.max(channelDuration,totalDuration);}this._controlAnim=new r.Animation(totalDuration);events.addListener(this._controlAnim,"frame",this._processFrame,this);events.addListener(this._controlAnim,"complete",this._complete,this);};r.Timeline.prototype={_advanceChannel:function(i){var currentAnim=this._channels[i][this._channelPos[i]],nextAnim=this._channels[i][++this._channelPos[i]];if(currentAnim&&currentAnim._playing){currentAnim._playing=false;events.fire(currentAnim,"complete");}if((nextAnim)!==undefined){if(typeof nextAnim=="function"){nextAnim();this._advanceChannel(i);}else{nextAnim.position=0;nextAnim._channelIndex=i;events.fire(nextAnim,"start");nextAnim._playing=true;}}},_complete:function(){if(this.loop){this.start();return ;}events.fire(this,"complete");},_processFrame:function(){var i,len,anim,controlAnim=this._controlAnim,msFromStart=(new Date().valueOf())-controlAnim._timeAnchor;for(i=0,len=this._channels.length;i<len;i++){if(!(anim=this._channels[i][this._channelPos[i]])){continue;}anim.position=(msFromStart-anim._timelineOffset)/1000;if(anim.position>anim.duration){anim.position=anim.duration;}anim.value=anim.tween(anim.position/anim.duration);events.fire(anim,"frame");if(anim.position==anim.duration){this._advanceChannel(i);}}},start:function(){var e=events.fire(this,"start");if(e.defaultPrevented()){return this;}var i,iLen,j,jLen,anim;this._playing=true;for(i=0,iLen=this._channels.length;i<iLen;i++){this._channelPos[i]=-1;this._advanceChannel(i);for(j=this._channels[i].length;j;j--){anim=this._channels[i][j];if(anim instanceof r.Animation){anim.goTo(0);}}}this._controlAnim.start();},stop:function(){if(this._playing){var e=events.fire(this,"stop");if(e.defaultPrevented()){return this;}this._playing=false;var anim;for(var i=0,len=this._channels.length;i<len;i++){anim=this._channels[i][this._channelPos[i]];if(anim instanceof r.Animation&&anim._playing){events.fire(anim,"stop");anim._playing=false;}}this._controlAnim.stop();}},resume:function(){if(!this._playing){var e=events.fire(this,"resume");if(e.defaultPrevented()){return this;}this._playing=true;var anim;for(var i=0,len=this._channels.length;i<len;i++){anim=this._channels[i][this._channelPos[i]];if(anim instanceof r.Animation&&!anim._playing){events.fire(anim,"resume");anim._playing=true;}}this._controlAnim.resume();}},isPlaying:function(){return this._playing;}};return r;}});;glow.module("glow.dragdrop","0.3.1",{require:["glow.tweens","glow.events","glow.dom","glow.anim"],implementation:function(){var C=glow.events,I=C.addListener,S=C.fire,G=C.removeListener,Q=glow.dom,H=Q.get,K=Q.create;var M={},T=1000,A=(document.compatMode=="CSS1Compat"&&glow.env.ie>=5)?true:false,U=(document.compatMode!="CSS1Compat"&&glow.env.ie>=5)?true:false,D=glow.env.ie>=5;function B(V,X){var Y=V.prototype[X];var W="cached_"+X;V.prototype[X]=function(){if(W in this){return this[W];}return this[W]=Y.apply(this,arguments);};}function F(V,W){var Y=V.prototype[W];var X="cached_"+W;V.prototype[W]=function(Z){if(!this[X]){this[X]={};}if(Z in this[X]){return this[X][Z];}return this[X][Z]=Y.apply(this,arguments);};}function R(Y,X){for(var W=0,V=X.length;W<V;W++){delete Y["cached_"+X[W]];}}function L(a,W,Z){var X=a["cached_"+W];if(!X){return ;}for(var Y=0,V=Z.length;Y<V;Y++){delete X[Z[Y]];}}var O=function(V){this.el=V;};O.prototype={val:function(V){var W=parseInt(this.el.css(V));return isNaN(W)?0:W;},width:function(){return this.borderWidth()-this.val("border-left-width")-this.val("padding-left")-this.val("padding-right")-this.val("border-right-width");},height:function(){return this.borderHeight()-this.val("border-top-width")-this.val("padding-top")-this.val("padding-bottom")-this.val("border-bottom-width");},offsetTop:function(){var V=0,W=this.el[0],Z,Y;if(glow.env.ie){do{Y=W.offsetTop;if(!isNaN(Y)){V+=Y;}W=W.offsetParent;if(W){Z=H(W).css("position");}}while(W&&!(Z=="absolute"||Z=="fixed"||Z=="relative"));}else{V=W.offsetTop;}if(glow.env.opera){var X=parseInt(H(W.offsetParent).css("border-top-width"));V-=isNaN(X)?0:X;}return V;},offsetLeft:function(){var V=0,W=this.el[0],Z,Y;if(glow.env.ie){do{Y=W.offsetLeft;if(!isNaN(Y)){V+=Y;}W=W.offsetParent;if(W){Z=H(W).css("position");}}while(W&&!(Z=="absolute"||Z=="fixed"||Z=="relative"));}else{V=W.offsetLeft;}if(glow.env.opera){var X=parseInt(H(W.offsetParent).css("border-left-width"));V-=isNaN(X)?0:X;}return V;},borderWidth:function(){var V=this.el[0].offsetWidth;if(glow.env.khtml){V-=this.val("margin-left")+this.val("margin-right")+this.val("border-left-width")+this.val("border-right-width");}return V;},borderHeight:function(){if(this._logicalBottom){return this._logicalBottom-this.offsetTop();}var V=this.el[0].offsetHeight;if(glow.env.khtml){V-=this.val("margin-top")+this.val("margin-bottom")+this.val("border-top-width")+this.val("border-bottom-width");}return V;},outerWidth:function(){return this.borderWidth()+this.val("margin-left")+this.val("margin-right");},outerHeight:function(){return this.borderHeight()+this.val("margin-top")+this.val("margin-bottom");},innerLeftPos:function(){return this.offsetLeft()+this.val("border-left-width")+this.val("padding-left");},innerTopPos:function(){return this.offsetTop()+this.val("border-top-width")+this.val("padding-top");},surroundWidth:function(){return this.val("margin-left")+this.val("border-left-width")+this.val("padding-left")+this.val("padding-right")+this.val("border-right-width")+this.val("margin-right");},surroundHeight:function(){return this.val("margin-top")+this.val("border-top-width")+this.val("padding-top")+this.val("padding-bottom")+this.val("border-bottom-width")+this.val("margin-bottom");},verticalCenter:function(){return this.offsetTop()+(this.outerHeight()/2);},horizontalCenter:function(){return this.offsetTop()+(this.outerWidth()/2);}};for(var P in O.prototype){if(P=="val"){F(O,P);}else{B(O,P);}}glow.lang.apply(O.prototype,{resetPosition:function(){R(this,["offsetTop","offsetLeft","borderTopPos","borderLeftPos","innerTopPos","innerLeftPos","verticalCenter","horizontalCenter"]);},setLogicalBottom:function(V){this._logicalBottom=V;},boundsFor:function(X){var W=this.innerTopPos(),V=this.innerLeftPos();return[W,V+this.width()-X.outerWidth(),W+this.height()-X.outerHeight(),V];},outerBounds:function(){var W=this.offsetLeft(),V=this.offsetTop();return[V,W+this.borderWidth(),V+this.borderHeight(),W];},intersectSize:function(X){var W=this.outerBounds(),V=X.outerBounds();return(W[2]<V[0]?0:V[2]<W[0]?0:W[0]<V[0]?(W[2]<V[2]?W[2]-V[0]:V[2]-V[0]):V[2]<W[2]?V[2]-W[0]:W[2]-W[0])*(W[1]<V[3]?0:V[1]<W[3]?0:W[3]<V[3]?(W[1]<V[1]?W[1]-V[3]:V[1]-V[3]):V[1]<W[1]?V[1]-W[3]:W[1]-W[3]);},sizePlaceholder:function(a,b,Y,W){var Z=new O(a),X=this.el,V=b||X.css("position");a.css("display","none");X.after(a);a.css("width",(this.outerWidth()-Z.surroundWidth())+"px");a.css("height",(this.outerHeight()-Z.surroundHeight())+"px");a.remove();a.css("display","block");if(V!="static"){a.css("left",Y+"px");a.css("top",W+"px");}a.css("position",V);},contains:function(W){var V=this.boundsFor(W),Y=W.offsetTop(),X=W.offsetLeft();return Y>=V[0]&&X<=V[1]&&Y<=V[2]&&X>=V[3];},containsPoint:function(W){var V=this.el.offset();return W.x>=V.x&&W.y>=V.y&&W.x<=V.x+this.borderWidth()&&W.y<=V.y+this.borderHeight();},positionedAncestorBox:function(){var V=this.el.parent(),W;while(V[0]){W=V.css("position")||"static";if(W=="relative"||W=="absolute"||W=="fixed"){return new O(V);}V=V.parent();}return null;}});function E(W){var V=W[0].tagName.toLowerCase()=="li"?"li":"div";var X=K("<"+V+"></"+V+">");if(V=="li"){X.css("list-style-type","none");}return X;}M.Draggable=function(Y,Z){this.element=H(Y);this._opts=Z=glow.lang.apply({dragPrevention:["input","textarea","button","select","option","a"],placeholder:"spacer",placeholderClass:"glow-dragdrop-placeholder"},Z||{});this._preventDrag=[];for(var W=0,V=Z.dragPrevention.length;W>V;W++){this._preventDrag[W]=Z.dragPrevention[W].toLowerCase();}if(Z.container){this.container=H(Z.container);}this._handle=Z.handle&&this.element.get(Z.handle)||this.element;if(Z.dropTargets){this.dropTargets=H(Z.dropTargets);}var X=this._listeners=[],W=0;if(Z.onDrag){X[W++]=I(this,"drag",this._opts.onDrag,this);}if(Z.onEnter){X[W++]=I(this,"enter",this._opts.onEnter,this);}if(Z.onLeave){X[W++]=I(this,"leave",this._opts.onLeave,this);}if(Z.onDrop){X[W++]=I(this,"drop",this._opts.onDrop,this);}this._dragListener=I(this._handle,"mousedown",this._startDragMouse,this);return ;};var N=glow.env.ie;M.Draggable.prototype={_createPlaceholder:function(){var V=this.element,X,W=this._box;if(this._opts.placeholder=="clone"){X=V.clone();}else{X=E(V);}if(this._opts.placeholderClass){X.addClass(this._opts.placeholderClass);}W.sizePlaceholder(X,null,this._startLeft,this._startTop);V.after(X);this._placeholder=X;},_removePlaceholder:function(){this._placeholder.remove();},_resetPosition:function(){var W=this._preDragPosition,Y=this.element,Z=this._box,V=this._startOffset,b=Y.css("position");Z.resetPosition();var a={x:Z.offsetLeft()-Z.val("margin-left"),y:Z.offsetTop()-Z.val("margin-top")};if(this._placeholder||this._dropIndicator){Y.remove();}if(W=="static"&&a.y==V.y&&a.x==V.x){Y.css("position","static");Y.css("left","");Y.css("top","");}else{Y.css("z-index",this._preDragZIndex);Y.css("position",W=="static"?"relative":W);if(W=="static"){Y.css("left",(a.x-V.x)+"px");Y.css("top",(a.y-V.y)+"px");}else{if(W=="relative"&&b!="relative"){Y.css("left",(this._startLeft+(a.x-V.x))+"px");Y.css("top",(this._startTop+(a.y-V.y))+"px");}}}if(this._dropIndicator){var X=this._dropIndicator.parent()[0];if(X){X.replaceChild(Y[0],this._dropIndicator[0]);}delete this._dropIndicator;if(this._placeholder){this._placeholder.remove();delete this._placeholder;}}else{if(this._placeholder){var X=this._placeholder.parent()[0];if(X){X.replaceChild(Y[0],this._placeholder[0]);}delete this._placeholder;}}},_startDragMouse:function(n){var h=this._preventDrag,f=n.source,o=f.tagName.toLowerCase();for(var m=0,g=h.length;m<g;m++){if(h[m]==o){return ;}}if(this._dragging==1){return this.endDrag();}else{if(this._dragging){return ;}}this._dragging=1;var h=this._preventDrag,V=this.element,c=this.container,Y=this._preDragPosition=V.css("position"),d=this._opts,a=this._box=new O(V);if(c){this._containerBox=new O(c);this._bounds=this._containerBox.boundsFor(a);}else{delete this._bounds;}this._mouseStart={x:n.pageX,y:n.pageY};var k=this._startOffset={x:a.offsetLeft(),y:a.offsetTop()};this._preDragStyle=V.attr("style");this._preDragZIndex=V.css("z-index");V.css("z-index",T++);this._startLeft=V[0].style.left?parseInt(V[0].style.left):0;this._startTop=V[0].style.top?parseInt(V[0].style.top):0;if(this._opts.placeholder&&this._opts.placeholder!="none"){this._createPlaceholder();}V.css("position","absolute");V.css("left",k.x+"px");V.css("top",k.y+"px");if(A){this._scrollY=document.documentElement.scrollTop;this._innerHeight=document.documentElement.clientHeight;}else{if(U){this._scrollY=document.body.scrollTop;this._innerHeight=document.body.clientHeight;}else{this._scrollY=window.scrollY;this._innerHeight=window.innerHeight;}}var b=H(document).height();this._bodyHeight=b<this._innerHeight?this._innerHeight:b;var Z=S(this,"drag");var W=function(){return false;},p=document.documentElement;if(this.dropTargets){var j=new C.Event();j.draggable=this;for(var m=0,g=this.dropTargets.length;m<g;m++){S(this.dropTargets[m],"active",j);}this._mousePos={x:n.pageX,y:n.pageY};var X=this;this._testForDropTargets();}this._dragListeners=[I(p,"selectstart",W),I(p,"dragstart",W),I(p,"mousedown",W),I(p,"mousemove",this._dragMouse,this),I(p,"mouseup",this._releaseElement,this)];},_dragMouse:function(Y){var V=this.element,Z=this._opts.axis=="y"?this._startOffset.x:(this._startOffset.x+Y.pageX-this._mouseStart.x),X=this._opts.axis=="x"?this._startOffset.y:(this._startOffset.y+Y.pageY-this._mouseStart.y),W=this._bounds;if(W){Z=Z<W[3]?W[3]:Z>W[1]?W[1]:Z;X=X<W[0]?W[0]:X>W[2]?W[2]:X;}V[0].style.left=Z+"px";V[0].style.top=X+"px";if(this.dropTargets){this._mousePos={x:Y.pageX,y:Y.pageY};}if(D&&Y.nativeEvent.button==0){this._releaseElement(Y);return false;}return false;},_testForDropTargets:function(f){if(!this._lock){this._lock=0;}if(f){this._lock--;}else{if(this.lock){return ;}}if(this._dragging!=1){return ;}var X=this.activeTarget,W,s=this.dropTargets,t,a,d=this._box,j=this._mousePos;d.resetPosition();var b=0;for(var k=0,h=s.length;k<h;k++){t=s[k];a=t._box;if(t._opts.tolerance=="contained"){if(a.contains(d)){W=t;break;}}else{if(t._opts.tolerance=="cursor"){if(a.containsPoint(j)){W=t;break;}}else{var m;if((m=a.intersectSize(d))>b){b=m;W=t;}}}}this.activeTarget=W;if(W!==X){if(W){var g=new C.Event();g.draggable=this;S(W,"enter",g);var V=new C.Event();V.dropTarget=W;S(this,"enter",V);}if(X){var c=new C.Event();c.draggable=this;S(X,"leave",c);var e=new C.Event();e.dropTarget=X;S(this,"leave",e);}}if(W&&W._opts.dropIndicator!="none"){var q,n=W._childBoxes,Y=W._children;d.resetPosition();var r=W._box.innerTopPos();var p=d.verticalCenter();var o=0;for(var k=0,h=n.length;k<h;k++){if(Y[k]==this.element[0]){continue;}q=n[k];r+=q.outerHeight();if(p<=r){if(W._dropIndicatorAt!=k){H(q.el).before(W._dropIndicator);W._dropIndicatorAt=k;}o=1;break;}}if(!o){if(q){H(q.el).after(W._dropIndicator);W._dropIndicatorAt=k+1;}else{W.element.append(W._dropIndicator);W._dropIndicatorAt=0;}}}this._lock++;var Z=this;setTimeout(function(){Z._testForDropTargets(1);},100);},_releaseElement:function(a){if(this._dragging!=1){return ;}this._dragging=2;var X,V;var c=this.dropTargets,b=this.activeTarget;if(c){for(X=0,V=c.length;X<V;X++){var Z=new C.Event();Z.draggable=this;Z.droppedOnThis=b&&b==c[X];S(c[X],"inactive",Z);}}if(b){var Z=new C.Event();Z.draggable=this;S(b,"drop",Z);}var W=this._dragListeners;for(X=0,V=W.length;X<V;X++){C.removeListener(W[X]);}var Y=S(this,"drop");if(!Y.defaultPrevented()&&this.dropTargets){this.returnHome();}else{this.endDrag();}},endDrag:function(){if(this._dragging!=2){return ;}this._dragging=0;if(this._reset){this._reset();delete this._reset;}if(this.placeholder){this.placeholder.remove();}this._resetPosition();delete this.activeTarget;},returnHome:function(W){var Z=(W)?W:glow.tweens.linear(),X=this.element,b=Math.pow(Math.pow(this._startOffset.x-this._box.offsetLeft(),2)+Math.pow(this._startOffset.y-this._box.offsetTop(),2),0.5),a=0.3+(b/1000);var V=[[glow.anim.css(this.element,a,{left:{from:this._box.offsetLeft(),to:this._startOffset.x},top:{from:this._box.offsetTop(),to:this._startOffset.y}},{tween:Z})]];if(this._dropIndicator){V.push([glow.anim.css(this._dropIndicator,a-0.1,{opacity:{to:0}})]);}var Y=new glow.anim.Timeline(V);I(Y,"complete",function(c){this.endDrag();},this);Y.start();return ;}};var J=0;M.DropTarget=function(V,W){var V=this.element=H(V);if(!V.length){throw"no element passed into DropTarget constuctor";}if(V.length>1){throw"more than one element passed into DropTarget constructor";}this._id=++J;this._opts=W=glow.lang.apply({dropIndicator:"none",acceptDropOutside:false,dropIndicatorClass:"glow-dragdrop-dropindicator",tolerance:"intersect"},W||{});if(W.onActive){I(this,"active",W.onActive);}if(W.onInactive){I(this,"inactive",W.onInactive);}if(W.onEnter){I(this,"enter",W.onEnter);}if(W.onLeave){I(this,"leave",W.onLeave);}if(W.onDrop){I(this,"drop",W.onDrop);}this._activeListener=I(this,"active",this._onActive);this._activeListener=I(this,"inactive",this._onInactive);return this;};M.DropTarget.prototype={setLogicalBottom:function(V){this._logicalBottom=V;},_onActive:function(Y){var W=Y.draggable;this._box=new O(this.element);if(this._logicalBottom){this._box.setLogicalBottom(this._logicalBottom);}if(this._opts.dropIndicator=="none"){return ;}this._onEnterListener=I(this,"enter",this._onEnter);this._onLeaveListener=I(this,"leave",this._onLeave);this._dropIndicator=E(W.element);if(this._opts.dropIndicatorClass){this._dropIndicator.addClass(this._opts.dropIndicatorClass);}W._box.sizePlaceholder(this._dropIndicator,"relative",0,0);var X=this._children=H(this.element.children()).filter(function(){var Z=H(this);return(!Y.draggable._placeholder||!Z.eq(Y.draggable._placeholder))&&(!this._dropIndicator||!Z.eq(this._dropIndicator));});var V=this._childBoxes=[];X.each(function(Z){V[Z]=new O(H(X[Z]));});},_onInactive:function(V){G(this._onEnterListener);G(this._onLeaveListener);delete this._box;if(this._opts.dropIndicator=="none"){return ;}if(!V.droppedOnThis&&this._dropIndicator){this._dropIndicator.remove();delete this._dropIndicator;}delete this._childBoxes;delete this._children;},_onEnter:function(X){var W=this,V=X.draggable;this._dropIndicatorAt=-1;},_onLeave:function(V){this._dropIndicator.remove();},moveToPosition:function(V){var Z=this._dropIndicator,W=new O(Z);var Y=parseInt(Z.css("margin-left")),X=parseInt(Z.css("margin-top"));if(isNaN(Y)){Y=0;}if(isNaN(X)){X=0;}V._startOffset={x:W.offsetLeft()-Y,y:W.offsetTop()-X};V._dropIndicator=Z;delete this._dropIndicator;}};return M;}});/*@end @*/