var Fading=function(a){this.elt=a.elt;this.min=a.min>=0?+a.min:25;this.max=a.max>=0?+a.max:100;this.courant=a.min>=0?+a.min:25;this.speed=+a.speed||50;this.step=+a.step||5;this.timer=null;this.evtOn=a.evtOn||"mouseover";this.evtOn=this.evtOn.replace(/^on/,"");this.evtOff=a.evtOff||"mouseout";this.evtOff=this.evtOff.replace(/^on/,"");this.eltOn=a.eltOn||a.elt;var b=this;if(this.elt.filters){this.elt.style.width=this.elt.style.width||this.elt.offsetWidth+"px";this.elt.style.filter="alpha(opacity="+this.min+")";this.elt.filters[0].opacity=this.min;this.propOp=this.elt.filters[0];this.coeff=1}else{this.elt.style.opacity=this.min/100;this.propOp=this.elt.style;this.coeff=100}this.on=function(){clearTimeout(b.timer);b.removeEvent(b.eltOn,b.evtOn,b.on);b.addEvent(b.eltOn,b.evtOff,b.off);b.changeOp(b.courant,b.max)};this.off=function(){clearTimeout(b.timer);b.removeEvent(b.eltOn,b.evtOff,b.off);b.addEvent(b.eltOn,b.evtOn,b.on);b.changeOp(b.courant,b.min)};this.addEvent(this.eltOn,this.evtOn,this.on)};Fading.prototype.changeOp=function(d,c){var b=this;if(d==c){this.propOp.opacity=c/this.coeff;return false}this.propOp.opacity=this.courant/this.coeff;var a=d<c?1:-1;this.courant=Math.abs(d-c)<this.step?c:d+(this.step*a);this.timer=setTimeout(function(){b.changeOp(b.courant,c)},this.speed)};Fading.prototype.addEvent=function(a,b,c){if(a.attachEvent){a.attachEvent("on"+b,c)}else{a.addEventListener(b,c,false)}};Fading.prototype.removeEvent=function(a,b,c){if(a.detachEvent){a.detachEvent("on"+b,c)}else{a.removeEventListener(b,c,false)}};

