function verifdate(date_test) { //vérif validité date
	var reg = /^(\d{1,2}\/){2}\d{4}$/
	return (date_test.match(reg))
}

function verifemail(email_test) { // vérif validité email
   var reg = /[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]{2,}[.][A-Za-z]{2,3}/
   return (email_test.match(reg))
}

function verifcp(cp_test) { // vérif validité code postal
   var reg = /[a-zA-Z]/
   return (cp_test.match(reg))
}

function verifstr(string_char) { // vérif validité chaine de caractères
   var reg = /^[a-zA-Z]$/
   return (string_char.match(reg))
}

function TestChamp() {

	var p_left = ((document.body.clientWidth)/2)-(300/2);
	var p_top = ((document.body.clientHeight)/2)-(150/2);
	
	win = new Window ({className:"mac_os_x",resizable:false,minimizable:false,height:150,width:300,maximizable:false,destroyOnClose:true});
	win.setLocation (p_top,p_left);

/*	TEST DE VALIDATION DU CHAMP NOM		*/
	if ($('nom').value == "") {
		Form.disable ('formddoc');
		win.setHTMLContent ("<div style=\"width:100%;\"><p align=\"center\" style=\"margin-top:50px;font:12px Verdana;font-weight:bold;\">Le champ nom est vide ou n'est pas rempli correctement</p></div>");
		win.show();
		return(false);
	}
/*	TEST DE VALIDATION DU CHAMP PRENOM		*/
	if ($('prenom').value == "") {
		Form.disable ('formddoc');
		win.setHTMLContent ("<div style=\"width:100%;\"><p align=\"center\" style=\"margin-top:50px;font:12px Verdana;font-weight:bold;\">Le champ prénom est vide ou n'est pas rempli correctement</p></div>");
		win.show();
		return(false);
	}
/*	TEST DE VALIDATION DU CHAMP CODE POSTAL	*/
	if ($('cp').value == "") {
		Form.disable ('formddoc');
		win.setHTMLContent ("<div style=\"width:100%;\"><p align=\"center\" style=\"margin-top:50px;font:12px Verdana;font-weight:bold;\">Le champ code postal est vide</p></div>");
		win.show();
		return(false);	
	}
	if (verifcp($('cp').value) != null) {
		Form.disable ('formddoc');
		win.setHTMLContent ("<div style=\"width:100%;\"><p align=\"center\" style=\"margin-top:50px;font:12px Verdana;font-weight:bold;\">Le champ code postal n'est pas rempli correctement</p></div>");
		win.show();
		return(false);	
	}
/*	TEST DE VALIDATION DU CHAMP DATE DE NAISSANCE		*/		
	if ($('naissance').value == "" || $('naissance').value == "01/01/2000") {
		Form.disable ('formddoc');
		win.setHTMLContent ("<div style=\"width:100%;\"><p align=\"center\" style=\"margin-top:50px;font:12px Verdana;font-weight:bold;\">Le champ date de naissance est vide</p></div>");
		win.show();
		return(false);	
	}
	if (verifdate($('naissance').value) == null) {
		Form.disable ('formddoc');
		win.setHTMLContent ("<div style=\"width:100%;\"><p align=\"center\" style=\"margin-top:50px;font:12px Verdana;font-weight:bold;\">Le champ date de naissance n'est pas rempli correctement</p></div>");
		win.show();
		return(false);	
	}	
/*	TEST DE VALIDATION DU CHAMP 	ADRESSE	*/
	if ($('adresse').value == "") {
		Form.disable ('formddoc');
		win.setHTMLContent ("<div style=\"width:100%;\"><p align=\"center\" style=\"margin-top:50px;font:12px Verdana;font-weight:bold;\">Le champ adresse est vide</p></div>");
		win.show();
		return(false);	
	}
/*	TEST DE VALIDATION DU CHAMP EMAIL		*/
	if ($('mail').value != "" && verifemail($('mail').value)==null) {
		Form.disable ('formddoc');
		win.setHTMLContent ("<div style=\"width:100%;\"><p align=\"center\" style=\"margin-top:50px;font:12px Verdana;font-weight:bold;\">Le champ e-mail n'est pas rempli correctement</p></div>");
		win.show();
		return(false);	
	}
/*	TEST DE VALIDATION DU CHAMP VILLE		*/
	if ($('ville').value == "") {
		Form.disable ('formddoc');
		win.setHTMLContent ("<div style=\"width:100%;\"><p align=\"center\" style=\"margin-top:50px;font:12px Verdana;font-weight:bold;\">Le champ ville est vide</p></div>");
		win.show();
		return(false);	
	}
/*	TEST DE VALIDATION DU CHAMP PAYS		*/
	if ($('pays').value == "") {
		Form.disable ('formddoc');
		win.setHTMLContent ("<div style=\"width:100%;\"><p align=\"center\" style=\"margin-top:50px;font:12px Verdana;font-weight:bold;\">Le champ pays est vide</p></div>");
		win.show();
		return(false);	
	}
/*	TEST DE VALIDATION DU CHAMP NIVEAU ETUDE		*/
	if ($('formation').value == "" || $('formation').value == 'NOCHOOSE') {
		Form.disable ('formddoc');
		win.setHTMLContent ("<div style=\"width:100%;\"><p align=\"center\" style=\"margin-top:50px;font:12px Verdana;font-weight:bold;\">Le champ 'Votre formation' est vide</p></div>");
		win.show();
		return(false);	
	}
/*	TEST DE VALIDATION DU CHAMP TELEPHONE		*/
	if ($('tel').value == "" || $('tel').value == "0320000000") {
		Form.disable ('formddoc');
		win.setHTMLContent ("<div style=\"width:100%;\"><p align=\"center\" style=\"margin-top:50px;font:12px Verdana;font-weight:bold;\">Le champ téléphone est vide</p></div>");
		win.show();
		return(false);	
	}
	
	if (verifcp($('tel').value) != null ) {
		Form.disable ('formddoc');
		win.setHTMLContent ("<div style=\"width:100%;\"><p align=\"center\" style=\"margin-top:50px;font:12px Verdana;font-weight:bold;\">Le champ téléphone n'est pas rempli correctement</p></div>");
		win.show();
		return(false);	
	}	
/*	TEST DE VALIDATION DU CHAMP NIVEAU ETUDE		*/
	if ($('comment').value == "" || $('comment').value == 'NOCHOOSE') {
		Form.disable ('formddoc');
		win.setHTMLContent ("<div style=\"width:100%;\"><p align=\"center\" style=\"margin-top:50px;font:12px Verdana;font-weight:bold;\">Le champ 'Comment nous avez-vous connu?' est vide</p></div>");
		win.show();
		return(false);	
	}
/*	TEST DE VALIDATION DU CHAMP Comment nous avez vous connu		*/
	if ($('precisez').value == "" || $('precisez').value == 'NOCHOOSE') {
		Form.disable ('formddoc');
		win.setHTMLContent ("<div style=\"width:100%;\"><p align=\"center\" style=\"margin-top:50px;font:12px Verdana;font-weight:bold;\">Le champ 'précisez' est vide</p></div>");
		win.show();
		return(false);	
	}
}
