function  confirmSuppression(url,quoi){
   if(quoi == '')
      quoi = "cet élement";

   if(confirm("Etes vous sûr de vouloir supprimer "+ quoi + " ?")){
      location.href=url;
   }
   return false;
}

function confirmDelete(url) {
  if(confirm('Êtes-vous sûr de vouloir supprimer cet élément ?')) {
    document.location.href=''+url;
  }
}

function getElement (nameOrId) {
  if (document.all)
	return eval("document.all." + nameOrId) ;
  else
	return document.getElementById(nameOrId) ;
}

function hide(nr) {
  if (document.getElementById) {
     document.getElementById(nr).style.display = 'none';
  }
  else if (document.layers) {
     document.layers[nr].display = 'none';
  }
  else if (document.all) {
     document.all[nr].style.display = 'none';
  }
}

function show(nr) {
  if (document.getElementById) {
     document.getElementById(nr).style.display = 'block';
  }	 
  else if (document.layers) {
     document.layers[nr].display = 'block';
  }
  else if (document.all) {
     document.all[nr].style.display = 'block';
  }
}

function dateEvent(val,nr) {
  if(val == 1) 
    hide(nr);
  else if(val == 2)
    show(nr);
  else
    hide(nr);	
    
}

function ouvreFenetre(page, largeur, hauteur) {
      var top=(screen.height-hauteur)/2;
      var left=(screen.width-largeur)/2;

      window.open(page, "", "top="+top+",left="+left+",scrollbars=no,menubar=no,toolbar=no,resizable=yes,width=" 
              + largeur + ",height=" + hauteur);
    }

function addLink (label, url) {
  text = ' ' + '<a href="' + url + '" title="' + label + '">' + label + '</a>' + ' ';
  if (document.post.description.createTextRange && document.post.description.caretPos) {
    var caretPos = document.post.description.caretPos;
    caretPos.text = caretPos.text.charAt(caretPos.text.length - 1) == ' ' ? text + ' ' : text;
    document.post.description.focus();
  } 
  else {
    document.post.description.value  += text;
    document.post.description.focus();
  }
}

function storeCaret_post(textEl) {
  if (textEl.createTextRange) textEl.caretPos = document.selection.createRange().duplicate();
}