function valider(frm) {
         frm=document.forms['contactform'];
         if(frm.elements['name'].value.length != 0 && frm.elements['email'].value.length != 0 && frm.elements['message'].value.length != 0) 
         {
         //if(verifMail(frm.elements['email'].value)) return true;
         //else {
         //      alert("votre adresse email n'est pas valide");
         //      return false;
         //}
	         if (frm.elements['email'].value.search(/^[\w\-]+(\.[\w\-]+)*@[\w\-]+(\.[\w\-]+)*\.[\w\-]{2,}$/) == -1)
	         {
	         alert ('Veuillez entrer une adresse e-mail valide.');
	         return false;
	         }
	         else return true;
	 }
	 else {
		var text = "Vous n'avez pas saisis tous les champs obligatoires.";
		//alert(text);
		sexyBOX(' Warning!<br/>' + text,'300');
		return false;
	 }
}

function verifMail(a) {

	testm = false ;
	for (var j=1 ; j<(a.length) ; j++) {
		if (a.charAt(j)=='@') {
		// La on commence les conditions de tests. Ici on cherche l'@
			if (j<(a.length-6)){
			// Ici on regarde si il y a bien 6 caractè aprèle @
				for (var k=j ; k<(a.length-2) ; k++) {
				// On ouvre une seconde boucle pour
					if (a.charAt(k)=='.') testm = true;
				}
			}
		}
	}
return testm ;
}
function $(v) { 
        return(document.getElementById(v)); 
}


function $S(v) { 
	return($(v).style); 
}



function agent(v) { 
	return(Math.max(navigator.userAgent.toLowerCase().indexOf(v),0)); 
}



function isset(v) { 
	return((typeof(v)=='undefined' || v.length==0)?false:true); 
}



function XYwin(v) { 
	var z=agent('msie')?Array(document.body.clientHeight,document.body.clientWidth):Array(window.innerHeight,window.innerWidth); 
	return(isset(v)?z[v]:z); 
}



function sexyTOG() { 
	document.onclick=function(){ 
		$S('sexyBG').display='none'; 
		$S('sexyBOX').display='none';
		document.onclick=function(){}; 
	}; 
}



function sexyBOX(v,b) { 
	setTimeout("sexyTOG()",100); 
	$S('sexyBG').height=XYwin(0)+'px'; 
	$S('sexyBG').display='none'; 
	$('sexyBOX').innerHTML=v+'<div class="sexyX">(click outside box to close)'+"<\/div>"; 
//	$S('sexyBOX').left=Math.round((XYwin(1)-b)/2)+'px'; 
	$S('sexyBOX').left='50 %';
	$S('sexyBOX').width=b+'px'; 
	$S('sexyBOX').display='block'; 
}

