var visiblePart;
var movingPart;
var movingPart1;
var movingPart2;
var mouseStop;
var leftPos;

var speedConstant = 1600;
var movingSpeed = 40;
var visibleWidth = 1100;
var partsWidth = 3985;  //in temporary version, this is fixed as browsers fail to count width properly

function movingInitiate() {
    visiblePart = document.getElementById("visible-part");
    movingPart = document.getElementById("moving-part");
    movingPart1 = document.getElementById("moving-part1");
    movingPart2 = document.getElementById("moving-part2");
    
    movingPart.onmouseover = function() {
        mouseStop = 1;
    }
    
    movingPart.onmouseout = function() {
        mouseStop = 0;
        moveLeft();
    }
    
    leftPos = 0;
    mouseStop = 0;
    moveLeft();
}

function moveLeft() {
    leftPos = leftPos - 1;
    movingPart.style.left =  leftPos + "px";
    
    returnPoint = (0 - partsWidth) + "px";
    if(movingPart.style.left == returnPoint) {
        leftPos = 0;
    }
    
    setDelay();
    
}

function setDelay() {
    
    if(mouseStop == 0) {
        var delay = speedConstant / movingSpeed; //the higher number in speed parameter, the faster it moves (-> shorter delay)
        setTimeout('moveLeft()', delay);
    }
    
}
