/////////////////////////////////////////////////////////////////
//  POP-UP DE TAILLE PERSONNALISABLE, REDIMENSIONNABLE OU NON  //
/////////////////////////////////////////////////////////////////

function popUp(url, largeur, hauteur, redimensionnable)
{
 H = Math.round((screen.availHeight - hauteur) / 2);
 L = Math.round((screen.availWidth - largeur) / 2);
 window.open(url, "Observatoire de l'art contemporain", "toolbar=0,location=0,directories=0,status=0,scrollbars=yes,resizable="+redimensionnable+",menubar=no,top="+H+",left="+L+",width="+largeur+",height="+hauteur);
}


//////////////////////////////////////////////////////////////
//  SELECTIONNE/DESELECTIONNE TOUTES LES LIGNES DU TABLEAU  //
//////////////////////////////////////////////////////////////

function cocher_decocher_tout(etat)
{
 var casesACocher = document.getElementsByTagName('input');

 for(var indice = 1; indice < casesACocher.length; indice++)
	{
  if(casesACocher[indice].type == 'checkbox')
		{
   casesACocher[indice].checked = etat;
  }
	}
}


////////////////////////////////////////////////////////////////////
//  SELECTIONNE/DESELECTIONNE LA CASE A COCHER TOUT SELECTIONNER  //
////////////////////////////////////////////////////////////////////

function decocher(etat)
{
 if (document.formulaire['selections0'].checked) {
  document.formulaire['selections0'].checked = false;
 }
}


//////////////////////
//  TEST NUMERIQUE  //
//////////////////////

function is_numeric(num)
{
	var exp = new RegExp("^[0-9-.]*$","g");
	return exp.test(num);
}


/////////////////////////
//  MENU DE REROUTAGE  //
/////////////////////////

function menuDeReroutage(targ, selObj, restore)
{
 eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
 if (restore) selObj.selectedIndex=0;
}


////////////////////////////////////////////////////////////
//  AJOUTER L'URL DE LA PAGE AUX FAVORIS DE L'INTERNAUTE  //
////////////////////////////////////////////////////////////

function favoris()
{
 if (navigator.appName != 'Microsoft Internet Explorer')
 {
  window.sidebar.addPanel(document.title, document.URL, "");
 }
 else {
  window.external.AddFavorite(document.URL, document.title);
 }
}


////////////////////////////////////
//  COPIER DANS LE PRESSE-PAPIER  //
////////////////////////////////////

function copierDansLePressePapier(texte)
{
 textRange = document.body.createTextRange();
 textRange.moveToElementText(texte);
 textRange.execCommand("Copy");
}


////////////////////
//  CONFIRMATION  //
////////////////////

function confirmation()
{
 var val = (confirm("Êtes-vous certain de vouloir supprimer ce produit ?")) ? true : false;
 if(val == true)
	{
  document.formulaire.action.value = 'supprimer'; 
  document.formulaire.submit();
	}
}


/////////////////////////////////////
//  COMPTER LES CARACTERES SAISIS  //
/////////////////////////////////////

function compterCaracteres(champ, compteur, limite)
{
 compteur.value = '(' + champ.value.length + '/' + limite + ' caractères conseillés)';
}
