var slideShow=function(){
    var bxs,bxe,fxs,fxe,ys,ye,ta,ia,ie,st,ss,ft,fs,xp,yp,ci,t,tar,tarl;
    ta=document.getElementById(thumbid); ia=document.getElementById(imgid);
    t=ta.getElementsByTagName('li'); ie=document.all?true:false;
    st=3; ss=3; ft=10; fs=5; xp,yp=0;
    return{
        init:function(){
           
            len=t.length;tar=[];
            for(i=0;i<len;i++){
                var id=t[i].value; tar[i]=id;
		
                var listaId= 'li#lista' + id;
                var identif= $(listaId).attr("id");
                
                var la =document.createElement('img');   
                var lala =document.getElementById(identif);
                
                var srcId= 'img#imagen' + id;
                var src = $(srcId).attr("src");
                var alt = $(srcId).attr("alt");
                if (len>1) {
                $(listaId).text(id);
                }
                lala.appendChild(la);
                la.src=src ;
                la.alt=alt;
                la.style.display='none';
                la.id = 'imagen' + id;
                
                t[i].onclick=new Function("slideShow.getimg('"+id+"')");
                if(i==0){this.getimg(id)}
            }
            tarl=tar.length;
        },
        scrl:function(d){
            clearInterval(ta.timer);
            var l=(d==-1)?0:(t[tarl-1].offsetLeft-(ta.parentNode.offsetWidth-t[tarl-1].offsetWidth)+10)
        },
        cncl:function(){clearTimeout(ta.timer)},
        getimg:function(id){
            if(auto){clearTimeout(ia.timer)}
            if(ci!=null){
                var ts,tsl,x;
                ts=ia.getElementsByTagName('img'); tsl=ts.length;x=0;
                for(x;x<tsl;x++){
                    if(ci.id!=id){var o=ts[x]; clearInterval(o.timer); o.timer=setInterval(function(){slideShow.fdout(o)},fs)}
                }
            }
            if(!document.getElementById(id)){
                var i=document.createElement('img');
                  
                var srcId= 'img#imagen' + id;
                var listaId= 'li#lista' + id;
                var altImg= $(srcId).attr("alt");
                var srcImg= $(srcId).attr("src");
                ia.appendChild(i);
               
                i.id=id; i.av=0; i.style.opacity=0;
                i.style.filter='alpha(opacity=0)';
                i.alt = altImg;
                i.title = altImg;
                i.src= srcImg;
                var x=1;
                for(x;x<=len;x++){
                   if (id==x) {
                 	 $(listaId).attr("class", "activeSlide");   
                   }else {
                         var listaIdaux = 'li#lista' + x;
                         $(listaIdaux).attr("class", "");
                   }
                }
                
                      
            }else{
                i=document.getElementById(id); clearInterval(i.timer);
            }
            i.timer=setInterval(function(){slideShow.fdin(i)},fs);
        },
        nav:function(d){
            var c=0;
            for(key in tar){if(tar[key]==ci.id){c=key}}
            if(tar[parseInt(c)+d]){
                this.getimg(tar[parseInt(c)+d]);
            }else{
                if(d==1){
                    this.getimg(tar[0]);
                }else{this.getimg(tar[tarl-1])}
            }
        },
        auto:function(){ia.timer=setInterval(function(){slideShow.nav(1)},autodelay*1000)},
        fdin:function(i){
            if(i.complete){i.av=i.av+fs; i.style.opacity=i.av/100; i.style.filter='alpha(opacity='+i.av+')'}
            if(i.av>=100){if(auto){this.auto()}; clearInterval(i.timer); ci=i}
        },
        fdout:function(i){
            i.av=i.av-fs; i.style.opacity=i.av/100;
            i.style.filter='alpha(opacity='+i.av+')';
            if(i.av<=0){clearInterval(i.timer); if(i.parentNode){i.parentNode.removeChild(i)}}
        }
    };
}();

