var browserCode = navigator.appCodeName;
var browserAgent = navigator.userAgent;
var browserName =  navigator.appName;
var browserVersion =  parseFloat(navigator.appVersion);
var browserPlatform = navigator.platform;
var browserOkForEditor = (browserPlatform == "Win32" && browserName == "Microsoft Internet Explorer" && browserVersion >= 4);
// var browserOkForApplication=(browserPlatform == "Win32" && browserName == "Microsoft Internet Explorer" && browserVersion >= 4 &&  browserAgent.indexOf("Opera") == -1);
var browserOkForApplication=(browserName == "Microsoft Internet Explorer" && browserVersion >= 4 &&  browserAgent.indexOf("Opera") == -1);

var zoomInFactor=1.2;
var zoomOutFactor=0.8;

// name - name of the cookie
// value - value of the cookie
// [expires] - expiration date of the cookie (defaults to end of current session)
// [path] - path for which the cookie is valid (defaults to path of calling document)
// [domain] - domain for which the cookie is valid (defaults to domain of calling document)
// [secure] - Boolean value indicating if the cookie transmission requires a secure transmission
// * an argument defaults when it is assigned null as a placeholder
// * a null placeholder is not required for trailing omitted arguments
function setCookie(name, value, expires, path, domain, secure) {
  var curCookie = name + "=" + escape(value) +
      ((expires) ? "; expires=" + expires.toGMTString() : "") +
      ((path) ? "; path=" + path : "") +
      ((domain) ? "; domain=" + domain : "") +
      ((secure) ? "; secure" : "");
  document.cookie = curCookie;
}

// name - name of the desired cookie
// * return string containing value of specified cookie or null if cookie does not exist
function getCookie(name) {
  var dc = document.cookie;
  var prefix = name + "=";
  var begin = dc.indexOf("; " + prefix);
  if (begin == -1) {
    begin = dc.indexOf(prefix);
    if (begin != 0) return null;
  } else
    begin += 2;
  var end = document.cookie.indexOf(";", begin);
  if (end == -1)
    end = dc.length;
  return unescape(dc.substring(begin + prefix.length, end));
}

// name - name of the cookie
// [path] - path of the cookie (must be same as path used to create cookie)
// [domain] - domain of the cookie (must be same as domain used to create cookie)
// * path and domain default if assigned null or omitted if no explicit argument proceeds
function deleteCookie(name, path, domain) {
  if (getCookie(name)) {
    document.cookie = name + "=" +
    ((path) ? "; path=" + path : "") +
    ((domain) ? "; domain=" + domain : "") +
    "; expires=Thu, 01-Jan-70 00:00:01 GMT";
  }
}

// date - any instance of the Date object
// * hand all instances of the Date object to this function for "repairs"
function fixDate(date) {
  var base = new Date(0);
  var skew = base.getTime();
  if (skew > 0)
    date.setTime(date.getTime() - skew);
}

Array.prototype.inArray = function (value){
// Returns true if the passed value is found in the
// array.  Returns false if it is not.
	var i;
	for (i=0; i < this.length; i++) {
		if (this[i] === value) {
			return true;
		}
	}
	return false;
}


function loadFrames(page1, page2) {
framecode = "<frameset rows='90%,10%'>"
+ "<frame src='" + page1 + "'>"
+ "<frame src='" + page2 + "'>"
+ "</frameset>";

page = window.open("");
page.document.open();
page.document.write(framecode);
page.document.close();
}

function changeRepertoire() {
if (document.forms[0].typelien[0].checked){
  document.forms[0].repertoireLiens.value = document.forms[0].repertoirePDF.value;
} else {
  document.forms[0].repertoireLiens.value = document.forms[0].repertoirePublications.value;
}
 return true;
}


function showList(fname,wname,wattr) {
 sList = window.open(fname,wname,wattr);
  }

function remLink() {
 if (window.sList && window.sList.open && !window.sList.closed)
  window.sList.opener = null; }


function MM_goToURL() { //v3.0
  var i, args=MM_goToURL.arguments; document.MM_returnValue = false;
  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
}

