function select_area(){ //v3.0
  formulaire_maj.textfield.select();
}

function select_area2(){ //v3.0
  formulaire_maj.textfield2.select();
}

function stats_cotis() {
  document.form2.submit();
  }

function MM_showHideLayers() { //v9.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3)
  with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

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

function FW_OpenWindow(theURL,features) {
  window.open(theURL,'Detail',features);
}

function changeLibellePhoto(id_photo){
	 openfenetre('../gene/changeLibellePhoto.php?id_photo='+id_photo,'A','400','200','no','center');
}
function FW_open_popup() {
 larg=document.formulaire_maj.largeur_popup2.value;
 haut=document.formulaire_maj.hauteur_popup2.value;
 openfenetre('../ressources/popup/pop_up<? echo $no_popup;?>.php','A',''+larg+'',''+haut+'','no','center')
 }

function FW_open_popup_430(fichier, id_groupe) {
 openfenetre('../gene/editeur.php?fichier='+fichier+'&id_groupe='+id_groupe,'A','700','600','no','center')
}

function MM_popupMsg(msg) { //v1.0
  alert(msg);
}

function openfenetre_red(mypage,myname,w,h,scroll,pos){
  if(pos=="random"){LeftPosition=(screen.width)?Math.floor(Math.random()*(screen.width-w)):100;TopPosition=(screen.height)?Math.floor(Math.random()*((screen.height-h)-75)):100;}
  if(pos=="center"){LeftPosition=(screen.width)?(screen.width-w)/2:100;TopPosition=(screen.height)?(screen.height-h)/2:100;}
  else if((pos!="center" && pos!="random") || pos==null){LeftPosition=0;TopPosition=20}
  settings='width='+w+',height='+h+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',location=no,directories=no,status=no,menubar=no,toolbar=no,resizable=yes';
  win=window.open(mypage,myname,settings);
}

function FW_open_popup_browse(field, id_groupe) {
 openfenetre_red('../in/browse_rep.php?field='+field+'&id_groupe='+id_groupe,'A','300','400','yes','center')
}


function ajout_bandeau() {
	var editeur = tinyMCE.get('ContenuEditeur');
	
	editeur.setContent('<img src="http://www.supoptique.org/images/toplogo_new.gif" /><table width=600><tr><td><font face="Verdana" size=2><br><br>Bonjour |%prenom%|,<br>'+editeur.getContent()+'</font></td></tr></table>');
	document.FormEditeur.images.value='toplogo_new.gif';

	/*
	document.FormEditeur.ContenuEditeur.value='<img src="toplogo_new.gif"><table width=600><tr><td><font face="Verdana" size=2><br><br>Bonjour |%prenom%|,<br>'+document.FormEditeur.ContenuEditeur.value+'</font></td></tr></table>';
	document.FormEditeur.Contenu_texte.value='Bonjour |%prenom%|,\n'+document.FormEditeur.Contenu_texte.value;
	document.FormEditeur.images.value='toplogo_new.gif';
	*/
}

//Fonction pour le menu admin
sfHover = function() {
  var sfEls = document.getElementById("menuAdmin").getElementsByTagName("LI");
  for (var i=0; i<sfEls.length; i++) {
    sfEls[i].onmouseover = function() {
      this.className += " sfhover";
    }
    sfEls[i].onmouseout = function() {
      this.className = this.className.replace(new RegExp(" sfhover\\b"), "");
    }
  }
}

if (window.attachEvent) // propriété spécifique à Internet Explorer !
  window.attachEvent("onload", sfHover);


function fenetre_fiche_entreprise(formulaire) {
   fen = window.open("rech_entreprise.php?number=" + formulaire  , "", "width=550,height=400,scrollbars=yes");
   if (!fen.opener) fen.opener = self;
}

function _body_onload()	{

  SetContext('clients');
  setActiveButtonByName('clients');

  if(document.getElementById('loader'))
    document.body.removeChild(document.getElementById('loader'));
}

function _body_onunload() {

  //Création du calque contenaire pour avoir le fond semi transparent
  var myDiv = document.createElement('DIV');
  myDiv.setAttribute('id','loader');
  myDiv.style.width=document.body.scrollWidth+"px";
  myDiv.style.height=document.body.scrollHeight+"px";
  myDiv.style.padding=(document.documentElement.scrollTop+20)+"px 0";
  myDiv.style.background="transparent url('../images/semi-transparent.gif') left top";

  document.body.appendChild(myDiv);

  //Création du calque de contenu
  var myDiv2 = document.createElement('DIV');
  myDiv2.innerHTML = '<img src="../images/loading.gif" alt="Chargement en cours ..." /> Chargement en cours ...';

  myDiv.appendChild(myDiv2);

}

