var ElementEffects={blinkBorder:function(C,D,B){if(C){if(!B){B=130}if(!D){D=3}var A=["border-top-color","border-bottom-color","border-left-color","border-right-color"];this.doBlinkWork(C,D*2,B,A)}},blinkColor:function(B,C,A){if(B){if(!A){A=130}if(!C){C=3}this.doBlinkWork(B,C*2,A,["color"])}},blinkBorderAndColor:function(C,D,B){if(C){if(!B){B=130}if(!D){D=3}var A=["border-top-color","border-bottom-color","border-left-color","border-right-color","color"];this.doBlinkWork(C,D*2,B,A)}},blinkBackgroundColor:function(C,D,B){if(C){if(!B){B=130}if(!D){D=3}var A=["backgroundColor"];this.doBlinkWork(C,D*2,B,A)}},doBlinkWork:function(C,A,G,H){if((A>0)&&H&&(H.length>0)){var I=new Object();var B;var F;for(var D=0;D<H.length;D++){B=C.getStyle(H[D]);F=this.oppositeColor(B);if(F){I[H[D]]=F}}C.setStyle(I);var E=A-1;setTimeout(function(){ElementEffects.doBlinkWork(C,E,G,H)},G)}},animateScroll:function(C,E,B,D,A){if(C&&E){if(!B){B=100}if((D>1)||(D<0)){velcoity=0.35}C.mEndingSize=E;C.mGrowing=$([(E[0]<C.scrollLeft),(E[1]<C.scrollTop)]);C.mSoFar=$([(C.scrollLeft),(C.scrollTop)]);C.mVelocity=D;C.mPostFunction=A;C.mMaximumSets=50;C.mStepsCount=0;this.doAnimateScroll(C,B)}},doAnimateScroll:function(E,D){if(E&&E.mEndingSize&&E.mGrowing){E.mStepsCount++;if((E.mVelocity>1)||(E.mVelocity<0)){E.mVelocity=0.35}var B=true;if((E.mEndingSize[0]!=(E.scrollLeft))||(E.mEndingSize[1]!=(E.scrollTop))){var C=true;if(E.mEndingSize[0]!=(E.scrollLeft)){C=this.doAnimateElementScrollWork(E,true)}var A=true;if(E.mEndingSize[1]!=(E.scrollTop)){A=this.doAnimateElementScrollWork(E,false)}B=((C==true)&&(A==true))}if(B==true||E.mStepsCount==30){if(E.mPostFunction){E.mPostFunction(E)}}else{setTimeout(function(){ElementEffects.doAnimateScroll(E,D)},D)}}},doAnimateElementScrollWork:function(B,E){var D=false;if(B){var C=(E==true)?0:1;var A=((E==true)?(B.scrollLeft):(B.scrollTop));if(((B.mGrowing[C])&&(A>B.mEndingSize[C]))||(!(B.mGrowing[C])&&(A<B.mEndingSize[C]))){newPosition=this.calcuateNextValue(B,C,A,0);if(E==true){if(newPosition>=0){B.scrollLeft=newPosition}}else{if(newPosition>=0){B.scrollRight=newPosition}}if(newPosition==B.mEndingSize[C]){D=true}}}return D},animateElementGrowth:function(D,F,C,E,B){if(D&&F){if(!C){C=100}if((E>1)||(E<0)){velcoity=0.35}var A=jshBorderOffset(D,[0,0]);D.mEndingSize=F;D.mGrowing=$([(F[0]<D.getWidth()),(F[1]<D.getHeight())]);D.mSoFar=$([(D.getWidth()+A[0]),(D.getHeight()+A[1])]);D.mVelocity=E;D.mPostFunction=B;D.mMaximumSets=50;D.mStepsCount=0;this.doAnimateElementGrowth(D,C)}},doAnimateElementGrowth:function(F,E){if(F&&F.mEndingSize&&F.mGrowing){F.mStepsCount++;if((F.mVelocity>1)||(F.mVelocity<0)){F.mVelocity=0.35}var C=true;var A=jshBorderOffset(F,[0,0]);if((F.mEndingSize[0]!=(F.getWidth()-A[0]))||(F.mEndingSize[1]!=(F.getHeight()-A[1]))){var D=true;if(F.mEndingSize[0]!=(F.getWidth()-A[0])){D=this.doAnimateElementGrowthWork(F,true)}var B=true;if(F.mEndingSize[1]!=(F.getHeight()-A[1])){B=this.doAnimateElementGrowthWork(F,false)}C=((D==true)&&(B==true))}if(C==true||F.mStepsCount==30){if(F.mPostFunction){F.mPostFunction(F)}}else{setTimeout(function(){ElementEffects.doAnimateElementGrowth(F,E)},E)}}},doAnimateElementGrowthWork:function(C,D){var F=false;if(C){var B=jshBorderOffset(C,[0,0]);var E=(D==true)?0:1;var A=((D==true)?(C.getWidth()-B[0]):(C.getHeight()-B[1]));if(((C.mGrowing[E])&&(A>C.mEndingSize[E]))||(!(C.mGrowing[E])&&(A<C.mEndingSize[E]))){newPosition=this.calcuateNextValue(C,E,A,0);if(D==true){if(newPosition>=0){C.style.width=newPosition+"px"}}else{if(newPosition>=0){C.style.height=newPosition+"px"}}if(newPosition==C.mEndingSize[E]){F=true}}}return F},animateElementPosition:function(F,H,E,G,C){if(F&&H){if(!E){E=100}if((G>1)||(G<0)){velcoity=0.35}var D=(F.style.left)?F.style.left:F.style.right;var B=(F.style.top)?F.style.top:F.style.bottom;var A=[parseInt(D),parseInt(B)];F.mEndingSize=H;F.mSoFar=$([(A[0]),(A[1])]);F.mVelocity=G;F.mPostFunction=C;F.mGrowing=$(new Array());F.mGrowing[0]=((F.style.left)?(H[0]<A[0]):(H[0]>A[0]));F.mGrowing[1]=((F.style.top)?(H[1]<A[1]):((H[1]<A[1])));this.doAnimateElementPosition(F,E)}},doAnimateElementPosition:function(E,D){if(E&&E.mEndingSize&&E.mGrowing){if((E.mVelocity>1)||(E.mVelocity<0)){E.mVelocity=0.35}var C=(E.style.left)?E.style.left:E.style.right;var B=(E.style.top)?E.style.top:E.style.bottom;var A=[parseInt(C),parseInt(B)];if((E.mEndingSize[0]!=A[0])||(E.mEndingSize[1]!=A[1])){if(E.mEndingSize[0]!=A[0]){this.doAnimateElementPositionWork(E,0)}if(E.mEndingSize[1]!=A[1]){this.doAnimateElementPositionWork(E,1)}setTimeout(function(){ElementEffects.doAnimateElementPosition(E,D)},D)}else{if(E.mPostFunction){E.mPostFunction(E)}}}},doAnimateElementPositionWork:function(E,F){if(E){var D=(E.style.left)?E.style.left:E.style.right;var C=(E.style.top)?E.style.top:E.style.bottom;var B=[parseInt(D),parseInt(C)];var A=B[F];if(((E.mGrowing[F])&&(A>E.mEndingSize[F]))||(!(E.mGrowing[F])&&(A<E.mEndingSize[F]))){newPosition=this.calcuateNextValue(E,F,A,0,false);if(F==0){if(E.style.left){E.style.left=newPosition+"px"}else{E.style.right=newPosition+"px"}}else{if(E.style.top){E.style.top=newPosition+"px"}else{E.style.bottom=newPosition+"px"}}}}},linearNextValue:function(D,G,A,B,E){var H=B;if(D){if(((D.mGrowing[G])&&(A<D.mEndingSize[G]))||(!(D.mGrowing[G])&&(A>D.mEndingSize[G]))){var F=D.mVelocity;if(!D.mGrowing[G]){F*=-1}D.mSoFar[G]+=F;var C=A+F;if(E!=true){C=Math.round(C)}if(((D.mGrowing[G])&&(A>D.mEndingSize[G]))||(!(D.mGrowing[G])&&(A<D.mEndingSize[G]))||(F==0)){C=D.mEndingSize[G]}H=C}}return H},calcuateNextValue:function(D,G,A,B,E){var H=B;if(D){if(((D.mGrowing[G])&&(A>D.mEndingSize[G]))||(!(D.mGrowing[G])&&(A<D.mEndingSize[G]))){var F=D.mEndingSize[G]-D.mSoFar[G];if((F>1)||(F<-1)){F*=D.mVelocity}if(F==0){C=D.mEndingSize[G]}else{D.mSoFar[G]+=F;var C=A+F;if(E!=true){C=Math.round(C)}}H=C}}return H},fadeElement:function(D,F,B,E,A){if(D){if(!B){B=100}if((E>1)||(E<0)){velcoity=0.35}var C=(D.mOpacity>=0)?D.mOpacity:1;D.mOpacity=C;D.mEndingSize=[F];D.mSoFar=$([C]);D.mVelocity=E;D.mPostFunction=A;D.mGrowing=[(C<F)];ElementEffects.doFadeElement(D,B)}},doFadeElement:function(B,A){if((B.mGrowing[0]&&(B.mOpacity<B.mEndingSize[0]))||(!B.mGrowing[0]&&(B.mOpacity>B.mEndingSize[0]))){var C=ElementEffects.linearNextValue(B,0,B.mOpacity,0,true);ElementEffects.setOpacity(B,C);setTimeout(function(){ElementEffects.doFadeElement(B,A)},A)}else{ElementEffects.setOpacity(B,B.mEndingSize[0]);if(B.mPostFunction){B.mPostFunction(B)}}},setOpacity:function(B,A){if(B){A=Math.min(A,1);A=Math.max(A,0);B.style.opacity=A;B.style.MozOpacity=A;B.style.KhtmlOpacity=A;B.style.filter="alpha(opacity="+(A*100)+")";B.mOpacity=A}},oppositeColor:function(A){var C=A;if(A){var B=new RGBColor(A);if(B.ok){A=B.toRGB();var E=A.split(",");if(E.length==3){for(var D=0;D<E.length;D++){E[D]=E[D].gsub("[a-z,A-Z,(,)]+","");E[D]=255-parseInt(E[D])}C="rgb( "+E.join(", ")+")"}}}return C}};