function MM_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

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.0
  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 && document.getElementById) x=document.getElementById(n); return x;
}

function MM_showHideLayers() { //v3.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 MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i>a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.0
  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 && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}


function newImage(arg) {
        if (document.images) {
                rslt = new Image();
                rslt.src = arg;
                return rslt;
        }
}

function changeImages() {
        if (document.images && (preloadFlag == true)) {
                for (var i=0; i<changeImages.arguments.length; i+=2) {
                        document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
                }
        }
}

var preloadFlag = false;
function preloadImages() {
        if (document.images) {
                openfile_over = newImage("images/openfile-over.gif");
                openfile_down = newImage("images/openfile-down.gif");
                preloadFlag = true;
        }
}

function emailOk(address) {
  if ((address.indexOf ('@') == -1)
    || (address.indexOf ('.') == -1)){
      return false;
  }
  return true;
}

function check_email(address) {
	if (address == ""){
		return true;
	} else {
	if ((address.indexOf ('@') == -1)
		|| (address.indexOf ('.') == -1))
		return false;
	}
	return true;
}

function check_phone(checkStr) {
  var checkOK = "0123456789.-()- \t\r\n\f";
  var allValid = true;
  for (i = 0;  i < checkStr.length;  i++)
  {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length)
    {
      allValid = false;
      break;
    }
  }
return allValid;
}

function not_empty(text) {
  return (text.length > 0); // returns false if empty
}

function removeSlashes(entry){
	var out="\\";
	var add="";
	var pos;
	var temp = "" + entry; // temporary holder
	while (temp.indexOf(out)>-1) {
		pos= temp.indexOf(out);
		temp = "" + (temp.substring(0, pos) + add +
		temp.substring((pos + out.length), temp.length));
	}
	return temp;
}

function validateForm() {
	validity = true; // assume valid	
	for (var i = 0; i<document.forms[0].elements.length; i++) {
	if (document.forms[0].elements[i].name!="")
		if ((document.forms[0].elements[i].validate) && 
			(document.forms[0].elements[i].name=='courriel') && 
			(not_empty(document.forms[0].elements[i].value)) && 
			(!check_email(document.forms[0].elements[i].value))){
			var prompt = removeSlashes(document.forms[0].elements[i].prompt+' '+document.forms[0].elements[i].value);
			alert(prompt);
			document.forms[0].elements[i].focus();
			return false;
		} else
		if ((!not_empty(document.forms[0].elements[i].value)) && (document.forms[0].elements[i].name!='courriel') &&  
		    (document.forms[0].elements[i].validate) && (document.forms[0].elements[i].type!="BUTTON") && (document.forms[0].elements[i].type!="RESET"))  {
			var prompt = removeSlashes(document.forms[0].elements[i].prompt);
			alert(prompt);
			document.forms[0].elements[i].focus();
			return false;
		} 
	}
  document.forms[0].submit();
}

var text = "";

function ConvertBR(input) {
// Converts carriage returns
// to <BR> for display in HTML

var output = "";
for (var i = 0; i < input.length; i++) {
if ((input.charCodeAt(i) == 13) && (input.charCodeAt(i + 1) == 10)) {
i++;
output += "<BR>";
} else {
output += input.charAt(i);
   }
}
return output;
}


