 var lastRanked = 0;
 var opened = 0;

/*Funcion que muestra las 5 estrellas de la votacion*/
function PaintStars(number){
for ( i=1 ; i<=number ; i++ ) {
	var image = document.getElementById("star" + i);
	image.src = "http://www.lopeor.com/images/lopeor-star-vote-onn.gif";
}
for ( ; i<=5 ; i++ ) {
	var image = document.getElementById("star" + i);
	image.src = "http://www.lopeor.com/images/lopeor-star-vote-offn.gif";
}

}//PaintStars

function RecoverLastRanked(){
	PaintStars(lastRanked);
}

//Verifica que una cadena sea Email
			function validaEmail(cadena)
			{
				if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(cadena))
				{
					return true;
				} 
				else	 
				{
					return false;
				}
			}	
		
			function popUP(direccion)
			{
				window.open(direccion,"pollwin","toolbar=no,scrollbars=no,directories=no, status=no,menubar=no,resizable=no,width=350,height=150");
			}

			function validarViral(tipoEnvio)
			{
				flag=1;
				if (document.formViral.usuario.value=="" || document.formViral.usuario.value=="usuario") 
				{
					alert ('Debes de ingresar tu usuario');
					document.formViral.usuario.focus();
					return false;
					flag=0;
				}
				if (document.formViral.pass.value=="" || document.formViral.pass.value=="contrasena") 
				{
					alert ('Debes de ingresar tu password');
					document.formViral.pass.focus();
					return false;
					flag=0;
				}
			
			if (tipoEnvio=='1')
			document.formViral.Enviar.value='1';
			
			if (flag==1)
			document.formViral.submit();
			}
			
			function MM_preloadImages() { //v3.0
			  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_swapImgRestore() { //v3.0
			  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_findObj(n, d) { //v4.01
			  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() { //v3.0
			  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 writeIntoObject(text,id)
			{
				if (document.getElementById)
				{
					x = document.getElementById(id);
					x.innerHTML = '';
					x.innerHTML = text;
				}
				else if (document.all)
				{
					x = document.all[id];
					x.innerHTML = text;
				}
				else if (document.layers)
				{
					x = document.layers[id];
					text2 =  text ;
					x.document.open();
					x.document.write(text2);
					x.document.close();
				}
			}
			
		function recomienda (jokelink,jokeType,jokeType2,jokename,jokePic,statreco,id){
			/*
			if(opened==1){
				if (document.layers && document.layers[id])
				document.layers['recomienda'].display = 'none';
				else if (document.all)
				document.all['recomienda'].style.display = 'none';
				else if (document.getElementById)
				document.getElementById('recomienda').style.display = 'block';				
				opened = 0;
				return false;
			}else{
				if (document.layers && document.layers[id])
				document.layers['recomienda'].display = 'visible';
				else if (document.all)
				document.all['recomienda'].style.display = 'visible';
				else if (document.getElementById)
				document.getElementById('recomienda').style.display = 'visible';
				opened = 1;
			}*/
			
			Recomienda='';
			Recomienda=Recomienda+'<table width="100%" border="0" cellspacing="0" cellpadding="0" style="border:2px solid #391073; margin-top:2px;" height="260">';
			Recomienda=Recomienda+'	<tr>';
			Recomienda=Recomienda+'		<td align="center" valign="top" bgcolor="#ebe7f1">';
			Recomienda=Recomienda+'			<form id="frmRecomienda" name="frmRecomienda" method="post" action="../enviaRecomienda.asp">';
			Recomienda=Recomienda+'			<input type="Hidden" name="act" value="reco">';
			Recomienda=Recomienda+'			<input type="Hidden" name="jl" value="'+jokelink+'">';
			Recomienda=Recomienda+'			<input type="Hidden" name="jt" value="'+jokeType+'">';
			Recomienda=Recomienda+'			<input type="Hidden" name="jt2" value="'+jokeType2+'">';
			Recomienda=Recomienda+'			<input type="Hidden" name="jn" value="'+jokename+'">';
			Recomienda=Recomienda+'			<input type="Hidden" name="jp" value="'+jokePic+'">';
			Recomienda=Recomienda+'			<input type="Hidden" name="St" value="'+statreco+'">';
			Recomienda=Recomienda+'			<span style="font-size:15px; color:#391073">';
			Recomienda=Recomienda+'				<b>';
			Recomienda=Recomienda+'					Si no tienes cuenta de Hotmail, Yahoo o Gmail <br>';
			Recomienda=Recomienda+'					llena los siguientes campos:';
			Recomienda=Recomienda+'				</b>';
			Recomienda=Recomienda+'			</span>';
			Recomienda=Recomienda+'			<br>';
			Recomienda=Recomienda+'			<br>';			

					Recomienda=Recomienda+'<table width="410" border="0" cellpadding="0" cellspacing="2">';
					Recomienda=Recomienda+'	<tr>';
					Recomienda=Recomienda+'		<td align="left" style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px; color:#391073">';
					Recomienda=Recomienda+'			<b>1.</b>Ingresa tus datos';
					Recomienda=Recomienda+'		</td>';
					Recomienda=Recomienda+'		<td width="185" style="font-family:Verdana, Arial, Helvetica, sans-serif; font-size:11px; color:#391073"">';
					Recomienda=Recomienda+'			<b>2.</b>Escribe el email de 7 Amigos:';
					Recomienda=Recomienda+'		</td>';
					Recomienda=Recomienda+'	</tr>';
					Recomienda=Recomienda+'	<tr>';
					Recomienda=Recomienda+'		<td valign="top">';
					Recomienda=Recomienda+'			<table width="100%" border="0" cellspacing="5" cellpadding="0">';
					Recomienda=Recomienda+'				<tr>';
					Recomienda=Recomienda+'					<td align="right" style="font-size:11px; color:#391073;">';
					Recomienda=Recomienda+'						<b>Tu Nombre: </b>';
					Recomienda=Recomienda+'					</td>';
					Recomienda=Recomienda+'					<td>';
					Recomienda=Recomienda+'									<input name="frmNombre" value="Tu nombre" onFocus="if(this.value==\'Tu nombre\')this.value=\'\';" onBlur="if(this.value==\'\')this.value=\'Tu nombre\';"  type="text" style="font-family:verdana; font-size:11px; color:#391073; font-weight:bold;" size="15">';
					Recomienda=Recomienda+'					</td>';
					Recomienda=Recomienda+'				</tr>';
					Recomienda=Recomienda+'				<tr>';
					Recomienda=Recomienda+'					<td align="right" style="font-size:11px; color:#391073;">';
					Recomienda=Recomienda+'						<b>Tu Correo: </b>';
					Recomienda=Recomienda+'					</td>';
					Recomienda=Recomienda+'					<td>';
					Recomienda=Recomienda+'									<input name="frmRemitente" value="Tu e-mail" onFocus="if(this.value==\'Tu e-mail\')this.value=\'\';" onBlur="if(this.value==\'\')this.value=\'Tu e-mail\';"  type="text" style="font-family:verdana; font-size:11px; color:#391073; font-weight:bold;" size="15">';
					Recomienda=Recomienda+'					</td>';
					Recomienda=Recomienda+'				</tr>';
					Recomienda=Recomienda+'				<tr>';
					Recomienda=Recomienda+'					<td align="right" valign="top" style="font-size:11px; color:#391073;">';
					Recomienda=Recomienda+'						Escribe un comentario<BR>';
					Recomienda=Recomienda+'						<b>EJEMPLO:</b> <BR>';
					Recomienda=Recomienda+'						"Mira este<BR>';
					Recomienda=Recomienda+'						que buen <BR>Chiste ..."';
					Recomienda=Recomienda+'					</td>';
					Recomienda=Recomienda+'					<td>';
					Recomienda=Recomienda+'									<textarea name="frmComentario" cols="15" rows="5" style="font-family:verdana; font-size:11px; color:#391073;" onFocus="if(this.value==\'Haz tu comentario...\')this.value=\'\';" onBlur="if(this.value==\'\')this.value=\'Haz tu comentario...\';">Haz tu comentario...</textarea>';
					Recomienda=Recomienda+'					</td>';
					Recomienda=Recomienda+'				</tr>';
					Recomienda=Recomienda+'			</table>';
					Recomienda=Recomienda+'		</td>';
					Recomienda=Recomienda+'		<td>';
					Recomienda=Recomienda+'			<table width="100%" border="0" cellspacing="3" cellpadding="0">';
					var i = 1;
					for(i==1;i<8;i++){
					Recomienda=Recomienda+'				<tr>';
					Recomienda=Recomienda+'					<td>';
					Recomienda=Recomienda+'						<input name="frmReceptor'+i+'" type="text" style="font-family:verdana; font-size:11px; color:#391073;" value="Email de Tu Amigo '+i+'" onFocus="if(this.value==\'Email de Tu Amigo '+i+'\')this.value=\'\';" onBlur="if(this.value==\'\')this.value=\'Email de Tu Amigo '+i+'\';" size="25">';
					Recomienda=Recomienda+'					</td>';
					Recomienda=Recomienda+'				</tr>';
					}
					Recomienda=Recomienda+'			</table>';
					Recomienda=Recomienda+'		</td>';
					Recomienda=Recomienda+'	</tr>';
					Recomienda=Recomienda+'</table>';
					Recomienda=Recomienda+'			<input type="Button" name="Submit3" value="Enviar" style="background-color:#391073; color:#bde718; font-size:11px; font-weight:bold;" onclick="validarFormEnvio();" >';
					Recomienda=Recomienda+'</form>';
			Recomienda=Recomienda+'		</td>';
			Recomienda=Recomienda+'	</tr>';
			Recomienda=Recomienda+'</table>';
			
			writeIntoObject(Recomienda,'recomienda');

}//recomienda

function mostrarDiv(element) {
	var sele;

	if (typeof element == 'string')
	{
		sele = document.getElementById(element);

		if (sele.style.display == '')  
			document.getElementById(element).style.display = 'block';
		else
			document.getElementById(element).style.display = '';				
	}	
}	