


/*****************************************/
/*		   DETECTION FLECHES			 */
/*****************************************/


Event.observe(document, "keydown",
    function(event) {
    	
    	
    	
    	// Fleche Gauche
       if (event.keyCode == 37) {
       	if (currentPhoto!=1) slidePhoto('left');
       }
       
       // Fleche Droite
       if (event.keyCode == 39) {
       if (currentPhoto!=nbImages) slidePhoto('right');
       }
    }); 
 


/*****************************************/
/*		   FONCTION SLIDE				 */
/*****************************************/


var currentPhoto = 1;
var pos_x;

function slidePhoto(direction) {



if (direction == "right") currentPhoto++;
else currentPhoto--;

var pos_x =parseInt($('ngg-image-'+currentPhoto).positionedOffset());



if (currentPhoto == 1) $('btn-left').style.display='none';
else  $('btn-left').style.display='block';



if (currentPhoto == nbImages) $('btn-right').style.display='none';
else $('btn-right').style.display='block';


// Récupère la position X du prochain element


//$('btn'+page).childNodes[0].className='active';

//alert($('ngg-galleryoverview'));

new Effect.Move($('ngg-galleryoverview'),{beforeFinish:function() {},afterFinish:function() {},x:  -pos_x, y: 0, mode: 'absolute',duration: 0.2,transition: Effect.Transitions.sinoidal});

}


/*****************************************/
/*		   DETECTION SOURIS				 */
/*****************************************/

// Detect if the browser is IE or not.
// If it is not IE, we assume that the browser is NS.
var IE = document.all?true:false

// If NS -- that is, !IE -- then set up for mouse capture
if (!IE) document.captureEvents(Event.MOUSEMOVE)

// Set-up to use getMouseXY function onMouseMove


// Temporary variables to hold mouse x-y pos.s
var tempX = 0
var tempY = 0

var interval;

// Main function to retrieve mouse x-y pos.s

function getMouseXY(e) {
	
	
  if (IE) { // grab the x-y pos.s if browser is IE
    tempX = event.clientX + document.body.scrollLeft
    tempY = event.clientY + document.body.scrollTop
  } else {  // grab the x-y pos.s if browser is NS
    tempX = e.pageX
    tempY = e.pageY
  } 
  
  // catch possible negative values in NS4
  if (tempX < 0){tempX = 0}
  if (tempY < 0){tempY = 0}  
  // show the position values in the form named Show
  // in the text fields named MouseX and MouseY
  
   if (interval) clearTimeout(interval);
   
   $('infoBulle').style.display="block";
   $('infoBulle').style.left = (tempX-15)+"px";
   $('infoBulle').style.top =(tempY+15)+"px";

 	interval = setTimeout('hideInfoBulle()','3000');
 	
 }
 
function startCaptureMouse(str) {

$('infoBulleLegende').innerHTML = str;
document.onmousemove = getMouseXY;
}


function stopCaptureMouse() {
hideInfoBulle();
$('infoBulleLegende').innerHTML = '';
document.onmousemove = function() {return false;};
}

function hideInfoBulle() {
$('infoBulle').style.display="none";
//$('infoBulle').fade({duration:1});
if (interval) clearTimeout(interval);
}
