﻿    var curX=1;
    var itemOffset=230;
    var t;
    var autoSlideActive=true;
    var autoSlideTimer;
    var autoSlideDelay=3000;
    
    function manualSlide(d) {
        if(autoSlideTimer)window.clearTimeout(autoSlideTimer);
        autoSlideActive=false;
        slide(d);
    }
    
    function slide(d) {
        var itemCount = document.getElementById("strip").getElementsByTagName("div").length;
        var e=document.getElementById("strip").style;
        if((curX+d<2)&&(curX+d>-itemCount+3)){
            if(t)t.stop();
            t=new Tween(e,'left',Tween.strongEaseOut,curX*itemOffset-70,(curX+d)*itemOffset-70,0.8,"px");
            curX+=d;
            t.start();

            if(curX==1){
                document.getElementById("arrowLeft").style.opacity=0.2;
                document.getElementById("arrowLeft").style.filter="alpha(opacity=20)";
            }else{
                document.getElementById("arrowLeft").style.opacity=1;
                document.getElementById("arrowLeft").style.filter="alpha(opacity=100)";
            }
            if(curX==-itemCount+4){
                document.getElementById("arrowRight").style.opacity=0.2;
                document.getElementById("arrowRight").style.filter="alpha(opacity=20)";
            }else{
                document.getElementById("arrowRight").style.opacity=1;
                document.getElementById("arrowRight").style.filter="alpha(opacity=100)";
            }
        }
    }
    
    function autoSlide() {
        if(autoSlideActive){
            var itemCount = document.getElementById("strip").getElementsByTagName("div").length;
        
            if(curX==-itemCount+4){
                var e=document.getElementById("strip").style;
                if(t)t.stop();
                t=new Tween(e,'left',Tween.strongEaseOut,curX*itemOffset-70,1*itemOffset-70,0.8,"px");
                curX=1;
                t.start();
            }else{
                slide(-1);
            }

            autoSlideTimer = window.setTimeout("autoSlide()",autoSlideDelay);
        }
    }
    
    autoSlideTimer = window.setTimeout("autoSlide()",autoSlideDelay);

