    function visit(newURL) {
      if (newURL != "") {
        document.location.href=newURL
      }
    }

var haveerrors = 0;
var errToFocus = null;

function validStr(aStr) {
    var i;
    for (i=0; i<aStr.length; i++) {
        if (aStr[i] != ' ') {
            return true;
        }
    }
    return false;
}

function showError(myObj, errors) {
  if (errors && (errToFocus == null)){
    errToFocus = myObj;
  }
  if (errors){
    myObj.className = 'error';
    document.getElementById('zoneErreur').style.visibility='visible';
    document.getElementById('zoneErreur').style.height='auto';

  }else{
    myObj.className = 'fdtxt'
  }
  if (!haveerrors && errors) haveerrors = errors;
}


function validateForm_news(f) {
haveerrors = 0;
errToFocus = null;


(!validStr(f.courriel.value) || (f.courriel.value.search("@") == -1) || (f.courriel.value.search("[.*]") == -1))
? showError(f.courriel, true)
: showError(f.courriel, false);


if (errToFocus != null) errToFocus.focus();

return (!haveerrors);
}


function showError2(myObj, errors) {
  if (errors && (errToFocus == null)){
    errToFocus = myObj;
  }
  if (errors){
    myObj.className = 'error';
    document.getElementById('zoneErreur2').style.visibility='visible';
    document.getElementById('zoneErreur2').style.height='auto';

  }else{
    myObj.className = 'fdtxt'
  }
  if (!haveerrors && errors) haveerrors = errors;
}


function validateForm_commentaire(f) {
haveerrors = 0;
errToFocus = null;

(f.nom.value.length < 1)
? showError2(f.nom, true)
: showError2(f.nom, false);

(f.telephone.value.length < 6)
? showError2(f.telephone, true)
: showError2(f.telephone, false);

(!validStr(f.courriel.value) || (f.courriel.value.search("@") == -1) || (f.courriel.value.search("[.*]") == -1))
? showError2(f.courriel, true)
: showError2(f.courriel, false);

(f.message.value.length < 1)
? showError2(f.message, true)
: showError2(f.message, false);

if (errToFocus != null) errToFocus.focus();

return (!haveerrors);
}

function toogleImage(nObjet, nObjet2, nObjet3) {
 document.getElementById(nObjet).style.display = 'block';
 document.getElementById(nObjet).style.height = 'auto';
 document.getElementById(nObjet2).style.display = 'none';
 document.getElementById(nObjet2).style.height = '0';
 document.getElementById(nObjet3).style.display = 'none';
 document.getElementById(nObjet3).style.height = '0';
}


function visibilite(thingId)
{
var targetElement;
targetElement = document.getElementById(thingId) ;
if (targetElement.style.display == "none")
{
targetElement.style.display = "" ;
} else {
targetElement.style.display = "none" ;
}
}
