function displayVideo(my_video){
//Media('box',"<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0' width='100%' height='100%'><param name='wmode' value='transparent'><param name='movie' value='/Portal_Upload/Files/Videos/video.swf?varvideo="+my_video+"'><param name='quality' value='high'><embed src='/Portal_Upload/Files/Videos/video.swf?varvideo="+my_video+"' quality='high' pluginspage='http://www.macromedia.com/go/getflashplayer' type='application/x-shockwave-flash' width='100%' height='100%' wmode='transparent'></embed></object>");
Media('box',"<param name='flashvars' value='varvideo="+my_video+"' ><embed pluginspage='http://www.macromedia.com/go/getflashplayer' src='/portal_upload/files/videos/video.swf?varvideo="+my_video+"' width='550' height='388' flashvars='varvideo="+my_video+"' type='application/x-shockwave-flash' scale='ShowAll' loop='loop' menu='menu' wmode='Window' quality='high'></embed>");
//document.getElementById('box').style.width='690px';
//document.getElementById('box').style.height='388px';
displayDiv('block');
}

function displayMap(){
Media('box','<iframe width="100%" height="100%" frameborder="0" scrolling="no" marginheight="0" marginwidth="0" src="http://maps.google.fr/maps?f=q&amp;source=s_q&amp;hl=fr&amp;geocode=&amp;q=Pugnac&amp;sll=44.857816,-0.848694&amp;sspn=0.97347,1.705627&amp;ie=UTF8&amp;ll=45.096186,-0.486488&amp;spn=0.088481,0.152607&amp;z=13&amp;iwloc=A&amp;output=embed"></iframe><br /><small><a href="http://maps.google.fr/maps?f=q&amp;source=embed&amp;hl=fr&amp;geocode=&amp;q=Pugnac&amp;sll=44.857816,-0.848694&amp;sspn=0.97347,1.705627&amp;ie=UTF8&amp;ll=45.096186,-0.486488&amp;spn=0.088481,0.152607&amp;z=13&amp;iwloc=A" style="color:#0000FF;text-align:left">Agrandir le plan</a></small>');
displayDiv('block');
}
function displayImage(strImage){
Media('box',"<img src='/portal_upload/images/"+strImage+"' alt='zoom' title='zoom' id='ZoomImage'>");
displayDiv('block');
}

