// JavaScript Document
	function valida(forma)
	{
		var forma = document.forms[forma];
		
		if(forma.elements[1].value == "" )
		{
			alert("Olvidaste introducir el usuario");
			forma.elements[1].focus();
			return false;
		}
 
		if(forma.elements[2].value == "")
		{
			alert("Olvidaste introducir la clave");
			forma.elements[2].focus();
			return false;
		}
		
		forma.submit();
	}

// VENTANA EMERGENTE
function openpopup(url,name,options,fullscreen) {
  //fullurl = "http://localhost" + url;
  windowobj = window.open(url,name,options);
  if (fullscreen) {
     windowobj.moveTo(0,0);
     windowobj.resizeTo(screen.availWidth,screen.availHeight);
  }
  windowobj.focus();
  return false;
}

function popup(URL, OPCIONES){
          day = new Date();
          id = day.getTime();
          window.open(URL, id , OPCIONES);
}

function cargaComentarios(numeroAzar, vid, id){
  var nombre, comentario, clave, variables, estado;
  
  nombre      = document.getElementById("nombre").value;
  estado      = document.getElementById("estado").value;
  comentario  = document.getElementById("comentario").value;
  clave       = document.getElementById("clave").value;
  
  variables = "id="+id+"&vid="+vid;
  
  if(numeroAzar != clave){
    alert("La clave debe coincidir!");
    self.location= "./verVideos.php?"+variables+"&inserta=0";
    return null;
  }
  
  if((comentario == "") || (nombre == "")){
    alert("Debe de ingresar un nombre y un comentario!");
    document.getElementById("nombre").focus();
    return null;
  }
  
  if(estado == 0){
    alert("Por favor seleccione su Estado!");
    document.getElementById("estados").focus();
    return null;
  }
  
  variables += "&inserta=1&nombre=" + nombre + "&comentario="+comentario+ "&estado="+estado;
  
  
  self.location= "./verVideos.php?" + variables;

}

// PRE-CARGA DE IMÁGENES.

function cargaVideos(anio, mes, mesTxt){
  var contenedorL;    
  contenedorL = document.getElementById("contenido");

  ajaxL=nuevoAjax();
  ajaxL.open("GET", "./xvideos.php?aniov="+anio+"&mesv="+mes,true);
  ajaxL.onreadystatechange=function(){
    
  if(ajaxL.readyState != 4) {
    contenedorL.innerHTML = "<div class = 'divVideos'><table><tr><td>Un momento por favor...</td></tr></table></div>";
  }else{
    contenedorL.innerHTML = ajaxL.responseText;
  }
  }
  
  ajaxL.send(null);
  if(mesTxt != ""){
    popUp(mesTxt, 'width=1000,height=600');
  }
}

