function ValidDate() {
	if (navigator.appName == "Netscape")
		return 1;	// error with a2=d2.getYear()
	var errStr1 = 'Invalid date';
	var errStr2 = errStr1;
	with(document.frm_contact_email) {
		var j = lt_day[lt_day.selectedIndex].value;
		var m = lt_month[lt_month.selectedIndex].value;
		var a = lt_year[lt_year.selectedIndex].value;
	}
	var d2=new Date(a,m-1,j);
	j2=d2.getDate();
	m2=d2.getMonth()+1;
	a2=d2.getYear();
	if ( (j!=j2)||(m!=m2)||(a!=a2) ) {
		return 0;
	}

	var today=new Date;
	j1=today.getDate();
	m1=today.getMonth()+1;
	a1=today.getYear();
	var d1 = new Date(a1,m1-1,j1);
	//alert("Dates : " + d1 + " : " + d2);
	if ( d2 < d1 ) {
		return 0;
	}
	return 1;
}


function show_other()
{
  if (document.all.lt_action.value == "other") 
  {
	document.all.lb_hotel.style.display = "none";
    document.all.lt_hotel.style.display = "none";       
	document.all.lb_agency.style.display = "none";
    document.all.tf_agency.style.display = "none";   
    document.all.tf_other_action.style.display = "";
    document.all.tf_other_action.focus();
    document.all.lb_surname.style.display = "";
    document.all.tf_surname.style.display = "";
	document.all.lb_arrival.style.display = "none"
	document.all.lt_day.style.display = "none"
	document.all.lt_month.style.display = "none"
	document.all.lt_year.style.display = "none"
	document.all.lb_persons.style.display = "none"
	document.all.nb_persons.style.display = "none"
	document.all.lb_nights.style.display = "none"
	document.all.nb_nights.style.display = "none"
    document.all.lb_confirmation_number.style.display = "none";
    document.all.tf_confirmation_number.style.display = "none";
  }

  if ((document.all.lt_action.value == "cancel") || (document.all.lt_action.value == "modify"))
  {
	document.all.lb_hotel.style.display = "";
    document.all.lt_hotel.style.display = "";       
	document.all.lb_agency.style.display = "none";
    document.all.tf_agency.style.display = "none";    
    document.all.tf_other_action.style.display = "none";
	document.all.lb_surname.style.display = "";
    document.all.tf_surname.style.display = "";
	document.all.lb_arrival.style.display = "none"
	document.all.lt_day.style.display = "none"
	document.all.lt_month.style.display = "none"
	document.all.lt_year.style.display = "none"
	document.all.lb_persons.style.display = "none"
	document.all.nb_persons.style.display = "none"
	document.all.lb_nights.style.display = "none"
	document.all.nb_nights.style.display = "none"
    document.all.lb_confirmation_number.style.display = "";
    document.all.tf_confirmation_number.style.display = "";
  }
  
  if ((document.all.lt_action.value == "information") || (document.all.lt_action.value == "select"))
  {
	document.all.lb_hotel.style.display = "none";
    document.all.lt_hotel.style.display = "none";       
	document.all.lb_agency.style.display = "none";
    document.all.tf_agency.style.display = "none";    
    document.all.tf_other_action.style.display = "none";
    document.all.lb_surname.style.display = "";
    document.all.tf_surname.style.display = "";
    document.all.lb_arrival.style.display = "none"
	document.all.lt_day.style.display = "none"
	document.all.lt_month.style.display = "none"
	document.all.lt_year.style.display = "none"
	document.all.lb_persons.style.display = "none"
	document.all.nb_persons.style.display = "none"
	document.all.lb_nights.style.display = "none"
	document.all.nb_nights.style.display = "none"
    document.all.lb_confirmation_number.style.display = "none";
    document.all.tf_confirmation_number.style.display = "none";
  }
  
  if ((document.all.lt_action.value == "make"))
  {
	document.all.lb_hotel.style.display = "";
    document.all.lt_hotel.style.display = "";     
	document.all.lb_agency.style.display = "none";
    document.all.tf_agency.style.display = "none";    
	document.all.lb_surname.style.display = "";
    document.all.tf_surname.style.display = "";  
    document.all.tf_other_action.style.display = "none";
	document.all.lb_arrival.style.display = ""
	document.all.lt_day.style.display = ""
	document.all.lt_month.style.display = ""
	document.all.lt_year.style.display = ""
	document.all.lb_persons.style.display = ""
	document.all.nb_persons.style.display = ""
	document.all.lb_nights.style.display = ""
	document.all.nb_nights.style.display = ""
	document.all.lb_confirmation_number.style.display = "none";
    document.all.tf_confirmation_number.style.display = "none";
  }
  
  if ((document.all.lt_action.value == "ta_getcode"))
  {
	document.all.lb_hotel.style.display = "none";
    document.all.lt_hotel.style.display = "none";      
	document.all.lb_agency.style.display = "";
    document.all.tf_agency.style.display = "";    
	document.all.lb_surname.style.display = "";
    document.all.tf_surname.style.display = "";  
    document.all.tf_other_action.style.display = "none";
	document.all.lb_arrival.style.display = "none"
	document.all.lt_day.style.display = "none"
	document.all.lt_month.style.display = "none"
	document.all.lt_year.style.display = "none"
	document.all.lb_persons.style.display = "none"
	document.all.nb_persons.style.display = "none"
	document.all.lb_nights.style.display = "none"
	document.all.nb_nights.style.display = "none"
	document.all.lb_confirmation_number.style.display = "none";
    document.all.tf_confirmation_number.style.display = "none";
  }
}





