// JavaScript Document
// Scripts de validationn des champs obligatoires
function alertmess(msg) {
alert(msg);
return false;
}
function validateNumber(field, msg, min, max) {
if (!min) { min = 0 }
if (!max) { max = 255 }
if ( (parseInt(field.value) != field.value) ||
field.value < min ||
field.value > max) {
alert(msg);
field.focus();
return false;
}
return true;
}
function validateString(field, msg, min, max) {
if (!min) { min = 1 }
if (!max) { max = 65535 }
if (!field.value || field.value.length < min || field.value.length > max) {
alert(msg);
field.focus();
return false;
}
return true;
}
function validateEq(field1, field2, msg) {
if (field1.value == field2.value) {
alert(msg);
field2.focus();
return false;
}
return true;
}
function validateDiff(field1, field2, msg) {
if (field1.value != field2.value) {
alert(msg);
field2.focus();
return false;
}
return true;
}
function validateSup(field1, field2, msg) {
if (field1.value > field2.value) {
alert(msg);
field2.focus();
return false;
}
return true;
}
function validateInf(field1, field2, msg) {
if (field1.value < field2.value) {
alert(msg);
field2.focus();
return false;
}
return true;
}

function afficheId(baliseId) 
  {
  if (document.getElementById && document.getElementById(baliseId) != null) 
    {
    document.getElementById(baliseId).style.visibility='visible';
    document.getElementById(baliseId).style.display='block';
    }
  }

function cacheId(baliseId) 
  {
  if (document.getElementById && document.getElementById(baliseId) != null) 
    {
    document.getElementById(baliseId).style.visibility='hidden';
    document.getElementById(baliseId).style.display='none';
    }
  }
