// JavaScript Document
// Agregar a favoritos.

function agregar()

{

if ((navigator.appName=="Microsoft Internet Explorer") && (parseInt(navigator.appVersion)>=4)) 

{

var url="http://www.thespanishsun.com";

var titulo="The Spanish Sun - Villa and Apartment Holiday Rentals in Southern Spain";

window.external.AddFavorite(url,titulo);

}

else 

{

if(navigator.appName == "Netscape") 

alert ("Add to Favorites (Ctrl+D)");

}

}

function agregar_esp()

{

if ((navigator.appName=="Microsoft Internet Explorer") && (parseInt(navigator.appVersion)>=4)) 

{

var url="http://www.thespanishsun.com";

var titulo="The Spanish Sun - Alquiler de Villas y  Apartamentos para sus vacaciones en la Costa del Sol";

window.external.AddFavorite(url,titulo);

}

else 

{

if(navigator.appName == "Netscape") 

alert ("Para añadir a favoritos pulse: Ctrl+D");

}

}


// Validar Formulario

function Validar(form)
{
  if (form.Name.value == "")
  { alert("Please type your name."); form.Name.focus(); return; }
	
  if (form.Address.value == "")
  { alert("Please type your address."); form.Address.focus(); return; }
  
  if (form.PostCode.value == "")
  { alert("Please type your post code."); form.Code.focus(); return; }
  
  if (form.Country.value == "")
  { alert("Please type your country."); form.Country.focus(); return; }
  
  if (form.Phone.value == "")
  { alert("Please type your Phone."); form.Phone.focus(); return; }
  	
  if ((form.FROM.value.indexOf ('@', 0) == -1)||(form.FROM.value.indexOf ('.', 0) == -1)||(form.FROM.value.length < 5))     
  {
	if (form.FROM.value == "")
	  {
	  alert("Please type your e-mail address."); 
  	  form.FROM.focus();
  	  return (false); 
	  }
      else
      {
  	  alert("Please type a valid e-mail address."); 
  	  form.FROM.focus();
  	  return (false); 
 	  }
  }
 
  form.submit();
}

function Validar_Esp(form)
{
  if (form.Nombre.value == "")
  { alert("Por favor, indique su nombre."); form.Name.focus(); return; }
	
  if (form.Direccion.value == "")
  { alert("Por favor, indique su dirección."); form.Address.focus(); return; }
  
  if (form.Codigo_Postal.value == "")
  { alert("Por favor, indique su código postal."); form.Code.focus(); return; }
  
  if (form.Pais.value == "")
  { alert("Por favor, indique su país."); form.Country.focus(); return; }
  
  if (form.Telefono.value == "")
  { alert("Por favor, indique su teléfono."); form.Phone.focus(); return; }
  	
  if ((form.FROM.value.indexOf ('@', 0) == -1)||(form.FROM.value.indexOf ('.', 0) == -1)||(form.FROM.value.length < 5))     
  {
	if (form.FROM.value == "")
	  {
	  alert("Por favor, indique su e-mail."); 
  	  form.FROM.focus();
  	  return (false); 
	  }
      else
      {
  	  alert("Indique una dirección de e-mail válida."); 
  	  form.FROM.focus();
  	  return (false); 
 	  }
  }
 
  form.submit();
}

function textCounter(field, maxlimit) 
{
if (field.value.length > maxlimit)
field.value = field.value.substring(0, maxlimit);
}

