// @Nom:          navigation.js //
// @Ann嶪:        2011          //
// @Auteur:       Benjamin JEHL //
// @Copyright:    db-clic.com   //

/* 中中中中中中中中中中中中中中中中中中中中中中中中中中中中中中中中中中中中中 */
/* ANIMATIONS --------------------------------------------------------------- */
/* 中中中中中中中中中中中中中中中中中中中中中中中中中中中中中中中中中中中中中 */
// Animation Porte d'Entr嶪
function PorteAnimOn(){
    bouton('entree_btn','out');
    document.getElementById('entree').style.display = "none";
    document.getElementById('porte').style.display = "block";
    NavigLevel = "int";
    NavigVertical = null;
    NavigHorizontal = null;
    timerTween = new Tween(new Object(),'xyz',Tween.strongEaseOut,0,100,0.5);
    timerTween.onMotionFinished = function(){OpacityAnimExt();};
    timerTween.start();
}
// Animation Interieur <-> Exterieur
function OpacityAnimExt(){
    document.getElementById('Interieur').style.display = "block";
    opacityTweenExt = new OpacityTween(document.getElementById('Exterieur'),Tween.regularEaseInOut, 100, 0, 0.6);
    opacityTweenExt.onMotionFinished =
    function(){
        document.getElementById('Exterieur').style.display = "none";
        document.getElementById('retourAccueil_btn_box').style.display = "block";
        document.getElementById('admin').style.right = 37+"px";
        document.getElementById('compteurBox').style.right = 69+"px";
        document.getElementById('news').style.right = 150+"px";
        // Bouton retour a l'accueil
        rootPage();
    };
    opacityTweenExt.start();
}
function OpacityAnimInt(){
    document.getElementById('retourAccueil_btn_box').style.display = "none";
    document.getElementById('admin').style.right = 5+"px";
    document.getElementById('compteurBox').style.right = 37+"px";
    document.getElementById('news').style.right = 118+"px";
    document.getElementById('Exterieur').style.display = "block"
    document.getElementById('porte').style.display = "none";
    opacityTweenExt = new OpacityTween(document.getElementById('Exterieur'),Tween.regularEaseInOut, 0, 100, 0.6);
    opacityTweenExt.onMotionFinished =
    function(){
        NavigLevel = "ext";
        NavigVertical = null;
        NavigHorizontal = null;
        document.getElementById('Interieur').style.display = "none";
        document.getElementById('entree').style.display = "block";
        rootPage();
    };
    opacityTweenExt.start();
}
/* 中中中中中中中中中中中中中中中中中中中中中中中中中中中中中中中中中中中中中 */
/* INTERACTIONS ------------------------------------------------------------- */
/* 中中中中中中中中中中中中中中中中中中中中中中中中中中中中中中中中中中中中中 */
// NAVIGATION DIRECTE
function navigToLabel(index,color){
    document.getElementById(index).style.color=color;
    Cufon.replace(document.getElementById(index), { fontFamily: 'Stencil BT' });
}
function navigOutLabel(index,color){
    document.getElementById(index).style.color=color;
    Cufon.replace(document.getElementById(index), { fontFamily: 'Stencil BT' });
}
// AFFICHAGES DES PHOTOS
function photoBox(width){
    document.getElementById('photoBoxDisplay').style.display = "block";
}
// DIAPORAMA
function diapoToPlay(thisImage,thisTaille,thisTotal,thisloops){
    
    image = thisImage;
    taille= thisTaille;
    total= thisTotal;
    loops = thisloops;
    
    diapo = 'start';
    document.getElementById('navPhotoContent').style.backgroundImage='url(./images/interface/menus/navigation/diaporamaOff.gif)';
    opacity('navPhotoContentBg',0);opacity('navPhotoContent',0);
    
    if (loops=="play"){calcLoopsDiapo = 1;}
    if (loops=="replay"){calcLoopsDiapo = 0;}
    
    diapoTween = new Tween(new Object(),'xyz',Tween.regularEaseInOut,0,100,6);
    diapoTween.onMotionFinished =
    function(){
        calcLoopsDiapo++;
        adjustPhotosBox(taille[calcLoopsDiapo]);
        window.status=image[calcLoopsDiapo];
        document.getElementById('navPhotoContent').style.width=taille[calcLoopsDiapo] +'px';
        document.getElementById('navPhotoContentBg').style.width=taille[calcLoopsDiapo]+'px';
        document.getElementById('photoBoxDisplay').style.backgroundImage='url(./images/photoMax/'+image[calcLoopsDiapo]+')';
        
        if(calcLoopsDiapo<total){diapoTween.rewind();diapoTween.start();}
        else{
            diapo = 'stop';
            document.getElementById('navPhotoContent').style.backgroundImage='url(./images/interface/menus/navigation/diaporamaOn.gif)';
            opacity('navPhotoContentBg',50);
            opacity('navPhotoContent',100);
            
        }
    };
    diapoTween.start();
}


