/*####################################################
########## FORMULARI DE CONTACTE #####################
####################################################*/
function validateFormContacte(thisform){
var digits=" .-,/+0123456789";
var temp;
var idioma = thisform.idioma.value;

switch(idioma){
case "1":
  error_nom = "Ha d'indicar el seu nom"
	error_tel = "Ha d'indicar el seu telèfon"
	error_tel2 = "Format de telèfon incorrecte"
	error_mail = "Ha d'indicar el seu e-mail"
	error_mail2 = "Format e-mail incorrecte"
	error_miss = "Ha d'indicar el seu missatge"
  break;
case "2":
  error_nom = "Debe indicar su nombre"
	error_tel = "Debe indicar su teléfono"
	error_tel2 = "Formato de teléfono incorrecto"
	error_mail = "Debe indicar su e-mail"
	error_mail2 = "Formato e-mail incorrecto"
	error_miss = "Debe indicar su mensaje"
  break;
default:
  idioma = 1;
}

if (thisform.nom.value==""){
	 alert(error_nom);
	 thisform.nom.focus();
	 return false;
	 }
if (thisform.telefon.value==""){
	 alert(error_tel);
	 thisform.telefon.focus();
	 return false;
	 }
if (thisform.telefon.value!=""){
    for (var i=0;i<thisform.telefon.value.length;i++){
      temp=thisform.telefon.value.substring(i,i+1)
      if (digits.indexOf(temp)==-1){
        alert(error_tel2);
        thisform.telefon.focus();
        return false;
      }
    }
    }
if (thisform.email.value==""){
	 alert(error_mail);
	 thisform.email.focus();
	 return false;
	 }
if (thisform.email.value!="") {
    if (thisform.email.value.indexOf("@")==-1 || thisform.email.value.indexOf(".")==-1 || thisform.email.value.indexOf(" ")!=-1 || thisform.email.value.length<6) {
      alert(error_mail2);
      thisform.email.focus();
      return false;
    }
    }
if (thisform.missatge.value==""){
	 alert(error_miss);
	 thisform.missatge.focus();
	 return false;
	 }
else return true;
}