function contact_us_form_validation_en()
{
   error = false;
  
  if (frm_contact_email.lt_action.value=='select')
   {
      alert("Please select an action.");
	  frm_contact_email.lt_action.focus();
	  error = true;
   }  
   
   if ((!error)&&(frm_contact_email.lt_hotel.value=='select')&&((frm_contact_email.lt_action.value=='make')||(frm_contact_email.lt_action.value=='modify')||(frm_contact_email.lt_action.value=='cancel')))
   {
      alert("Please select a hotel.");
	  frm_contact_email.lt_hotel.focus();
	  error = true;
   }  
   
    if ((!error)&&(frm_contact_email.tf_other_action.value.replace(/ /g,"").length==0 )&&(frm_contact_email.lt_action.value=='other'))
   {
      alert("Please enter other action.");
	  frm_contact_email.tf_other_action.focus();
	  error = true;	  
   }
   
    if ((!error)&&(frm_contact_email.tf_name.value.replace(/ /g,"").length==0))
   {
      alert("Please enter your name.");
	  frm_contact_email.tf_name.focus();
	  error = true;	  
   }
   
   if ((!error)&&(frm_contact_email.tf_surname.value.replace(/ /g,"").length==0))
   {
      alert("Please enter your surname.");
	  frm_contact_email.tf_surname.focus();
	  error = true;	  
   }  
   
    if ((!error)&&(frm_contact_email.lt_action.value=='ta_getcode')&&(frm_contact_email.tf_agency.value.replace(/ /g,"").length==0))
   {
      alert("Please enter your Travel Agency.");
	  frm_contact_email.tf_agency.focus();
	  error = true;
   }  
   
   if ((!error)&&((frm_contact_email.lt_action.value=='cancel')||(frm_contact_email.lt_action.value=='modify'))&&(frm_contact_email.tf_confirmation_number.value.replace(/ /g,"").length==0))
   {
      alert("Please enter the confirmation number of your reservation.");
	  frm_contact_email.tf_confirmation_number.focus();
	  error = true;	  
   }
   
   if ((!error)&&(frm_contact_email.lt_action.value=='make')&&(!ValidDate()))
   {
      alert("Please enter a valid date.");
	  frm_contact_email.lt_day.focus();
	  error = true;	  
   }
   
   if ((!error)&&((frm_contact_email.tf_email.value.replace(" ","").length==0)||(frm_contact_email.tf_email.value.lastIndexOf("@")==-1) || (frm_contact_email.tf_email.value.lastIndexOf(".")==-1)))
   {
      alert("Please, type the email address correctly.");
	  frm_contact_email.tf_email.focus();
	  error = true;
   }
   if ((!error)&&((frm_contact_email.lt_action.value=='information')||(frm_contact_email.lt_action.value=='other'))&&(frm_contact_email.tf_comment.value.replace(/ /g,"").length==0))
   {
      alert("Please enter your comment.");
	  frm_contact_email.tf_comment.focus();
	  error = true;	  
   }
   
   if (!error)
   {
      return true;
   }
   else
   {
      return false;	  
   }
}

