/*******************************************************************************
 * File        : BC.Fader.js
 * Version     : 2.1.0
 * Created     : 2006/01/01
 * Last Update : 2008/01/19
 * Author      : Salvatore Porchia (sporchia@blindchaos.net) blog.blindchaos.net
 *
 * This was modifed for Seton, mouse events removed.
 *******************************************************************************
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; version 2 of the License.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 ******************************************************************************/
if(!window.$){function $(id){return document.getElementById(id)}}
if(!window.isUndefined){function isUndefined(a){return typeof a=='undefined'}}
if(!window.BC){BC=new Object()}
BC.Fader={counter:1,opcheck:(document.all)?new RegExp("opacity=([0-9]+)"):null,
fade:function(div,type){o=BC.Fader[div];if(((type>0)&&(o.perc<100))||((o.perc>o.low)&&(type<0))){o.perc+=type}else if(o.perc<o.low){o.perc+=Math.abs(type)}else{clearInterval(o.erval);if(o.out){o.erval=setInterval("BC.Fader.fade("+o.f+",-"+o.sd+")",o.dd);o.out=false}else{if(o.udf){o.udf()}}};if(o.perc>100){o.perc=100};if(Math.abs(type)>Math.abs(o.perc-o.low)){o.perc=o.low};if(document.all){o.style.filter="alpha(opacity="+o.perc+");"}else{o.style.opacity=o.perc/100}},
begin:function(e){BC.Fader[this.f].out=false;clearInterval(BC.Fader[this.f].erval);BC.Fader[this.f].erval=setInterval("BC.Fader.fade("+this.f+","+BC.Fader[this.f].su+")",BC.Fader[this.f].du)},
end:function(e){BC.Fader[this.f].out=true;if(BC.Fader[this.f].perc==100){clearInterval(BC.Fader[this.f].erval);BC.Fader[this.f].erval=setInterval("BC.Fader.fade("+this.f+",-"+BC.Fader[this.f].sd+")",BC.Fader[this.f].dd)}},
create:function(o,low,dup,sup,ddn,sdn,udf){o.low=(low==0)?0:(low?low:20);o.du=dup?dup:40;o.su=sup?sup:10;o.dd=ddn?ddn:40;o.sd=sdn?sdn:10;if(o!=BC.Fader[o.f]){o.f=BC.Fader.counter++;BC.Fader[o.f]=o};if(!o.perc){o.perc=document.all?(BC.Fader.opcheck.test(o.style.filter)?parseInt(BC.Fader.opcheck.exec(o.style.filter)[1],10): 100):(o.style.opacity?o.style.opacity*100:100)};clearInterval(o.erval);o.udf=udf;o.erval=setInterval("BC.Fader.fade("+o.f+",-"+o.sd+")",o.dd)},
kill:function(o){clearInterval(BC.Fader[o.f].erval);delete BC.Fader[o.f];return true},
start:function(mC,low,dup,sup,ddn,sdn,udf){try{BC.Fader.create(mC,low,dup,sup,ddn,sdn,udf);return}catch(e){};try{o=$(mC);BC.Fader.create(o,low,dup,sup,ddn,sdn,udf);return}catch(e){};var els=document.getElementsByTagName('*');var pattern=new RegExp("\\b"+mC+"\\b");for(i=0;i < els.length;i++){if(pattern.test(els[i].className)){BC.Fader.create(els[i],low,dup,sup,ddn,sdn,udf)}}},
stop:function(mC){try{if(mC.parentNode){if(BC.Fader[mC.f]){BC.Fader.kill(mC)};return}}catch(e){};try{obj=$(mC);if(obj==BC.Fader[obj.f]){BC.Fader.kill(obj);return}}catch(e){};var els=document.getElementsByTagName('*');var pattern=new RegExp("\\b"+mC+"\\b");for(i=0;i < els.length;i++){if(pattern.test(els[i].className)){if(BC.Fader[els[i].f]){BC.Fader.kill(els[i])}}}}}
