
function buscar()
{
	var cadena = document.getElementById("buscar_id");
	if(cadena.value=='')
		{
		alert("Debes escribir un criterio de busqueda");
		cadena.focus();
		return;
		}
	document.formulario.submit();
		
}
function popUp(URL) {
var day = new Date();
var id = day.getTime();
eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=750,height=500');");
}
function CargarFoto(img, ancho, alto){
  derecha=(screen.width-ancho)/2;
  arriba=(screen.height-alto)/2;
  string="toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=1,width="+ancho+",height="+alto+",left="+derecha+",top="+arriba+"";
  fin=window.open(img,"",string);
  }
    function Confirma(msn,url)
	{
	var respuesta=confirm(msn);
        if (respuesta==true)
		location.href=url
		//document.location=url;
	}

function popUp1(URL1) {
var day = new Date();
var id = day.getTime();
eval("page" + id + " = window.open(URL1, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=500,height=500');");
}

function popUpC(URLC) {
var day = new Date();
var id = day.getTime();
eval("page" + id + " = window.open(URLC, '" + id + "', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=380,height=280');");
}

//funciones para el formulario de opiniones
   function enviar_opinion()
   {
   //valida los datos antes de enviarlos  
   var nombre =document.getElementById("nombre_id");
   var asunto =document.getElementById("asunto_id"); 
   if(nombre.value=='')
     {
      alert("Debes completar el nombre para que sepamos quién eres. Gracias.");
      document.getElementById("nombre_id").focus();
      return;
     }
   if(asunto.value=='')
     {
      alert("Debes escribir tu opinión. Gracias");
      asunto.focus();
      return;
     }
    // alert("Gracias por colaborar con nosotros.") 
     document.form_opiniones.submit();
   }

   function enviar()
   {
   //valida los datos antes de enviarlos  
   var nombre =document.getElementById("nombre_id");
   var email =document.getElementById("email_id");
   var asunto =document.getElementById("asunto_id"); 
   var telefono =document.getElementById("telefono_id"); 
   if(nombre.value=='')
     {
      alert("Debes completar el nombre para que sepamos quién eres. Gracias.");
      document.getElementById("nombre_id").focus();
      return;
     }
   if(email.value=='')
     {
      alert("Debes completar el email para poder contactar contigo. Gracias.");
      email.focus();
      return;
     }
   else
     {
     if(es_email(email.value)=='-1'||email.value.length<8)
				{
        alert("Debes introducir un email correcto. Gracias.");
				email.focus();
				return;
        }
     }
 /*  if(asunto.value=='')
     {
      alert("Debes completar el asunto. Gracias");
      asunto.focus();
      return;
     }*/
   if(telefono.value=='')
     {
      alert("Debes completar el telefono para poder contactar contigo. Gracias.");
      telefono.focus();
      return;
     }
     alert("En breve recibiras un e-mail de confirmación. Gracias.") 
     document.formulario.submit();
   }

  function es_email(email)
  {
   //devuelve -1 si no encuentrala @ y el .
   var cadena = email;
   var arroba = cadena.indexOf('@');
   if(arroba=='-1')return arroba;
   var punto = cadena.indexOf('.',arroba);
   return punto;
  }