function roc(leid,lacouleur){
	document.getElementById(leid).style.backgroundColor = lacouleur;
}
function roi(leid,limg){
	document.getElementById(leid).style.backgroundImage = 'url('+limg+')';
}
function rob(leid,val){
	document.getElementById(leid).style.border = val;
}


function aff_menu(lespan,lafleche){
	if (document.getElementById(lespan).style.display == "block"){
		document.getElementById(lespan).style.display = "none";
		document[lafleche].src = "/i/fleche_n_cote.gif";
	}else{
		document.getElementById(lespan).style.display = "block";
		document[lafleche].src = "/i/fleche_n_bas.gif";
	}
}

//Lorsque détail avec fleche
function affiche_detail(layer_id)
	{
	if (document.getElementById(layer_id).style.display == "block")
		{
		document.getElementById(layer_id).style.display = "none";
		document["fleche_"+layer_id].src = "/i/fleche_cote.gif";
		}
	else
		{
		document.getElementById(layer_id).style.display = "block";
		document["fleche_"+layer_id].src = "/i/fleche_bas.gif";
	}
}

function isDate(mois, jrs, annee, allow_null){
	if ((allow_null==1)&&((mois==0)||(mois==""))&&((jrs==0)||(jrs==""))&&((annee==0)||(annee==""))){
		return true;
	}else{
		if((mois==0)||(mois=="")||(jrs==0)||(jrs=="")||(annee==0)||(annee=="")){
			return false;
		}else{
			date_validation = mois + '/' + jrs + '/' + annee;
			date_validation = new Date(date_validation);
			if(date_validation.getMonth()+1 != mois){
				return false;
			}else{
				return true;
			};
		};
	};
};



/*=================================
POUR LES MENUS DU HEADER DU SITE
===================================*/
$(document).ready(function(){
	$("#nav-one li").hover(
		function(){ $("ul", this).fadeIn("fast"); }, 
		function() { } 
	);
	if (document.all) {
		$("#nav-one li").hoverClass ("sfHover");
	}
});

$.fn.hoverClass = function(c) {
	return this.each(function(){
		$(this).hover( 
			function() { $(this).addClass(c);  },
			function() { $(this).removeClass(c); }
		);
	});
};



function isEmail(emailStr, nom_champs, allow_null) {
  if ((emailStr == "") && (allow_null == 1)) {
	return (true);
  } else {
	var emailPat = /^(.+)@(.+)$/
	var specialChars = "\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"
	var validChars = "\[^\\s" + specialChars + "\]"
	var quotedUser = "(\"[^\"]*\")"
	var ipDomainPat = /^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/
	var atom = validChars + '+'
	var word = "(" + atom + "|" + quotedUser + ")"
	var userPat = new RegExp("^" + word + "(\\." + word + ")*$")
	var domainPat = new RegExp("^" + atom + "(\\." + atom + ")*$")
	var matchArray = emailStr.match(emailPat)

	if (matchArray == null) {
	  alert("Le courriel est invalide")
	  return false
	}
	var user = matchArray[1]
	var domain = matchArray[2]

	if (user.match(userPat) == null) {
	  alert("Le format de l'adresse courriel est invalide") //alert(nom_champs + ":\n\nLe format de l'adresse courriel est invalide")
	  return false
	}

	var IPArray = domain.match(ipDomainPat)
	if (IPArray != null) {
	  for (var i = 1; i <= 4; i++) {
		if (IPArray[i] > 255) {
		  alert("Le courriel est invalide") //alert(nom_champs + ":\nDestination IP address is invalid!")
		  return false
		}
	  } return true
	}

	var domainArray = domain.match(domainPat)
	if (domainArray == null) {
	  alert("Le courriel est invalide") //alert(nom_champs + ":\nThe domain name doesn't seem to be valid.")
	  return false
	}

	var atomPat = new RegExp(atom, "g")
	var domArr = domain.match(atomPat)
	var len = domArr.length
	if (domArr[domArr.length - 1].length < 2 ||
	domArr[domArr.length - 1].length > 3) {
	  alert("Le courriel est invalide") //alert(nom_champs + ":\nThe address must end in a three-letter domain, or two letter country.")
	  return false
	}

	if (len < 2) {
	  //var errStr = nom_champs + ":\nThis address is missing a hostname!"
	  //alert(errStr)
	  alert("Le courriel est invalide")
	  return false
	}

	return true;
  }

}









