// FICHERO DE FUNCIONES
// si pongo aqui el codigo de noright click se ejecutar en TODAS las paginas  No rightclick script v.2.5

// FUNCION PARA VALIDAR FORMULARIO
// dentro de la funcion respetar las mayus/minus de los nombres de los campos
// si no introducimos nombre da error y me pone el cursor en casilla nombre

function check_form()
{

  if (document.forms[0].elements["nombre"].value=="") 
  {
    window.alert("Introduzca su NOMBRE, por favor");
    document.forms[0].elements["nombre"].focus();
    return false;
  }

  if (document.forms[0].elements["ciudad"].value=="") 
  {
    window.alert("Introduzca su CIUDAD, por favor");
    document.forms[0].elements["ciudad"].focus();
    return false;
  }
  
  if (document.forms[0].elements["provincia"].value=="") 
  {
    window.alert("Introduzca su PROVINCIA, por favor");
    document.forms[0].elements["provincia"].focus();
    return false;
  }
  
  if ((document.forms[0].elements["telefono"].value=="") && (document.forms[0].elements["email"].value=="")) 
  {
    window.alert("Indíquenos al menos una forma de contactar con usted, bien mediante e-mail o bien por teléfono.");
    document.forms[0].elements["email"].focus();
    return false;
  }
  
  if (document.forms[0].elements["fecha de entrada"].value=="") 
  {
    window.alert("Introduzca su FECHA DE ENTRADA, por favor");
    document.forms[0].elements["fecha de entrada"].focus();
    return false;
  }
  
  
    if (document.forms[0].elements["fecha de salida"].value=="") 
  {
    window.alert("Introduzca su FECHA DE SALIDA, por favor");
    document.forms[0].elements["fecha de salida"].focus();
    return false;
  }
  
  document.forms[0].submit();
  return true;
}
//////////////////////////////////////////////////
//////////////////////////////////////////////////
//////////////////////////////////////////////////

function newwinn(fich)
{
  var numargs = arguments.length;
  if (numargs < 2) {
     var a= Math.random() *100000;
     window.open(fich,"w" + Math.round(a),"width=600,height=500,scrollbars=yes,resizable=yes,top=10,left=10");
  } else {
       var w= arguments[1];
       var h= arguments[2];
       window.open(fich,"w" + Math.round(a),"width=" + w + ",height=" + h + ",resizable=no,top=10,left=10");      
    }
}

function newwins(fich)
{ 
      var a= Math.random() *100000;
      var w= arguments[1];
       var h= arguments[2];
       window.open(fich,"w" + Math.round(a),"width=" + w + ",height=" + h + ",scrollbars=yes,resizable=no,top=10,left=10");      
 }

function abreFoto(ruta)
{
i1 = new Image;
i1.src = ruta;
html = ' <html><head><title>La Posada de la Venta - Casa de Aldea</title></head>';
html += '<body leftmargin=0 marginwidth=0 topmargin=0 marginheight=0>';
html += '<center><img src="'+ruta+'" border=0 name="Foto" ';
html += 'onLoad="window.resizeTo(document.Foto.width,document.Foto.height + 50)">';
html += '<br><font face="Verdana, Arial, Helvetica, sans-serif" size="1"><a href="#" onClick="window.close();"><B>CERRAR</a></font>'
html += '</center></body></html>';
popupImage = window.open('','_blank','scrollbars=0,resizable=0');
popupImage.document.open();
popupImage.document.write(html);
popupImage.document.close();
}

function cambia(td,color)
{
	td.bgColor=color;
}