// JavaScript Document
var image= new Array(nbimage);
var imageObj = new Image();
for (i=1; i<(nbimage+1); i++) { 
  image[i] = i+".jpg"; 
  imageObj.src=ImgLocation+image[i];
} 

function open_image(imageURL) { 
  window.open("image.htm?"+imageURL, "Image",  
              "height=200,width=200,location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no"); 
} 

function open_nouvelleimage(image) { 
  document.tableau.Xoffset.value = document.body.scrollTop;			  
  window.open("nouvelleimage.php?filename="+image, "NouvelleImage",  
              "height=140,width=450,location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no"); 
}

function resize_image (y) {
  for (i=(0+NbImgAvantOutil); i<(nbimage+NbImgAvantOutil); i++) {
    $width = document.images[i].width;
    $height = document.images[i].height;
    if ($width <= max && $height <= max) {
		  $new_height = $height;
		  $new_width = $width;
    } else if ($width < $height) {
		  $new_height = max;
		  $new_width = ($width * max) / $height;
		} else if ($width > $height) {
		  $new_width = max;
		  $new_height = ($height * max) / $width;
		} else if ($width = $height) {
		  $new_width = max;
		  $new_height = max;
		}    
	  document.images[i].width = $new_width;
    document.images[i].height = $new_height;

  } 
  window.scrollTo(0, parseInt(document.tableau.Xoffset.value));
  document.tableau.save.value = "";
  layer_wait.style.visibility = "hidden";
  layer_image.style.visibility = "visible";
}

function monter(row) {
  document.tableau.save.value = "monter";
  document.tableau.row.value = row;
  document.tableau.Xoffset.value = document.body.scrollTop;
  document.tableau.submit();
}

function ajouter(row) {
  document.tableau.save.value = "ajouter";
  document.tableau.row.value = row;
  document.tableau.Xoffset.value = document.body.scrollTop;
  document.tableau.submit();
}

function sauvegarder(row) {
  document.tableau.save.value = "sauvegarder";
  document.tableau.row.value = row;
  document.tableau.Xoffset.value = document.body.scrollTop;
  document.tableau.submit();
}

function supprimer(row) {
  document.tableau.save.value = "supprimer";
  document.tableau.row.value = row;
  document.tableau.Xoffset.value = document.body.scrollTop;
  document.tableau.submit();
}

function descendre(row) {
  document.tableau.save.value = "descendre";
  document.tableau.row.value = row;
  document.tableau.Xoffset.value = document.body.scrollTop;
  document.tableau.submit();
}

function modifconfig() {
  document.tableau.save.value = "modifconfig";
  document.tableau.Xoffset.value = document.body.scrollTop;
  document.tableau.submit();
}

function logout() {
  deleteCookie('user', '/', '');
  deleteCookie('pwd', '/', '');
  window.top.location = "http://www.perigold.com/login.php";
}





