/*window.onload=function (){
 	document.getElementById('plusdd').style.left=(screenOffset('plusdd')-30)+"px";
	document.getElementById('servicesdd').style.left=(screenOffset('servicesdd')-20)+"px";
	document.getElementById('galeriedd').style.left=(screenOffset('galeriedd')-20)+"px";
	
}
window.onresize=function () {
 	document.getElementById('plusdd').style.left=(screenOffset('plusdd')-30)+"px";
	document.getElementById('servicesdd').style.left=(screenOffset('servicesdd')-20)+"px";
	document.getElementById('galeriedd').style.left=(screenOffset('galeriedd')-20)+"px";
}
function screenOffset(id) {
	var	c=0;
	e=document.getElementById(id).parentNode;
	do 
		c+=e.offsetLeft;
	while(e=e.offsetParent);	
	return c;
}*/
function toggleTab(tab,id) {
	if (tab=="top") {
		if (id==1) idc=[2,3,4];
		else if (id==2) idc=[1,3,4];
		else if (id==3) idc=[1,2,4];
		else idc=[1,2,3];
	}
	else
		if (id==1) idc=[2]; else idc=[1];
	for (var i=0;i<idc.length;i++) {
	document.getElementById(tab+idc[i]).className="hidden";
	document.getElementById(tab+"tab"+idc[i]).className="";
	}

	document.getElementById(tab+id).className="tabscontent";
	document.getElementById(tab+"tab"+id).className="active";
}
function toggleBouton(id) {
	if (document.getElementById("bouton"+id).className=="tabscontent")
		document.getElementById("bouton"+id).className="hidden";
	else
		document.getElementById("bouton"+id).className="tabscontent";
	
}
function emptyField(elt,ch) {
	if (ch=="") ch="Rechercher ..." ;
if (elt.value==ch) elt.value="";
}
function refreshField(elt,ch) {
	if (ch=="") ch="Rechercher ..." ;
	elt.value=trim(elt.value);
	if (elt.value=="") elt.value=ch;
}
function trim(str) {
	return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');	
}
function submitSearch(elt) {
	if (document.getElementById("typesearch2").checked) 	{
		elt.method="get";
		document.getElementById("recherche").name="q";
		elt.action="/recherche/search.php";
	}
	else {
		elt.method="post";
		document.getElementById("recherche").name="EdTextToFind";
		elt.action="/recherche/";
	
	}
}
function AddToFavorite() {
   var titre="Webmanagercenter.com : Le portail des entreprises";
   var lien="http://www.webmanagercenter.com";
   if (window.sidebar)
   	window.sidebar.addPanel(titre, lien,"");
   else if( document.all )
   window.external.AddFavorite(lien,titre);
   else
   	alert("Cette fonction n'est pas compatible avec votre navigateur");
}
function setHomePage(itm) {
if ( document.all ) {
	itm.style.behavior='url(#default#homepage)'; itm.setHomePage('http://www.webmanagercenter.com');	
}
else
	alert("Cette fonction n'est pas compatible avec votre navigateur");
}	
var xhr = null; // Fonction de creation de l'objet XMLHttpRequest qui resservira pour chaques fonctions AJAX 
function getXhr() { 
	if(window.XMLHttpRequest) 
		xhr = new XMLHttpRequest(); 
	else if(window.ActiveXObject) { 
		try { 
			xhr = new ActiveXObject("Msxml2.XMLHTTP"); 
		} 
		catch (e) { 
			xhr = new ActiveXObject("Microsoft.XMLHTTP"); 
		}
	} 
	else { 
		alert("Votre navigateur ne supporte pas les objets XMLHTTPRequest, veuillez le mettre à jour"); xhr = false; 
	} 
} 
function refreshCalDiv(divid) { 
	getXhr(); 
	xhr.onreadystatechange = function() { 
		if(xhr.readyState == 4 && xhr.status == 200) { 
		document.getElementById(divid).innerHTML = xhr.responseText;
		}
	} 
	xhr.open("POST",'../include.new/'+divid+'.inc.php',true); 
	xhr.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
	xhr.send('mois='+document.getElementById(divid+'mois').value+'&annee='+document.getElementById(divid+'annee').value); 
	document.getElementById(divid).innerHTML = '<img src="../images.new/wait.gif" alt="wait" width="42" height="42" />Chargement ...';
} 
function goToPage(p) {
	document.getElementById("id2").value=p;
	document.getElementById("pagination").submit();
}
function goToPageactu(p) {
	if(p==0){
	document.getElementById("pagination").action="actualite.php";	
	}else{
	document.getElementById("pagination").action="actu.php";	
		}
	document.getElementById("id2").value=p;
	document.getElementById("pagination").submit();
}
function VerifDate() {
	startdate=document.getElementById("startdate").value;
	enddate=document.getElementById("enddate").value;
	if (startdate!="" && enddate!="")
		return isValidDate(startdate) && isValidDate(enddate);
	else {
		alert("Veuillez saisir une date correcte");
		return false;
	}
}
function isValidDate(strDate){
var dteDate;
var day, month, year;
var datePat = /^(\d{1,2})(\/)(\d{1,2})(\/)(\d{4})$/;
var matchArray = strDate.match(datePat);
if (matchArray == null)
return false;
day = matchArray[1];
month = matchArray[3];
year = matchArray[5];
month--;
dteDate=new Date(year,month,day);
return ((day==dteDate.getDate()) && (month==dteDate.getMonth()) && (year==dteDate.getFullYear()));
}


function affichediv(name,name2){
var nom=name;
var nom2=name2;
var obj = document.getElementById(nom);
document.getElementById(nom2).style.display='none'; 
obj.style.display='block';

}


function ValideMailAdress(nChamp) 
{
  if (nChamp.value.length > 0) {
    if ((nChamp.value.lastIndexOf(".") < nChamp.value.indexOf("@")+3
      || nChamp.value.lastIndexOf(".") > nChamp.value.length-3
      || nChamp.value.indexOf("@") < 1 )
      || nChamp.value.indexOf("@") != nChamp.value.lastIndexOf("@")) {

      alert("\nSaisie invalide!\nAssurez-vous d'entrer un format valide de courriel \"votrenom@serveur.com\".");
      nChamp.focus();
      nChamp.select();
    }
  }
}

function cmdEnvoyer_clik()
{

 document.FrmIsncription.posted.value = 1; 
 mss = "Saisies obligatoire : \n"  ;
 
	 	
 if (document.FrmIsncription.EdInMail.value =="" )
	 {
 		mss = mss + "Email  \n"
		document.FrmIsncription.posted.value=0
	}
if (document.FrmIsncription.EdfMessage.value =="" )
	 {
		document.FrmIsncription.posted.value=0
		mss = mss + "Commentaire \n"
	 } 
if 	(document.FrmIsncription.posted.value==0 ) {
alert (mss)  
}
else
{

document.FrmIsncription.submit();
}
}
