//****************************************************************************//
//  NE PAS SAISIR LES BALISES JAVASCRIPT
//****************************************************************************//

// ******* OUVERTURE D'UNE POPup CENTREE
function PopupCentrer(page,largeur,hauteur,options) {
var top=(screen.height-hauteur)/2;
var left=(screen.width-largeur)/2;
window.open(page,"","top="+top+",left="+left+",width="+largeur+",height="+hauteur+","+options);
}
//appelle de la fonction :
//<a HREF='javascript:PopupCentrer("popup.php",".$largeur.",".$hauteur.","menubar=no,scrollbars=no,statusbar=no")'>lien</a>


//******** VALIDATION DE FORMULAIRE
function check_form(form)
{
return_boolean = true
 obj = eval(form)
 for(i=0;i<obj.length;i++)
 {
  field_name = obj.elements[i].name;
  if (field_name.indexOf("_ck") != -1)
  {
    if (obj.elements[i].value == "")
    {
      obj.elements[i].style.backgroundColor = "red";
      return_boolean = false
    }
    else
    {
      obj.elements[i].style.backgroundColor = "white";
    }
  }
 } 
 if ( return_boolean == false){
alert("veuillez remplir les champs obligatoires (*)")
 }
return return_boolean;
}

// name="nom_ck"
//onsubmit="return check_form(this)"

//******* FONCTION PERMETTANT DE DEMANDER LA CONFIRMATION D'UNE SUPPRESSION
function validSup(message, url)
{
 var where_to= confirm(message);
	 if (where_to== true)
	 {
		top.location = url;
	}else{
		return false;
	}
}

function resizePopUp(monImage, monTitre)
{
    
  w = window.open('','chargement','width=10,height=10');
  w.document.write( "<html><head><title>"+monTitre+"</title>\n" ); 
  w.document.write( "<script language='JavaScript'>\n"); 
  w.document.write( "IE5=NN4=NN6=false;\n"); 
  w.document.write( "if(document.all)IE5=true;\n"); 
  w.document.write( "else if(document.getElementById)NN6=true;\n"); 
  w.document.write( "else if(document.layers)NN4=true;\n"); 
  w.document.write( "function autoSize() {\n"); 
  w.document.write( "if(IE5) self.resizeTo(document.images[0].width+10,document.images[0].height+31)\n"); 
  w.document.write( "else if(NN6) self.sizeToContent();\n");
  w.document.write( "else window.resizeTo(document.images[0].width,document.images[0].height+20)\n"); 
  w.document.write( "self.focus();\n"); 
  
  // debut modification par franck pour le centrage
  w.document.write( "autoMove();\n"); 
  w.document.write( "}\n"); 
  w.document.write( "function autoMove() {\n"); 
  w.document.write( "var h = document.images[0].width;\n"); 
  w.document.write( "var l = document.images[0].height;\n"); 
  w.document.write( "var PosX = ( screen.availWidth - h ) / 2;\n"); 
  w.document.write( "var PosY = ( screen.availHeight - l ) / 2;\n"); 
  w.document.write( "window.moveTo(PosX, PosY);\n"); 
  // fin modification pour le centrage
  
  w.document.write( "}\n</scri");
  w.document.write( "pt>\n"); 
  w.document.write( "</head><body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 onLoad='javascript:autoSize();'>" );
  w.document.write( "<a href='javascript:window.close();'><img src='"+monImage+"' border=0 alt='"+monTitre+"'></a>" ); 
  w.document.write( "</body></html>" );
  w.document.close(); 
}