searchCatalog=[ { "gameName":"Journey of Hope", "gameNameNorm":"journey_of_hope", "gameDesc":"Explore exotic locations, find hidden objects and solve clever puzzles in this breathtaking journey toward the unknown!", "gameLink":"/games/685550/journey_of_hope", "gameScreenShot1":"https://img.exent.com/Free/FRG/products/685550/screenshot1_sm.jpg", "gameScreenShot2":"https://img.exent.com/Free/FRG/products/685550/screenshot2_sm.jpg", "gameId":685550, "gameRank":200.0, "gameSize":171, "gameProductionTime":"", "gameLink":"/games/685550/journey_of_hope", "gameType" : "0 " } , { "gameName":"The Treasures of Montezuma", "gameNameNorm":"the_treasures_of_montezuma", "gameDesc":"Group colorful gem-clustered tokens and accumulate Power Totems in this breathtaking Match 3 game to find a secret Azetc city and an incredible treasure", "gameLink":"/games/466550/the_treasures_of_montezuma", "gameScreenShot1":"https://img.exent.com/Free/FRG/products/466550/screenshot1_sm.jpg", "gameScreenShot2":"https://img.exent.com/Free/FRG/products/466550/screenshot2_sm.jpg", "gameId":466550, "gameRank":208.76721, "gameSize":18, "gameProductionTime":"", "gameLink":"/games/466550/the_treasures_of_montezuma", "gameType" : "0 " } , { "gameName":"The Treasures Of Montezuma 2", "gameNameNorm":"the_treasures_of_montezuma_2", "gameDesc":"Return to the jungle in Treasures of Montezuma 2. It\'s everything that\'s addictive about the first Treasures of Montezuma, only with more levels and more challenges!", "gameLink":"/games/659550/the_treasures_of_montezuma_2", "gameScreenShot1":"https://img.exent.com/Free/FRG/products/659550/screenshot1_sm.jpg", "gameScreenShot2":"https://img.exent.com/Free/FRG/products/659550/screenshot2_sm.jpg", "gameId":659550, "gameRank":206.44159, "gameSize":59, "gameProductionTime":"", "gameLink":"/games/659550/the_treasures_of_montezuma_2", "gameType" : "0 " } , { "gameName":"The Treasures of Montezuma 3", "gameNameNorm":"the_treasures_of_montezuma_3", "gameDesc":"Match tokens to unlock incredible riches in over 160 levels of Match-3 fun.", "gameLink":"/games/729250/the_treasures_of_montezuma_3", "gameScreenShot1":"https://img.exent.com/Free/FRG/products/729250/screenshot1_sm.jpg", "gameScreenShot2":"https://img.exent.com/Free/FRG/products/729250/screenshot2_sm.jpg", "gameId":729250, "gameRank":207.02747, "gameSize":138, "gameProductionTime":"", "gameLink":"/games/729250/the_treasures_of_montezuma_3", "gameType" : "0 " } , { "gameName":"The Treasures of Montezuma 4", "gameNameNorm":"the_treasures_of_montezuma_4", "gameDesc":"Free the gods\' powers and fulfill your destiny in The Treasures of Montezuma 4.", "gameLink":"/games/800250/the_treasures_of_montezuma_4", "gameScreenShot1":"https://img.exent.com/Free/FRG/products/800250/screenshot1_sm.jpg", "gameScreenShot2":"https://img.exent.com/Free/FRG/products/800250/screenshot2_sm.jpg", "gameId":800250, "gameRank":200.0, "gameSize":481, "gameProductionTime":"", "gameLink":"/games/800250/the_treasures_of_montezuma_4", "gameType" : "0 " } , { "gameName":"The Treasures of Montezuma 5", "gameNameNorm":"the_treasures_of_montezuma_5", "gameDesc":"Search for untold treasure deep within an ancient temple!", "gameLink":"/games/834850/the_treasures_of_montezuma_5", "gameScreenShot1":"https://img.exent.com/Free/FRG/products/834850/screenshot1_sm.jpg", "gameScreenShot2":"https://img.exent.com/Free/FRG/products/834850/screenshot2_sm.jpg", "gameId":834850, "gameRank":200.0, "gameSize":64, "gameProductionTime":"", "gameLink":"/games/834850/the_treasures_of_montezuma_5", "gameType" : "2 " } ]; $(document).ready(function(){ boxData = genreCatalog_getBoxData(); $("#genreCatalog_sortOptions li").click(function() { // move selected option to be first $(this).parent().prepend( $(this)); genreCatalog_sort( $(this).attr("sort") ); genreCatalog_changeHash(); genreCatalog_render(); genreCatalog_loadVisibleImages(); genreCatalog_setupPopup(); }); $("#genreCatalog_sortOptions li").each(function() { if( $(this).attr("sort") == genreCatalog_getHashParam("sort") ) { $(this).parent().prepend( $(this)); } }); genreCatalog_sort(genreCatalog_getHashParam("sort")); genreCatalog_render(); genreCatalog_loadVisibleImages(); genreCatalog_setupPopup(); }); function genreCatalog_getBoxData() { imageBase = "https://img.exent.com/free/frg/products/%GAME_ID%/boxshot.jpg"; box = $('#genreCatalog'); cols = box.attr("cols"); rows = box.attr("rows"); slideContainer = box.find(".slides_container")[0]; pagination = box.find("div.pagenation") paginationBulletContainer = $(pagination).find("ul"); games = searchCatalog; numberOfGames = games.length; return {imageBase:imageBase, box:box, games:games, slideContainer:slideContainer, cols:cols, rows:rows, numberOfGames:numberOfGames, pagination:pagination, paginationBulletContainer:paginationBulletContainer}; } /** * Destroys the genreCatalog's content, and rebuild it acording to the gamelist */ function genreCatalog_render () { boxData = genreCatalog_getBoxData(); //gameBox_sort() genreCatalog_reset(); if(boxData.games[0].errorMsg!=null){ $("#genreCatalog").append('