var temp;

var temp1 = 0;
var temp2 = 0;
var temp3 = 0;
var temp4 = 0;
var temp5 = 0;
var temp6 = 0;
	function go_signin() {
	if (temp1 == 0) {Effect.BlindDown('open_signin'); temp1 = 1;}
	else if (temp1 == 1) {Effect.BlindUp('open_signin'); temp1 = 0;}
	}

	function go_news() {
	if (temp2 == 0) {Effect.BlindDown('open_news'); temp2 = 1;}
	else if (temp2 == 1) {Effect.BlindUp('open_news'); temp2 = 0;}
	}

	function go_account() {
	if (temp3 == 0) {Effect.BlindDown('open_account'); temp3 = 1;}
	else if (temp3 == 1) {Effect.BlindUp('open_account'); temp3 = 0;}
	}

	function open_brand() {
	if (temp4 == 0) {
	if (temp5 == 1) {Effect.BlindUp('open_pers'); temp5 = 0;}
	if (temp6 == 1) {Effect.BlindUp('open_achat'); temp6 = 0;}
	Effect.BlindDown('open_brand'); temp4 = 1;}
	}

	function open_pers() {
	if (temp5 == 0) {
	if (temp4 == 1) {Effect.BlindUp('open_brand'); temp4 = 0;}
	if (temp6 == 1) {Effect.BlindUp('open_achat'); temp6 = 0;}
	Effect.BlindDown('open_pers'); temp5 = 1;}
	}
	
			function open_achat() {
	if (temp6 == 0) {
	if (temp4 == 1) {Effect.BlindUp('open_brand'); temp4 = 0;}
	if (temp5 == 1) {Effect.BlindUp('open_pers'); temp5 = 0;}
	Effect.BlindDown('open_achat'); temp6 = 1;}
	}

var temp6 = 0;
function account_over()
{
if (temp6 == 0) {Effect.BlindDown('open_account'); temp6 = 1;}
}

function account_out()
{
if (temp6 == 1) {Effect.BlindUp('open_account'); temp6 = 0;}
}

window.load=cache('amenu');
function montre(id) {
var d = document.getElementById(id);
if (d) {d.style.display='block';}
}

function cache(id) {
var d = document.getElementById(id);
if (d) {d.style.display='none';}
}

function	flush_photo(id)
{
document.getElementById(id).value = "";
alert('Your photo is going to be deleted, if you are sure please apply !');
}

function	flush_event(id)
{
document.getElementById(id).value = "";
alert('Your event is going to be deleted, if you are sure please apply !');
}

function total() {

  for(i=0; i<document.getElementsByTagName('p').length; i++){

     document.getElementsByTagName('p').item(i).innerHTML;
     document.getElementsByTagName('p').item(i).style.color;
  }
}

function redimImage(inImg, inMW, inMH)
{
  // Cette function recoit 3 parametres
  // inImg : Chemin relatif de l'image
  // inMW  : Largeur maximale
  // inMH   : Hauteur maximale
  var maxWidth = inMW;
  var maxHeight = inMH;
  // Declarations des variables "Nouvelle Taille"
  var dW = 0;
  var dH = 0;
  // Declaration d'un objet Image
  var oImg = new Image();
  // Affectation du chemin de l'image a l'objet
  oImg.src = inImg;
  // On recupere les tailles reelles
  var h = dH = oImg.height;
  var w = dW = oImg.width;
  // Si la largeur ou la hauteur depasse la taille maximale
  if ((h >= maxHeight) || (w >= maxWidth)) {
    // Si la largeur et la hauteur depasse la taille maximale
    if ((h >= maxHeight) && (w >= maxWidth)) {
      // On cherche la plus grande valeur
      if (h > w) {
        dH = maxHeight;
        // On recalcule la taille proportionnellement
        dW = parseInt((w * dH) / h, 10);
      } else {
        dW = maxWidth;
        // On recalcule la taille proportionnellement
        dH = parseInt((h * dW) / w, 10);
      }
    } else if ((h > maxHeight) && (w < maxWidth)) {
      // Si la hauteur depasse la taille maximale
      dH = maxHeight;
        // On recalcule la taille proportionnellement
      dW = parseInt((w * dH) / h, 10);
    } else if ((h < maxHeight) && (w > maxWidth)) {
      // Si la largeur depasse la taille maximale
      dW = maxWidth;
        // On recalcule la taille proportionnellement
      dH = parseInt((h * dW) / w, 10);
    }
  }
  // On ecrit l'image dans le document
  document.writeln("<img src=\"" + inImg + "\" width=\"" + dW + "\" height=\"" + dH + "\" border=\"0\">");
};

function  delete_img(id)
{
	var answer = confirm("You are sure ?")
	if (answer){
		use_form_ajax('', '/box/act/deletephotos/id/'+id+'/', '7', '', '');
	}
	else{
	}
}