function diapoReload(){
    if((typeof(diapoTween)!="undefined")&&(diapo=='stop')){
        opacity('navPhotoContentBg',0);opacity('navPhotoContent',0);
        diapoTween.rewind();
        diapoToPlay(image,taille,total,'replay');
    }
}









// PHOTOS BOX
function adjustPhotosBox(cible){
    chooseContentBox = "showPhotos";
    contentBoxWidth=cible+78;
    contentBoxHeight=425;
    
    
    contentBoxWindowLabel = document.getElementById('contentBoxWindow');
    contentBoxWindowSx = document.getElementById('contentBoxWindow').offsetWidth;
    contentBoxWindowSy = document.getElementById('contentBoxWindow').offsetHeight;
    
    document.getElementById('photoBoxDisplay').style.width = cible+"px";
    
    slideWinX = new Tween (contentBoxWindowLabel.style,'width',Tween.elasticEaseOut,contentBoxWindowSx,contentBoxWidth,0.65,'px');
    slideWinY = new Tween (contentBoxWindowLabel.style,'height',Tween.elasticEaseOut,contentBoxWindowSy,contentBoxHeight,0.65,'px');

    slideWinY.onMotionChanged =
                                function(){
                                    
                                    initBox();
                                    document.getElementById('photos_Content').style.display = "none";
                                    
                                    
                                    contentBoxMarginLeft = (redimWidth-document.getElementById('contentBoxWindow').offsetWidth)/2+10;
                                    contentBoxMarginTop = (redimHeight-document.getElementById('contentBoxWindow').offsetHeight)/2+10;
                                    document.getElementById('contentBoxWindow').style.marginTop = contentBoxMarginTop+'px';
                                    document.getElementById('contentBoxWindow').style.marginLeft = contentBoxMarginLeft+'px';
                                    //contentBoxColor
                                    document.getElementById('contentBoxColor').style.width = document.getElementById('contentBoxWindow').offsetWidth+"px";
                                    document.getElementById('contentBoxColor').style.height = document.getElementById('contentBoxWindow').offsetHeight+"px";
                                    document.getElementById('cMiddleLeft').style.height = document.getElementById('contentBoxWindow').offsetHeight-16+"px";
                                    document.getElementById('cMiddle').style.height = document.getElementById('contentBoxWindow').offsetHeight-2+"px";
                                    document.getElementById('cMiddle').style.width = document.getElementById('contentBoxWindow').offsetWidth-16+"px";
                                    document.getElementById('cMiddleRight').style.height = document.getElementById('contentBoxWindow').offsetHeight-16+"px";
                                    //contentBoxBorder
                                    document.getElementById('contentBoxBorder').style.display= "none";
                                    //Exit btn
                                    document.getElementById('exitContentWindow_btn_box').style.display= "none";
                                };
    slideWinY.onMotionFinished =
                                function(){
                                    //contentBoxBorder
                                    document.getElementById('contentBoxBorder').style.display= "block";
                                    document.getElementById('bTop').style.width = document.getElementById('contentBoxWindow').offsetWidth-16+"px";
                                    document.getElementById('bMiddleLeft').style.height = document.getElementById('contentBoxWindow').offsetHeight-16+"px";
                                    document.getElementById('bMiddleRight').style.height = document.getElementById('contentBoxWindow').offsetHeight-16+"px";
                                    document.getElementById('bBottom').style.width = document.getElementById('contentBoxWindow').offsetWidth-16+"px";
                                    //Exit btn
                                    document.getElementById('exitContentWindow_btn_box').style.display= "block";
                                    
                                    document.getElementById('photos_Content').style.display = "block";
                                    document.getElementById('photos_Content').style.width =contentBoxWidth-50+"px";
                                    document.getElementById('photos_Content').style.height = contentBoxHeight-50+"px";
                                    document.getElementById('photos_Content_title').style.left = (contentBoxWidth-233)/2-25+"px";
                                    
                                    
                                    
                                    
                                    
                                    
                                    
                                    document.getElementById('navigationDirecte').style.display = "block";
                                    // Navigation pour La carte
                                    document.getElementById('navigationDirecte').style.width=206+'px';
                                    document.getElementById('navigationDirecte').style.left=(contentBoxWidth-206)/2+'px';
                                    // hide / Show
                                    document.getElementById('navigationDirecte1').style.display='block';
                                    document.getElementById('navigationDirecte2').style.display='block';
                                    document.getElementById('navigationDirecte3').style.display='none';
                                    // Position
                                    document.getElementById('navigationDirecte1').style.left=0+'px';
                                    document.getElementById('navigationDirecte2').style.left=110+'px';
                                    
                                    
                                    document.getElementById('bullePhotos2').style.width = contentBoxWidth-78+"px";
                                    document.getElementById('bullePhotos3').style.left = contentBoxWidth-64+"px";
                                    document.getElementById('bullePhotos4').style.height = contentBoxHeight-156+"px";
                                    document.getElementById('bullePhotos4').style.width = contentBoxWidth-55+"px";
                                    document.getElementById('bullePhotos5').style.height = contentBoxHeight-156+"px";
                                    document.getElementById('bullePhotos5').style.left = contentBoxWidth-55+"px";
                                    document.getElementById('bullePhotos6').style.top = contentBoxHeight-142+"px";
                                    document.getElementById('bullePhotos7').style.top = contentBoxHeight-142+"px";
                                    document.getElementById('bullePhotos7').style.width = contentBoxWidth-78+"px";
                                    document.getElementById('bullePhotos8').style.top = contentBoxHeight-142+"px";
                                    document.getElementById('bullePhotos8').style.left = contentBoxWidth-64+"px";
                                    
                                    
                                    
                                    //Fx
                                    document.getElementById('FxWindow').style.display = "block";
                                    if (navigator.appName=='Microsoft Internet Explorer'){
                                        document.getElementById('FxWindow').style.width = contentBoxWidth-10+"px";
                                        document.getElementById('FxWindow').style.height = contentBoxHeight-10+"px";
                                        document.getElementById('FxWindow').style['filter'] = "progid:DXImageTransform.Microsoft.Blur(PixelRadius=6, MakeShadow='true', ShadowOpacity=0.75)";
                                    }else{
                                        document.getElementById('FxWindow').style.backgroundColor = "transparent";
                                        document.getElementById('FxWindow').style.width = contentBoxWidth+2+"px";
                                        document.getElementById('FxWindow').style.height = contentBoxHeight+2+"px";
                                        document.getElementById('MozOmbre').style.display = "block";
                                        document.getElementById('MoZmidlle').style.height = contentBoxHeight-21+"px";
                                        document.getElementById('MoZbottom').style.width = contentBoxWidth-21+"px";
                                    }
                                    document.getElementById('FxWindow').style.marginTop = contentBoxMarginTop+6+"px";
                                    document.getElementById('FxWindow').style.marginLeft = contentBoxMarginLeft+6+"px";
                                    
                                    
                                    photoBox(cible);
                                    
                                };
    slideWinX.start();
    slideWinY.start();
}