function send_form_en()
{
 if (contact_us_form_validation_en())
   {
   frm_contact_email.submit();
   }
}

function contact_us_form_validation_trade_portal_en()
{
   error = false;
   if (frm_contact_email.tf_name.value=='')
   {
      alert("Please enter your name.");
	  frm_contact_email.tf_name.focus();
	  error = true;
   }  
   if ((!error)&&((frm_contact_email.tf_email.value.replace(" ","").length==0)||(frm_contact_email.tf_email.value.lastIndexOf("@")==-1) || (frm_contact_email.tf_email.value.lastIndexOf(".")==-1)))
   {
      alert("Please, type the email address correctly.");
	  frm_contact_email.tf_email.focus();
	  error = true;
   }
   if ((!error)&&(frm_contact_email.tf_comment_text.value==''))
   {
      alert("Please, enter your comments.");
	  frm_contact_email.tf_comment_text.focus();
	  error = true;
   }
   if (!error)
   {
      return true;
   }
   else
   {
      return false;	  
   }
}

function send_form_trade_portal_en()
{
 if (contact_us_form_validation_trade_portal_en())
   {
   frm_contact_email.submit();
   }
}




function contact_us_form_validation_es()
{
   error = false;
   if (frm_contact_email.lt_action.value=='select')
   {
      alert("Por favor seleccione una acción.");
	  frm_contact_email.lt_action.focus();
	  error = true;
   }  
   
   if ((!error)&&(frm_contact_email.lt_hotel.value=='select')&&((frm_contact_email.lt_action.value=='make')||(frm_contact_email.lt_action.value=='modify')||(frm_contact_email.lt_action.value=='cancel')))
   {
      alert("Por favor seleccione un hotel.");
	  frm_contact_email.lt_hotel.focus();
	  error = true;
   }  
   
    if ((!error)&&(frm_contact_email.tf_other_action.value.replace(/ /g,"").length==0)&&(frm_contact_email.lt_action.value=='other'))
   {
      alert("Por favor entre otra acción.");
	  frm_contact_email.tf_other_action.focus();
	  error = true;	  
   }
   
    if ((!error)&&(frm_contact_email.tf_name.value.replace(/ /g,"").length==0))
   {
      alert("Por favor entre su nombre.");
	  frm_contact_email.tf_name.focus();
	  error = true;	  
   }
   
   if ((!error)&&(frm_contact_email.tf_surname.value.replace(/ /g,"").length==0))
   {
      alert("Por favor entre su apellido.");
	  frm_contact_email.tf_surname.focus();
	  error = true;	  
   }  
   
    if ((!error)&&(frm_contact_email.lt_action.value=='ta_getcode')&&(frm_contact_email.tf_agency.value.replace(/ /g,"").length==0))
   {
      alert("Por favor entre su Agencia de Viajes.");
	  frm_contact_email.tf_agency.focus();
	  error = true;
   }  
   
   if ((!error)&&((frm_contact_email.lt_action.value=='cancel')||(frm_contact_email.lt_action.value=='modify'))&&(frm_contact_email.tf_confirmation_number.value.replace(/ /g,"").length==0))
   {
      alert("Por favor entre el número de su reservación");
	  frm_contact_email.tf_confirmation_number.focus();
	  error = true;	  
   }
   
   if ((!error)&&(frm_contact_email.lt_action.value=='make')&&(!ValidDate()))
   {
      alert("Por favor entre una fecha válida.");
	  frm_contact_email.lt_day.focus();
	  error = true;	  
   }
   
   if ((!error)&&((frm_contact_email.tf_email.value.replace(" ","").length==0)||(frm_contact_email.tf_email.value.lastIndexOf("@")==-1) || (frm_contact_email.tf_email.value.lastIndexOf(".")==-1)))
   {
      alert("Por favor, teclee la dirección de correo correctamente.");
	  frm_contact_email.tf_email.focus();
	  error = true;
   }
   
   if ((!error)&&((frm_contact_email.lt_action.value=='information')||(frm_contact_email.lt_action.value=='other'))&&(frm_contact_email.tf_comment.value.replace(/ /g,"").length==0))
   {
      alert("Por favor entre sus comentarios.");
	  frm_contact_email.tf_comment.focus();
	  error = true;	  
   }
   
   if (!error)
   {
      return true;
   }
   else
   {
      return false;	  
   }
}

