
var intWait = 9000;
function TimerMoveTo(intMove){
        var fx = new Fx.Style('myListShare', 'margin-left', {
				duration: 1000,
				transition: Fx.Transitions.Back.easeInOut,
				wait: true
	   });
	   document.getElementById("totIncrement").value=intMove;
	   ToggleButtons(document.getElementById("totIncrement").value,275*-4);
	   fx.stop();
	   fx.start(document.getElementById("totIncrement").value);
        if(intMove==(275*-1)){
            intTimer1=setTimeout("TimerMoveTo(275*-2);",intWait);
        }
        if(intMove==(275*-2)){
            intTimer1=setTimeout("TimerMoveTo(275*-3);",intWait);
        }
        if(intMove==(275*-3)){
            intTimer1=setTimeout("TimerMoveTo(275*-4);",intWait);
        }
        if(intMove==(275*-4)){
            intTimer1=setTimeout("TimerMoveTo(0);",intWait);
        }
        if(intMove==0){
            intTimer1=setTimeout("TimerMoveTo(275*-1);",intWait);
        }
}


    function ToggleButtons(totIncrement,maxRightIncrement){
        var objDivPrev = document.getElementById("DivPrev");
        var objDivNext = document.getElementById("DivNext");
        if(totIncrement==0){
            objDivPrev.style.visibility="hidden";
        }else{
            objDivPrev.style.visibility="visible";
        }
        if(totIncrement==maxRightIncrement){
            objDivNext.style.visibility="hidden";
        }else{
            objDivNext.style.visibility="visible";
        }
    }
    window.addEvent('domready', function() {
        var increment = 275;
        var intList = 0;
        var myListShare = document.getElementById("myListShare");
        for (i = 0; i < myListShare.childNodes.length; i++) {
            if (myListShare.childNodes[i].nodeName == "LI") {
                intList = intList + 1;
            }
        }
        var maxRightIncrement = Math.round(increment * ((-1 * (Math.round(intList) - 1))));
        ToggleButtons(document.getElementById("totIncrement").value, maxRightIncrement);
        var intTimer1 = setTimeout("TimerMoveTo(275*-1);", intWait);
        var fx = new Fx.Style('myListShare', 'margin-left', {
            duration: 1000,
            transition: Fx.Transitions.Back.easeInOut,
            wait: true
        });
        //-------------------------------------
        // EVENTS for the button "previous"
        $('previous').addEvents({
            'click': function(event) {
                if (document.getElementById("totIncrement").value < 0) {
                    document.getElementById("totIncrement").value = (document.getElementById("totIncrement").value * 1) + increment;
                    ToggleButtons(document.getElementById("totIncrement").value, maxRightIncrement);
                    fx.stop()
                    fx.start(document.getElementById("totIncrement").value);
                }
            }
        });

        //-------------------------------------
        // EVENTS for the button "next"
        $('next').addEvents({
            'click': function(event) {
                if (document.getElementById("totIncrement").value > maxRightIncrement) {
                    document.getElementById("totIncrement").value = (document.getElementById("totIncrement").value * 1) - increment;
                    ToggleButtons(document.getElementById("totIncrement").value, maxRightIncrement);
                    fx.stop()
                    fx.start(document.getElementById("totIncrement").value);
                }
            }
        })


    });
    
    function clicked(){
        //
    }