function Ajax()
{
	var xmlhttp=false;
	try {
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e){
			try {
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (E){
					xmlhttp = false;
				}
		}
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') 
	{
		xmlhttp = new XMLHttpRequest();
	}
	return xmlhttp;
}

 function Wait(control,Pagina)
  {
	var contenedor;
		contenedor = document.getElementById(control);	
		ajax=Ajax();
		ajax.open("GET", Pagina, true);
		ajax.onreadystatechange=function() {
			if (ajax.readyState==4) 
			{contenedor.innerHTML = ajax.responseText}
			}
			if (ajax.readyState==1) 
			{
				var divespera=document.getElementById(control)
				divespera.innerHTML="<span><img src='http://www.youhot.com/links/imagenes/iconos/cargando.gif' width='24' height='24' /></span>";
				
			}
		ajax.send(null)
  }

  function Mostrar(control, Pagina)
  {
		Wait(control,Pagina);

  }

function refrescar()
{
	var cache=Math.floor(Math.random()*9999)
	Mostrar('drefres','http://www.youhot.com/links/reload.php?cache='+cache);
}

function rotar(cont,thumb,id)
{
	vthumb=cont;
	cambiar(cont,thumb,id);
}

function cambiar(cont,thumb, id)
{
	thumb++;
	if(cont==vthumb)
	{
	   if(thumb==21)
	   {
		   thumb=1;
	   }
	   
		     vimagen=document.getElementById(id);
		     vimagen.src='/media/videos/tmb/'+id+'/'+thumb+'.jpg';
		     setTimeout("cambiar("+cont+","+thumb+",'"+id+"')",500);

	}
	 
}

function detener(id)
{
	  vimagen=document.getElementById(id);
	  vimagen.src='/media/videos/tmb/'+id+'/1.jpg';
	  vthumb=0;
}