var paso = 0; var menu_x = ["","X"]; var options = []; var rutas = []; var fin = -1; var disparo = 0; var ini_tap = 0; function on_off(){ if($("#menu_z").html()===menu_x[0]){ if(ini_tap===0){ window.clearInterval(disparo); } $("#tap_"+ini_tap).css("background",""); if(ini_tap===0){ $("#menu_z").fadeIn(400,function(){ $("#tapa").css("display","none"); disparo = window.setInterval("movida()",1000); paso=0; }); } ini_tap--; }else{ if(ini_tap===document.getElementById("tapa").getElementsByTagName("td").length){ window.clearInterval(disparo); } $("#tap_"+ini_tap).css("background","black"); if(ini_tap===document.getElementById("tapa").getElementsByTagName("td").length){ $("#menu_z").fadeIn(400,function(){ $("#menu").fadeIn(); paso=0; }); } ini_tap++; } } function crear_tapa(){ var cad = ""; var sw = 0; var z = 0; for(var x=0;x<=5;x++){ cad = cad + ""; var temp = (sw===0?z:z+4); for(var y=0;y<=4;y++){ cad = cad + ""; temp=(sw===0?temp+1:temp-1); } z = z + 5; sw=(sw===0?1:0); cad = cad + ""; } $("#b_0").html($("#b_0").html()+cad+""); } function movida(){ fin = -1; while(fin < 0 || fin > 8){ fin = (Math.random()+"").substr(3,1)*1; } for(var x=0;x<=8;x++){ $("#p_"+x).css("background-color",(x===fin?"black":"orange")); } } function mnx(){ if(paso===1){ return; } paso=1; if($("#tapa").css("display") !== "none"){ $("#menu").fadeOut(500,function(){ $("#menu_z").fadeOut(400,function(){ $("#menu_z").html(menu_x[0]); ini_tap = document.getElementById("tapa").getElementsByTagName("td").length-1; disparo=window.setInterval("on_off()",50); }); }); }else{ $("#menu_z").fadeOut(400,function(){ $("#menu_z").html(menu_x[1]); window.clearInterval(disparo); $("#tapa").css("display",""); ini_tap = 0; disparo=window.setInterval("on_off()",50); }); } } function cargar_menu(){ var sw = 0; for(var x=0;x<=document.getElementById("tab0").getElementsByTagName("td").length-1;x++){ document.getElementById("tab0").getElementsByTagName("td")[x].id = "td"+x; if(sw===0){ options.push($("#td"+x).text().trim()); }else{ rutas.push($("#td"+x).text().trim()); } sw=(sw===0?1:0); } var tab = ""; var cad = ["Q","W","E","R","T","Y"]; for(var x=0;x<=options.length-1;x++){ if(options[x] !== document.title){ tab = tab + ""; tab = tab + ""; } } $("#px").html("
"+tab+"

"+cad[x]+"

"+options[x]+"
"); } $(document).ready(function () { disparo = window.setInterval("movida()",1000); menu_x[0] = $("#menu_z").html(); document.getElementsByTagName("body")[0].id = "b_0"; crear_tapa(); $("#b_0").html(window.localStorage.tab0+window.localStorage.menu+$("#b_0").html()); $(window).resize(); $("#tope").css("z-index",600); $("#contenido").css("z-index",-1); $("#tapa").css("z-index",5); $("#menu").css("z-index",100); cargar_menu(); $("#b_0").css("display",""); }); $(window).resize(function(){ $("#boton").css("left", $(window).width()-110); $("#boton").css("top", $(window).height()-50); $("#contenido").css("left","0"); $("#contenido").css("top","50"); $("#contenido").height( $(window).height()-50); $("#contenido").width("101%"); $("#tapa").height( $(window).height()-50); $("#menu").width("100%"); $("#menu").height( $(window).height()-50); });