(function(){
//³õÊ¼»¯×é¼þ
(function(){
	var A=function(D,C,E,F){if(!D){}this.init(D,C,E,F);},
	M=new function(){
		var C=null;var B=[];var A=0;this.fps=1000;this.delay=1;
		this.registerElement=function(F){B[B.length]=F;A+=1;F._onStart.fire();this.start();};
		this.unRegister=function(G,F){
			F=F||E(G);
			if(!G.isAnimated()||F==-1){return false;}
			G._onComplete.fire();
			B.splice(F,1);
			A-=1;
			if(A<=0){this.stop();}
			return true;
		};
		this.start=function(){if(C===null){C=setInterval(this.run,this.delay);}};
		this.stop=function(H){
			if(!H){
				clearInterval(C);
				for(var G=0,F=B.length;G<F;++G){this.unRegister(B[0],0);}
				B=[];C=null;A=0;
			}else{this.unRegister(H);}
		};
		this.run=function(){
			for(var H=0,F=B.length;H<F;++H){
				var G=B[H];
				if(!G||!G.isAnimated()){continue;}
				if(G.currentFrame<G.totalFrames||G.totalFrames===null){
					G.currentFrame+=1;
					if(G.useSeconds){D(G);}
					G._onTween.fire();
				}else{
					M.stop(G,H);
				}
			}
		};
		var E=function(H){for(var G=0,F=B.length;G<F;++G){if(B[G]==H){return G;}}return -1;};
		var D=function(G){
			var J=G.totalFrames;
			var I=G.currentFrame;
			var H=(G.currentFrame*G.duration*1000/G.totalFrames);
			var F=(new Date()-G.getStartTime());
			var K=0;
			if(F<G.duration*1000){
				K=Math.round((F/H-1)*G.currentFrame);
			}else{
				K=J-(I+1);
			}
			if(K>0&&isFinite(K)){
				if(G.currentFrame+K>=J){K=J-(I+1);}
				G.currentFrame+=K
			}
		};
	},
	ua=function(){
		var E={ie:0,opera:0,gecko:0,webkit:0,mobile:null,air:0,caja:0},F=navigator.userAgent,D;
		if((/KHTML/).test(F)){E.webkit=1}
		D=F.match(/AppleWebKit\/([^\s]*)/);
		if(D&&D[1]){
			E.webkit=parseFloat(D[1]);
			if(/ Mobile\//.test(F)){E.mobile="Apple"}else{
				D=F.match(/NokiaN[^\/]*/);
				if(D){E.mobile=D[0]}
			}
			D=F.match(/AdobeAIR\/([^\s]*)/);
			if(D){E.air=D[0]}
		}
		if(!E.webkit){
			D=F.match(/Opera[\s\/]([^\s]*)/);
			if(D&&D[1]){
				E.opera=parseFloat(D[1]);
				D=F.match(/Opera Mini[^;]*/);
				if(D){E.mobile=D[0]}
			}else{
				D=F.match(/MSIE\s([^;]*)/);
				if(D&&D[1]){E.ie=parseFloat(D[1])}else{
					D=F.match(/Gecko\/([^\s]*)/);
					if(D){
						E.gecko=1;
						D=F.match(/rv:([^\s\)]*)/);
						if(D&&D[1]){E.gecko=parseFloat(D[1])}
					}
				}
			}
		}
		D=F.match(/Caja\/([^\s]*)/);
		if(D&&D[1]){E.caja=parseFloat(D[1])}
		return E
	}();
	A.NAME="Anim";
	A.prototype={
		toString:function(){
			var C=this.getEl()||{},D=C.id||C.tagName;
			return(this.constructor.NAME+": "+D);
		},
		patterns:{
			noNegatives:/width|height|opacity|padding/i,
			offsetAttribute:/^((width|height)|(top|left))$/,
			defaultUnit:/width|height|top$|bottom$|left$|right$/i,
			offsetUnit:/\d+(em|%|en|ex|pt|in|cm|mm|pc)$/i
		},
		doMethod:function(C,E,D){return this.method(this.currentFrame,E,D-E,this.totalFrames);},
		setAttribute:function(C,F,E){
			var D=this.getEl();
			if(this.patterns.noNegatives.test(C)){F=(F>0)?F:0;}
			if("style" in D){$(D).css(C,F+E);}else{if(C in D){D[C]=F;}}
		},
		getAttribute:function(C){
			var E=this.getEl(),G=$(E).css(C);
			if(G!=="auto"&&!this.patterns.offsetUnit.test(G)){return parseFloat(G);}
			var D=this.patterns.offsetAttribute.exec(C)||[],H=!!(D[3]),F=!!(D[2]);
			if("style" in E){
				if(F||($(E).css("position")=="absolute"&&H)){
					G=E["offset"+D[0].charAt(0).toUpperCase()+D[0].substr(1)];
				}else{
					G=0;
				}
			}else{
				if(C in E){G=E[C];}
			}
			return G;
		},
		getDefaultUnit:function(C){
			if(this.patterns.defaultUnit.test(C)){return"px";}
			return"";
		},
		setRuntimeAttribute:function(D){
			var I,E,F=this.attributes;
			this.runtimeAttributes[D]={};
			var H=function(J){return(typeof J!=="undefined");};
			if(!H(F[D]["to"])&&!H(F[D]["by"])){return false;}
			I=(H(F[D]["from"]))?F[D]["from"]:this.getAttribute(D);
			if(H(F[D]["to"])){E=F[D]["to"];}else{
				if(H(F[D]["by"])){
					if(I.constructor==Array){
						E=[];
						for(var G=0,C=I.length;G<C;++G){
							E[G]=I[G]+F[D]["by"][G]*1;
						}
					}else{
						E=I+F[D]["by"]*1;
					}
				}
			}
			this.runtimeAttributes[D].start=I;
			this.runtimeAttributes[D].end=E;
			this.runtimeAttributes[D].unit=(H(F[D].unit))?F[D]["unit"]:this.getDefaultUnit(D);
			return true;
		},
		init:function(E,J,I,C){
			var D=false,F=null,H=0;
			E=$(E)[0];
			this.attributes=J||{};
			this.duration=undefined!==I?I:1;
			this.method=C||function(B,A,D,C){return D*B/C+A;};
			this.useSeconds=true;
			this.currentFrame=0;
			this.totalFrames=1000;
			this.setEl=function(M){E=$(M)[0];};
			this.getEl=function(){return E;};
			this.isAnimated=function(){return D;};
			this.getStartTime=function(){return F;};
			this.runtimeAttributes={};
			this.animate=function(){
				if(this.isAnimated()){return false;}
				this.currentFrame=0;
				this.totalFrames=(this.useSeconds)?Math.ceil(1000*this.duration):this.duration;
				if(this.duration===0&&this.useSeconds){this.totalFrames=1;}
				M.registerElement(this);
				return true;
			};
			this.stop=function(M){
				if(!this.isAnimated()){return false;}
				if(M){this.currentFrame=this.totalFrames;this._onTween.fire();}
				M.stop(this);
			};
			var L=function(){
				this.onStart.fire();
				this.runtimeAttributes={};
				for(var M in this.attributes){this.setRuntimeAttribute(M);}
				D=true;H=0;F=new Date();
			},
			K=function(){
				var O={
					duration:new Date()-this.getStartTime(),
					currentFrame:this.currentFrame
				};
				O.toString=function(){return("duration: "+O.duration+", currentFrame: "+O.currentFrame);};
				this.onTween.fire(O);
				var N=this.runtimeAttributes;
				for(var M in N){this.setAttribute(M,this.doMethod(M,N[M].start,N[M].end),N[M].unit);}
				H+=1;
			},
			G=function(){
				var M=(new Date()-F)/1000;
				var N={duration:M,frames:H,fps:H/M};
				N.toString=function(){return("duration: "+N.duration+", frames: "+N.frames+", fps: "+N.fps);};
				D=false;H=0;this.onComplete.fire(N);
			};
			this._onStart=new X("_start",this,true);
			this.onStart=new X("start",this);
			this.onTween=new X("tween",this);
			this._onTween=new X("_tween",this,true);
			this.onComplete=new X("complete",this);
			this._onComplete=new X("_complete",this,true);
			this._onStart.subscribe(L);
			this._onTween.subscribe(K);
			this._onComplete.subscribe(G);
		}
	};
	function X(H,I,J,F){
		this.type=H;
		this.scope=I||window;
		this.silent=J;
		this.signature=F||0;
		this.subscribers=[];
		if(!this.silent){}
		var G="_YUICEOnSubscribe";
		if(H!==G){this.subscribeEvent=new X(G,this,true)}
		this.lastError=null
	}
	X.prototype={
		subscribe:function(D,F,E){
			if(!D){throw new Error("Invalid callback for subscriber to '"+this.type+"'")}
			if(this.subscribeEvent){this.subscribeEvent.fire(D,F,E)}
			this.subscribers.push(new S(D,F,E))
		},
		unsubscribe:function(J,H){
			if(!J){return this.unsubscribeAll()}
			var I=false;
			for(var L=0,G=this.subscribers.length;L<G;++L){
				var K=this.subscribers[L];
				if(K&&K.contains(J,H)){this._delete(L);I=true}
			}
			return I
		},
		fire:function(){
			this.lastError=null;
			var T=[],Z=this.subscribers.length;
			if(!Z&&this.silent){return true}
			var V=[].slice.call(arguments,0),X=true,N,U=false;
			if(!this.silent){}
			var O=this.subscribers.slice();
			for(N=0;N<Z;++N){
				var R=O[N];
				if(!R){U=true}else{
					if(!this.silent){}
					var S=R.getScope(this.scope);
					if(this.signature==1){
						var P=null;
						if(V.length>0){P=V[0]}
						try{X=R.fn.call(S,P,R.obj)}catch(Y){
							this.lastError=Y;
						}
					}else{
						try{X=R.fn.call(S,this.type,V,R.obj)}catch(W){
							this.lastError=W;
						}
					}
					if(false===X){if(!this.silent){}break}
				}
			}
			return(X!==false)
		},
		unsubscribeAll:function(){
			var C=this.subscribers.length,D;
			for(D=C-1;D>-1;D--){this._delete(D)}
			this.subscribers=[];
			return C
		},
		_delete:function(C){
			var D=this.subscribers[C];
			if(D){delete D.fn;delete D.obj}
			this.subscribers.splice(C,1)
		},
		toString:function(){
			return"CustomEvent: '"+this.type+"', context: "+this.scope
		}
	};
	function S(D,F,E){
		this.fn=D;this.obj=undefined===F?null:F;
		this.overrideContext=E
	};
	S.prototype={
		getScope:function(B){
			if(this.overrideContext){
				if(this.overrideContext===true){return this.obj}else{return this.overrideContext}
			}
			return B
		},
		contains:function(C,D){
			if(D){return(this.fn==C&&this.obj==D)}else{return(this.fn==C)}
		},
		toString:function(){
			return"Subscriber { obj: "+this.obj+", overrideContext: "+(this.overrideContext||"no")+" }"
		}
	};
	window.DH={banner:A,ua:ua};
})();
})();
