

function invalidForm(field,msg){
	alert(msg);
	field.focus();
}

function checkChars(str,comp){
	flg=0;
	for (var i=0;i<str.length;i++){
		tst=str.substring(i,i+1)
		if (comp.indexOf(tst)<0) flg++;
	}
	if (flg!=0) return false;
	else return true;
}

function checkMail(val) {
	test = val.split('@');
        if (test.length==2 && test[0]!='' && test[1]!='' && test[1].substring(0,1)!='.'){
        	test2 = test[1].split('.');
        	if (test2.length<2 || test2[test2.length-1]=='' || test2[test2.length-2]=='') return false;
        } else return false;
        return true;
}

function validateForm(complete){
	f= document.europe;
	valid = true;
	
	if (valid==true) {
		if (f.mail.value==''){
			invalidForm(f.mail,'Veuillez entrer un email !');
			valid = false;
		} else if (!checkMail(f.mail.value)){
			invalidForm(f.mail,'Email incorrect!!');
			valid = false;
		
		} 
	}
	if (valid==true) document.europe.submit();
}

