// JavaScript Document


/*******************************************************
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
         }
      }
   }    
}

/* fonction de test et d'envois d'e-mail */

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;}
}

/**/
function flash_inc(fichier,largeur,hauteur,classid) 
{ 
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0" width="'+largeur+'" height="'+hauteur+'">\n'); 
document.write('<param name="movie" value="'+ fichier +'"  >\n'); 
document.write('<param name="quality" value="high">\n');
document.write('<param name="wmode" value="transparent">\n');
document.write('<embed src="'+ fichier +'" width="'+largeur+'" height="'+hauteur+'" quality="high" wmode="transparent" type="application/x-shockwave-flash">\n'); 
document.write('</embed>\n'); 
document.write('</object>\n');
} 