function initBox(){
    // Initialise les contents
    document.getElementById('FxWindow').style.display = "none";
    document.getElementById('contact_Content').style.display = "none";
    document.getElementById('admin_Content').style.display = "none";
    document.getElementById('gmaps_Content').style.display = "none";
    document.getElementById('navigationDirecte').style.display = "none";
    document.getElementById('mentions_Content').style.display = "none";
    document.getElementById('scrollbox1').style.display = "none";
    document.getElementById('laCarte_Content').style.display = "none";
    document.getElementById('scrollbox2').style.display = "none";
    document.getElementById('photos_box').style.display = "none";
    document.getElementById('scrollbox3').style.display = "none";
    document.getElementById('laCarte_Content_title').style.display = "none";
    document.getElementById('agendaBox').style.display = "none";
    document.getElementById('agenda_box').style.display = "none";
}

// CONTENT BOX
function adjustContentBox(cible){
    
    if(typeof(diapoTween)!="undefined"){diapoTween.stop();}
    
    BoutonClick+=1;
    opacity('contentBoxWindow',100);
    if(BoutonClick==1){
        document.getElementById('contentBoxWindow').style.width = 16+"px";
        document.getElementById('contentBoxWindow').style.height = 16+"px";
    }
    if(cible=="defaut" || cible=="agenda" || cible=="photos" ){
        document.getElementById('navigationDirecte').style.display = "block";
    }else{
        document.getElementById('navigationDirecte').style.display = "none";
    }
    if(cible=="googleMap"){
        chooseContentBox = "googleMap";
        contentBoxWidth = 462;
        contentBoxHeight = redimHeight-120;
        if(contentBoxHeight>=325){
            contentBoxHeight=325;
        }
        adjustMapBox = contentBoxHeight-158;
        document.getElementById('mapBox').style.height = adjustMapBox+"px";
        document.getElementById('bulleMap').style.height = adjustMapBox+26+"px";
        document.getElementById('bulleMapMiddle').style.height = adjustMapBox+2+"px";
    }
    if(cible=="contact"){
        chooseContentBox = "contact";
        contentBoxWidth = 342;
        contentBoxHeight = redimHeight-80;
        adjustContactBox = contentBoxHeight-158;
        document.getElementById('bulleContact').style.height = adjustContactBox+26+"px";
        document.getElementById('bulleContactMiddle').style.height = adjustContactBox+2+"px";
        document.getElementById('mailBox').style.height = adjustContactBox-144+"px";
    }
    if(cible=="admin"){
        chooseContentBox = "admin";
        contentBoxWidth = 270;
        contentBoxHeight = redimHeight-120;
        if(contentBoxHeight>=233){
            contentBoxHeight=233;
        }
        adjustAdminBox = contentBoxHeight-158;
        document.getElementById('bulleAdmin').style.height = adjustAdminBox+26+"px";
        document.getElementById('bulleAdminMiddle').style.height = adjustAdminBox+2+"px";

    }
    if(cible=="mentions"){
        chooseContentBox = "mentions";
        contentBoxWidth = 608;
        contentBoxHeight = redimHeight-80;
        if(contentBoxHeight>=424){
            contentBoxHeight=424;
            document.getElementById('scrollbox1').style.display="none";
        }else{
            document.getElementById('scrollbox1').style.display="block";
            document.getElementById('scrollbox1').style.height = contentBoxHeight-155+"px";
            document.getElementById('bulleMentionsBox').style.top = 0+"px";
            document.getElementById('scrollbar1').style.top = 0+"px";
        }
        adjustMentionsBox = contentBoxHeight-158;
        document.getElementById('bulleMentions').style.height = adjustMentionsBox+26+"px";
        document.getElementById('bulleMentionsMiddle').style.height = adjustMentionsBox+2+"px";
    }
    if(cible=="defaut"){
        chooseContentBox = "defaut";
        contentBoxWidth = 608;
        contentBoxHeight = redimHeight-80;
        document.getElementById('photos_Content').style.display= "none";
        
        // Navigation pour La carte
        document.getElementById('navigationDirecte').style.width=193+'px';
        document.getElementById('navigationDirecte').style.left=(contentBoxWidth-193)/2+'px';
        // hide / Show
        document.getElementById('navigationDirecte1').style.display='none';
        document.getElementById('navigationDirecte2').style.display='block';
        document.getElementById('navigationDirecte3').style.display='block';
        // Position
        document.getElementById('navigationDirecte2').style.left=0+'px';
        document.getElementById('navigationDirecte3').style.left=110+'px';
        // Scrollbar pour la carte
        document.getElementById('scrollbox2').style.display="block";
        document.getElementById('scrollbox2').style.height = contentBoxHeight-50+"px";
        document.getElementById('laCarte_bg').style.top = 0+"px";
        document.getElementById('scrollbar2').style.top = 0+"px";
    }
    if(cible=="photos"){
        chooseContentBox = "photos";
        contentBoxWidth = 494;
        contentBoxHeight = redimHeight-80;
        document.getElementById('photoBoxDisplay').style.display= "none";
        // Navigation pour La carte
        document.getElementById('navigationDirecte').style.width=206+'px';
        document.getElementById('navigationDirecte').style.left=(contentBoxWidth-206)/2+'px';
        // hide / Show
        document.getElementById('navigationDirecte1').style.display='block';
        document.getElementById('navigationDirecte2').style.display='block';
        document.getElementById('navigationDirecte3').style.display='none';
        // Position
        document.getElementById('navigationDirecte1').style.left=0+'px';
        document.getElementById('navigationDirecte2').style.left=110+'px';

        document.getElementById('bullePhotos4').style.height = contentBoxHeight-156+"px";
        document.getElementById('bullePhotos4').style.width = contentBoxWidth-55+"px";
        document.getElementById('bullePhotos5').style.height = contentBoxHeight-156+"px";
        document.getElementById('bullePhotos5').style.left = contentBoxWidth-55+"px";
        document.getElementById('bullePhotos6').style.top = contentBoxHeight-142+"px";
        document.getElementById('bullePhotos7').style.top = contentBoxHeight-142+"px";
        document.getElementById('bullePhotos7').style.width = contentBoxWidth-78+"px";
        document.getElementById('bullePhotos8').style.top = contentBoxHeight-142+"px";
        document.getElementById('bullePhotos8').style.left = contentBoxWidth-64+"px";
    }
    if(cible=="agenda"){
        chooseContentBox = "agenda";
        contentBoxWidth = 608;
        contentBoxHeight = redimHeight-80;
        document.getElementById('photos_Content').style.display= "none";
        document.getElementById('photoBoxDisplay').style.display= "none";
        
        // Navigation pour La carte
        document.getElementById('navigationDirecte').style.width=193+'px';
        document.getElementById('navigationDirecte').style.left=(contentBoxWidth-193)/2+'px';
        // hide / Show
        document.getElementById('navigationDirecte1').style.display='block';
        document.getElementById('navigationDirecte2').style.display='none';
        document.getElementById('navigationDirecte3').style.display='block';
        // Position
        document.getElementById('navigationDirecte1').style.left=0+'px';
        document.getElementById('navigationDirecte3').style.left=110+'px';
        
    }
    
    
    
    contentBoxWindowLabel = document.getElementById('contentBoxWindow');
    contentBoxWindowSx = document.getElementById('contentBoxWindow').offsetWidth;
    contentBoxWindowSy = document.getElementById('contentBoxWindow').offsetHeight;
    
    slideWinX = new Tween (contentBoxWindowLabel.style,'width',Tween.elasticEaseOut,contentBoxWindowSx,contentBoxWidth,0.65,'px');
    slideWinY = new Tween (contentBoxWindowLabel.style,'height',Tween.elasticEaseOut,contentBoxWindowSy,contentBoxHeight,0.65,'px');
    slideWinY.onMotionChanged =
                                function(){
                                    initBox();
                                    document.getElementById('photos_Content').style.display = "none";
                                                                        
                                    contentBoxMarginLeft = (redimWidth-document.getElementById('contentBoxWindow').offsetWidth)/2+10;
                                    contentBoxMarginTop = (redimHeight-document.getElementById('contentBoxWindow').offsetHeight)/2+10;
                                    document.getElementById('contentBoxWindow').style.marginTop = contentBoxMarginTop+'px';
                                    document.getElementById('contentBoxWindow').style.marginLeft = contentBoxMarginLeft+'px';
                                    //contentBoxColor
                                    document.getElementById('contentBoxColor').style.width = document.getElementById('contentBoxWindow').offsetWidth+"px";
                                    document.getElementById('contentBoxColor').style.height = document.getElementById('contentBoxWindow').offsetHeight+"px";
                                    document.getElementById('cMiddleLeft').style.height = document.getElementById('contentBoxWindow').offsetHeight-16+"px";
                                    document.getElementById('cMiddle').style.height = document.getElementById('contentBoxWindow').offsetHeight-2+"px";
                                    document.getElementById('cMiddle').style.width = document.getElementById('contentBoxWindow').offsetWidth-16+"px";
                                    document.getElementById('cMiddleRight').style.height = document.getElementById('contentBoxWindow').offsetHeight-16+"px";
                                    //contentBoxBorder
                                    document.getElementById('contentBoxBorder').style.display= "none";
                                    //Exit btn
                                    document.getElementById('exitContentWindow_btn_box').style.display= "none";
                                };
    slideWinY.onMotionFinished =
                                function(){
                                    //contentBoxBorder
                                    document.getElementById('contentBoxBorder').style.display= "block";
                                    document.getElementById('bTop').style.width = document.getElementById('contentBoxWindow').offsetWidth-16+"px";
                                    document.getElementById('bMiddleLeft').style.height = document.getElementById('contentBoxWindow').offsetHeight-16+"px";
                                    document.getElementById('bMiddleRight').style.height = document.getElementById('contentBoxWindow').offsetHeight-16+"px";
                                    document.getElementById('bBottom').style.width = document.getElementById('contentBoxWindow').offsetWidth-16+"px";
                                    //Exit btn
                                    document.getElementById('exitContentWindow_btn_box').style.display= "block";
                                    //Contents
                                    if(chooseContentBox=="googleMap"){
                                        document.getElementById('gmaps_Content').style.display = "block";
                                        document.getElementById('gmaps_Content').style.width =contentBoxWidth-50+"px";
                                        document.getElementById('gmaps_Content').style.height = contentBoxHeight-50+"px";            
                                    }
                                    if(chooseContentBox=="contact"){
                                        document.getElementById('contact_Content').style.display = "block";
                                        document.getElementById('contact_Content').style.width =contentBoxWidth-50+"px";
                                        document.getElementById('contact_Content').style.height = contentBoxHeight-50+"px";  
                                    }
                                    if(chooseContentBox=="admin"){
                                        document.getElementById('admin_Content').style.display = "block";
                                        document.getElementById('admin_Content').style.width =contentBoxWidth-50+"px";
                                        document.getElementById('admin_Content').style.height = contentBoxHeight-50+"px";  
                                    }
                                    if(chooseContentBox=="mentions"){
                                        document.getElementById('scrollbox1').style.display = "block";
                                        document.getElementById('mentions_Content').style.display = "block";
                                        document.getElementById('mentions_Content').style.width =contentBoxWidth-50+"px";
                                        document.getElementById('mentions_Content').style.height = contentBoxHeight-50+"px";
                                        if(contentBoxHeight>=424){
                                            document.getElementById('scrollbox1').style.display="none";
                                        }else{
                                            document.getElementById('scrollbox1').style.display="block";
                                            document.getElementById('scrollbox1').style.height = contentBoxHeight-155+"px";
                                            document.getElementById('bulleMentionsBox').style.top = 0+"px";
                                            document.getElementById('scrollbar1').style.top = 0+"px";
                                            document.getElementById('scrollbar1').style.height = (document.getElementById('bulleMentionsMiddle').offsetHeight*document.getElementById('scrollbox1').offsetHeight)/document.getElementById('bulleMentionsBox').offsetHeight+"px";
                                        }
                                    }
                                    if(cible=="defaut"){
                                        // HyperNav
                                        document.getElementById('laCarte_Content_title').style.display = "block";
                                        document.getElementById('navigationDirecte').style.display = "block";
                                        document.getElementById('laCarte_Content').style.display = "block";
                                        document.getElementById('laCarte_Content').style.width =contentBoxWidth-50+"px";
                                        document.getElementById('laCarte_Content').style.height = contentBoxHeight-128+"px";
                                        document.getElementById('scrollbox2').style.display="block";
                                        document.getElementById('scrollbox2').style.height = contentBoxHeight-128+"px";
                                        document.getElementById('bulleMentionsBox').style.top = 0+"px";
                                        document.getElementById('scrollbar2').style.top = 0+"px";
                                        document.getElementById('scrollbar2').style.height = (document.getElementById('laCarte_Content').offsetHeight*document.getElementById('scrollbox2').offsetHeight)/document.getElementById('laCarte_bg').offsetHeight+"px";
                                    }
                                    if(cible=="photos"){
                                        // HyperNav
                                        document.getElementById('photos_Content').style.display = "block";
                                        document.getElementById('photos_Content_title').style.display = "block";
                                        document.getElementById('navigationDirecte').style.display = "block";
                                        contentBoxWidth = 494;
                                        contentBoxHeight = redimHeight-80;
                                        
                                        
                                        document.getElementById('photos_Content_title').style.left = (contentBoxWidth-233)/2-25+"px";
                                        
                                        
                                        
                                        document.getElementById('photos_box').style.display = "block";
                                        document.getElementById('photos_box').style.width = contentBoxWidth-78+"px";
                                        document.getElementById('photos_box').style.height = contentBoxHeight-156+"px";
                                        
                                        document.getElementById('photos_bg').style.width = contentBoxWidth-78+"px";
                                        document.getElementById('photos_bg').style.top = 0+"px";
                                        
                                        
                                        
                                        setScrollbarA = parseInt(document.getElementById('photos_box').style.height);
                                        setScrollbarB = parseInt(document.getElementById('photos_bg').style.height);
                                        
                                        
                                        if(setScrollbarA<setScrollbarB){
                                                document.getElementById('scrollbox3').style.display="block";
                                                
                                        }else{
                                                document.getElementById('scrollbox3').style.display="none";
                                        }
                                        document.getElementById('scrollbox3').style.height = setScrollbarA+"px";
                                        document.getElementById('scrollbar3').style.top = 0+"px";
                                        document.getElementById('scrollbar3').style.height = Math.round((setScrollbarA*document.getElementById('scrollbox3').offsetHeight)/setScrollbarB)+"px";
                                        
                                        document.getElementById('photos_Content').style.display = "block";
                                        document.getElementById('photos_Content').style.width =contentBoxWidth-50+"px";
                                        document.getElementById('photos_Content').style.height = contentBoxHeight-50+"px";
                                        
                                        document.getElementById('bullePhotos2').style.width = contentBoxWidth-78+"px";
                                        document.getElementById('bullePhotos3').style.left = contentBoxWidth-64+"px";
                                        
                                        document.getElementById('bullePhotos4').style.height = contentBoxHeight-156+"px";
                                        document.getElementById('bullePhotos4').style.width = contentBoxWidth-55+"px";
                                        document.getElementById('bullePhotos5').style.height = contentBoxHeight-156+"px";
                                        document.getElementById('bullePhotos5').style.left = contentBoxWidth-55+"px";
                                        document.getElementById('bullePhotos6').style.top = contentBoxHeight-142+"px";
                                        document.getElementById('bullePhotos7').style.top = contentBoxHeight-142+"px";
                                        document.getElementById('bullePhotos7').style.width = contentBoxWidth-78+"px";
                                        document.getElementById('bullePhotos8').style.top = contentBoxHeight-142+"px";
                                        document.getElementById('bullePhotos8').style.left = contentBoxWidth-64+"px";
                                        
                                    }
                                    if(cible=="agenda"){
                                        // HyperNav
                                        
                                        document.getElementById('agendaBox').style.display = "block";
                                        document.getElementById('navigationDirecte').style.display = "block";
                                        
                                        document.getElementById('photos_Content').style.display = "block";
                                        document.getElementById('photos_box').style.display = "none";
                                        document.getElementById('photos_Content_title').style.display = "none";
                                        
                                        document.getElementById('photos_Content').style.width =contentBoxWidth-50+"px";
                                        document.getElementById('photos_Content').style.height = contentBoxHeight-50+"px";
                                        
                                        document.getElementById('agenda_box').style.display = "block";
                                        document.getElementById('agenda_box').style.width = contentBoxWidth-78+"px";
                                        document.getElementById('agenda_box').style.height = contentBoxHeight-156+"px";
                                        
                                        document.getElementById('agenda_bg').style.width = contentBoxWidth-78+"px";
                                        document.getElementById('agenda_bg').style.top = 0+"px";
                                        
                                        setScrollbarA = parseInt(document.getElementById('agenda_box').style.height);
                                        setScrollbarB = parseInt(document.getElementById('agenda_bg').style.height);
                                        
                                        
                                        if(setScrollbarA<setScrollbarB){
                                                document.getElementById('scrollbox1').style.display="block";
                                                
                                        }else{
                                                document.getElementById('scrollbox1').style.display="none";
                                        }
                                        document.getElementById('scrollbox1').style.height = setScrollbarA+"px";
                                        document.getElementById('scrollbar1').style.top = 0+"px";
                                        document.getElementById('scrollbar1').style.height = Math.round((setScrollbarA*document.getElementById('scrollbox1').offsetHeight)/setScrollbarB)+"px";



                                        document.getElementById('bullePhotos2').style.width = contentBoxWidth-78+"px";
                                        document.getElementById('bullePhotos3').style.left = contentBoxWidth-64+"px";
                                        
                                        document.getElementById('bullePhotos4').style.height = contentBoxHeight-156+"px";
                                        document.getElementById('bullePhotos4').style.width = contentBoxWidth-55+"px";
                                        document.getElementById('bullePhotos5').style.height = contentBoxHeight-156+"px";
                                        document.getElementById('bullePhotos5').style.left = contentBoxWidth-55+"px";
                                        document.getElementById('bullePhotos6').style.top = contentBoxHeight-142+"px";
                                        document.getElementById('bullePhotos7').style.top = contentBoxHeight-142+"px";
                                        document.getElementById('bullePhotos7').style.width = contentBoxWidth-78+"px";
                                        document.getElementById('bullePhotos8').style.top = contentBoxHeight-142+"px";
                                        document.getElementById('bullePhotos8').style.left = contentBoxWidth-64+"px";
                                        
                                        
                                    }


                                    //Fx
                                    document.getElementById('FxWindow').style.display = "block";
                                    if (navigator.appName=='Microsoft Internet Explorer'){
                                        document.getElementById('FxWindow').style.width = contentBoxWidth-10+"px";
                                        document.getElementById('FxWindow').style.height = contentBoxHeight-10+"px";
                                        document.getElementById('FxWindow').style['filter'] = "progid:DXImageTransform.Microsoft.Blur(PixelRadius=6, MakeShadow='true', ShadowOpacity=0.75)";
                                    }else{
                                        document.getElementById('FxWindow').style.backgroundColor = "transparent";
                                        document.getElementById('FxWindow').style.width = contentBoxWidth+2+"px";
                                        document.getElementById('FxWindow').style.height = contentBoxHeight+2+"px";
                                        document.getElementById('MozOmbre').style.display = "block";
                                        document.getElementById('MoZmidlle').style.height = contentBoxHeight-21+"px";
                                        document.getElementById('MoZbottom').style.width = contentBoxWidth-21+"px";
                                    }
                                    document.getElementById('FxWindow').style.marginTop = contentBoxMarginTop+6+"px";
                                    document.getElementById('FxWindow').style.marginLeft = contentBoxMarginLeft+6+"px";
                                };
    slideWinX.start();
    slideWinY.start();
}
function showBackground(){
    opacity('contentBoxWindow',0);
    // Modules
    document.getElementById('contact_Content').style.display = "none";
    document.getElementById('admin_Content').style.display = "none";
    document.getElementById('gmaps_Content').style.display = "none";
    document.getElementById('mentions_Content').style.display = "none";
    document.getElementById('FxWindow').style.display = "none";
    document.getElementById('scrollbox1').style.display = "none";
    
    
    document.getElementById('contentBoxWindow').style.width = 16+'px';
    document.getElementById('contentBoxWindow').style.height = 16+'px';
    document.getElementById('contentBoxWindow').style.display = 'none';
    BoutonClick=0;

}
function adjustLaCarte(label){
    hauteurMenu = parseInt(document.getElementById('laCarte_bg').style.height);
    hauteurEcran = (contentBoxHeight-128);
    hauteurBar = Math.round((contentBoxHeight-128)*(contentBoxHeight-128)/hauteurMenu)+2;

    if(label==0){position1 = 0;position2=0;}
    if(label==1){position1 = -2270;position2=114*hauteurEcran/350;}
    if(label==2){position1 = -6137;position2=307*hauteurEcran/350;}
    if(label==3){position1 = -1493;position2=75*hauteurEcran/350;}
    if(label==4){position1 = hauteurEcran-hauteurMenu+50;position2=hauteurEcran-hauteurBar;}
    
    document.getElementById('laCarte_bg').style.top = position1+'px';
    document.getElementById('scrollbar2').style.marginTop = position2+'px';
}







