// JavaScript Document
function verifEtiquette()
{
	sVign = document.Form.sVign.value;
	var reg = /^[0-9]+$/;
	
	if ( sVign == '') {
		window.alert('Le champ nombre de vignette n\'est pas rempli');
		return false;
	}
	
	if ( sVign.length > 3 ) {
		window.alert('Le nombre de vignette est trop important');
		return false;
	}
	 
    if ( reg.exec(sVign)!= null ) 
    {     } 
    else  
     { 
         window.alert('Le nombre de vignette n\'est pas valide!');
		 return false;
     } 
	 
	 return true;
}
function verifdevis() 
{ 
	if ( document.Form.devis_sNom.value == '') {
		window.alert('Le champ Nom n\'est pas rempli');
		return false;
	}
	
	if ( document.Form.devis_sNom.value.length < 2 ) {
		window.alert('Le nom n\'est pas valide');
		return false;
	}
	
	tel = document.Form.devis_sTelFixe.value;
    var reg = /^[0-9\ \-_().]+$/ ;
	 
	if ( document.Form.devis_sTelFixe.value == '') {
		window.alert('Le champ Tˇlˇphone n\'est pas rempli');
		return false;
	}
	
	if ( document.Form.devis_sTelFixe.value.length < 8 ) {
		window.alert('Le numˇro de tˇlˇphone est trop court');
		return false;
	}
	 
    if ( reg.exec(tel)!= null ) 
    {      } 
    else  
     { 
         window.alert('Le numˇro de tˇlˇphone n\'est pas valide!');
		 return false;
     } 
	 
	 if ( document.Form.devis_sEmail.value == '') {
		window.alert('Le champ E-mail n\'est pas rempli');
	return false;
	}
	
	adresse = document.Form.devis_sEmail.value;
	taille = document.Form.devis_sEmail.value.length;

	validelog = false;
	validedom = false;
	valideext = false;

	arob = adresse.lastIndexOf("@");
	login = adresse.substring(0,arob);

	pointfinal = adresse.lastIndexOf(".");
	extension = adresse.substring(pointfinal,taille);

	domaine = adresse.substring(arob+1,pointfinal);

	if ( login.length > 2 ) {
		validelog = true;
	}
	else {
		alert('L\'adresse e-mail n\'est pas valide');
		return false;
		validelog = false;
	}

	if ( domaine.length > 1 ) {
		validedom = true;	
	}
	else {
		alert('L\'adresse e-mail n\'est pas valide.\nLe nom de domaine n\'existe pas.');
		return false;
		validelog = false;
	}

	if ( pointfinal > -1 && (extension.length == 3 || extension.length == 4) ) {
		valideext = true;
	}
	else {
		alert('L\'adresse e-mail n\'est pas valide.\nCette extension n\'existe pas.');
		return false;
		valideext = false;
	}

	if ( validelog == true && validedom == true && valideext == true ) {
		return true;
	}
	else {
		return false;
	}
}
function verif() 
{ 
	if ( document.formulaire.vNom.value == '') {
		window.alert('Le champ Nom n\'est pas rempli');
		return false;
	}
	
	if ( document.formulaire.vNom.value.length < 2 ) {
		window.alert('Le nom n\'est pas valide');
		return false;
	}
	
	if ( document.formulaire.vSociete.value == '') {
		window.alert('Le champ Sociˇtˇ n\'est pas rempli');
		return false;
	}

	if ( document.formulaire.vSociete.value.length < 2 ) {
		window.alert('Le nom de la sociˇtˇ n\'est pas valide');
		return false;
	}

    tel = document.formulaire.vTel.value;
    var reg = /^[0-9\ \-_().]+$/ ;
	 
	if ( document.formulaire.vTel.value == '') {
		window.alert('Le champ Tˇlˇphone n\'est pas rempli');
		return false;
	}
	
	if ( document.formulaire.vTel.value.length < 8 ) {
		window.alert('Le numˇro de tˇlˇphone est trop court');
		return false;
	}
	 
    if ( reg.exec(tel)!= null ) 
    {      } 
    else  
     { 
         window.alert('Le numˇro de tˇlˇphone n\'est pas valide!');
		 return false;
     } 

	if ( document.formulaire.vEmail.value == '') {
		window.alert('Le champ E-mail n\'est pas rempli');
	return false;
	}
	
	adresse = document.formulaire.vEmail.value;
	taille = document.formulaire.vEmail.value.length;

	validelog = false;
	validedom = false;
	valideext = false;

	arob = adresse.lastIndexOf("@");
	login = adresse.substring(0,arob);

	pointfinal = adresse.lastIndexOf(".");
	extension = adresse.substring(pointfinal,taille);

	domaine = adresse.substring(arob+1,pointfinal);

	if ( login.length > 2 ) {
		validelog = true;
	}
	else {
		alert('L\'adresse e-mail n\'est pas valide');
		return false;
		validelog = false;
	}

	if ( domaine.length > 1 ) {
		validedom = true;	
	}
	else {
		alert('L\'adresse e-mail n\'est pas valide.\nLe nom de domaine n\'existe pas.');
		return false;
		validelog = false;
	}

	if ( pointfinal > -1 && (extension.length == 3 || extension.length == 4) ) {
		valideext = true;
	}
	else {
		alert('L\'adresse e-mail n\'est pas valide.\nCette extension n\'existe pas.');
		return false;
		valideext = false;
	}

	if ( validelog == true && validedom == true && valideext == true ) {
		return true;
	}
	else {
		return false;
	}
} 