function getActiveText(attribute,field,ot,ot2,sel,ahref,exwin) {
// Sets text MSIE or Netscape active
// text based on browser, puts text in form

if (ot.value=="") {
 ot.value=field.value;
 ot2.value=field.value;
}

if ((navigator.appName=='Microsoft Internet Explorer')
   && (navigator.platform=='Win32')) {
text = (document.all) ? document.selection.createRange().text :
 document.getSelection();
}
else
{
text=sel.value;
}

alltext = field.value;
if (text.length==0){return false;}

if (attribute=="bold") {
  ntext="<b>" + text + "</b>";
} else
 if (attribute=="italic") {
  ntext="<i>" + text + "</i>";
 } else
    if (attribute=="li") {
     ntext="<li>" + text;
     } else
      if (attribute=="nobr") {
       ntext="<nobr>" + text + "</nobr>";
    } else
     if (attribute=="h1") {
      ntext="<h1>" + text + "</h1>";
      } else
      if (attribute=="h2") {
       ntext="<h2>" + text + "</h2>";
      } else
       if (attribute=="h3") {
        ntext="<h3>" + text + "</h3>";
       } else
        if (attribute=="h4") {
         ntext="<h4>" + text + "</h4>";
        } else
         if (attribute=="h5") {
          ntext="<h5>" + text + "</h5>";
         } else
          if (attribute=="center") {
           ntext="<p align=center>" + text + "</p>";
          } else
          if (attribute=="left") {
           ntext="<p align=left>" + text + "</p>";
          } else
          if (attribute=="right") {
           ntext="<p align=right>" + text + "</p>";
          } else
          if (attribute=="size") {
           var aSize = ahref.value;
           if (isNaN(aSize) || (aSize.length==0)) {
            return false;
           } else {ntext="<font size="+ aSize +">" + text + "</font>";
           }
          } else
          if (attribute=="ahref") {
           var hrname = ahref.value;
           if (hrname.substring(0,3)=="www") {hrname="http://"+hrname;}
           if (exwin.checked) {
             ntext = "<a href=\"javascript:;\" onClick="+"MM_openBrWindow('" + hrname +"','lienexterne','toolbar=yes,location=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width=500,height=400')"+">" + text + "</a>";
           } else {
             ntext="<a href='../admindb/%22%20%2B%20hrname%20%2B%20%22'>" + text + "</a>";
           }

          } else
           if (attribute=="mailto") {
            var mname = ahref.value;
            ntext = "<a href='mailto:" + mname + "'>" + text + "</a>";
           }

text2 = replaceString(text,ntext,alltext);
field.value = text2;
ahref.focus();
field.blur();

return true;
}

function setSelection(sel) {
// Sets text MSIE or Netscape active
// text based on browser, puts text in form

 sel.value = (document.all) ? document.selection.createRange().text :
 document.getSelection();

 }

function delHTML(HTMLWord)
{
 a = HTMLWord.indexOf("<");
 b = HTMLWord.indexOf(">");
 HTMLlen = HTMLWord.length;
 c = HTMLWord.substring(0, a);
 if(b == -1) b = a;
 d = HTMLWord.substring((b + 1), HTMLlen);
 Word = c + d;
 tmp = Word.indexOf("<");
 if(tmp != -1) Word = delHTML(Word);
 return Word;
}
 


function transferFormValues(){
alert(arguments.length);
 if (arguments.length>0){
  for (i=0;i<arguments.length;i++){
	tempf='temp'+arguments[i];
alert(tempf);
	tempf1=eval('document.forms[0].'+tempf);
alert(tempf1);
	f=eval('document.forms[0].'+arguments[i]);
alert(f);
	f.value=tempf1.value;
  }
 } 
}

function transferFormValues0(){
 if (arguments.length>0){
 for (i=0;i<arguments.length;i=i+2){
  arguments[i+1].value=arguments[i].value;
  }
 } 
}



function replaceChars(entry,out,add) {
// in string entry, replace out with add
// replaceChars(aString,"a","z")

temp = "" + entry; // temporary holder
while (temp.indexOf(out)>-1) {
pos= temp.indexOf(out);
temp = "" + (temp.substring(0, pos) + add +
temp.substring((pos + out.length), temp.length));
}
document.forms[0].descriptif.value = temp;
}

function cleanupAllHTML(field) {
 field.value = delHTML(field.value);
return true;
}

function cleanupString(field,ot,ot2,sel,ahref) {
if (field.value!=ot2.value)
{
  if (ot.value!="") {
  field.value = ot.value;
  ot.value="";
  ahref.focus();
  field.blur();
  }
}
return true;
}


