﻿var currentPosition = 0;
var tabImg = new Array();
function Move(sens) {
    var MarginLeftMini = 900-nbMinis*100;
    
    var currentMarginLeft = parseInt(document.getElementById("Defil").style.marginLeft);
    var newMarginLeft;

    if(sens == "left"){
        currentPosition--;
        
        if(currentPosition < (9-nbMinis))
            currentPosition = 9-nbMinis;
    }
    else{
        currentPosition++;
        
        if(currentPosition > 0)
            currentPosition = 0;
    }
       
   newMarginLeft = 0+(currentPosition*100);
        
   if(newMarginLeft > 0)
        newMarginLeft = 0;
   
   if(newMarginLeft < MarginLeftMini)
        newMarginLeft = MarginLeftMini;
    
    document.getElementById("NumPage").innerHTML = ((currentPosition-1)*-1) + " - " + (((currentPosition-1)*-1)+9)
    
    if(currentPosition == 0)
        document.getElementById("Prev").style.opacity = "0.2";
    else
        document.getElementById("Prev").style.opacity = "1";
        
    if(currentPosition == (9-nbMinis))
        document.getElementById("Next").style.opacity = "0.2";
    else
        document.getElementById("Next").style.opacity = "1";
    
    $("#Defil").animate( { marginLeft:newMarginLeft+"px"}, 300 )
}

function AffichGrd(id){ 
    for(j = 0 ; j < tabImg.length ; j++){
        document.getElementById("photo_"+tabImg[j]).className = "photo alpha";
    }
    document.getElementById("Flash").style.display = "";
    document.getElementById("photo_"+id).className = "photo";
    document.getElementById("Grd").style.backgroundImage="url(/images/collections_bis/grd/"+id+".jpg)";
    $("#Flash").fadeOut("fast");
}