function buscador(){
	var busqueda = document.getElementById('busqueda').value;
	var buscar = busqueda.replace(/([\s]+)/g,'_');
	location.href='http://www.viciajuegos.com/buscar-'+buscar+'.html';
	return false;
}
function vacio()
{	
	if(document.getElementById('busqueda').value == '')
	{		
		document.getElementById('busqueda').select();
		return(false);
	}
	for(i = 0; i < document.getElementById('busqueda').value.length; i++)
	{ 
         if (document.getElementById('busqueda').value.charAt(i)!=" ")
		 { 
             return(true);
         } 
    }
	document.getElementById('busqueda').select(); 
    return(false); 
}
function contacto()
{	
    if(document.getElementById('mensaje').value == '')
	{
		alert('Falta el mensaje.');
		document.getElementById('mensaje').select();
		return(false);
	}              	
}
function intercambio()
{	
	if(document.getElementById('titulo').value == '')
	{
		alert('Falta el título de tu web o blog.');
		document.getElementById('titulo').select();
		return(false);
	}
    if(document.getElementById('url').value == '')
	{
		alert('Falta la url o dominio de tu web o blog.');
		document.getElementById('url').select();
		return(false);
	}              	
}
function GetThis(T, C, U, L)
{		
	var targetUrl = 'http://www.myspace.com/index.cfm?fuseaction=postto&' + 't=' + encodeURIComponent(T) + '&c=' + encodeURIComponent(C) + '&u=' + encodeURIComponent(U) + '&l=' + L;
	
	window.open(targetUrl);
}
function ir(url)
{	
	window.open(url, "_blank");

}
function reiniciar(url)
{	
	window.open(url, "_self");

}
function popup(url)
{	
	window.open(url,'','width=300,height=200,scrollbars=1');

}
function popupdescarga(url)
{	
	window.open(url,'','width=550,height=300,scrollbars=1');

}
function popuprecomendar(url)
{	
	window.open(url,'','width=600,height=200,scrollbars=1');

}
function smile(texto){
document.getElementById('comentario').value = document.getElementById('comentario').value + texto;
}
function blancos()
{	
	if(document.getElementById('comentario').value == '')
	{		
		document.getElementById('comentario').select();
		return(false);
	}
	for(i = 0; i < document.getElementById('comentario').value.length; i++)
	{ 
         if (document.getElementById('comentario').value.charAt(i)!=" ")
		 { 
             return(true);
         } 
    }
	document.getElementById('comentario').select(); 
    return(false); 
}
function maxcha()
{
   var tar2=document.form_comentar.comentario;
   var luzera=tar2.value.length;
   if(luzera>200)
    {
     tar2.value=tar2.value.substr(0,200);
     alert("El máximo de caracteres es de 200");
    }
}
function registro()
{		
    if(document.getElementById('nick').value == '')
	{
		alert('Falta tu nick.');
		document.getElementById('nick').select();
		return(false);
	}
	if(document.getElementById('contrasena').value == '')
	{
		alert('Falta tu contraseña.');
		document.getElementById('contrasena').select();
		return(false);
	}
	if(document.getElementById('contrasena2').value == '')
	{
		alert('Falta repetir tu contraseña.');
		document.getElementById('contrasena2').select();
		return(false);
	}
	if(document.getElementById('contrasena').value != document.getElementById('contrasena2').value)
	{
		alert('Las contraseñas no coinciden.');
		document.getElementById('contrasena2').select();
		return(false);
	}
	if(document.getElementById('email').value == '')
	{
		alert('Falta tu E-mail.');
		document.getElementById('email').select();
		return(false);
	}	
	if(document.getElementById('pais').value == 0 || document.getElementById('pais').value == 'Selecciona un pais')
	{
		alert('Falta tu país.');		
		return(false);
	}
	if (!document.getElementById('normas').checked)
	{
		alert('Debes aceptar las normas para registrarte.');
		document.getElementById('normas').select();
		return(false);
	} 
	var mailres = true;             
    var cadena = "abcdefghijklmnñopqrstuvwxyzABCDEFGHIJKLMNÑOPQRSTUVWXYZ1234567890@._-"; 
     
    var arroba = document.getElementById('email').value.indexOf("@",0); 
    if ((document.getElementById('email').value.lastIndexOf("@")) != arroba) arroba = -1; 
     
    var punto = document.getElementById('email').value.lastIndexOf("."); 
                 
     for (var contador = 0 ; contador < document.getElementById('email').value.length ; contador++)
	 { 
        if (cadena.indexOf(document.getElementById('email').value.substr(contador, 1),0) == -1)
		{ 
			alert('El e-mail es incorrecto.');
			document.getElementById('email').select();
            return(false);
            break; 
        } 
     } 

    if ((arroba > 1) && (arroba + 1 < punto) && (punto + 1 < (texto.length)) && (mailres == true) && (document.getElementById('email').value.indexOf("..",0) == -1)) 
     mailres = true; 
    else
	{
	 alert('El e-mail es incorrecto.');
	 document.getElementById('email').select(); 
     return(false); 
	}	
    return(true);       	
}
function login()
{	
    if(document.getElementById('username').value == '')
	{
		alert('Falta tu nick.');
		document.getElementById('username').select();
		return(false);
	}
	if(document.getElementById('password').value == '')
	{
		alert('Falta tu password.');
		document.getElementById('password').select();
		return(false);
	}	
}
function tablear(tabla){	
	switch(tabla){
		case "1":						
			document.getElementById("opcion1").style.display="";
			document.getElementById("opcion2").style.display="none";			
			break;
		case "2":						
			document.getElementById("opcion1").style.display="none";
			document.getElementById("opcion2").style.display="";			
			break;		
		default:
			break;
	}
}
function mostrar_text(id)
{
    if(id.value.length == 0)
    {
        id.style.display='none';
        texto = document.getElementById("pass_text");
        texto.style.display = 'block';
    }
}
function mostrar_pass(id)
{
    id.style.display='none';
    pass = document.getElementById("password");
    pass.style.display = 'block';
    pass.focus();
}
function invita()
{	
	if(document.getElementById('nombre').value == '')
	{
		alert('Falta tu nombre.');
		document.getElementById('password').select();
		return(false);
	}
    if(document.getElementById('username').value == '')
	{
		alert('Falta tu correo.');
		document.getElementById('username').select();
		return(false);
	}
	if(document.getElementById('password').value == '')
	{
		alert('Falta tu password.');
		document.getElementById('password').select();
		return(false);
	}	
}