function replaceString(oldS,newS,fullS) {
// Replaces oldS with newS in the string fullS
var occ=0;
   for (var i=0; i<fullS.length; i++) {
      if (fullS.substring(i,i+oldS.length) == oldS) {
         occ = occ + 1;
         j = i - 16;
         if (j>0) {j=0;}
         k = i+newS.length+16;
         if (k>fullS.length){k=fullS.length;}
     fullS0 = fullS.substring(j,i) + " >>>>>" + newS + "<<<<< " + fullS.substring(i+oldS.length,k);
     // if (approveModification(fullS.substring(0,i),newS,fullS.substring(i+oldS.length,fullS.length))){
     if (confirm("Remplacer" + makeQuestion(occ) + "occurence de : \n" + fullS0 + "?")) {
         fullS = fullS.substring(0,i) + newS + fullS.substring(i+oldS.length,fullS.length);
         i=i+newS.length+1;
         }

      }
   }
return fullS
}

function cleanString(oldS,newS,fullS) {
// Replaces oldS with newS in the string fullS
var occ=0;
   for (var i=0; i<fullS.length; i++) {
      if (fullS.substring(i,i+oldS.length) == oldS) {
         occ = occ + 1;
         tempS = " _ " + newS;
     fullS0 = fullS.substring(0,i) + tempS + fullS.substring(i+oldS.length,fullS.length);
     if (confirm("Remplacer" + makeQuestion(occ) + "occurence de : \n" + fullS0 + "?")) {
         fullS = fullS.substring(0,i) + newS + fullS.substring(i+oldS.length,fullS.length);
         i=i-oldS.length;
         }

      }
   }
return fullS
}

function makeQuestion(occ){
 items = new Array(13)
  items[0]='';
  items[1]=' la première ';
  items[2]=' la seconde ';
  items[3]=' la troisième ';
  items[4]=' la quatrième ';
  items[5]=' la cinquième ';
  items[6]=' la sixième ';
  items[7]=' la septième ';
  items[8]=' la huitième ';
  items[9]=' la neuvième ';
  items[10]=' la dixième ';
  items[11]=' la onzième ';
  items[12]=' la douzième ';
  items[13]=' cette ';

// alert("occ = " + occ);

 if ((occ>=1) && (occ<13)) {
  return items[occ];
 } else {
   return items[13];
  }

}


 function voirHTML(txt){
 var w = window.open("","resultat","resizable,scrollbars,status,width=500,height=400");
 var d = w.document;
 d.writeln("<html>");
 d.writeln("<head>");
 d.writeln("<title>Visionnement du résultat</title>");
 d.writeln("<meta http-equiv='Content-Type' content='text/html; charset=iso-8859-1'>");
 d.writeln("<link rel='stylesheet' href='stylesheet.css' type='text/css'>");
 d.writeln("<SCRIPT LANGUAGE=\"JavaScript\">");
 d.writeln("<!-- Begin");
 d.writeln("function MM_openBrWindow(theURL,winName,features) { //v2.0");
 d.writeln("  window.open(theURL,winName,features);");
 d.writeln("}");
 d.writeln("//  End -->");
 d.writeln("</script>");
 d.writeln("</head>");
 d.writeln("<body>");
 d.writeln("<TABLE WIDTH=\"100%\" BORDER=\"0\" CELLSPACING=\"0\" CELLPADDING=\"0\" HEIGHT=\"100%\">");
 d.writeln("  <TR>");
 d.writeln("    <TD HEIGHT=\"90%\" ALIGN=\"LEFT\" VALIGN=\"TOP\">");
 d.writeln(""+ConvertBR(txt)+"");
 d.writeln("</TD>");
 d.writeln("  </TR>");
 d.writeln("  <TR>");
 d.writeln("    <TD ALIGN=\"CENTER\" VALIGN=\"BOTTOM\">");
 d.writeln("<hr>");
 d.writeln("	  <center><INPUT TYPE=\"BUTTON\"  class=\"normal\"name=\"fermer\" value=\"Fermer\" align=\"middle\" onClick=\"window.close()\"></center>");
 d.writeln(" 	</TD>");
 d.writeln("  </TR>");
 d.writeln("</TABLE>");
 
 d.writeln("</body>");
 d.writeln("</html>");
 d.close();
 return true;
}