/* 中中中中中中中中中中中中中中中中中中中中中中中中中中中中中中中中中中中中中 */
/* NAVIGATION INTERRACTIVE -------------------------------------------------- */
/* 中中中中中中中中中中中中中中中中中中中中中中中中中中中中中中中中中中中中中 */
// MOTEUR DE RENDU
function mouseEvent(mousePoz,poz){
    // Evenement Mouse
    mouseEvt = mousePoz;
    // On la direction du mouvement
    vecteur = poz;
    if (typeof poz == 'undefined'){vecteur=null;}
    // Initialisation du moteur
    if (mouseEvt=="offmouse" && typeof mytweenPage != 'undefined'){NavigClick=0;mytweenPage.stop();document.getElementById('MenuBG').style.display = "block";}
    if (mouseEvt=="onmouse"){NavigClick++;dynamicNav();}
}
function dynamicNav(){
    // Dbugg click
    if(NavigClick>1){mytweenPage.stop();}
    if(typeof mytweenPage != 'undefined'){mytweenPage.stop();}
    // On determine la cible
    if(NavigLevel=="ext"){cible="Exterieur";}
    if(NavigLevel=="int"){cible="Interieur";LargeurContenu=7765;}
    // On recupere les positions de la cible
    target_id = document.getElementById(cible);
    // Positions
    targettop = target_id.style.top;
    target_top = parseFloat(targettop);
    targetleft = target_id.style.left;
    target_left = parseFloat(targetleft);
    target_bottom = HauteurContenu-HauteurConteneur+target_top;
    target_right = LargeurContenu-LargeurConteneur+target_left;
    // On determine les extremums
    max_target_top=0;
    min_target_top=(target_top-target_bottom);
    max_target_left=0;
    min_target_left=(target_left-target_right);
    if (cible=="Interieur"){max_target_left=0;min_target_left=-6507;}
    // On cree une boucle pour le panoramique interieur
    if(target_left>=0 && cible=="Interieur" && vecteur=="left"){target_left=-6507;}
    if(target_left<=-6507 && cible=="Interieur" && vecteur=="right"){target_left=0;}
    // On recupere le sens du mouvement
    if (vecteur=="top"){NavigVertical="top";tweenStyle="top";tweenStart=target_top;tweenStop=max_target_top;}
    if (vecteur=="bottom"){NavigVertical="bottom";tweenStyle="top";tweenStart=target_top;tweenStop=min_target_top;}
    if (vecteur=="left"){NavigHorizontal="left";tweenStyle="left";tweenStart=target_left;tweenStop=max_target_left;}
    if (vecteur=="right"){NavigHorizontal="right";tweenStyle="left";tweenStart=target_left;tweenStop=min_target_left;}
    // On determine la vitesse du mouvement
    var vitesse = 12;
    if (vecteur=="top"){timerLoop = ((vitesse*(tweenStop-tweenStart))/6507).toFixed(1);}
    if (vecteur=="bottom"){timerLoop = ((vitesse*(-1*tweenStop+tweenStart))/6507).toFixed(1);}
    if (vecteur=="left"){timerLoop = ((vitesse*(-1*tweenStart+tweenStop))/6507).toFixed(1);}
    if (vecteur=="right"){timerLoop = ((vitesse*(-1*tweenStop+tweenStart))/6507).toFixed(1);}
    
    mytweenPage = new Tween(target_id.style,tweenStyle,Tween.regularEase,tweenStart,tweenStop,timerLoop,'px');
    mytweenPage.onMotionFinished = function(){dynamicNav();};
    mytweenPage.onMotionStarted = function(){document.getElementById('MenuBG').style.display = "none";};
    mytweenPage.start();
}
