function launchOnEnter(expression) {
  if(event.keyCode==3 || event.keyCode==13) {
    eval(expression);
  }
}

function goPop(typerubrique, rubriqueid, elementid, offset, nbrec, firstrec, height, width, ajout) {
  window.open('','popupDetails'+ajout,'scrollbars,resizable,status=yes,toolbar=no,directories=no,width='+width+',height='+height);
  document.getElementById('submitor').target = 'popupDetails'+ajout;
  document.getElementById('submitor').typerubrique.value = typerubrique;
  document.getElementById('submitor').rubriqueid.value = rubriqueid;
  document.getElementById('submitor').elementid.value = elementid;
  document.getElementById('submitor').offset.value = offset;
  document.getElementById('submitor').nbrec.value = nbrec;
  document.getElementById('submitor').openMode.value = "POPUP";
  document.getElementById('submitor').firstrec.value = firstrec;
  document.getElementById('submitor').submit();
  document.getElementById('submitor').target = '';
}

function openSite(liste) {
  open(liste.options[liste.selectedIndex].value, 'Site');
}

var timer=setTimeout('1',0);

function setEnr(enregistrementid,firstenr,nbenr) {
  document.getElementById('submitor').enregistrementid.value = enregistrementid;
  document.getElementById('submitor').nbenr.value = nbenr;
  document.getElementById('submitor').firstenr.value = firstenr;
} 



function setTimer(s) {
  clearTimeout(timer);
  timer=setTimeout(s,600);
}
  
function go(typerubrique,rubriqueid,elementid,offset,nbrec,firstrec) {
  document.getElementById('submitor').target='';
  document.getElementById('submitor').typerubrique.value = typerubrique;
  document.getElementById('submitor').rubriqueid.value = rubriqueid;
  document.getElementById('submitor').elementid.value = elementid;
  document.getElementById('submitor').offset.value = offset;
  document.getElementById('submitor').nbrec.value = nbrec;
  document.getElementById('submitor').firstrec.value = firstrec;
  document.getElementById('submitor').openMode.value = "";
  document.getElementById('submitor').submit();
} 

function notgood(field,msg) {
  field.focus();
  alert(msg);
  return false;
}

function isFull(field,msg){
  if (field.value=='') {return notgood(field,msg);}
  return true;
}

function isDigit(field,msg) {
  i = field.value.charCodeAt(0);
  if (!((47<i)&&(i<58))){return notgood(field,msg);}
  return true;
}

function isSelect(field,msg){
  if (field.selectedIndex==0 && field.options[0].value=="") {return notgood(field,msg);}
  return true;
}

function isMail(field,msg) {
  email=field.value;
  arobase=email.indexOf('@');
  point=email.indexOf('.',arobase);
  longueur=email.length;
  if(arobase<=0||point<=arobase+1||longueur<=point+1) {return notgood(field,msg);}
  return true;
}

function goMail(elementid,zeracine) {
  mailfen = window.open('','mail','scrollbars,toolbar=no,directories=no,width=350,height=200');
  racine=zeracine;
  
  imgLoad =new Image; imgLoad.src= racine + 'img/wait.gif';
  imgLoad.height=73;
  imgLoad.width=75;
  
  mailfen.moveTo((screen.width/2)-(350/2),(screen.height/2)-(200/2));
  
  wait = setTimeout("if(imgLoad.complete){writeMessageBeforeMailAndSend("+elementid+");}",315);    
}  

function writeMessageBeforeMailAndSend(elementid){
  mailfen.document.writeln('<html>');
  mailfen.document.writeln('<head>');
  mailfen.document.writeln('  <title>Envoi de message</title>');
  mailfen.document.writeln('</head>');
  mailfen.document.writeln('<body>    ');
  mailfen.document.writeln('  <table cellpadding="0" border="0" cellspacing="0" width="100%">');
  mailfen.document.writeln('    <tr>');
  mailfen.document.writeln('      <td align="center">');
  mailfen.document.writeln('        &#160;');
  mailfen.document.writeln('      </td>');
  mailfen.document.writeln('    </tr>');
  mailfen.document.writeln('    <tr>');
  mailfen.document.writeln('      <td align="center">');
  mailfen.document.writeln('        &#160;');
  mailfen.document.writeln('      </td>');
  mailfen.document.writeln('    </tr>');
  mailfen.document.writeln('    <tr>');
  mailfen.document.writeln('      <td align="center">');
  mailfen.document.writeln('        <span class="texte">');
  mailfen.document.writeln('          <img height="73" width="75" id="wait" src="' + racine + 'img/wait.gif"/>');
  mailfen.document.writeln('        </span>');
  mailfen.document.writeln('      </td>');
  mailfen.document.writeln('    </tr>');
  mailfen.document.writeln('    <tr>');
  mailfen.document.writeln('      <td align="center" style="font-family:verdana;font-size:10px;">');
  mailfen.document.writeln('        <span class="texte">');
  mailfen.document.writeln('          Veuillez patienter...');
  mailfen.document.writeln('        </span>');
  mailfen.document.writeln('      </td>');
  mailfen.document.writeln('    </tr>');
  mailfen.document.writeln('  </table>   ');    
  mailfen.document.writeln('</body>');
  mailfen.document.writeln('</html>');
  
  document.getElementById('submitor').target = 'mail';
  document.getElementById('submitor').action = racine + 'xsltMailer.aspx';
  ///alert(document.getElementById('submitor').elementid);
  document.getElementById('submitor').elementid.value = elementid;
  document.getElementById('submitor').submit();
  document.getElementById('submitor').target = '';
  document.getElementById('submitor').action='xslt.aspx';    
}

          var top = 0;
    	  var s1,s2;
              
          function prepare() {
            s1 = document.getElementById('scroller1');
            s2 = document.getElementById('scroller2');
            s2.style.top = s1.offsetHeight;
            setTimeout("move()",120);
          }
          
          function move() {
            top -= 2;
            s1.style.top = top + 'px';
            s2.style.top = top + 'px';
            if (Math.abs(top)>s1.offsetHeight) {
              top = 0;
              s1.parentNode.removeChild(s1);
              s2.style.top = top + 'px';
              s2.parentNode.appendChild(s1);
              s1.style.top = top + 'px';
              s = s2;
              s2 = s1;
              s1 = s;
            }
            setTimeout("move()",120);
          }
  