function displayDiv(param){
document.getElementById('box').style.display= param;
document.getElementById('cache').style.display= param;
document.getElementById('fermerBtn').style.display= param; 
if(param == 'block'){
document.getElementById('page').style.zIndex = 1;
document.getElementById('diap_campagne').style.zIndex = 1;
//document.getElementById('page').style.display= 'none';
} else {
//document.getElementById('page').style.display= '';
document.getElementById('page').style.zIndex = 20;
//document.getElementById('box').style.height='550px';
document.getElementById('diap_campagne').style.zIndex = 20;
}
location.href="#menutop";
}

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(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 Media(id, media) 
{ 
    if (document.getElementById) { 
document.getElementById(id).innerHTML = media; 
    } 
} 

function Media(id, media) 
{ 
    if (document.getElementById) { 
document.getElementById(id).innerHTML = media; 
    } 
} 
function OpenW(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=no';
win=window.open(mypage,myname,settings);}

LoadProfil = function(inVAL, inFRAME, inURL)
{
 var aVal = inVAL.split("&");
 for (i = 0; i < aVal.length; i++) {
  oObj = eval("document.forms[0]." + aVal[i].substring(0, aVal[i].indexOf("=")));
  oObj.value = aVal[i].substring(aVal[i].indexOf("=") + 1, aVal[i].length);
 }
 document.forms[0].h_mode.value = 'LoadProfil';
 //document.forms[0].target = inFRAME.substring(inFRAME.lastIndexOf(".") + 1, inFRAME.length);
 document.forms[0].action = inURL;
 document.forms[0].submit();
}

jsTrim = function(inOBJ)
{
  var monTexte = new String("");
  monTexte = inOBJ.value;
  while (monTexte.charAt(0) == ' ') {
    monTexte = monTexte.substring(1,monTexte.length);
  }
  while (monTexte.charAt(monTexte.length - 1) == ' ') {
    monTexte = monTexte.substring(0, (monTexte.length - 1));
  }
  inOBJ.value = monTexte;
}


var newwin;
function launchwin(winurl,winname,winfeatures){
  newwin = window.open(winurl,winname,winfeatures);
  setTimeout('newwin.focus();',250);
};

function goToPage(leMode, laPage, laTarget) {

var i=parseInt(laTarget);
if (laTarget=='') {i = 0};
  document.forms[i].h_mode.value = leMode;
  document.forms[i].action = laPage;
  document.forms[i].submit();
};

function goToCat(leCatId, laTarget) {
var i=parseInt(laTarget);
if (laTarget=='') {i = 0};
  document.forms[i].h_catid.value = leCatId;
};

function goToTopic(leTopId, laTarget) {
var i=parseInt(laTarget);
if (laTarget=='') {i = 0};
  document.forms[i].h_topicid.value = leTopId;
};

function goToTemplate(leTmplId, laTarget) {
var i=parseInt(laTarget);
if (laTarget=='') {i = 0};
  document.forms[i].h_tmplid.value = leTmplId;
};

function goToProfil(leProfil, laTarget) {
var i=parseInt(laTarget);
if (laTarget=='') {i = 0};
  document.forms[i].h_profil.value = leProfil;
};

function goToGroupe(leGroupId, laTarget) {
var i=parseInt(laTarget);
if (laTarget=='') {i = 0};
  document.forms[i].h_groupid.value = leGroupId;
};

function goToModele(leModId, laTarget) {
var i=parseInt(laTarget);
if (laTarget=='') {i = 0};
  document.forms[i].h_modelid.value = leModId;
};

function goToUser(leUserId, laTarget) {
var i=parseInt(laTarget);
if (laTarget=='') {i = 0};
  document.forms[i].h_userid.value = leUserId;
};

function goToMeta(leMetaId, laTarget) {
var i=parseInt(laTarget);
if (laTarget=='') {i = 0};
  document.forms[i].h_metaordre.value = leMetaId;
};


function jsUCase(monItem) {
  var monTexte = "" + monItem.value;
  monItem.value = monTexte.toUpperCase();
};

function switchRadio(rdo, pos, val, rdoStr, parStr, listStr, rdoType) {
  // rdo     : Identifiant radio
  // pos     : Position radio racine
  // val     : Valeur radio racine
  // rdoStr  : Name Input Radio
  // parStr  : Name Hidden Parent
  // listStr : Name List ID
  // rdoType : Type du message Alert
  var myForm = document.forms[1], leRdo, laList, lePar, leTemp, leStr = "", i = 0, leCompteur = 0;
  leRdo = eval("myForm." + rdoStr + rdo);
  if ((leRdo[pos].checked == true) || (rdoType == "CatShared")) {
    lePar = eval("myForm." + parStr + rdo);
    laList = eval("myForm." + listStr);
    leStr = ""
    while (lePar) {
      leStr = leStr + "§" + lePar.value + "§";
      lePar = eval("myForm." + parStr + lePar.value);
    };
    for (i = 0; i < laList.length; i++) {
      if (laList[i].value == rdo) {
        leCompteur = i + 1;
        break;
      }
    };
    if (rdoType!="CatShared") {
    	for (i = leCompteur; i < laList.length; i++) {
      	lePar = eval("myForm." + parStr + laList[i].value);
      	if (leStr.indexOf("§" + lePar.value + "§") != -1) {
	        break;
      	} else {
	        leTemp = eval("myForm." + rdoStr + laList[i].value);
	        leTemp[pos].checked = true;
      	}
    	};
    }	
  } else {
    lePar = eval("myForm." + parStr + rdo);
    leTemp = eval("myForm." + rdoStr + lePar.value);
    if (leTemp) {
      if (leTemp[pos].checked == true) {
        leRdo[pos].checked = true;

        // GESTION ALERTE //
        if (rdoType == "Grp") {
          alert("Vous ne pouvez modifier les droits d\'un groupe si l'un de ses pères est interdit");
        } else {
          alert("Vous ne pouvez modifier les droits d\'une page si l'une de ses pères est interdite");
        }	
      }
    }
  }
};

function autoSelect(fld, slt) {
  // fld : Field de saisie
  // slt : Select de destination
  var myForm = this.document.forms[0], leFld, leSlt, leTxt = "", laTaille = 0, i = 0, j = 0, leTest = "";
  leFld = eval("myForm." + fld)
  leSlt = eval("myForm." + slt)
  leTxt = ("" + leFld.value).toUpperCase();
  laTaille = leTxt.length;
  if (leTxt != "") {
    for (i = 0; i < leSlt.length; i++) {
      leTest = leSlt.options[i].text;
      leTest = (leTest.substring(0, laTaille)).toUpperCase();
      if (leTest == leTxt) {
        for (j = 0; j < leSlt.length; j++) {
          leSlt.options[j].selected = false;
        };
	leSlt.options[i].selected = true;
        break;
      }
    };
  } else {
    for (i = 0; i < leSlt.length; i++) {
      leSlt.options[i].selected = false;
    };
  }
};
function autoSelect2(fld, slt) {
  // fld : Field de saisie
  // slt : Select de destination
  var myForm = this.document.forms[1], leFld, leSlt, leTxt = "", laTaille = 0, i = 0, j = 0, leTest = "";
  leFld = eval("myForm." + fld)
  leSlt = eval("myForm." + slt)
  leTxt = ("" + leFld.value).toUpperCase();
  laTaille = leTxt.length;
  if (leTxt != "") {
    for (i = 0; i < leSlt.length; i++) {
      leTest = leSlt.options[i].text;
      leTest = (leTest.substring(0, laTaille)).toUpperCase();
      if (leTest == leTxt) {
        for (j = 0; j < leSlt.length; j++) {
          leSlt.options[j].selected = false;
        };
	leSlt.options[i].selected = true;
        break;
      }
    };
  } else {
    for (i = 0; i < leSlt.length; i++) {
      leSlt.options[i].selected = false;
    };
  }
};
function switchSelect(slt_1, slt_2, type) {
  // s_1   : le select de depart
  // s_2   : le select arrivee
  // type  : type du switch - 'one' / 'all' - determine le passage
  var myForm = this.document.forms[0], sltFrom, sltTo, uneOption, i = 0, leCompteur = 0;
  sltFrom = eval("myForm." + slt_1);
  sltTo = eval("myForm." + slt_2);
  if (sltFrom.length > 0) {
    if (type == "one") {
      for (i = 0; i < sltFrom.length; i++) {
	if (sltFrom.options[i].selected == true) {
	  leCompteur = 1;
	  break;
	}
      };
      if (leCompteur == 1) {
	leCompteur = 0;
	for (i = 0; i < sltFrom.length; i++) {
	  if (sltFrom.options[i].selected == true) {
	    leCompteur++;
	  }
	};
	for (i = 0; i < leCompteur; i++) {
         if (sltFrom.options[sltFrom.selectedIndex].style.color.toUpperCase() != "#FF0000") {
	  uneOption = new Option(sltFrom.options[sltFrom.selectedIndex].text, sltFrom.options[sltFrom.selectedIndex].value, false, false);
	  sltTo.options[sltTo.length] = uneOption;
	  sltFrom.options[sltFrom.selectedIndex] = null;
         } else {
          uneOption = new Option(sltFrom.options[sltFrom.selectedIndex].text, sltFrom.options[sltFrom.selectedIndex].value, false, false);
          sltFrom.options[sltFrom.length] = uneOption;
          uneOption.style.color = "#FF0000";
          sltFrom.options[sltFrom.selectedIndex] = null;
         }
	};
      } else {
	alert("Il n\'y a pas d\'option(s) sélectionnée(s).");
      }
    } else {
      leCompteur = sltFrom.length;
      for (i = 0; i < leCompteur; i++) {
       if (sltFrom.options[0].style.color.toUpperCase() != "#FF0000") {
	uneOption = new Option(sltFrom.options[0].text, sltFrom.options[0].value, false, false);
	sltTo.options[sltTo.length] = uneOption;
	sltFrom.options[0] = null;
       } else {
	uneOption = new Option(sltFrom.options[0].text, sltFrom.options[0].value, false, false);
	sltFrom.options[sltFrom.length] = uneOption;
        uneOption.style.color = "#FF0000";
	sltFrom.options[0] = null;
       }
      };
    }
  } else {
    alert("Il n\'y a plus d\'options à deplacer dans ce sens.");
  }
};
function switchSelect2(slt_1, slt_2, type) {
  // s_1   : le select de depart
  // s_2   : le select arrivee
  // type  : type du switch - 'one' / 'all' - determine le passage
  var myForm = this.document.forms[1], sltFrom, sltTo, uneOption, i = 0, leCompteur = 0;
  sltFrom = eval("myForm." + slt_1);
  sltTo = eval("myForm." + slt_2);
  if (sltFrom.length > 0) {
    if (type == "one") {
      for (i = 0; i < sltFrom.length; i++) {
	if (sltFrom.options[i].selected == true) {
	  leCompteur = 1;
	  break;
	}
      };
      if (leCompteur == 1) {
	leCompteur = 0;
	for (i = 0; i < sltFrom.length; i++) {
	  if (sltFrom.options[i].selected == true) {
	    leCompteur++;
	  }
	};
	for (i = 0; i < leCompteur; i++) {
         if (sltFrom.options[sltFrom.selectedIndex].style.color.toUpperCase() != "#FF0000") {
	  uneOption = new Option(sltFrom.options[sltFrom.selectedIndex].text, sltFrom.options[sltFrom.selectedIndex].value, false, false);
	  sltTo.options[sltTo.length] = uneOption;
	  sltFrom.options[sltFrom.selectedIndex] = null;
         } else {
          uneOption = new Option(sltFrom.options[sltFrom.selectedIndex].text, sltFrom.options[sltFrom.selectedIndex].value, false, false);
          sltFrom.options[sltFrom.length] = uneOption;
          uneOption.style.color = "#FF0000";
          sltFrom.options[sltFrom.selectedIndex] = null;
         }
	};
      } else {
	alert("Il n\'y a pas d\'option(s) sélectionnée(s).");
      }
    } else {
      leCompteur = sltFrom.length;
      for (i = 0; i < leCompteur; i++) {
       if (sltFrom.options[0].style.color.toUpperCase() != "#FF0000") {
	uneOption = new Option(sltFrom.options[0].text, sltFrom.options[0].value, false, false);
	sltTo.options[sltTo.length] = uneOption;
	sltFrom.options[0] = null;
       } else {
	uneOption = new Option(sltFrom.options[0].text, sltFrom.options[0].value, false, false);
	sltFrom.options[sltFrom.length] = uneOption;
        uneOption.style.color = "#FF0000";
	sltFrom.options[0] = null;
       }
      };
    }
  } else {
    alert("Il n\'y a plus d\'options à deplacer dans ce sens.");
  }
};
function resetSwitch(hid_1, hid_2, slt_1, slt_2, fld_1, fld_2) {
  // hid_1 : Hidden name pour remplir le premier select
  // hid_2 : Hidden name pour remplir le deuxieme select
  // slt_1 : Nom du premier select
  // slt_2 : Nom du deuxieme select
  // fld_1 : Nom du Recherche 1
  // fld_2 : Nom du Recherche 2
  var myForm = this.document.forms[0], i = 0, leCompteur = 0, hid1, hid2, slt1, slt2, tot1, tot2, fld1, fld2;
  
  hid1 = eval("myForm." + hid_1);
  hid2 = eval("myForm." + hid_2);
  slt1 = eval("myForm." + slt_1);
  slt2 = eval("myForm." + slt_2);
  tot1 = eval("myForm." + hid_1 + "_TOT");
  tot2 = eval("myForm." + hid_2 + "_TOT");
  
  leCompteur = slt1.length;
  for (i = 0; i < leCompteur; i++) {
    slt1.options[0] = null;
  };
  if (tot1.value > 0) {
    leCompteur = 0;
    for (i = 0; i < hid1.length; i = i + 3) {
      uneOption = new Option(hid1[i + 1].value, hid1[i].value, false, false);
      slt1.options[leCompteur] = uneOption;
      if (hid1[i + 2].value == document.forms[0].h_groupid.value) {uneOption.style.color = "#FF0000";}
      leCompteur++;
    };
  }

  leCompteur = slt2.length;
  for (i = 0; i < leCompteur; i++) {
    slt2.options[0] = null;
  };
  if (tot2.value > 0) {
    leCompteur = 0;
    for (i = 0; i < hid2.length; i = i + 3) {
      uneOption = new Option(hid2[i + 1].value, hid2[i].value, false, false);
      slt2.options[leCompteur] = uneOption;
      if (hid2[i + 2].value == document.forms[0].h_groupid.value) {uneOption.style.color = "#FF0000";}
      leCompteur++;
    };
  }

  if (fld_1 != "") { 
    fld1 = eval("myForm." + fld_1);
    fld1.value = "";
  }
  if (fld_1 != "") { 
    fld2 = eval("myForm." + fld_2);
    fld2.value = "";
  }

};
function resetSwitch2(hid_1, hid_2, slt_1, slt_2, fld_1, fld_2) {
  // hid_1 : Hidden name pour remplir le premier select
  // hid_2 : Hidden name pour remplir le deuxieme select
  // slt_1 : Nom du premier select
  // slt_2 : Nom du deuxieme select
  // fld_1 : Nom du Recherche 1
  // fld_2 : Nom du Recherche 2
  var myForm = this.document.forms[1], i = 0, leCompteur = 0, hid1, hid2, slt1, slt2, tot1, tot2, fld1, fld2;
  
  hid1 = eval("myForm." + hid_1);
  hid2 = eval("myForm." + hid_2);
  slt1 = eval("myForm." + slt_1);
  slt2 = eval("myForm." + slt_2);
  tot1 = eval("myForm." + hid_1 + "_TOT");
  tot2 = eval("myForm." + hid_2 + "_TOT");
  
  leCompteur = slt1.length;
  for (i = 0; i < leCompteur; i++) {
    slt1.options[0] = null;
  };
  if (tot1.value > 0) {
    leCompteur = 0;
    for (i = 0; i < hid1.length; i = i + 3) {
      uneOption = new Option(hid1[i + 1].value, hid1[i].value, false, false);
      slt1.options[leCompteur] = uneOption;
      if (hid1[i + 2].value == document.forms[0].h_groupid.value) {uneOption.style.color = "#FF0000";}
      leCompteur++;
    };
  }

  leCompteur = slt2.length;
  for (i = 0; i < leCompteur; i++) {
    slt2.options[0] = null;
  };
  if (tot2.value > 0) {
    leCompteur = 0;
    for (i = 0; i < hid2.length; i = i + 3) {
      uneOption = new Option(hid2[i + 1].value, hid2[i].value, false, false);
      slt2.options[leCompteur] = uneOption;
      if (hid2[i + 2].value == document.forms[0].h_groupid.value) {uneOption.style.color = "#FF0000";}
      leCompteur++;
    };
  }

  if (fld_1 != "") { 
    fld1 = eval("myForm." + fld_1);
    fld1.value = "";
  }
  if (fld_1 != "") { 
    fld2 = eval("myForm." + fld_2);
    fld2.value = "";
  }

};
function resetSwitchGrp(hid_1, hid_2, slt_1, slt_2, fld_1, fld_2) {
  // hid_1 : Hidden name pour remplir le premier select
  // hid_2 : Hidden name pour remplir le deuxieme select
  // slt_1 : Nom du premier select
  // slt_2 : Nom du deuxieme select
  // fld_1 : Nom du Recherche 1
  // fld_2 : Nom du Recherche 2
  var myForm = this.document.forms[0], i = 0, leCompteur = 0, hid1, hid2, slt1, slt2, tot1, tot2, fld1, fld2;
  
  hid1 = eval("myForm." + hid_1);
  hid2 = eval("myForm." + hid_2);
  slt1 = eval("myForm." + slt_1);
  slt2 = eval("myForm." + slt_2);
  tot1 = eval("myForm." + hid_1 + "_TOT");
  tot2 = eval("myForm." + hid_2 + "_TOT");
  
  leCompteur = slt1.length;
  for (i = 0; i < leCompteur; i++) {
    slt1.options[0] = null;
  };
  if (tot1.value > 0) {
    leCompteur = 0;
    for (i = 0; i < hid1.length; i = i + 3) {
      uneOption = new Option(hid1[i + 1].value, hid1[i].value, false, false);
      slt1.options[leCompteur] = uneOption;
      if (hid1[i + 2].value != 0) {uneOption.style.color = "#FF0000";}
      leCompteur++;
    };
  }

  leCompteur = slt2.length;
  for (i = 0; i < leCompteur; i++) {
    slt2.options[0] = null;
  };
  if (tot2.value > 0) {
    leCompteur = 0;
    for (i = 0; i < hid2.length; i = i + 3) {
      uneOption = new Option(hid2[i + 1].value, hid2[i].value, false, false);
      slt2.options[leCompteur] = uneOption;
      if (hid2[i + 2].value != 0) {uneOption.style.color = "#FF0000";}
      leCompteur++;
    };
  }

  if (fld_1 != "") { 
    fld1 = eval("myForm." + fld_1);
    fld1.value = "";
  }
  if (fld_1 != "") { 
    fld2 = eval("myForm." + fld_2);
    fld2.value = "";
  }

};
function resetSwitchGrp2(hid_1, hid_2, slt_1, slt_2, fld_1, fld_2) {
  // hid_1 : Hidden name pour remplir le premier select
  // hid_2 : Hidden name pour remplir le deuxieme select
  // slt_1 : Nom du premier select
  // slt_2 : Nom du deuxieme select
  // fld_1 : Nom du Recherche 1
  // fld_2 : Nom du Recherche 2
  var myForm = this.document.forms[1], i = 0, leCompteur = 0, hid1, hid2, slt1, slt2, tot1, tot2, fld1, fld2;
  
  hid1 = eval("myForm." + hid_1);
  hid2 = eval("myForm." + hid_2);
  slt1 = eval("myForm." + slt_1);
  slt2 = eval("myForm." + slt_2);
  tot1 = eval("myForm." + hid_1 + "_TOT");
  tot2 = eval("myForm." + hid_2 + "_TOT");
  
  leCompteur = slt1.length;
  for (i = 0; i < leCompteur; i++) {
    slt1.options[0] = null;
  };
  if (tot1.value > 0) {
    leCompteur = 0;
    for (i = 0; i < hid1.length; i = i + 3) {
      uneOption = new Option(hid1[i + 1].value, hid1[i].value, false, false);
      slt1.options[leCompteur] = uneOption;
      if (hid1[i + 2].value != 0) {uneOption.style.color = "#FF0000";}
      leCompteur++;
    };
  }

  leCompteur = slt2.length;
  for (i = 0; i < leCompteur; i++) {
    slt2.options[0] = null;
  };
  if (tot2.value > 0) {
    leCompteur = 0;
    for (i = 0; i < hid2.length; i = i + 3) {
      uneOption = new Option(hid2[i + 1].value, hid2[i].value, false, false);
      slt2.options[leCompteur] = uneOption;
      if (hid2[i + 2].value != 0) {uneOption.style.color = "#FF0000";}
      leCompteur++;
    };
  }

  if (fld_1 != "") { 
    fld1 = eval("myForm." + fld_1);
    fld1.value = "";
  }
  if (fld_1 != "") { 
    fld2 = eval("myForm." + fld_2);
    fld2.value = "";
  }

};
function resetSwitchColonne(hid_1, slt_1, fld_1) {
  // NB : si multicolonne, exécuter cette fn pour toutes !
  // hid_1 : Hidden name pour remplir le select
  // slt_1 : Nom du elect
  // fld_1 : Nom du Recherche
  var myForm = this.document.forms[0], i = 0, leCompteur = 0, hid1, slt1, tot1, fld1;
  
  hid1 = eval("myForm." + hid_1);
  slt1 = eval("myForm." + slt_1);
  tot1 = eval("myForm." + hid_1 + "_TOT");
  
  leCompteur = slt1.length;
  for (i = 0; i < leCompteur; i++) {
    slt1.options[0] = null;
  };
  if (tot1.value > 0) {
    leCompteur = 0;
    for (i = 0; i < hid1.length; i = i + 3) {
      uneOption = new Option(hid1[i + 1].value, hid1[i].value, false, false);
      slt1.options[leCompteur] = uneOption;
      if (hid1[i + 2].value == document.forms[0].h_groupid.value) {uneOption.style.color = "#FF0000";}
      leCompteur++;
    };
  }

  if (fld_1 != "") { 
    fld1 = eval("myForm." + fld_1);
    fld1.value = "";
  }
};

function resetSwitchColonne2(hid_1, slt_1, fld_1) {
  // NB : si multicolonne, exécuter cette fn pour toutes !
  // hid_1 : Hidden name pour remplir le select
  // slt_1 : Nom du elect
  // fld_1 : Nom du Recherche
  var myForm = this.document.forms[1], i = 0, leCompteur = 0, hid1, slt1, tot1, fld1;
  
  hid1 = eval("myForm." + hid_1);
  slt1 = eval("myForm." + slt_1);
  tot1 = eval("myForm." + hid_1 + "_TOT");
  
  leCompteur = slt1.length;
  for (i = 0; i < leCompteur; i++) {
    slt1.options[0] = null;
  };
  if (tot1.value > 0) {
    leCompteur = 0;
    for (i = 0; i < hid1.length; i = i + 3) {
      uneOption = new Option(hid1[i + 1].value, hid1[i].value, false, false);
      slt1.options[leCompteur] = uneOption;
      if (hid1[i + 2].value == document.forms[0].h_groupid.value) {uneOption.style.color = "#FF0000";}
      leCompteur++;
    };
  }

  if (fld_1 != "") { 
    fld1 = eval("myForm." + fld_1);
    fld1.value = "";
  }
};


function validSwitch(slt) {
  // slt : Select valide
  var myForm = this.document.forms[0], leSlt, i = 0;
  leSlt = eval("myForm." + slt)
  for (i = 0; i < leSlt.length; i++) {
    leSlt.options[i].selected = true;
  };
};
function validSwitch2(slt) {
  // slt : Select valide
  var myForm = this.document.forms[1], leSlt, i = 0;
  leSlt = eval("myForm." + slt)
  for (i = 0; i < leSlt.length; i++) {
    leSlt.options[i].selected = true;
  };
};
function swapAPI(slt, fld) {
  // slt : Select API
  // fld : Field de destination
  var myForm = this.document.forms[0], leSelect, leField, leTemp;
  leSelect = eval("myForm." + slt);
  leField = eval("myForm." + fld);
  if (leSelect.options[leSelect.selectedIndex].value < 0) {
    leField.value = "";
  } else {
    leTemp = eval("myForm.h_Mod_Id_" + leSelect.options[leSelect.selectedIndex].value);
    leField.value = leTemp.value;
  }
};

function swapAPI2(slt, fld) {
  // slt : Select API
  // fld : Field de destination
  var myForm = this.document.forms[1], leSelect, leField, leTemp;
  leSelect = eval("myForm." + slt);
  leField = eval("myForm." + fld);
  if (leSelect.options[leSelect.selectedIndex].value < 0) {
    leField.value = "";
  } else {
    leTemp = eval("myForm.h_Mod_Id_" + leSelect.options[leSelect.selectedIndex].value);
    leField.value = leTemp.value;
  }
};
function FUCase(monItem) {
  // Passage de la premiere lettre en majuscule
  leText = "" + monItem.value;
  if (leText.value + "" != "") {
    monItem.value = (leText.substring(0,1)).toUpperCase() + leText.substring(1,leText.length);
  }
};

function getOrder(prt, ord) {
  // prt : Select contenant le Parent
  // ord : Select de destination
  var myForm = this.document.forms[0], leParent, leOrder, leTemp, i = 0, leCompteur, uneOption;
  leParent = eval("myForm." + prt);
  leOrder = eval("myForm." + ord);
  leCompteur = leOrder.length
  for (i = 1; i < leCompteur; i++) {
    leOrder.options[1] = null;
  };
  leTemp = eval("myForm.h_Parent_Sort_" + leParent.options[leParent.selectedIndex].value.substring(0, leParent.options[leParent.selectedIndex].value.indexOf('|')));
  if (leTemp) {
    if (leTemp.length > 1) {
      leCompteur = leOrder.length;
      for (i = 0; i < leTemp.length; i++) {
        uneOption = new Option('Après ' + leTemp[i].value, leCompteur, false, false);
        leOrder.options[leOrder.length] = uneOption;
        leCompteur++;
      };
    } else {
      uneOption = new Option('Après ' + leTemp.value, leOrder.length, false, false);
      leOrder.options[leOrder.length] = uneOption;
    }
  }
  leOrder.focus();
};
function getOrder2(prt, ord,myid) {
  // prt : Select contenant le Parent
  // ord : Select de destination
  var myForm = this.document.forms[myid], leParent, leOrder, leTemp, i = 0, leCompteur, uneOption;
  leParent = eval("myForm." + prt);
  leOrder = eval("myForm." + ord);
  leCompteur = leOrder.length
  for (i = 1; i < leCompteur; i++) {
    leOrder.options[1] = null;
  };
  leTemp = eval("myForm.h_Parent_Sort_" + leParent.options[leParent.selectedIndex].value.substring(0, leParent.options[leParent.selectedIndex].value.indexOf('|')));
  if (leTemp) {
    if (leTemp.length > 1) {
      leCompteur = leOrder.length;
      for (i = 0; i < leTemp.length; i++) {
        uneOption = new Option('Après ' + leTemp[i].value, leCompteur, false, false);
        leOrder.options[leOrder.length] = uneOption;
        leCompteur++;
      };
    } else {
      uneOption = new Option('Après ' + leTemp.value, leOrder.length, false, false);
      leOrder.options[leOrder.length] = uneOption;
    }
  }
  leOrder.focus();
};
function AfficheMaxi(inHTML, inTITLE) {
 html = '<HTML><HEAD><TITLE>' + inTITLE + '</TITLE></HEAD><BODY LEFTMARGIN=20 MARGINWIDTH=20 TOPMARGIN=20 MARGINHEIGHT=20><CENTER>' + inHTML + '</CENTER></BODY></HTML>';
 var popupImage = window.open('','_blank','toolbar=0,location=0,directories=0,menuBar=0,scrollbars=1,resizable=1,top=100,left=100');
 popupImage.document.open();
 popupImage.document.write(html);
 popupImage.document.close()
};

function checkEmail(myItem, myMsg) {
 if((myItem.value.search(/[A-Za-z0-9_-]*@[A-Za-z0-9_-]*\.[A-Za-z0-9_-]*/gi) == -1) && (myItem.value + "" != "")){
  if (myMsg != "") {
   alert(myMsg);
   myItem.value = "";
  }
  return false;
 } else {
  return true;
 }
};

function checkLength(myItem, myMin, myMax, myMsg) {
 var myLength = parseInt((myItem.value + "").length, 10);
 if (myLength != 0) {
  if (myLength < parseInt(myMin, 10) || myLength > parseInt(myMax, 10)) {
   if (myMsg != "") {
    alert(myMsg);
    myItem.value = "";
   }
   return false;
  } else {
   return true;
  }
 }
};

function doubleCheck(inF, inS) {
 if (inF.value + "" == inS.value + "") {
  return true;
 } else {
  return false;
 }
};