function enterkeypress(e)
{
	key=(document.all) ? e.keyCode : e.which;
	if (key==13) { ingresa(); }	
}
function eliminar_palabra(palabra){
	if (palabra=="Escribe el juego")
		{
			document.getElementById('box').value="";
			document.getElementById('enterkey').value=0;
		}
	
}
function ingresa(){
var val;
val=document.formsearh.result.value;
var out = "", flag = 0;
if (val.length>1)
	{
	for (i = 0; i < val.length; i++) {
		if (val.charAt(i) != " ") {
		out += val.charAt(i);
		}
	else {	out += "+"; }
	}
	if (val!='')
		{
		document.formsearh.action="/result/"+out+"/";
		document.formsearh.submit();	
		}
	}
}
var load_timer_start = (new Date()).getTime();
function load_timer_stop() {
if (Math.floor(Math.random()*100) == 0) {
(new Image()).src = 'http://www.google.com/lt/?u=' + self.location + '&t=' +
(((new Date()).getTime() - load_timer_start) / 1000) + '&r=' + document.referrer;
}
} 
function _browser(str) {
(navigator.userAgent.toLowerCase().indexOf(str)+1) ? ret = true : ret = false;
return ret;
}
<!--
// callback function invoked before the preloader
var gameType = 'swf';
function spillPreloaderCallbackBefore() {
$("#zoom_td").hide();
document.getElementById("aumentos").style.visibility="visible";	
//document.getElementById("flashobj").style.float="none";	
//document.getElementById("flashobj").style.textAlign="center";	
//document.getElementById("flashobj").style.styleFloat = "none";	
//document.getElementById('flashobj').setAttribute("style","float:none");

};
// callback function invoked after the SWF is (pre)loaded
function spillPreloaderCallbackAfter() {
$("#zoom_td").show();
};  
var js_spillpre_whileloading = 'Carregando o jogo...';
var js_spillpre_click2close = 'Jogo carregado. Clique aqui para comecar ...';
function muestra(play){	document.getElementById(play).style.visibility="visible";} 
function oculta(play){	document.getElementById(play).style.visibility="hidden"; }
function muestraToolTip(div){
var tool=document.getElementById('tool');
tool.innerHTML="<div style='color:#000; width:524px; height:176px; margin:10px; padding:10px;'>"+document.getElementById('d'+div).innerHTML+"<div>";
tool.style.visibility="visible";	  
var capa=document.getElementById('juego'+div);
if((capa.offsetLeft+160+340)>document.body.offsetWidth) //160=anchura del div juego; 316=anchura de la imagen de la descripción
{		  
if(navigator.appName=='Microsoft Internet Explorer')
{
tool.style.left=capa.offsetLeft-265+"px";
tool.style.top=capa.offsetTop-20+"px";	
}else{
tool.style.left=capa.offsetLeft-320+"px";
tool.style.top=capa.offsetTop-15+"px";
}
}else{
if(navigator.appName=='Microsoft Internet Explorer')
{
tool.style.left=capa.offsetLeft+220+"px";
tool.style.top=capa.offsetTop-20+"px";			 
}else{
tool.style.left=capa.offsetLeft+160+"px";
tool.style.top=capa.offsetTop-15+"px";
}
}
}
function ocultaToolTip(){
document.getElementById('tool').style.visibility="hidden";
}
var request = null;
function createRequest() {
try {	request = new XMLHttpRequest();} 
catch (trymicrosoft) {
try {request = new ActiveXObject("Msxml2.XMLHTTP");} 
catch (othermicrosoft) {
try {request = new ActiveXObject("Microsoft.XMLHTTP");} 
catch (failed) {request = null;}
}
}
if (request == null) alert("Error creating request object!");
}
function listar(modo){
document.getElementById('lista').innerHTML='';
createRequest();
request.open("GET", "listar.php?modo="+modo, true);
request.onreadystatechange = function(){
if (request.readyState == 4) {	
if(request.status==200){			
document.getElementById('lista').innerHTML = request.responseText;			
}
}			
};
request.send(null);			
}
function menu_opciones(id,oculta,muestra){
if (document.getElementById){ //se obtiene el id
var el = document.getElementById(id); //se define la variable "el" igual a nuestro div
var img = document.getElementById(id); //se define la variable "el" igual a nuestro div
el.style.display = (el.style.display == 'none') ? 'block' : 'none'; //damos un atributo display:none que oculta el div
document.getElementById(oculta).style.display='none'; 
document.getElementById(muestra).style.display='block'; 
}
}
function nuevoAjax()
{ 
/* Crea el objeto AJAX. Esta funcion es generica para cualquier utilidad de este tipo, por
lo que se puede copiar tal como esta aqui */
var xmlhttp=false; 
try 
{ 
// Creacion del objeto AJAX para navegadores no IE
xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); 
}
catch(e)
{ 
try
{ 
// Creacion del objet AJAX para IE 
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); 
} 
catch(E) { xmlhttp=false; }
}
if (!xmlhttp && typeof XMLHttpRequest!='undefined') { xmlhttp=new XMLHttpRequest(); } 
return xmlhttp; 
}
function addjuego(id)
{
ajax=nuevoAjax();
ajax.open("GET", "/ajaxsmilista.php?id="+id+"&num_ale="+Math.random(), true);
ajax.onreadystatechange=function() 
{ 
if (ajax.readyState==4)
{ 
document.getElementById("milista").innerHTML=ajax.responseText;
} 
}
ajax.send(null);       
}
function deljuego(id)
{
if (confirm("Tem certeza que quer eliminar o jogo?"))
{
var cantidadjuegos;
var cantidadjuegos_actual;
cantidadjuegos=document.getElementById("cantidadjuegos").value;
cantidadjuegos_actual=parseInt(cantidadjuegos)-1;
document.getElementById("cantidadjuegos").value=cantidadjuegos_actual; 
ajax=nuevoAjax();
ajax.open("GET", "/ajaxsdeljuego.php?id="+id+"&num_ale="+Math.random(), true);
ajax.onreadystatechange=function() 
{ 
if (ajax.readyState==4)
{ 
document.getElementById("favdiv-"+id+"").innerHTML=ajax.responseText;
			
		   if(document.getElementById("addjuegodiv-"+id+""))
			{
   			document.getElementById("addjuegodiv-"+id+"").style.visibility='visible';
    		document.getElementById("addjuegodiv-"+id+"").style.display='none';
			}
		if(document.getElementById("addjuego"+id+""))
			{
			document.getElementById('addjuego'+id).style.display='block';
			document.getElementById('addjuego'+id).style.visibility='visible';
			}
			
		document.getElementById("favdiv-"+id+"").style.display='none';	
        } 
    }
    ajax.send(null);       
	if (cantidadjuegos_actual==0)
		{
		   	document.getElementById("divnojuego").style.display="block";	
		}
	}
}

