/*
var current=0;
var aImages;
var whereIam = "#image-360";
var ratio = 1.0667;

// variable pour l'augmentation et diminution du zoom
var zoomWidth = 400;
var zoomHeight = 0;
var limitBorderx = 0;
var limitBordery = 0;
var centerTop = 0;
var centerLeft = 0;
var imageWidth = 400;
// backup

var centerTop_bk = centerTop;
var centerLeft_bk = centerLeft;
var zoomWidth_bk = zoomWidth;
var zoomHeight_bk = zoomHeight;
var limitBorderx_bk = limitBorderx;
var limitBordery_bk = limitBordery;

 
function moveNext () {

  //alert(current)

	if (current==((pictures.length)-1)) {
		current=0;
	} else {
		current++;
	}
  
	if (zoomWidth == imageWidth){
		jQuery("#image-360").attr("src",url_product_image + '/' + pictures[current]);
	}else{
		jQuery("#image-360").attr("src",url_product_image + '/' + pictures[current]);
	}
	return false;
}

function movePrev () {
	
  //alert(current)
  
  if (current==0) {
		current=((pictures.length)-1);
	} else {
		current--;
	}
  
	if (zoomWidth == imageWidth){
		jQuery("#image-360").attr("src", url_product_image + '/' + pictures[current]);
	}else{
		jQuery("#image-360").attr("src", url_product_image + '/' + pictures[current]);
	}
	return false;
}



function zoomSmall () {
	
	if (zoomWidth > imageWidth) {
		if (zoomWidth == 620 && whereIam == "#image-360"){
			jQuery(whereIam).attr("src", url_product_image + '/' + pictures[current]);
		} 
		
		//On diminue la taille de l'image + on redefinie les limites
		zoomWidth = parseInt(zoomWidth) - 365;
		if (zoomWidth==imageWidth)
			zoomHeight = imageWidth;
		else
			zoomHeight = parseInt(zoomWidth) / ratio;
		limitBorderx = -1 * (parseInt(zoomWidth) - imageWidth);
		limitBordery = -1 * (parseInt(zoomHeight) - 400);

		//On augmente la position du top et left pour un zoom plus 'centrer'
		centerTop = parseInt(jQuery(whereIam).css("top")) + 185;
		centerLeft = parseInt(jQuery(whereIam).css("left")) + 210;
			
		// Animation zoom
		jQuery.updatePositionWhenZoom_hide(whereIam);
		jQuery(whereIam).animate({
			width: zoomWidth, height: zoomHeight, top: centerTop, left: centerLeft
		}, 500, function (){
				jQuery(whereIam).attr({width: zoomWidth, height: zoomHeight});
				jQuery(whereIam).css({top: centerTop, left: centerLeft});
		});

	}
  
  if (zoomWidth == imageWidth) {
    jQuery("#click_and_drag_image").css("display","none");
    if (!current) // if zooming out first image - switch to its original/better quality src
	    jQuery(whereIam).attr("src", url_product_image + '/' + firstImage);
  } 
  
  
	return false;
}

function zoomBig () {
  
	jQuery("#click_and_drag_image").css("display","block");
  
  //alert(current)
  
	if (zoomWidth < 1300) {
		if (zoomWidth == imageWidth && whereIam == "#image-360"){
			jQuery(whereIam).attr("src", url_product_image + '/' + pictures[current]);
		}
		
		// Pour limiter le zoom du mannequin
		if (zoomWidth > 370 && whereIam == "#image-mannequin") {
			//je ne fais rien
		}else {
			//On diminue la taille de l'image + on redefinie les limites
			zoomWidth = parseInt(zoomWidth) + 365;
			zoomHeight = parseInt(zoomWidth) / ratio;
			limitBorderx = -1 * (parseInt(zoomWidth) - imageWidth);
			limitBordery = -1 * (parseInt(zoomHeight) - 400);
			
			//On augmente la position du top et left pour un zoom plus 'centrer'
			centerTop = parseInt(jQuery(whereIam).css("top")) - 185;
			centerLeft = parseInt(jQuery(whereIam).css("left")) - 210;
			
			// Animation zoom
			jQuery(whereIam).animate({
				width: zoomWidth, height: zoomHeight, top: centerTop, left: centerLeft
			}, 500, function (){
				jQuery(whereIam).attr({width: zoomWidth, height: zoomHeight});
				jQuery(whereIam).css({top: centerTop, left: centerLeft});
			});
		}
	}
	return false;
}

function zoomReset () {
	//current = 1;
	limitBorderx = 0;
	limitBordery = 0;
	zoomHeight = 400;
	zoomWidth = 400;
	centerTop = 0;
	centerLeft = 0;
	
	jQuery("#click_and_drag_image").css("display","none");
	
	//jQuery(whereIam).fadeOut(1000);
	
	if (whereIam == "#image-360"){
		jQuery(whereIam).animate({
			width: zoomWidth, height: zoomHeight, top: centerTop, left: centerLeft
		}, 500, function(){
			if (current==0)
				jQuery(this).attr("src", url_product_image + '/' + firstImage)
			else
				jQuery(this).attr("src", url_product_image + '/' + pictures[current])
			jQuery(this).animate({opacity: 'show'},500);
		});
	}	

	return false;
}

function toggleImg(){
	jQuery("#switch_img").toggle(function(){

		// backup des positions tailles du bag
		centerTop_bk = centerTop;
		centerLeft_bk = centerLeft;
		zoomWidth_bk = zoomWidth;
		zoomHeight_bk = zoomHeight;
		limitBorderx_bk = limitBorderx;
		limitBordery_bk = limitBordery;

		//Fade in transition
		jQuery("#image-360").fadeOut(1000);	

		jQuery("#pro_rotate").css("display","none");

		ratio = 1.0667;
		jQuery("#turn_left_link").addClass('turn_left_inactiv');
		jQuery("#turn_right_link").addClass('turn_right_inactiv');
		
		if (zoomWidth == imageWidth) {
			jQuery("#click_and_drag_image").css("display","none");
		}else{
			jQuery("#click_and_drag_image").css("display","block");
		}
		
		return false;
		
	}, function(){
		
		// initialisation des variables du bag
		centerTop = centerTop_bk;
		centerLeft = centerLeft_bk;
		zoomWidth = zoomWidth_bk;
		zoomHeight = zoomHeight_bk;
		limitBorderx = limitBorderx_bk;
		limitBordery = limitBordery_bk;
		
		//Fade in transition
		jQuery("#image-mannequin").fadeOut(1000);	
		jQuery("#image-360").fadeIn(1000, function(){});
		
		jQuery("#pro_rotate").css("display","block");

		ratio = 1.0667;
		whereIam = "#image-360";
		
		if (zoomWidth == imageWidth) {
			jQuery("#click_and_drag_image").css("display","none");
		}else{
			jQuery("#click_and_drag_image").css("display","block");
		}
		
		return false;
	});
}
*/
/*
var zoomBoxWidth = 118;
var zoomBoxHeight = 200;
//product image dimensions
var productImageWidth = 400;
var productImageHeight = 400;



function zoomOut()
{
		jQuery("#zoomBox").css("display","none");
		jQuery("#productZoom").css("display","none");
		jQuery("#productInfoBox").css("display","block");

}

*/