function MM_swapImgRestore(){var i,x,a=document.MM_sr;for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++)x.src=x.oSrc;}
function MM_preloadImages(){var d=document;if(d.images){if(!d.MM_p)d.MM_p=new Array();var i,j=d.MM_p.length,a=MM_preloadImages.arguments;for(i=0;i<a.length;i++)
if(a[i].indexOf("#")!=0){d.MM_p[j]=new Image;d.MM_p[j++].src=a[i];}}}
function MM_findObj(n,d){var p,i,x;if(!d)d=document;if((p=n.indexOf("?"))>0&&parent.frames.length){d=parent.frames[n.substring(p+1)].document;n=n.substring(0,p);}
if(!(x=d[n])&&d.all)x=d.all[n];for(i=0;!x&&i<d.forms.length;i++)x=d.forms[i][n];for(i=0;!x&&d.layers&&i<d.layers.length;i++)x=MM_findObj(n,d.layers[i].document);if(!x&&d.getElementById)x=d.getElementById(n);return x;}
function MM_swapImage(){var i,j=0,x,a=MM_swapImage.arguments;document.MM_sr=new Array;for(i=0;i<(a.length-2);i+=3)
if((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x;if(!x.oSrc)x.oSrc=x.src;x.src=a[i+2];}}
function addSuscriber()
{var val=document.getElementById("suscriberemail").value;var p=val.indexOf('@');if((p<1||p==(val.length-1))&&document.getElementById("suscriberemail").value!='')
{alert('Por favor entre una dirección de correo válida');return;}
http_request=getRequest();http_request.open('POST','/TSRating/addsuscriber.php?a=a',false);http_request.setRequestHeader("Content-type","application/x-www-form-urlencoded");var parameters="email="+encodeURI(document.getElementById("suscriberemail").value);http_request.setRequestHeader("Content-length",parameters.length);http_request.setRequestHeader("Connection","close");http_request.send(parameters);var text=http_request.responseText;text=text.replace(/%26/g,"&");alert(text);}
function getRequest()
{http_request=false;if(window.XMLHttpRequest){http_request=new XMLHttpRequest();if(http_request.overrideMimeType){http_request.overrideMimeType('text/html');}}else if(window.ActiveXObject){try{http_request=new ActiveXObject("Msxml2.XMLHTTP");}catch(e){try{http_request=new ActiveXObject("Microsoft.XMLHTTP");}catch(e){}}}
if(!http_request){alert('Cannot create XMLHTTP instance');return false;}
return http_request;}
function updateRankings(id,pageview,p1,p2,p3)
{url=id;http_request=getRequest();http_request.open("GET",'/updaterankings.php?path='+encodeURI(url)+'&pageview='+pageview,false);http_request.send(null);var text=http_request.responseText;text=text.replace(/%26/g,"&");updateIMG(text,id,p1,p2,p3);}
function vote(id,value,p1,p2,p3)
{url=id;http_request=getRequest();http_request.open("GET",'/updaterankings.php?path='+encodeURI(url)+'&action=vote&value='+value,false);http_request.send(null);var text=http_request.responseText;text=text.replace(/%26/g,"&");updateIMG(text,id,p1,p2,p3);var i,x,a=document.MM_sr;for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++)x.oSrc=x.src;}
function updateIMG(text,id,p1,p2,p3)
{var arraytmp=new Array();arraytmp=text.split(",");if(arraytmp.length>1)
{var arrayid=id.split(",");var arrayp1=p1.split(",");var arrayp2=p2.split(",");var arrayp3=p3.split(",");}
for(k=0;k<arraytmp.length;k++)
{var tmp=arraytmp[k].split(";");if(arraytmp.length>1)
{id=arrayid[k];p1=arrayp1[k];p2=arrayp2[k];p3=arrayp3[k];}
tmp[0]=parseInt(tmp[0])+parseInt(p1);tmp[1]=parseInt(tmp[1])+parseInt(p2);tmp[2]=parseInt(tmp[2])+parseInt(p3);var nv=document.getElementById(id+"numvotes");nv.innerHTML=tmp[2]+" votos";var pv=document.getElementById(id+"visitas");pv.innerHTML=tmp[0]+" visitas";var pr=document.getElementById(id+"barra");if(tmp[0]/tmp[3]*100>100)
pr.style.width="100%";else
pr.style.width=(tmp[0]/tmp[3]*100)+"%";var img=new Array();for(i=1;i<6;i++)
img[i]=document.getElementById(id+"-"+i);var rank=tmp[1]/tmp[2];if(rank<1.5)
{img[1].src="/TSRating/images/star.gif";img[2].src="/TSRating/images/starg.gif";img[3].src="/TSRating/images/starg.gif";img[4].src="/TSRating/images/starg.gif";img[5].src="/TSRating/images/starg.gif";}
else if(rank<2.5)
{img[1].src="/TSRating/images/star.gif";img[2].src="/TSRating/images/star.gif";img[3].src="/TSRating/images/starg.gif";img[4].src="/TSRating/images/starg.gif";img[5].src="/TSRating/images/starg.gif";}
else if(rank<3.5)
{img[1].src="/TSRating/images/star.gif";img[2].src="/TSRating/images/star.gif";img[3].src="/TSRating/images/star.gif";img[4].src="/TSRating/images/starg.gif";img[5].src="/TSRating/images/starg.gif";}
else if(rank<4.5)
{img[1].src="/TSRating/images/star.gif";img[2].src="/TSRating/images/star.gif";img[3].src="/TSRating/images/star.gif";img[4].src="/TSRating/images/star.gif";img[5].src="/TSRating/images/starg.gif";}
else if(rank>=4.5)
{img[1].src="/TSRating/images/star.gif";img[2].src="/TSRating/images/star.gif";img[3].src="/TSRating/images/star.gif";img[4].src="/TSRating/images/star.gif";img[5].src="/TSRating/images/star.gif";}}}
var myid="";var mypageview="";var myp1="";var myp2="";var myp3="";function addUR(id,pageview,p1,p2,p3)
{if(myid!="")myid+=",";myid+=id;if(mypageview!="")mypageview+=",";mypageview+=pageview;if(myp1!="")myp1+=",";myp1+=p1;if(myp2!="")myp2+=",";myp2+=p2;if(myp3!="")myp3+=",";myp3+=p3;}
function myupdateRankings()
{updateRankings(myid,mypageview,myp1,myp2,myp3);}