//	Vamos a presuponer que el usuario es una persona inteligente...
var isIE = false;

//	Creamos una variable para el objeto XMLHttpRequest
var req;

//	Creamos una funcion para cargar los datos en nuestro objeto.
//	Logicamente, antes tenemos que crear el objeto.
//	Vease que la sintaxis varia dependiendo de si usamos un navegador decente
//	o Internet Explorer
function cargaXML(url) {
	//	Primero vamos a ver si la URL es una URL :)
	if(url==''){
		return;
	}
	//	Usuario inteligente...
	if (window.XMLHttpRequest) {
		req = new XMLHttpRequest();
		req.onreadystatechange = processReqChange;
		req.open("GET", url, true);
		req.send(null);
	//	...y usuario de Internet Explorer Windows
	} else if (window.ActiveXObject) {
		isIE = true;
		req = new ActiveXObject("Microsoft.XMLHTTP");
		if (req) {
			req.onreadystatechange = processReqChange;
			req.open("GET", url, true);
			req.send();
		}
	}
}


function cargaDIVXML(nombreDIV,nombreDIVx,msj,otr,height) {
	divID=nombreDIV;
	divIDx=nombreDIVx;
	mensaj=msj;
	otros=otr;
	divheight=height;
}
/*
function cargaTamano(tamDIV) {
	tam=tamDIV;
}
*/

//	Funcion que se llama cada vez que se dispara el evento onreadystatechange
//	del objeto XMLHttpRequest
function processReqChange(){

	var detalles = document.getElementById(divID);	
	var div =  document.getElementById(divIDx);


	if(req.readyState == 4){
		detalles.innerHTML = req.responseText;
	} else {
		
	if(otros=="NO"){
	div.innerHTML =mensaj;
	return;
	}

	if(otros=="IMAGEN"){
	div.innerHTML ="<img hspace='10' id='loaderimg' src='http://aguantexu.com.ar/foro/images/misc/progress.gif' align='middle' />"+mensaj;
	return;
	}
	
	if(divheight==null){
		divheight = 20;
	}
	

	if(otros==null){
conontenido="<table width='100%' height='"+divheight+"' border='0' align='center' cellpadding='0' cellspacing='0'><tr><td>";
conontenido=conontenido+"<img id='loaderimg' src='http://aguantexu.com.ar/foro/images/misc/progress.gif' align='middle' /> "+mensaj+"</td></tr></table>";
div.innerHTML =conontenido;
		}else{
conontenido="<table width='100%' valign='top' height='"+divheight+"' border='0' align='center' cellpadding='8' cellspacing='8'><tr><td valign='top'>";
conontenido=conontenido+"<img id='loaderimg' src='http://aguantexu.com.ar/foro/images/misc/progress.gif' align='middle' /> "+mensaj+"</td></tr></table>";
div.innerHTML =conontenido;
		}
		
	}
}



function autoplayXML(valorautoplay) {
alert(valorautoplay);
autoplayPHP(valorautoplay);

}

/***********************************************************/

var RequestObject = false;    
  var Archivo = 'videoteca-opciones.php'; //directorio donde tenemos el archivo ajax.php    
  window.setInterval("actualizacion_reloj()", 2000); // el tiempo X que tardará en actualizarse    
  if (window.XMLHttpRequest) //    
RequestObject = new XMLHttpRequest();   
if (window.ActiveXObject)      
  RequestObject = new ActiveXObject("Microsoft.XMLHTTP");   
  
function ReqChange() {   
// Si se ha recibido la información correctamente   
  if (RequestObject.readyState==4) {   
  // si la información es válida    
  if (RequestObject.responseText.indexOf('invalid') == -1)    
  {    
  // obtener la respuesta    
  var msgs = RequestObject.responseText.split('|');   
  // Buscamos la div con id online    
  document.getElementById("online").innerHTML = msgs[0];   
  }   
  else {   
  // Por si hay algun error    
  document.getElementById("online").innerHTML = "Error llamando";   
  }   
  }   
  }
  
function llamadaAjax() {   
	// Mensaje a mostrar mientras se obtiene la información remota...   
	document.getElementById("online").innerHTML = "";   
	// Preparamos la obtención de datos    
	RequestObject.open("GET", Archivo , true);   
	RequestObject.onreadystatechange = ReqChange;   
	// Enviamos    
	RequestObject.send(null);    
  }   
  function actualizacion_reloj() {   
 // llamadaAjax();
  }

function Mostrarurl(DIVname){
	if(document.getElementById(DIVname).style.display=='none'){
		document.getElementById(DIVname).style.display='';
	}else{
		document.getElementById(DIVname).style.display='none';
	}
}