function send_form_es()
{
 if (contact_us_form_validation_es())
   {
   frm_contact_email.submit();
   }
}

function contact_us_form_validation_trade_portal_es()
{
   error = false;
   if (frm_contact_email.tf_name.value=='')
   {
      alert("Por favor entre su nombre.");
	  frm_contact_email.tf_name.focus();
	  error = true;
   }  
   if ((!error)&&((frm_contact_email.tf_email.value.replace(" ","").length==0)||(frm_contact_email.tf_email.value.lastIndexOf("@")==-1) || (frm_contact_email.tf_email.value.lastIndexOf(".")==-1)))
   {
      alert("Por favor, teclee la dirección de correo correctamente.");
	  frm_contact_email.tf_email.focus();
	  error = true;
   }
   if ((!error)&&(frm_contact_email.tf_comment_text.value==''))
   {
      alert("Por favor entre sus comentarios.");
	  frm_contact_email.tf_comment_text.focus();
	  error = true;
   }
   if (!error)
   {
      return true;
   }
   else
   {
      return false;	  
   }
}

function send_form_trade_portal_es()
{
 if (contact_us_form_validation_trade_portal_es())
   {
   frm_contact_email.submit();
   }
}




function contact_us_form_validation_it()
{
   error = false;
   if (frm_contact_email.lt_action.value=='select')
   {
      alert("Selezioni un'attività.");
	  frm_contact_email.lt_action.focus();
	  error = true;
   }  
   
   if ((!error)&&(frm_contact_email.lt_hotel.value=='select')&&((frm_contact_email.lt_action.value=='make')||(frm_contact_email.lt_action.value=='modify')||(frm_contact_email.lt_action.value=='cancel')))
   {
      alert("Selezioni un hotel.");
	  frm_contact_email.lt_hotel.focus();
	  error = true;
   }  
   
    if ((!error)&&(frm_contact_email.tf_other_action.value.replace(/ /g,"").length==0)&&(frm_contact_email.lt_action.value=='other'))
   {
      alert("Scriva un'attività.");
	  frm_contact_email.tf_other_action.focus();
	  error = true;	  
   }
   
    if ((!error)&&(frm_contact_email.tf_name.value.replace(/ /g,"").length==0))
   {
      alert("Scriva il suo nome.");
	  frm_contact_email.tf_name.focus();
	  error = true;	  
   }
   
   if ((!error)&&(frm_contact_email.tf_surname.value.replace(/ /g,"").length==0))
   {
      alert("Scriva il suo cognome.");
	  frm_contact_email.tf_surname.focus();
	  error = true;	  
   }  
   
    if ((!error)&&(frm_contact_email.lt_action.value=='ta_getcode')&&(frm_contact_email.tf_agency.value.replace(/ /g,"").length==0))
   {
      alert("Scriva suo agenzie di viaggi.");
	  frm_contact_email.tf_agency.focus();
	  error = true;
   }  
   
   if ((!error)&&((frm_contact_email.lt_action.value=='cancel')||(frm_contact_email.lt_action.value=='modify'))&&(frm_contact_email.tf_confirmation_number.value.replace(/ /g,"").length==0))
   {
      alert("PScriva il numero della conferma della sua prenotazione.");
	  frm_contact_email.tf_confirmation_number.focus();
	  error = true;	  
   }
   
   if ((!error)&&(frm_contact_email.lt_action.value=='make')&&(!ValidDate()))
   {
      alert("Verifichi il suo data d' arrivo.");
	  frm_contact_email.lt_day.focus();
	  error = true;	  
   }
   
   if ((!error)&&((frm_contact_email.tf_email.value.replace(" ","").length==0)||(frm_contact_email.tf_email.value.lastIndexOf("@")==-1) || (frm_contact_email.tf_email.value.lastIndexOf(".")==-1)))
   {
      alert("Scriva il suo indirizzo di posta elettronica.");
	  frm_contact_email.tf_email.focus();
	  error = true;
   }
   
   if ((!error)&&((frm_contact_email.lt_action.value=='information')||(frm_contact_email.lt_action.value=='other'))&&(frm_contact_email.tf_comment.value.replace(/ /g,"").length==0))
   {
      alert("Scriva il suo commento.");
	  frm_contact_email.tf_comment.focus();
	  error = true;	  
   }
   
   if (!error)
   {
      return true;
   }
   else
   {
      return false;	  
   }
}