function openEditor(id){

if(browserOkForEditor) {
 var url= 'editor.php?idEnreg='+id;
 window.open(url,"Editor","titlebar=no,resizable,scrollbars,width=800,height=600");
 } else {
 var url= 'editor2.php?idEnreg='+id;
 window.open(url,"Editor","titlebar=no,resizable=no,scrollbars=no,width=798,height=598");
 }

}


var isns4 = (document.layers);
var isie4 = (document.all && !document.getElementById);
var isie5 = (document.all && document.getElementById);
var isns6 = (!document.all && document.getElementById);

function showMyLayer(id){
 // Netscape 4
 if(isns4){
 document.layers[id].visibility = "show";
 }
 // Explorer 4
 else if(isie4){
 document.all[id].style.visibility = "visible";
 }
 // W3C - Explorer 5+ and Netscape 6+
 else if(isie5 || isns6){
 document.getElementById(id).style.visibility = "visible";
 }
}

function hideMyLayer(id){
 // Netscape 4
 if(isns4){
 document.layers[id].visibility = "hide";
 }
 // Explorer 4
 else if(isie4){
 document.all[id].style.visibility = "hidden";
 }
 // W3C - Explorer 5+ and Netscape 6+
 else if(isie5 || isns6){
 document.getElementById(id).style.visibility = "hidden";
 }
}
function printframe() {
window.parent.data.focus();
window.print();
}


var p;
var p1;
var plen; 
function TrackCount(fieldObj,maxChars)
{
  
  var l = fieldObj.value.length;
  var diff = maxChars - l;
  var s = fieldObj.value;

  // Need to check & enforce limit here also in case user pastes data
  if (diff < 0)
  {
    fieldObj.value = fieldObj.value.substring(0,maxChars);
    diff = maxChars - fieldObj.value.length;
  }
	if ((l>4) && (s.charAt(4) != "-")) {
	 s = s.substring(0,4) + "-" + s.substring(4,l);
	 fieldObj.value = s;
	}
    l = s.length;
	if ((l>7) && (s.charAt(7) != "-")) {
	 s = s.substring(0,7) + "-" + s.substring(7,l);
	 fieldObj.value = s;
	}
    l = s.length;
	if ((l>11) && (s.charAt(11) != "-")) {
	 s = s.substring(0,11) + "-" + s.substring(11,l);
	 fieldObj.value = s;
	}
  s = fieldObj.value;
  if (s.length > maxChars) {
   fieldObj.value = s.substring(0,maxChars);
  }
}

function validateCode(){
	p=document.forms[0].nsn.value;
	if (p.length < plen) { // 4 < 5
		var l = p.length;
		var s1 = p.charAt(l-1);
		var d5 = s1.indexOf('-');	
		if(d5 != -1){
			document.forms[0].nsn.value="";
			document.forms[0].nsn.value=p.substring(0,l-1);
		}
		plen = p.length-1;
	}
	else
	{
		// format 1234-12-123-1234
		//        0123456789012345  
		if(p.length==4){
			pp=p;
			d5=p.indexOf('-')
			if(d5==-1){
				pp=pp+"-";
			}
			document.forms[0].nsn.value="";
			document.forms[0].nsn.value=pp;
		}
		if ((p.length==7) || (p.length==11)) {
			pp=p;
			pp=pp+"-";
			document.forms[0].nsn.value="";
			document.forms[0].nsn.value=pp;
		}
		plen = p.length;
	} // else
	setTimeout(validateCode,100)
}

function getIt(m){
  p1=m
  validateCode()
}

function testphone(obj1){
  p=obj1.value
  p=p.replace("-","")
  if (isNaN(p)==true){
    alert("Check value");
  return false;
  }
}



