function DataMapper(a){this.gModel=a}DataMapper.prototype={buildModel:function(a){this._buildGenres(a);this._buildWebApps(a);this._buildCategories(a);this._buildTop25Page(a);this._buildLastWebAppsPage(a);this._buildAdvertisement(a)},_buildWebApps:function(b){var d=b.apps;for(var a=0;a<d.length;a++){var c=d[a];this.gModel.createWebApp(c.id,c.tl,c.sd,c.ld,c.url,c.ic,c.imd,c.score);this.gModel.linkGenreWith(c.gr,c.id)}},_buildGenres:function(c){var d=c.genres;for(var a=0;a<d.length;a++){var b=d[a];this.gModel.createGenre(b.id,b.tl,b.ic)}},_buildCategories:function(c){var f=c.categories;var e="";for(var b=0;b<f.length;b++){var a=f[b];if(a.actif){e=a}}for(var b=0;b<f.length;b++){var a=f[b];if(a==e){break}if(e!=""&&b==0&&e.actif==1){var d=this.gModel.createCategorie(e.id,e.tl,"",e.ic,e.ic1);d.bpList=e.bp_list;d.isBp=e.id=="bonplan"}else{var d=this.gModel.createCategorie(a.id,a.tl,a.text,a.ic,a.ic1);d.appIds=this.convertArray(a.app_ids)}}},_buildTop25Page:function(a){this.gModel.setToTop25(this.convertArray(a.top25))},_buildLastWebAppsPage:function(a){this.gModel.setToNewWebApp(this.convertArray(a.lastWebApps))},_buildAdvertisement:function(b){var a=b.pubList;if(a){this.gModel.setAdvList(a)}},convertArray:function(d){var a="";for(var b=0;b<d.length;b++){var c=(d[b].id)?d[b].id:d[b];a=a+c+(((d.length-1)==b)?"":";")}return a}};var mGalleryModel="";function getGModel(){if(mGalleryModel==""){mGalleryModel=new GalleryModel()}return mGalleryModel}function GalleryModel(){this.genreWebAppsMap=new HashMap();this.genreMap=new HashMap();this.catMap=new HashMap();this.webAppMap=new HashMap();this.genreTable=new Array();this.catTable=new Array();this.webAppTable=new Array();this.top25="";this.top25Table=new Array();this.newWebApp="";this.newWATable=new Array();this.advList=new Array()}GalleryModel.prototype={getGenres:function(){return this.genreTable},cleanGenres:function(){var d=this.getGenres();var a=new Array();for(var b=0;b<d.length;b++){var c=this.getWebAppsFromGenreId(d[b].id);if(c&&c.length>0){a.push(d[b])}}if(a&&a.length>0){this.genreTable=a}return this.genreTable},getCategories:function(){return this.catTable},getWebApps:function(){return this.webAppTable},getNewWebApps:function(){return this.get(this.newWATable,this.newWebApp)},getTop25:function(){var a=this.get(this.top25Table,this.top25);return a},createGenre:function(d,c,b){var a=new Genre(d,c,b);this.set(this.genreTable,this.genreMap,a)},getGenre:function(a){return this.genreMap.get(a)},createCategorie:function(d,c,e,b,f){var a=new Categorie(d,c,e,b,f);this.set(this.catTable,this.catMap,a);return a},getCategorie:function(a){return this.catMap.get(a)},getBonPlan:function(){var b=this.catTable;for(var a=0;a<b.length;a++){if(b[a].isBp){return b[a].bpList}}return null},createWebApp:function(e,h,a,f,i,b,g,c){var d=new WebApp(e,h,a,f,i,b,g,c);this.set(this.webAppTable,this.webAppMap,d)},getWebApp:function(a){return this.webAppMap.get(a)},linkGenreWith:function(e,a){var c=this.genreWebAppsMap.get(e);if(c&&c.length>0){a=c+";"+a}this.genreWebAppsMap.put(e,a);var d=this.getWebAppsFromGenreId(e);for(var b=0;b<d.length;b++){if(d[b]){d[b].setGenre(this.getGenre(e))}}},getWebAppsFromGenreId:function(a){return this.getWebAppsFromMap(this.genreWebAppsMap,a)},getWebAppsFromCatId:function(b){var a=this.getCategorie(b);return this.getWebAppsFrom(a.appIds)},setToTop25:function(a){this.top25=a},setToNewWebApp:function(a){this.newWebApp=a},getWebAppsFromMap:function(c,a){var b=c.get(a);return this.getWebAppsFrom(b)},getElems:function(a){var b=new RegExp("[ ,;]+","g");if(a&&a.length>0){return a.split(b)}return[]},getWebAppsFrom:function(b){var d=this.getElems(b);var e=new Array();for(var c=0;c<d.length;c++){var a=this.getWebApp(d[c]);if(a){e.push(a)}}return e},setAdvList:function(a){this.advList=a},getAdvList:function(){return this.advList},set:function(a,c,b){a.push(b);c.put(b.id,b)},get:function(b,a){if(b.length==0){b=this.getWebAppsFrom(a)}return b}};var OrangeClient={getUserUnicId:function(){var a=PropertieManager.get(PropertieManager.UID_PARAM);if(a!=""){return a}return OrangeClient.C_NOT_IDENTIFIED},getUserAge:function(){var a=PropertieManager.get(PropertieManager.CA_PARAM);if(a!=""){return a}return OrangeClient.C_PARENTAL},isClient:function(){return OrangeClient.getUserUnicId()!=OrangeClient.C_NOT_IDENTIFIED},isInWifi:function(){return false}};OrangeClient.C_NOT_IDENTIFIED="NO_ID";OrangeClient.C_PARENTAL="D";OrangeClient.UID=0;OrangeClient.UPARENTAL=1;OrangeClient.UserDef=null;var PropertieManager={updateCookieVersion:function(){var b=Cookie.isCookieExist(PropertieManager.CNAME);var a=Cookie.getCookie(PropertieManager.CNAME);if(b&&a.length>0&&a.indexOf("|")<=0&&a.indexOf(",")>=0&&a.indexOf(PropertieManager.CA_PARAM)>=0&&a.indexOf(PropertieManager.UID_PARAM)>=0){a=Cookie.getCookie(PropertieManager.CNAME);var c=a.split(",");if(c.length>0){localStorage.clear();PropertieManager.setUserCookie(c[0],c[1])}}},setUserCookie:function(b,a){PropertieManager.set(PropertieManager.UID_PARAM,b);PropertieManager.set(PropertieManager.CA_PARAM,a)},initUserProps:function(){var a=loadContent(URL_PHP,"getServerConfig"+(inDev?"&activate=true":""),true);if(a.user==""&&a.age==""){NETWORK_STATUS=_WIFI_STATUS}var d=false;if((PropertieManager.get(PropertieManager.UID_PARAM)==""&&a.user!="")||(NETWORK_STATUS!=_WIFI_STATUS)){PropertieManager.setUserCookie(a.user,a.age)}PropertieManager.set("conn",NETWORK_STATUS);if(document.location.search){var b=urlParam("ca");var c=urlParam("id");if(b&&c){PropertieManager.setUserCookie(c,b)}if(urlParam("flashProps")){localStorage.clear();console.log("flashProps")}}},set:function(a,b){localStorage.setItem(a,b)},get:function(a){return localStorage.getItem(a)}};PropertieManager.UID_PARAM="uid";PropertieManager.CA_PARAM="ca";PropertieManager.CNAME="webstore";function urlParam(b){b=b.replace(/[\[]/,"\\[").replace(/[\]]/,"\\]");var a="[\\?&]"+b+"=([^&#]*)";var d=new RegExp(a);var c=d.exec(window.location.href);if(c==null){return""}else{return c[1]}};function Categorie(c,b,d,a,e){this.id=c;this.title=b;this.icon=a;this.icon1=e;this.text=d};function Genre(c,b,a){this.id=c;this.title=b;this.icon=a};function WebApp(g,f,h,a,e,c,b,d){this.id=g;this.title=f;this.sDesc=h;this.lDesc=a;this.icon=c;this.url=e;this.imgDesc=b;this.score=d}WebApp.prototype={getName:function(){return this.name},getId:function(){return this.id},setCategorie:function(a){this.categorie=a},setGenre:function(a){this.genre=a},getCategorie:function(){return this.categorie},getGenre:function(){return this.genre},};