function $(v,o) { return((typeof(o)=='object'?o:document).getElementById(v)); }
function $S(o) { return((typeof(o)=='object'?o:$(o)).style); }
function agent(v) { return(Math.max(navigator.userAgent.toLowerCase().indexOf(v),0)); }
function abPos(o) { var o=(typeof(o)=='object'?o:$(o)), z={X:0,Y:0}; while(o!=null) { z.X+=o.offsetLeft; z.Y+=o.offsetTop; o=o.offsetParent; }; return(z); }
function XY(e,v) { var o=agent('msie')?{'X':event.clientX+document.body.scrollLeft,'Y':event.clientY+document.body.scrollTop}:{'X':e.pageX,'Y':e.pageY}; return(v?o[v]:o); }

star={};

star.mouse=function(e,o) { if(star.stop || isNaN(star.stop)) { star.stop=0;
	//para actualizar las posiciones de las estrellas
	document.onmousemove=function(e) { var n=star.num;
	
		var p=abPos($('star'+n)), x=XY(e), oX=x.X-p.X, oY=x.Y-p.Y; star.num=o.id.substr(4);

		if(oX<1 || oX>84 || oY<0 || oY>19) { star.stop=1; star.revert(); }
		
		else {

			$S('starCur'+n).width=oX+'px';
			$S('starUser'+n).color='#111';
			$('starUser'+n).innerHTML=Math.round(oX/84*100)+'%';
		}
	};
} };

star.update=function(e,o,a) { var n=star.num, v=parseInt($('starUser'+n).innerHTML);

	n=o.id.substr(4); $('starCur'+n).title=v;
	//para poder enviar el resultado
	
	cargar_contenido('star','video.php?tarea=calificar&valor='+v+a);
	//req=new XMLHttpRequest(); req.open('GET','/AJAX_Star_Vote.php?vote='+(v/100),false); req.send(null);    

};

star.revert=function() { var n=star.num, v=parseInt($('starCur'+n).title);
	//para volver al valor anterior
	$S('starCur'+n).width=Math.round(v*84/100)+'px';
	$('starUser'+n).innerHTML=(v>0?Math.round(v)+'%':'');
	$('starUser'+n).style.color='#888';
	
	document.onmousemove='';

};

star.num=0;

function mostrar_foto_cuadro(pos)
{
	if(document.getElementById('foto_div'+pos).style.width=='300px')
	{
		document.getElementById('foto_div'+pos).style.width='120px';
		document.getElementById('foto_div'+pos).style.height='120px';
		document.getElementById('foto'+pos).style.width='120px';
		document.getElementById('foto'+pos).style.height='120px';
		document.getElementById('texto_foto'+pos).style.display='none';
	}
	else
	{
		document.getElementById('foto_div'+pos).style.width='300px';
		document.getElementById('foto_div'+pos).style.height='350px';
		document.getElementById('foto'+pos).style.width='300px';
		document.getElementById('foto'+pos).style.height='300px';
		document.getElementById('texto_foto'+pos).style.display='block';
		i=0;
		
		//alert(document.getElementById('foto'+i));
		
		while  (document.getElementById('foto'+i) != null)
		{
			if(i!=pos)
			{
				document.getElementById('foto_div'+i).style.width='120px';
				document.getElementById('foto_div'+i).style.height='120px';
				document.getElementById('foto'+i).style.width='120px';
				document.getElementById('foto'+i).style.height='120px';
				document.getElementById('texto_foto'+i).style.display='none';
			}
			i++;
		}
	}
}

function mostrar_foto_lista(pos)
{
	if(document.getElementById('foto_'+pos).style.width=='300px')
	{
		document.getElementById('foto_'+pos).style.width='130px';
		document.getElementById('foto_'+pos).style.height='130px';

	}
	else
	{

		i=0;
		
		//alert(document.getElementById('foto'+i));
		
		document.getElementById('foto_'+pos).style.width='300px';
		document.getElementById('foto_'+pos).style.height='300px';
		
		while  (document.getElementById('foto_'+i) != null)
		{
			if(i!=pos)
			{
				document.getElementById('foto_'+i).style.width='130px';
				document.getElementById('foto_'+i).style.height='130px';

			}
			i++;
		}
	}
}

function mostrar_biografia_telepais(pos,cantidad)
{
	if(document.getElementById('conductores'+pos).style.width=='300px')
	{
		

	}
	else
	{

		i=cantidad;
		
		while  (i>0)
		{
			if(i!=pos)
			{
				document.getElementById('foto_'+i).style.width='130px';
				document.getElementById('foto_'+i).style.height='130px';

			}
			i--;
		}
	}
}

function cambiar_nombre_telepais(nombre,pos)
{
	//document.getElementById('titulo_rss_telepais').innerHTML=nombre;
	var nombres;
	nombres=Array('INICIO','NACIONAL','INTERNACIONAL','DEPORTES','ECONOMIA','ESPECTACULOS','NOTICIAS','GALERIA DE VIDEOS');
	for(i=0;i<8;i++)
	{
		if(i==pos)
		{
			document.getElementById('link_'+pos).innerHTML='<table width="150" border="0" cellpadding="0" cellspacing="0"><tr> <td width="4" height="20" background="telepais/imagenes/template_06.png">&nbsp;</td>  <td align="center" bgcolor="#FFFFFF"><span class="link_activo_telepais">'+nombres[i]+'</span></td> <td width="4" background="telepais/imagenes/template_08.png">&nbsp;</td>  </tr>  <tr>								                    <td height="5" colspan="3" align="center" valign="top"><img src="telepais/imagenes/template_12.png" alt="" width="8" height="5" border="0"/></td>    </tr>						                </table>';	
		}
		else
		{
			document.getElementById('link_'+i).innerHTML=nombres[i];
		}
		
		
	}
	
	
}