(function(c,a,b){c(document).ready(function(){var i=c("#browse-default-menu");var k=c("#browse-default-container");var f=c("#browse-default-content");var d={game:[],system:[],publisher:[],category:[]};var e=function(l,n){var m=c("
    "),o=c("
  1. ");c.each(l,function(){m.append(o.clone().append(n(this)))});f.append(m)};var j=function(m,l){return function(){var o=function(){i.hide();k.show();e(d[m],l)};if(d[m].length===0){var n=c(this);c.ajax("/api/"+m+"/all",{data:{sort:"alphabetical"},success:function(r,p,q){if(r.Error!==null){alert(r.Error);return}d[m]=r.Data.records;o()},beforeSend:function(){n.toggleClass("loading-icon")},complete:function(){n.toggleClass("loading-icon")}})}else{o()}return false}};var h=function(m){var l=c("");return function(n,o){return l.clone().attr("href","/browse/"+m+"/"+n.Id).text(n.Name)}};var g=function(){var l=c("");return function(m,n){return l.clone().attr({href:"/browse/system/"+m.Id,title:m.Name}).text(m.Abbreviation)}}();c("#show-default-menu").click(function(){f.empty();k.hide();i.show();return false});c("#browse-game").click(j("game",h("game")));c("#browse-system").click(j("system",g));c("#browse-category").click(j("category",h("category")));c("#browse-publisher").click(j("publisher",h("publisher")))})}(jQuery,window));