/**
 * @author ladz
 */
/*options*/
scrollHorizontal = true;
scrollVertical = false;
/*imageContainer Info*/
containerId = 'content';
containerHeight = 450;
containerBackgroundImageWidth = 1383;
containerBackgroundImageHeight = 450;
viewportWidth = 800;
viewportHeight = 900;
topHeight = 80;

/*	
 containterImage Architekt ->Panorama zentrieren, scrollLeft -right auf display:block
 */
function architect(){
    document.getElementById('content').style.backgroundPosition = 0 - (containerBackgroundImageWidth - 800) / 2 + 'px';
    document.getElementById('scrollLeft').style.display = 'block';
    document.getElementById('scrollRight').style.display = 'block';
}

/*
 scrollImage mit Parameter LEFT oder RIGHT für die Richtung
 */
function scrollImage(direction){
    bgPos = document.getElementById("content").style.backgroundPosition;
    bgPosInPx = bgPos.substr(0, bgPos.lastIndexOf('p'));
    
    if (direction == 'left') {
        if (bgPosInPx == 0 - (containerBackgroundImageWidth - 800) / 2) { /*wenn imgCenter*/
            x = 0;
            Effect.Fade('scrollLeft');
            disappear("theFamily,theRestaurant,theBungalows,pickSomeCoconut,hammock");
            appear("theNeighbours,beach,pickSomeCoconutLeft,theBungalowsLeft,hammockLeft");
            
        }
        if (bgPosInPx == 0 - (containerBackgroundImageWidth - 800)) { /*wenn imgRight*/
            x = 0 - (containerBackgroundImageWidth - 800) / 2;
            Effect.Appear('scrollRight');
            disappear("snorkeling,theFamilyRight,theRestaurantRight,hammockRight");
            appear("pickSomeCoconut,theBungalows,theFamily,theRestaurant,hammock")
        }
    }
    
    if (direction == 'right') {
        if (bgPosInPx == 0 - (containerBackgroundImageWidth - 800) / 2) { /*iwenn mgCenter*/
            x = 0 - (containerBackgroundImageWidth - 800);
            Effect.Fade('scrollRight');
            disappear("theBungalows,pickSomeCoconut,beach,theFamily,theRestaurant,hammock");
            appear("snorkeling,theFamilyRight,theRestaurantRight,hammockRight");
        }
        if (bgPosInPx == 0) { /*wenn imgLeft*/
            x = 0 - (containerBackgroundImageWidth - 800) / 2;
            Effect.Appear('scrollLeft');
            appear("theFamily,theRestaurant,beach,theBungalows,pickSomeCoconut,hammock");
            disappear("theNeighbours,beach,pickSomeCoconutLeft,theBungalowsLeft,hammockLeft");
        }
    }
    
    
    new Effect.Morph('content', {
        style: {
            backgroundPosition: x + "px",
        }
    });
    
};

//rollImage Effekt - Parameter: Bild ohne Erweiterung (div MUSS den gleichen Namen haben, HOVER mit OVER)

function rollImage(imgToRoll){
    actuaIImagePath = document.getElementById(imgToRoll).src;
    actuaIImage = actuaIImagePath.slice(actuaIImagePath.lastIndexOf("/") + 1, actuaIImagePath.length - 4);
    if (actuaIImage == imgToRoll) {
        document.getElementById(imgToRoll).src = "img/" + imgToRoll + "Over.png";
    }
    else {
        document.getElementById(imgToRoll).src = "img/" + imgToRoll + ".png";
    }
}

//appear und disappear Effekte

function disappear(div){
    div = div.split(",");
    countDiv = div.length;
    for (var i = 0; i < div.length; i++) {
        document.getElementById(div[i]).style.display = "none";
    }
    
    
    
}

function appear(div){
    div = div.split(",");
    countDiv = div.length;
    for (var i = 0; i < div.length; i++) {
        document.getElementById(div[i]).style.display = "block";
    }
    
}