function send_form_it()
{
 if (contact_us_form_validation_it())
   {
   frm_contact_email.submit();
   }
}

function contact_us_form_validation_trade_portal_it()
{
   error = false;
   if (frm_contact_email.tf_name.value=='')
   {
      alert("Scriva il suo nome.");
	  frm_contact_email.tf_name.focus();
	  error = true;
   }  
   if ((!error)&&((frm_contact_email.tf_email.value.replace(" ","").length==0)||(frm_contact_email.tf_email.value.lastIndexOf("@")==-1) || (frm_contact_email.tf_email.value.lastIndexOf(".")==-1)))
   {
      alert("Scriva il suo indirizzo di posta elettronica.");
	  frm_contact_email.tf_email.focus();
	  error = true;
   }
   if ((!error)&&(frm_contact_email.tf_comment_text.value==''))
   {
      alert("Scriva il suo commento.");
	  frm_contact_email.tf_comment_text.focus();
	  error = true;
   }
   if (!error)
   {
      return true;
   }
   else
   {
      return false;	  
   }
}

function send_form_trade_portal_it()
{
 if (contact_us_form_validation_trade_portal_it())
   {
   frm_contact_email.submit();
   }
}


//funciones en frances
function contact_us_form_validation_fr()
{
   error = false;
   if (frm_contact_email.lt_action.value=='select')
   {
      alert("Veuillez sélectionnez une action.");
	  frm_contact_email.lt_action.focus();
	  error = true;
   }  
   
   if ((!error)&&(frm_contact_email.lt_hotel.value=='select')&&((frm_contact_email.lt_action.value=='make')||(frm_contact_email.lt_action.value=='modify')||(frm_contact_email.lt_action.value=='cancel')))
   {
      alert("Veuillez sélectionnez un hôtel.");
	  frm_contact_email.lt_hotel.focus();
	  error = true;
   }  
   
    if ((!error)&&(frm_contact_email.tf_other_action.value.replace(/ /g,"").length==0)&&(frm_contact_email.lt_action.value=='other'))
   {
      alert("Veuillez écrire autre action.");
	  frm_contact_email.tf_other_action.focus();
	  error = true;	  
   }
   
    if ((!error)&&(frm_contact_email.tf_name.value.replace(/ /g,"").length==0))
   {
      alert("Veuillez écrire votre prénom.");
	  frm_contact_email.tf_name.focus();
	  error = true;	  
   }
   
   if ((!error)&&(frm_contact_email.tf_surname.value.replace(/ /g,"").length==0))
   {
      alert("Veuillez écrire votre nom.");
	  frm_contact_email.tf_surname.focus();
	  error = true;	  
   }  
   
    if ((!error)&&(frm_contact_email.lt_action.value=='ta_getcode')&&(frm_contact_email.tf_agency.value.replace(/ /g,"").length==0))
   {
      alert("Veuillez écrire Nom de l’agence.");
	  frm_contact_email.tf_agency.focus();
	  error = true;
   }  
   
   if ((!error)&&((frm_contact_email.lt_action.value=='cancel')||(frm_contact_email.lt_action.value=='modify'))&&(frm_contact_email.tf_confirmation_number.value.replace(/ /g,"").length==0))
   {
      alert("Veuillez écrire le numéro de confirmation de votre réservation");
	  frm_contact_email.tf_confirmation_number.focus();
	  error = true;	  
   }
   
   if ((!error)&&(frm_contact_email.lt_action.value=='make')&&(!ValidDate()))
   {
      alert("Veuillez écrire correctement votre date d’arrivée.");
	  frm_contact_email.lt_day.focus();
	  error = true;	  
   }
   
   if ((!error)&&((frm_contact_email.tf_email.value.replace(" ","").length==0)||(frm_contact_email.tf_email.value.lastIndexOf("@")==-1) || (frm_contact_email.tf_email.value.lastIndexOf(".")==-1)))
   {
      alert("Veuillez écrire correctement votre adresse électronique.");
	  frm_contact_email.tf_email.focus();
	  error = true;
   }
   
   if ((!error)&&((frm_contact_email.lt_action.value=='information')||(frm_contact_email.lt_action.value=='other'))&&(frm_contact_email.tf_comment.value.replace(/ /g,"").length==0))
   {
      alert("Veuillez écrire votre commentaire.");
	  frm_contact_email.tf_comment.focus();
	  error = true;	  
   }
   
   if (!error)
   {
      return true;
   }
   else
   {
      return false;	  
   }
}