function modelesswin(url,mwidth,mheight,mxpos,mypos){
if (document.all&&window.print) //if ie5
eval('window.showModelessDialog(url,"recherche","help:0;status:no;resizable:1;scrollbars:no;center:no;dialogWidth:'+mwidth+'px;dialogHeight:'+mheight+'px;dialogTop:'+mypos+'px;dialogLeft:'+mxpos+'px")')
else
eval('window.open(url,"recherche","width='+mwidth+'px,height='+mheight+'px,status=no,resizable=0,status=no,scrollbars=no")')
}
function MM_callJS(jsStr) { //v2.0
  return eval(jsStr)
}



function positionTo(x,y) {
 var intTopPos = 0;
 var intLeftPos= 0;
 x=0;y=0;
 if(window.screenY)
   {
    if(document.layers)
    {
     var intTopPos = window.screenY + y;
     var intLeftPos= window.screenX + x;
    }
    else
    {
     var intTopPos = window.screenY + y;
     var intLeftPos= window.screenX + x;
    }
   }

   if(window.screenTop)
   {
    var intTopPos = window.screenTop + y;
    var intLeftPos= window.screenLeft + x;
   }
   if (confirm('intTopPos='+intTopPos+' intLeftPos='+intLeftPos)) self.moveTo(intLeftPos,intTopPos); 
}

function openBrWindow(fname, wname, width, height, x, y, scroll, aParent ){
	if(x == null) var x = 0;
	if(y == null) var y = 0;
	var intTopPos = 0;
	var intLeftPos= 0;

	if (aParent == null) {aParent = '';} else {aParent = '.'+aParent;}
	var obj = eval('window'+aParent);

	var w = 640, h = 480;
	if (document.layers) {
    	w = window.innerWidth;
	    h = window.innerHeight;
	} else {
	    w = document.body.clientWidth;
	    h = document.body.clientHeight;
	}

	if (x==0) x=(w/2)-(width/2);
	if (y==0) y=(h/2)-(height/2);
	if(obj.screenY){
		if(document.layers){
			var intTopPos = obj.screenY + y;
			var intLeftPos= obj.screenX + x;
		} else {
			var intTopPos = obj.screenY + y;
			var intLeftPos= obj.screenX + x;
		}
	}
	if(obj.screenTop) {
		var intTopPos = obj.screenTop + y;
		var intLeftPos= obj.screenLeft + x;
	}
	var scrollbars='no';
	if (scroll) scrollbars='yes'; 
	args='resizable=yes,scrollbars='+scrollbars+',width='+width+',height='+height+',top='+intTopPos+',screenY='+intLeftPos+',left='+intLeftPos+',screenX='+intTopPos;
	window.open(fname,wname,args);
}

function openModelessBrWindow(fname, wname, width, height, x, y, aParent){
if(x == null) var x = 0;
if(y == null) var y = 0;
var intTopPos = 0;
var intLeftPos= 0;

if (aParent == null) {aParent = '';} else {aParent = '.'+aParent;}
var obj = eval('window'+aParent);

var w = 640, h = 480;
if (document.layers) {
    w = window.innerWidth;
    h = window.innerHeight;
}
else {
    w = document.body.clientWidth;
    h = document.body.clientHeight;
}

if (x==0) x=(w/2)-(width/2);
if (y==0) y=(h/2)-(height/2);


 if(obj.screenY)
   {
    if(document.layers)
    {
     var intTopPos = obj.screenY + y;
     var intLeftPos= obj.screenX + x;
    }
    else
    {
     var intTopPos = obj.screenY + y;
     var intLeftPos= obj.screenX + x;
    }
   }

   if(obj.screenTop)
   {
    var intTopPos = obj.screenTop + y;
    var intLeftPos= obj.screenLeft + x;
   }

   args='resizable=yes,width='+width+',height='+height+',top='+intTopPos+',screenY='+intLeftPos+',left='+intLeftPos+',screenX='+intTopPos;
   if (document.all&&window.print) //if ie5
	eval('window.showModelessDialog(fname,wname,"help:0;status:no;resizable:1;scrollbars:no;center:no;dialogWidth:'+width+'px;dialogHeight:'+height+'px;dialogTop:'+intLeftPos+'px;dialogLeft:'+intTopPos+'px")')
   else
	eval('window.open(fname,wname,args)')
}