// fonction  dreamweaver

function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

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 MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

/***********************************************
* Switch Menu script- by Martial B of http://getElementById.com/
* Modified by Dynamic Drive for format & NS4/IE4 compatibility
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/

if (document.getElementById){ //DynamicDrive.com change
document.write('<style type="text/css">\n')
document.write('.submenu{display: none;}\n')
document.write('</style>\n')
}

function SwitchMenu(obj, entete){
	if(document.getElementById){
	var el = document.getElementById(obj);
	var ar = document.getElementById("masterdiv").getElementsByTagName("span"); //DynamicDrive.com change
		if(el.style.display != "inline"){ //DynamicDrive.com change
			for (var i=0; i<ar.length; i++){
				if (ar[i].className=="submenu") //DynamicDrive.com change
				ar[i].style.display = "none";
			}
			el.style.display = "inline";
		}else{
			el.style.display = "none";
		}
	}
	//window.parent.entete.location.replace(entete);
}
	
//********************************************************
// calcul du volume
var volume = new Array('0','1.7','0.77','0.3','1.75','1.25','2.75','0.75','1','1.3','0.16','1.35','0.07','0.07','0.07','0.07',
					   					'0.85','0.16','0.77','1.7','2.75','1','0.12','0.07','0.07','0.07','0.07',
										'0.98','0.16','0.19','0.35','2.35','1.2','1.6','0.65','1.12','0.5','0.07','0.07','0.07','0.07',
										'1.22','0.72','1.43','0.4','0.16','0.09','0.65','1','0.07','0.07','0.07','0.07','0.07','0.07',
										'0.35','1.25','1','0.75','0.75','0.09','0.07','0.07','0.07','0.07',
										'0.75','0.37','0.13','0.21','0.35','0.25','4.95','10','0.15','0.35','0.07','2','0.25','2.75');
						
var ns4=document.layers;
var ie4=document.all;
var ns6=document.getElementById&&!document.all;

function calcul(affich) {
	result=0;
	if(ie4) { // Internet explorer
		document.getElementById(affich).value = 0;
		for ( var ind = 1; ind < volume.length ; ind++ )
      	{
			result += (document.getElementById(ind).value * volume[ind]);
		}
		document.getElementById(affich).value = result.toFixed(2);
	}
	else if(ns4) { // Netscape 4.x
	
		document.eval(affich).value = 0
		for ( var ind = 1; ind < volume.length ; ind++ )
		{
			result += (document.eval(ind).value * volume[ind]);
			
		}
		document.eval(affich).value = result.toFixed(2);
	}
	else if(ns6) { // Netscape 6 (mozilla)
		var objns6 = document.getElementsByTagName("input");
		
		objns6[affich].value = 0
		for ( var ind = 1; ind < volume.length ; ind++ )
		{
			result += (objns6[ind].value * volume[ind]);
			
		}
		objns6[affich].value = result.toFixed(2);
	}

}






