$(document).ready(function(){$("a[rel]").click(function(){if((this.rel.indexOf("popup")>=0)||(this.rel.indexOf("external")>=0)){window.open(this.href);return false}if(this.rel.indexOf("legal")>=0){window.open(this.href,"","menubar=0,resizable=0,width=581,height=256");return false}});$("#anadir-favoritos").click(function(){window.external.AddFavorite($("#anadir-favoritos").attr("href"),"Jocjuegos.com - Juegos gratis");return false});var b=0;$.each($(".rotation"),function(){b=b+1});b=b-1;$("#rotation-up").click(function(){var h=0;var g=$("#rotation-0").html();for(j=0;j<=b;j++){h=j+1;if(h>b){$("#rotation-"+j).html(g);var i=$("#rotation-0 a").attr("href");var m=$("#rotation-0 a").attr("title");$("#novedades-juega").attr("href",i);$("#novedades-juega").attr("title",m)}else{var l=$("#rotation-"+h).html();$("#rotation-"+j).html(l)}}return false});$("#rotation-down").click(function(){var h=0;var g=$("#rotation-"+b).html();for(j=b;j>=0;j--){h=j-1;if(h<0){$("#rotation-0").html(g);var i=$("#rotation-0 a").attr("href");var m=$("#rotation-0 a").attr("title");$("#novedades-juega").attr("href",i);$("#novedades-juega").attr("title",m)}else{var l=$("#rotation-"+h).html();$("#rotation-"+j).html(l)}}return false});$("#select-votar").change(function(){$.ajax({type:"POST",url:"ajax_sumarvotos.php",data:"id="+this.value,success:this.disabled=true})});$(".frm_buscador").submit(function(h){h.preventDefault();var i=$(this).find(".value_busqueda").val();if(i!==""){var g=i.replace(/ /g,"-");$(function(){window.location="/juegos-de-"+g+".html"})}});$("#favoritos").click(function(i){i.preventDefault();var h=this.href;var g=this.title;if(window.sidebar){window.sidebar.addPanel(g,h,"")}else{if(window.external||document.all){window.external.AddFavorite(h,g)}else{if(window.opera){$("#favoritos").attr("href",h);$("#favoritos").attr("title",g);$("#favoritos").attr("rel","sidebar")}else{alert("Your browser does not support this bookmark action")}}}});$("#frm_nombre").val("");$("#frm_correo_emisor").val("");$("#frm_url").val("");$("#frm_comentarios").val("");var e=$(document.createElement("div"));var d=$(document.createElement("div"));e.attr("id","prev-comments");e.attr("class","nodisplay");d.attr("id","next-comments");var f=$("#numero-comentarios").attr("class");f=parseInt(f.substr(4));if(f<=5){d.attr("class","nodisplay")}var a=$(document.createElement("a"));var c=$(document.createElement("a"));a.attr("href",document.URL);c.attr("href",document.URL);$("#listado-comentarios").attr("class","pag-0");a.attr("title","Ver comentarios anteriores").click(function(h){var g=$("#listado-comentarios").attr("class");g=parseInt(g.substr(4))-5;$("#listado-comentarios").attr("class","pag-"+g);$.ajax({type:"POST",url:"ajax_comentarios.php",data:"pag="+$("#listado-comentarios").attr("class")+"&titol="+$("input[name=frm_tit]").attr("value"),success:function(k){$("#listado-comentarios").html(k)}});var i=$("#numero-comentarios").attr("class");i=parseInt(i.substr(4));if(g<=0){$("#prev-comments").attr("class","nodisplay")}else{$("#next-comments").attr("class","display")}return false});c.attr("title","Ver comentarios siguientes").click(function(h){var g=$("#listado-comentarios").attr("class");g=parseInt(g.substr(4))+5;$("#listado-comentarios").attr("class","pag-"+g);$.ajax({type:"POST",url:"ajax_comentarios.php",data:"pag="+$("#listado-comentarios").attr("class")+"&titol="+$("input[name=frm_tit]").attr("value"),success:function(k){$("#listado-comentarios").html(k)}});var i=$("#numero-comentarios").attr("class");i=parseInt(i.substr(4));if(g+5>=i){$("#next-comments").attr("class","nodisplay")}else{$("#prev-comments").attr("class","display")}return false});a.html("Anteriores");c.html("Siguientes");e.append(a);d.append(c);$("#listado-comentarios").after(d);$("#listado-comentarios").after(e)});