function modelesswin(url,mwidth,mheight,mxpos,mypos){
if (document.all&&window.print) //if ie5
	eval('window.showModelessDialog(url,"recherche","help:0;status:no;resizable:1;scrollbars:no;center:no;dialogWidth:'+mwidth+'px;dialogHeight:'+mheight+'px;dialogTop:'+mypos+'px;dialogLeft:'+mxpos+'px")')
else
	eval('window.open(url,"recherche","width='+mwidth+'px,height='+mheight+'px,status=no,resizable=0,status=no,scrollbars=no")')
}

function openAssistWindow(fname, wname, width, height, x, y, aParent){
if(x == null) var x = 0;
if(y == null) var y = 0;
var intTopPos = 0;
var intLeftPos= 0;

if (aParent == null) {aParent = '';} else {aParent = '.'+aParent;}
var obj = eval('window'+aParent);

var w = 640, h = 480;
if (document.layers) {
    w = window.innerWidth;
    h = window.innerHeight;
}
else {
    w = document.body.clientWidth;
    h = document.body.clientHeight;
}

if (x==0) x=(w/2)-(width/2);
if (y==0) y=(h/2)-(height/2);


 if(obj.screenY)
   {
    if(document.layers)
    {
     var intTopPos = obj.screenY + y;
     var intLeftPos= obj.screenX + x;
    }
    else
    {
     var intTopPos = obj.screenY + y;
     var intLeftPos= obj.screenX + x;
    }
   }

   if(obj.screenTop)
   {
    var intTopPos = obj.screenTop + y;
    var intLeftPos= obj.screenLeft + x;
   }
  args='scrollbars=yes, width='+width+',height='+height+',top='+intTopPos+',screenY='+intLeftPos+',left='+intLeftPos+',screenX='+intTopPos;
  window.open(fname,wname,args);
}


function openImgWindow(fname, wname, width, height, x, y, aParent){

if(width == null) var width = 150; 
if(height == null) var height = 100; 

if(width < 150) width = 150; 
if(height < 100) height = 100; 

height=eval(height)+eval(50);



if(x == null) var x = 0;
if(y == null) var y = 0;
var intTopPos = 0;
var intLeftPos= 0;

if (aParent == null) {aParent = '';} else {aParent = '.'+aParent;}
var obj = eval('window'+aParent);

var w = 640, h = 480;
if (document.layers) {
    w = window.innerWidth;
    h = window.innerHeight;
}
else {
    w = document.body.clientWidth;
    h = document.body.clientHeight;
}

if (x==0) x=(w/2)-(width/2);
if (y==0) y=(h/2)-(height/2);


 if(obj.screenY)
   {
    if(document.layers)
    {
     var intTopPos = obj.screenY + y;
     var intLeftPos= obj.screenX + x;
    }
    else
    {
     var intTopPos = obj.screenY + y;
     var intLeftPos= obj.screenX + x;
    }
   }

   if(obj.screenTop)
   {
    var intTopPos = obj.screenTop + y;
    var intLeftPos= obj.screenLeft + x;
   }

  args='width='+width+',height='+height+',top='+intTopPos+',screenY='+intLeftPos+',left='+intLeftPos+',screenX='+intTopPos;
  window.open(fname,wname,args);
}

function regleHauteurCardeBulletin(){
	var tableinterne = document.getElementById('tableinterne');
	if (tableinterne){
		if (navigator.appName == "Microsoft Internet Explorer"){
			var fenetre	= tableinterne.style.height; 
		} else {
			var fenetre	= tableinterne.offsetHeight; 
			var disponible = screen.availHeight
			var manquant = disponible - (fenetre + 156);
			// alert("disponible="+disponible+"\nfenetre="+fenetre+"\nmanquant="+manquant)
			var rangfooter = document.getElementById('rangfooter');
			if (rangfooter) rangfooter.style.height=manquant; 
		}
	}
}