function send_form_fr()
{
 if (contact_us_form_validation_fr())
   {
   frm_contact_email.submit();
   }
}

function contact_us_form_validation_trade_portal_fr()
{
   error = false;
   if (frm_contact_email.tf_name.value=='')
   {
      alert("Veuillez écrire votre prénom.");
	  frm_contact_email.tf_name.focus();
	  error = true;
   }  
   if ((!error)&&((frm_contact_email.tf_email.value.replace(" ","").length==0)||(frm_contact_email.tf_email.value.lastIndexOf("@")==-1) || (frm_contact_email.tf_email.value.lastIndexOf(".")==-1)))
   {
      alert("Veuillez écrire correctement votre adresse électronique.");
	  frm_contact_email.tf_email.focus();
	  error = true;
   }
   if ((!error)&&(frm_contact_email.tf_comment_text.value==''))
   {
      alert("Veuillez écrire votre commentaire.");
	  frm_contact_email.tf_comment_text.focus();
	  error = true;
   }
   if (!error)
   {
      return true;
   }
   else
   {
      return false;	  
   }
}

function send_form_trade_portal_fr()
{
 if (contact_us_form_validation_trade_portal_fr())
   {
   frm_contact_email.submit();
   }
}

//otros
function onrequest_booking_en()
{
	error = false;

	if (frm_onrequest_booking.txt_name.value.replace(/ /g,"").length==0)
	{
		alert("Please enter your name.");
		frm_onrequest_booking.txt_name.focus();
		error = true;	  
	}

	if ((!error)&&(frm_onrequest_booking.txt_surname.value.replace(/ /g,"").length==0))
	{
		alert("Please enter your surname.");
		frm_onrequest_booking.txt_surname.focus();
		error = true;	  
	}  
	
	if ((!error)&&((frm_onrequest_booking.txt_email.value.replace(" ","").length==0)||(frm_onrequest_booking.txt_email.value.lastIndexOf("@")==-1) || (frm_onrequest_booking.txt_email.value.lastIndexOf(".")==-1)))
	{
		alert("Please, type the email address correctly.");
		frm_onrequest_booking.txt_email.focus();
		error = true;
	}
	if (!error)
	{
		frm_onrequest_booking.submit();
	}
}
