function floatingBox(e,b,d){this.targetX=-250;this.targetY=10;this.interval=5;this.menu=e;this.index=d;this.options=b;this.hasInner=typeof window.innerWidth=="number";this.hasElement=document.documentElement&&document.documentElement.clientWidth;this.move=function(){jQuery(this.menu).css("left",this.nextX+"px").css("top",this.nextY+"px")};this.computeShifts=function(){var a=document.documentElement;this.shiftX=this.hasInner?pageXOffset:this.hasElement?a.scrollLeft:document.body.scrollLeft;if(this.targetX<
0)this.shiftX+=this.hasElement&&this.hasInner?a.clientWidth>window.innerWidth?window.innerWidth:a.clientWidth:this.hasElement?a.clientWidth:this.hasInner?window.innerWidth:document.body.clientWidth;this.shiftY=this.hasInner?pageYOffset:this.hasElement?a.scrollTop:document.body.scrollTop;if(this.targetY<0)this.shiftY+=this.hasElement&&this.hasInner?a.clientHeight>window.innerHeight?window.innerHeight:a.clientHeight:this.hasElement?document.documentElement.clientHeight:this.hasInner?window.innerHeight:
document.body.clientHeight};this.doFloat=function(){var a,c;this.computeShifts();a=(this.shiftX+this.targetX-this.nextX)*0.07;if(Math.abs(a)<0.5)a=this.shiftX+this.targetX-this.nextX;c=(this.shiftY+this.targetY-this.nextY)*0.07;if(Math.abs(c)<0.5)c=this.shiftY+this.targetY-this.nextY;if(Math.abs(a)>0||Math.abs(c)>0){this.nextX+=a;this.nextY+=c;this.move()}setTimeout("funcFloating["+this.index+"].func()",this.interval)};this.initSecondary=function(){this.computeShifts();this.nextX=this.shiftX+this.targetX;
this.nextY=this.shiftY+this.targetY;this.move()};this.position=function(a,c){if(typeof a=="number")this.targetX=a;else if(typeof a=="string")switch(a){case "left":this.targetX=1;break;case "right":this.targetX=-(jQuery(this.menu).outerWidth()+1)}if(typeof c=="number")this.targetY=c;else if(typeof c=="string")switch(c){case "top":this.targetY=1;break;case "bottom":this.targetY=-(jQuery(this.menu).outerHeight()+1)}};this.init=function(){jQuery(this.menu).css("position","absolute");if(typeof this.options==
"object")for(var a in this.options)switch(a){case "targetX":case "targetY":if(typeof this.options[a]=="number")this[a]=this.options[a];else if(typeof this.options[a]=="string")switch(this.options[a]){case "top":this.targetY=1;break;case "bottom":this.targetY=-(jQuery(this.menu).outerHeight()+1);break;case "left":this.targetX=1;break;case "right":this.targetX=-(jQuery(this.menu).outerWidth()+1)}break;default:this[a]=this.options[a]}this.initSecondary();this.doFloat()}}var funcFloating={};
jQuery.fn.floating=function(e){return jQuery(this).each(function(){var b=0,d;for(d in funcFloating)b=parseInt(d);funcFloating[b+1]={};funcFloating[b+1].box=this;funcFloating[b+1].obj=new floatingBox(this,e,b+1);funcFloating[b+1].func=function(){funcFloating[b+1].obj.doFloat()};if(document.layers)funcFloating[b+1].obj.init();else{funcFloating[b+1].obj.init();funcFloating[b+1].obj.initSecondary()}})};
jQuery.fn.floatingPosition=function(e,b){return jQuery(this).each(function(){for(var d in funcFloating)funcFloating[d].box==this&&funcFloating[d].obj.position(e,b)})};