function updateaddjuego(id)
{
	
	ajax=nuevoAjax();
    ajax.open("GET", "/ajaxslistajuegos.php?id="+id+"&num_ale="+Math.random(), true);
    ajax.onreadystatechange=function() 
    { 
        if (ajax.readyState==4)
        { 
            document.getElementById("listajuegosfavoritos").innerHTML=ajax.responseText;
        } 
    }
    ajax.send(null);       
}


function pantallascreen(){
	if (screen.width<=800)
		document.getElementById("izq").style.display="none";	
}

function juegosdestacados(id)
{
	clearTimeout (temp_destacados);
		for (i=0;i<9;i++)
		{
	 	 document.getElementById("divjuegodestacado-"+i).style.border="2px solid #FFFFFF";
		 document.getElementById("divjuegodestacado_"+i).style.display='none';	
		}
	 document.getElementById("divjuegodestacado-"+id).style.border="2px solid #FF0000";
	 document.getElementById("divjuegodestacado_"+id).style.display="block";
	 	id=id+1;
		if (id==9) id=0;
	temp_destacados=setTimeout("juegosdestacados("+id+")",9800);
	 
}
 

function juegodestacado(id,des,numdiv,destacados)
{
	
	for (i=0;i<9;i++)
		{
	 	 document.getElementById("divjuegodestacado-"+i).style.border="2px solid #FFFFFF";
		}
	 document.getElementById("divjuegodestacado-"+numdiv).style.border="2px solid #FF0000";
	
	ajax=nuevoAjax();
    ajax.open("GET", "/inc_juegodestacado.php?id="+id+"&des="+des+"&destacados="+destacados+"&numdiv="+numdiv+"&num_ale="+Math.random()*11, true);
    ajax.onreadystatechange=function() 
    { 
    if (ajax.readyState==4)  { document.getElementById("divjuegodestacado").innerHTML=ajax.responseText; } 
    }
    ajax.send(null);       
}

//CRONOMETRO
//Autor: Iván Nieto Pérez
//Este script y otros muchos los puedes
//encontrar en
//MundoJavascript.com
var CronoID = null
var segundostotal=0;
var tiempoejecutandose ="";
var CronoEjecutandose = false
var decimas, segundos, minutos

function DetenerCrono (idjuego){
  if(CronoEjecutandose)
  	{
	createCookie('cookietiempojuego',tiempoejecutandose,1);
	createCookie('cookietiempoidjuego',idjuego,1);
	createCookie('tiemposegundos',segundostotal,1);
	}
  clearTimeout(CronoID)
  CronoEjecutandose = false

}

function InicializarCrono () {
//inicializa contadores globales
decimas = 0
segundos = 0
minutos = 0

//pone a cero los marcadores
//document.crono.display.value = '00:00:0'
//document.crono.parcial.value = '00:00:0'
}

function MostrarCrono () {
      
  //incrementa el crono
  decimas++
if ( decimas > 9 ) {
decimas = 0
segundos++
segundostotal++
if ( segundos > 59 ) {
segundos = 0
minutos++
}
}

//configura la salida
var ValorCrono = ""
ValorCrono = (minutos < 10) ? "0" + minutos : minutos
ValorCrono += (segundos < 10) ? ":0" + segundos : ":" + segundos
tiempoejecutandose=ValorCrono;
 

  CronoID = setTimeout("MostrarCrono()", 100)
CronoEjecutandose = true
return true
}

function IniciarCrono () {
//DetenerCrono()
InicializarCrono()
MostrarCrono()
}


function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

