/*******************************************************
Fonction qui corrige les PNG transparents pour ie 5.5 & 6
********************************************************/
function correctPNG() 
{
   var arVersion = navigator.appVersion.split("MSIE")
   var version = parseFloat(arVersion[1])
   if ((version >= 5.5) && (document.body.filters)) 
   {
      for(var i=0; i<document.images.length; i++)
      {
         var img = document.images[i]
         var imgName = img.src.toUpperCase()
         if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
         {
            var imgID = (img.id) ? "id='" + img.id + "' " : ""
            var imgClass = (img.className) ? "class='" + img.className + "' " : ""
            var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
            var imgStyle = "display:inline-block;" + img.style.cssText 
            if (img.align == "left") imgStyle = "float:left;" + imgStyle
            if (img.align == "right") imgStyle = "float:right;" + imgStyle
            if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
            var strNewHTML = "<span " + imgID + imgClass + imgTitle
            + " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
            + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
            + "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>" 
            img.outerHTML = strNewHTML
            i = i-1
         }
      }
   }    
}



function montre(id) {
var d = document.getElementById('smenu'+id);

for (var i = 1; i<=10; i++) {
		if (document.getElementById('smenu'+i)) {
			document.getElementById('smenu'+i).style.display='none';
			}
	}
if (d) {
	d.style.display='block';
	}
}




function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function affiche_item(item) {
	if ((MM_findObj('item_'+item).style.display)=='') {
		MM_findObj('item_'+item).style.display = 'none';
	} else {
		MM_findObj('item_'+item).style.display = '';
	}
}



function soumettreMail(){
	if(verifieChamp()){
		document.formContact.submit();
	}
}

function verifieChamp(){
if(document.formContact.nom.value == "")  {
   alert("Veuillez entrer votre nom !");
   document.formContact.nom.focus();
   return false;
  }
if(document.formContact.prenom.value == "")  {
   alert("Veuillez entrer votre prenom !");
   document.formContact.prenom.focus();
   return false;
  }
 if(document.formContact.tel.value == "")  {
   alert("Veuillez entrer votre téléphone !");
   document.formContact.tel.focus();
   return false;
  }
 if(document.formContact.adresse.value == "")  {
   alert("Veuillez entrer votre adresse complète !");
   document.formContact.adresse_demandeur.focus();
   return false;
  }
 if(document.formContact.codepostal.value == "")  {
   alert("Veuillez entrer votre code postal !");
   document.formContact.cp_demandeur.focus();
   return false;
  }
  if(!verifieNumerique(document.formContact.codepostal.value)){
    alert("Votre code postal n'est pas valide!");
   document.formContact.codepostal.focus();
   return false;
  }
  if(document.formContact.ville.value == "")  {
   alert("Veuillez entrer votre ville!");
   document.formContact.ville.focus();
   return false;
  }
  if(!verifieEmail()){
   return false;
  }
return true;
}

function verifieEmail()
	{
	adresse = document.formContact.courriel.value;
	var place = adresse.indexOf("@",1);
	var point = adresse.indexOf(".",place+1);
	if ((place > -1)&&(adresse.length >2)&&(point > 1))
		{
		return(true);
		}
	else
		{
		alert('Votre courriel n\'est pas valide !');
		 document.formContact.courriel.focus();
		return(false);
		}
	}

function verifieNumerique(donnee)
{
numChars = "0123456789";
var isNum = true;
var index = 0;
while ((index < donnee.length) && (isNum))
     {
     isNum = (numChars.indexOf(donnee.charAt(index)) != -1);
     index ++;
     }
if (!isNum)
     {
    return false;
     }
else{return true;}
}
