////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
function enviarcorreos() 
{
var ventana=null;
var opciones="left=150,top=100,width=400,height=400, resizable=yes ,scrollbars=yes,menubar=no"; 
if (ventana==null||(ventana.closed))   ventana = window.open("","",opciones); 
//	ventana.location = archivo;
ventana.location = "envios.htm";
  return 1;
}
////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
function FormUsuarios()
{
  if (document.formuser.apellidos.value!="") 
  {  
  if (document.formuser.email.value!="")   
   {
  if (document.formuser.nombre.value!="")   
   {
      if (document.formuser.clave.value!="")   
       {
        if (document.formuser.nick.value!="")   
	     {  
           document.formuser.submit();
		 } else alert("El campo nick es Obligatorio");
      } else alert("El campo clave es Obligatorio");
   } else alert("El campo Nombre es Obligatorio");	  
   } else alert("El campo email es Obligatorio");	  
   } else alert("El campo apellidos es Obligatorio");	     
}
////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
function FormGrupos()
{
 if (document.formgrupos.nombre.value!="")   
	     {  
           document.formgrupos.submit();
		 } else alert("El campo nombre es Obligatorio");
}
////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
function FormSecciones()
{
 if (document.formsecciones.titulo.value!="")   
	     {  
           document.formsecciones.submit();
		 } else alert("El campo Titulo es Obligatorio");
}
////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
function FormRecursos()
{
 if (document.formrecursos.titulo.value!="")   
	     {  
           document.formrecursos.submit();
		 } else alert("El campo Titulo es Obligatorio");
}
////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
function FormPerfil()
{
  if (document.perfil.apellidos.value!="") 
  {  
  if (document.perfil.email.value!="")   
   {
  if (document.perfil.nombre.value!="")   
   {
      if (document.perfil.clave.value!="")   
       {
        if (document.perfil.nick.value!="")   
	     {  
           document.perfil.submit();
		 } else alert("El campo nick es Obligatorio");
      } else alert("El campo clave es Obligatorio");
   } else alert("El campo Nombre es Obligatorio");	  
   } else alert("El campo email es Obligatorio");	  
   } else alert("El campo apellidos es Obligatorio");	     
	  
}
////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
function abrirventana(documento)   //lanza una ventana pop-up
{
var ventana2=null;
var opciones="left=100,top=100,width=400,height=310, resizable=no ,scrollbars=np,menubar=no", i= 0; 
if (ventana2==null||(ventana.closed))   ventana2 = window.open(documento,"",opciones); 

ventana2.location = documento;
}

////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
function FormRecordar()
{
 if (document.recordar.recordar_mail.value!="")   
	     {  
           document.recordar.submit();
		 } else alert("El campo email es Obligatorio");
}

////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
function PonerEnAgenda(r)
{
url="ponerenagenda.php?r="+r;
abrirventana(url);
}
////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////

function DameUrl()
{
return location.href;
}
function DameGET()
{
return location.search;
}
////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
function IraURL()
{

if (DameGET()=="") {window.location="index.php?&op=5"}
else {window.location=DameUrl();}
}
////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
var ventana=null;
function LanzaImagen(foto)
{
 var opciones="left=100,top=100,width=250,height=150, resizable=yes ,scrollbars=yes", i= 0; 
if (ventana==null||(ventana.closed))   ventana = window.open("","",opciones); 

//construimos la pagina que se habrira en la nueva ventana
ventana.document.open();
ventana.document.write("<html><head><title>"+foto+"</title>");
 ventana.document.write("<");
 ventana.document.write("script LANGUAGE='JavaScript'>");
 ventana.document.write("imagen=new Image();");
 ventana.document.write("function colocar() { ");
 ventana.document.write("if (screen.availWidth>window.document.imagen.width)  ");
 ventana.document.write("pantallax=((screen.availWidth-window.document.imagen.width)/2);   ");
 ventana.document.write("else (pantallax=0);   ");
 ventana.document.write("if (screen.availHeight>window.document.imagen.height)  ");
 ventana.document.write("pantallay=((screen.availHeight-window.document.imagen.height)/2);  ");
 ventana.document.write("else (pantallay=0); ");
 ventana.document.write("window.moveTo(pantallax,pantallay);  ");
 ventana.document.write(" if(screen.availWidth>window.document.imagen.width)    ");
 ventana.document.write("fotox=window.document.imagen.width; ");
 ventana.document.write("else fotox=screen.availWidth; ");
 ventana.document.write("if(screen.availHeight>window.document.imagen.height) ");
 ventana.document.write("fotoy=window.document.imagen.height; ");
 ventana.document.write("else fotoy=screen.availHeight; ");
 ventana.document.write("window.resizeTo(fotox,fotoy); ");
 ventana.document.write("window.focus(); ");
  ventana.document.write("}");
 ventana.document.write("<");
 ventana.document.write("/script>");

ventana.document.write("</head>");
ventana.document.write("<body style='word-spacing: 0; text-indent: 0; margin: 0'>")
ventana.document.write("<img name=imagen src='"+foto+"' Border=0>");
 ventana.document.write("<");
 ventana.document.write("script LANGUAGE='JavaScript'>");

//ventana.document.write("imagen.src='"+foto+"';");
//ventana.document.write("imagen.onload=colocar();");
ventana.document.write("setTimeout('colocar();',1500);");
ventana.document.write("setTimeout('colocar();',7000);");

//llama a  dar tamaño a la ventana desde la precarga de la imagen porque así
// da tamaño a la ventana antes de que se termine de cargar la imagen

 ventana.document.write("<");
 ventana.document.write("/script>");

ventana.document.write("</body></html>");
ventana.focus(); 
}

////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////
function  mostrar_capa(elemento)
{
var ns4=document.layers
var ie4=document.all
var ns6=document.getElementById&&!document.all

	 if (ie4||ns6)
	   {
	     capa=ns6? document.getElementById(elemento) : document.all(elemento);
	 	 if (capa.style.display == "none")    capa.style.display = "";       
         else capa.style.display = "none";	 
	   }	 
     else if (ns4)
	  { 
	  capa=document.layers(elemento);
	   capa.display="" ;   
	  } 
}
////////////////////////////////////////////
////////////////////////////

function LanzaCalendario(op)
{
opcion=op;
ventana=open("selector.htm", "fechas", " location=no,menubar=no,resizable=no,scrollbars=no,status=no,toolbar=no,width=180,height=180,top=100,left=250");
ventana.focus();
}
function PonerResultado(valor)
{
switch (opcion) {
     case 1:  document.form1.fecha_ini.value=valor;
         break;
     case 2:  document.form1.fecha_fin.value=valor;
         break; 
}
  ventana.close();
}
function enviarform()
{
document.form1.fecha_ini.disabled="";
document.form1.fecha_fin.disabled="";
document.form1.submit();
}

