/***********************************************
 *        Module Javascript de MyFlashPano :         *
 *        - Développé par Henri ASTRE                *
 *        - Site Web : http://astre.henri.free.fr    *
 *                                                   *
 *        Gestion du panorama : rotation             *
 ***********************************************/

/***************************************
 *        fonction spécifique au navigateur  *
 ***************************************/

/* Fonction de recherche d'un élément ID compatible avec tous les navigateurs */
function FindID(id)
{
        if(document.layers)
                return document.layersid;

        if(document.all && !document.getElementById)
                return document.allid;

        if(document.all && document.getElementById)
                return document.getElementById(id);

        if(!document.all && document.getElementById)
                return document.getElementById(id);
}

/***************************************
 *        Fonctions de gestion du panoram    *
 ***************************************/

/* Variables globales du panorama */
var quickness = 10;     // temps pendant lequel la rotation reste active ou survol d'une zone (en ms)
var unitary_shift = 5; // decalage unitaire du panorama (en pixel)
var current_shift = 0;  // decalage courant du panorama (en pixel)
var actif;

function startMoveLeft(speed)
{
        actif = setInterval('moveLeft('+speed+')',quickness);
}

function startMoveRight(speed)
{
        actif = setInterval('moveRight('+speed+')',quickness);
}

function stopMove()
{
        clearInterval(actif);
}

function moveLeft(speed)
{
        var objImg  = FindID('div_pic');
        current_shift += unitary_shift*speed;

        objImg.style.backgroundPosition = current_shift+'px 0px';

}

function moveRight(speed)
{
        var objImg  = FindID('div_pic');
        current_shift -= unitary_shift*speed;

        objImg.style.backgroundPosition = current_shift+'px 0px';
}
