function launchOnEnter(expression) {
  if(event.keyCode==3 || event.keyCode==13) {
    eval(expression);
  }
}

var timer=setTimeout('1',0);

function setEnr(enregistrementid,firstenr,nbenr) {
  document.forms['submitor'].enregistrementid.value = enregistrementid;document.forms['submitor'].nbenr.value = nbenr;document.forms['submitor'].firstenr.value = firstenr;
} 
function Bip(id) { 
  var mesDivs = document.getElementsByTagName("div");
  for(var i=0; i<mesDivs.length; i++) {
    if(mesDivs[i].id.indexOf('menu')==0) {
      mesDivs[i].style.visibility = "hidden";
    }
  }
  document.getElementById('menu'+id).style.visibility='visible';
}

function adjustMenu(no,pos,lg,y) {
  if (document.body.clientWidth > 780) {
    x_sup = (document.body.clientWidth-780) / 2;
  }
  else {
    x_sup = 0;
  }
  x = lg * (pos-1) + x_sup;
  document.getElementById('menu'+no).style.left = x+'px';
  document.getElementById('menu'+no).style.top = y+'px';
}

function adjustMain() {
  x = 0;
  y = 0;
  if (document.body.clientWidth > 780) {
    x_sup = (document.body.clientWidth-780) / 2;
  }
  else {
    x_sup = 0;
  }
  if (document.body.clientHeight > 480) {
    y_sup = (document.body.clientHeight-480) / 2;
  }
  else {
    y_sup = 0;
  }
  x = x_sup + 495;
  y = y_sup + 5;
  y = 5;
  document.getElementById('menuContenu').style.left = x+'px';
  document.getElementById('menuContenu').style.top = y+'px';
}  
         
function Boup(id) {                
  document.getElementById('menu'+id).style.visibility='hidden';
}                 
    
function setTimer(s) {
  clearTimeout(timer);
  timer=setTimeout(s,600);
}
  
function go(typerubrique,rubriqueid,elementid,offset,nbrec,firstrec) {
  document.forms['submitor'].target='';
  document.forms['submitor'].typerubrique.value = typerubrique;
  document.forms['submitor'].rubriqueid.value = rubriqueid;
  document.forms['submitor'].elementid.value = elementid;document.forms['submitor'].offset.value = offset;
  document.forms['submitor'].nbrec.value = nbrec;
  document.forms['submitor'].firstrec.value = firstrec;
  document.forms['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,racine) {
  window.open('','mail','scrollbars,toolbar=no,directories=no,width=350,height=200');
  document.forms['submitor'].target = 'mail';
  document.forms['submitor'].action = racine + 'xsltMailer.aspx';
  document.forms['submitor'].elementid.value = elementid;
  document.forms['submitor'].submit();
  document.forms['submitor'].target = '';
  document.forms['submitor'].action='xslt.aspx';    
} 
  
var currentImgHeight;

function clicImage(obj) {
	img = document.getElementById(obj.id.replace("petit","grand"));
	if(img.style.display=="none") {
	  currentImgHeight = img.height;
	  document.getElementById('grandes_images').style.height = Math.max(img.height,document.body.offsetHeight) + 'px';
	  Effect.Appear(img.id);
	  Effect.Appear('grandes_images');
  }
  else {
    Effect.Fade(img.id);
    Effect.Fade('grandes_images');
  }
}

function scrollImage() {
  tp = document.getElementById('grandes_images').style.top;
  tp = parseFloat(tp.substring(0,tp.length-2));
  if(document.documentElement.scrollTop==0) {
    document.getElementById('grandes_images').style.top = window.pageYOffset + 'px';
  }
  else {
    document.getElementById('grandes_images').style.top = document.documentElement.scrollTop + 'px';
  }
}