searchCatalog=[ { "gameName":"Tradewinds 2", "gameNameNorm":"tradewinds_2", "gameDesc":"Sail the oceans and amass a fortune trading goods while fighting pirates. Encounter fascinating new places and discover uncharted ports. Set sail for great strategy adventure fun in this game.", "gameLink":"/games/460650/tradewinds_2", "gameScreenShot1":"https://img.exent.com/Free/FRG/products/460650/screenshot1_sm.jpg", "gameScreenShot2":"https://img.exent.com/Free/FRG/products/460650/screenshot2_sm.jpg", "gameId":460650, "gameRank":200.0, "gameSize":11, "gameProductionTime":"", "gameLink":"/games/460650/tradewinds_2", "gameType" : "0 " } , { "gameName":"Tradewinds Caravans", "gameNameNorm":"tradewinds_caravans", "gameDesc":"Travel along the bustling and dangerous Silk Road trading exotic goods and engaging in real-time battles as you build the most powerful trading caravan in history.", "gameLink":"/games/587250/tradewinds_caravans", "gameScreenShot1":"https://img.exent.com/Free/FRG/products/587250/screenshot1_sm.jpg", "gameScreenShot2":"https://img.exent.com/Free/FRG/products/587250/screenshot2_sm.jpg", "gameId":587250, "gameRank":100.0, "gameSize":63, "gameProductionTime":"", "gameLink":"/games/587250/tradewinds_caravans", "gameType" : "0 " } , { "gameName":"Tradewinds Classic", "gameNameNorm":"tradewinds_classic", "gameDesc":"Build your empire and sail the mystic seas as you journey to distant islands and barter with shrewd merchants", "gameLink":"/games/610950/tradewinds_classic", "gameScreenShot1":"https://img.exent.com/Free/FRG/products/610950/screenshot1_sm.jpg", "gameScreenShot2":"https://img.exent.com/Free/FRG/products/610950/screenshot2_sm.jpg", "gameId":610950, "gameRank":200.0, "gameSize":6, "gameProductionTime":"", "gameLink":"/games/610950/tradewinds_classic", "gameType" : "0 " } , { "gameName":"Tradewinds Legends", "gameNameNorm":"tradewinds_legends", "gameDesc":"Get carried away in the latest installment in the acclaimed Tradewinds™ series.", "gameLink":"/games/460550/tradewinds_legends", "gameScreenShot1":"https://img.exent.com/Free/FRG/products/460550/screenshot1_sm.jpg", "gameScreenShot2":"https://img.exent.com/Free/FRG/products/460550/screenshot2_sm.jpg", "gameId":460550, "gameRank":200.0, "gameSize":17, "gameProductionTime":"", "gameLink":"/games/460550/tradewinds_legends", "gameType" : "0 " } ]; $(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('