// JavaScript Document
function valider_saisie(nom_form, lg) {
	var f=document.forms[nom_form].elements;
	var e=0;
	email=f['email'].value;
	var place = email.indexOf("@",1);
	var point = email.indexOf(".",place+1);
	var lang=new Array();
	var m=['nom','tel','msg'];

	lang[2]={'err':"Attention, certaines données du formulaire sont incorrectes ou manquantes :\n",
			'nom':" -> Champ [ Nom ] incorrect\n",
			'adresse1':" -> Champ [ Adresse ]  incorrect\n",
			'cpostal':" -> Champ [ Code postal ] incorrect\n",
			'email':" -> Champ [ E-mail ] incorrect\n",
			'tel':" -> Champ [ Téléphone ] incorrect\n",
			'produit':" -> Champ [ Choisissez votre produit ] incorrect\n",
			'msg':" -> Champ [ Message ] incorrect\n",
			'action':"Merci de vérifier votre saisie.\n"
			};
	lang[3]={'err':"Important message: Certain information on the form is incorrect or missing:\n",
			'nom':" -> [ Name ] field incorrect\n",
			'adresse1':" -> [ Address ] field incorrect\n",
			'cpostal':" -> [ Postcode ] field incorrect\n",
			'email':" -> [ E-mail ] field incorrect\n",
			'tel':" -> [ Telephone ] field incorrect\n",
			'produit':" -> [ Choose your product ] field incorrect\n",
			'msg':" -> [ Message ] field incorrect\n",
			'action':"Please verify your data entry.\n"
			};
	lang[4]={'err':"Achtung, einige notwendige Informationen wurden nicht angegeben oder sind nicht konform :\n",
			'nom':" -> Feld [ Name ] inkorrekt\n",
			'adresse1':" -> Feld [ Addresse ] inkorrekt\n",
			'cpostal':" -> Feld [ Postleitzahl ] inkorrekt\n",
			'email':" -> Feld [ Email ] inkorrekt\n",
			'tel':" -> Feld [ Telefon ] inkorrekt\n",
			'produit':" -> Feld [ Unser “Pro” Angebot ] inkorrekt\n",
			'msg':" -> Feld [ Nachricht ] inkorrekt\n",
			'action':"Bitte überprüfen Sie ihre Angaben.\n"
			};
	var err=lang[lg]['err'];

	for (k in m) {if (f[m[k]].value==""||f[m[k]].value==null)	{e=1;err+=lang[lg][m[k]];}}
	if (!((place > -1)&&(email.length >2)&&(point > 1)))			{e=1;err+=lang[lg]['email'];}

	if(e==1){
		err+=lang[lg]['action'];
		alert(err);
		return false;
	} else {
		f['saisie_ok'].value=1;
		document.forms[nom_form].submit();
		return true;
	}
}
