var a;
(function(b){var e=function(){this.currentLocation="/";this.activeComponentRoute=this.activeComponent=this.activeComponentSet=this.activeRoute=this.prevLocation=this.activeSection=null;this.lock=false;this.lockUrl=""};e.prototype.setCurrentLocation=function(c){this.prevLocation=this.currentLocation||c;this.currentLocation=c};e.prototype.setBySectionInfo=function(c){this.activeSection=c.section;this.activeComponentSet=c.componentSet||null;this.activeComponent=c.component||null;this.activeComponentRoute=c.componentRoute||
null;this.currentLocation=this.setCurrentLocation(c.activeUrl)};b.AtlStateManager=new e})(window);var ArrayHelper={range:function(b,e,c){var f=[];c=c||1;var h=false;if(!isNaN(b)&&!isNaN(e)){b=b;e=e}else if(isNaN(b)&&isNaN(e)){h=true;b=b.charCodeAt(0);e=e.charCodeAt(0)}else{b=isNaN(b)?0:b;e=isNaN(e)?0:e}if(b<=e)for(;b<=e;){f.push(h?String.fromCharCode(b):b);b+=c}else for(;b>=e;){f.push(h?String.fromCharCode(b):b);b-=c}return f}};
Array.prototype.remove=function(b,e){e=this.slice((e||b)+1||this.length);this.length=b<0?this.length+b:b;return this.push.apply(this,e)};if(!Array.prototype.indexOf)Array.prototype.indexOf=function(b,e){var c=this.length;e=Number(e)||0;e=e<0?Math.ceil(e):Math.floor(e);if(e<0)e+=c;for(;e<c;e++)if(e in this&&this[e]===b)return e;return-1};
var _gaq=_gaq||[],prevPage,Analytics={event:function(b,e,c,f){_gaq.push(["_trackEvent",b,e,c,f])},track:function(b){if(prevPage!==b&&b!=="/"&&b!=="#"){_gaq.push(["_trackPageview",b]);prevPage=b}},trackFromSWF:function(b){Analytics.track(b.value)},init:function(){$.address.change(Analytics.trackFromSWF)}};
$(document).ready(function(){_gaq.push(["_setAccount",atl.config.googleTracker]);var b=document.createElement("script");b.type="text/javascript";b.async=true;b.src=("https:"==document.location.protocol?"https://ssl":"http://www")+".google-analytics.com/ga.js";var e=document.getElementsByTagName("script")[0];e.parentNode.insertBefore(b,e);var c=window.location.href,f=c.replace("http://","").split("/")[0];$("a").live("click",function(h){var k=$(h.currentTarget).attr("href");if(k&&(k.indexOf("http://")!==
-1||k.indexOf("www")!==-1))k.indexOf(f)===-1&&Analytics.event("external","view",k)})});
var AtlComponent=function(){this.executeMethodName="execute";this.template=null;this.type=this.id=this.key=this.name=this.subtitle=this.title=this.decorationMarkup=this.markup="";this.number=1;this.routes=[];this.roles=[];this.roleTemplates=[];this.routeMappings=[];this.columnSize=7;this.data={};this.executeOnShow=false;this.navigation="default";this.decoration="";this.executed=false;this.serviceLoadingState=0;this.isShowed=false;this.namespace="";this.content=false};a=AtlComponent.prototype;
a.run=function(){atl.runComponent(this,true)};
a.populate=function(b){this.name=b.name;this.key=b.key;this.number=b.number;this.namespace=b.namespace;this.content=b.content;if(b.executeMethodName)this.executeMethodName=b.executeMethodName;if(b.template)this.template=b.template;if(b.title)this.title=b.title;if(b.subtitle)this.subtitle=b.subtitle;if(b.type)this.type=b.type;if(b.columnSize)this.columnSize=b.columnSize;if(b.executeOnShow!==undefined)this.executeOnShow=b.executeOnShow;if(b.navigation)this.navigation=b.navigation;if(b.id)this.id=b.id;
if(b.decoration)this.decoration=b.decoration;if(b.roles)this.roles=b.roles;if(b.roleTemplates)this.roleTemplates=b.roleTemplates;if(b.routes)this.routes=b.routes;if(b.routeMappings)this.routeMappings=b.routeMappings};a.getRouteByUrl=function(b){b=this.routeMappings[b];if(b!==undefined)return this.routes[b];return null};a.init=function(){};a.onComplete=function(){};a.onShow=function(){};a.onChange=function(){};a.onSessionChange=function(){};a.onRoleChange=function(){};a.onLoadReady=function(){};
a.execute=function(){};a.setData=function(b){this.data=b};a.getData=function(){return this.data};a.unload=function(){atl.errorHandler.error("info","You called the unload method from abstract class AtlComponent: implement method in "+this.name)};
a.determineComponentTemplate=function(b){b=b||this;var e="component_"+b.name;if(b.template&&b.template!=="false")e+="_"+b.template;else if(b.template==="false")return false;var c=b.roleTemplates;if(c.length>0)for(var f=false,h=0,k=c.length;h<k&&!f;h++)if(f=atl.session.getCurrentRoles().indexOf(c[h])>-1)e+="_"+c[h];else if(atl.session.getUser()!==null)e+="_"+c[h];return b.namespace+e};a.loadServices=function(){};
a.checkLoading=function(b){if(this.serviceLoadingState===0)b.call(this);else var e=this,c=atl.config.intervalTimeout,f=setInterval(function(){atl.timeoutCheck(c,20,f);if(e.serviceLoadingState===0){clearInterval(f);b.call(e)}},20)};a.setLoadingState=function(b){this.serviceLoadingState=b};a.decreaseLoadingState=function(){--this.serviceLoadingState};a.increaseLoadingState=function(){++this.serviceLoadingState};
a.handleRoleElements=function(){var b=atl.session.getCurrentRoles(),e=[],c=this;if(this.markup!==null&&this.markup!==undefined)e=this.markup.find(".roles");else var f=atl.config.intervalTimeout,h=setInterval(function(){atl.timeoutCheck(f,50,h);if(this.markup!==null&&this.markup!==undefined){clearInterval(h);c.handleRoleElements()}},50);for(var k=e.length;k--;)for(var d=b.length,g=0;g<d;){$(e[k]).hasClass(b[g])?$(e[k]).show():$(e[k]).hide();++g}};
a.findRouteByFlashAction=function(b){var e=null;if(b.indexOf("?")>-1)b=b.substr(0,b.indexOf("?"));for(var c=0,f=this.routes.length;c<f&&e===null;c++){var h=this.routes[c];if(h.flashAction===b)e=h}return e};a.findRouteByFlashView=function(b){var e=null;if(b.indexOf("?")>-1)b=b.substr(0,b.indexOf("?"));if(this.routes)for(var c=0,f=this.routes.length;c<f;c++){var h=this.routes[c];if(h.flashView===b&&!h.flashAction)e=h}return e};
var AtlComponentSet=function(){this.components=[];this.componentsInfo=[];this.name="unknown";this.key="";this.type="dynamic";this.componentMappings=[];this.markup="";this.activeComponentIndex=0;this.template=null;this.navigation=[];this.subtitle=this.title=null;this.namespace=""};a=AtlComponentSet.prototype;
a.populate=function(b){this.name=b.name;this.namespace=b.namespace;this.key=b.key;this.componentsInfo=b.components;this.type=b.type;if(b.template)this.template=b.template;if(b.title)this.title=b.title;if(b.subtitle)this.subtitle=b.subtitle;if(b.navigation)this.navigation=b.navigation;if(b.componentMappings)this.componentMappings=b.componentMappings};a.init=function(){};a.onComplete=function(){};a.onChange=function(){};a.onSessionChange=function(){};a.onRoleChange=function(){};a.unload=function(){};
a.showComponent=function(b,e){if(e===undefined||e!==false){$(".pane",b.markup).hide();$(".loading").show()}var c=b.components[b.activeComponentIndex];c.executeOnShow&&c.run();c.loadServices();c.checkLoading(function(){c.onLoadReady();c.handleRoleElements();$(".pane",b.markup).eq(b.activeComponentIndex).fadeIn(125,function(){window.Cufon&&Cufon.refresh();if(c.isShowed)c.onChange();else{c.onShow();c.isShowed=true}if(window.Cufon)var f=atl.config.intervalTimeout,h=setInterval(function(){atl.timeoutCheck(f,
50,h);if($("canvas",b.markup).length>0||isIE6||isIE7||isIE8||isIE9){clearInterval(h);$(".loading").hide()}},50);else setTimeout(function(){$(".loading").hide()},100);atl.getExposeApi().fit()})})};
a.generateOverlayMenu=function(b){$(".form-steps",b.markup).empty().addClass("step-count-"+b.navigation.length);var e=0;if(b.componentsInfo[b.activeComponentIndex]!==undefined)e=b.navigation.indexOf(b.componentsInfo[b.activeComponentIndex].navigation);for(var c=0,f=b.navigation.length;c<f;c++){var h=$('<li class="step"><a><span>'+(c+1)+". "+b.navigation[c]+"</span></a></li>");c===0&&$(h).addClass("first");if(c===e)$(h).addClass("active");else if(c<e){$(h).addClass("visited");c+1===e&&$(h).addClass("step-before-active")}c+
1===b.navigation.length&&$(h).addClass("last");$(".form-steps",b.markup).append(h)}};a.getComponentByName=function(b){for(var e=this.components.length;e--;)if(this.components[e].name==b)return this.components[e];return false};a.setActiveComponentIndexByName=function(b){for(var e=this.components.length;e--;)if(this.components[e].name==b)this.activeComponentIndex=e};a.updateTitles=function(){this.title!==null&&$(this.markup).find("h1").text(this.title);this.subtitle!==null&&$(this.markup).find("h2#overlay-subheading").text(this.subtitle)};
var AtlComponentLoader=function(){var b=this;this.className="AtlComponent";this.ready=function(){};this.component=this.decorationFile=this.componentInfo=null;this.markup="";this.decoratorTarget=".content";this.viewName="widget";this.load=function(e,c,f){this.componentInfo=ComponentValidator.validate(e);if(this.componentInfo===null)return f.call(this,null);this.ready=f;this.viewName=c;this.decorationFile="decoration/view_"+(e.decoration?e.decoration:c)+"_component_decoration";if(e.type==="static"){e.className=
"AtlComponent";this.componentClassLoaded()}else if(window[b.componentInfo.className]){b.initComponent();atl.getTemplate(b.decorationFile,b.decorationTemplateLoaded)}else{e=".js";if(window.isIE6||window.isIE7)e+="?"+(new Date).getTime();jQuery.getScript("./assets/js/atl/components/"+this.componentInfo.namespace+this.componentInfo.className+e,b.componentClassLoaded)}};this.componentClassLoaded=function(){window[b.componentInfo.className]||atl.errorHandler.error("fatal","component not available: "+b.componentInfo.className);
b.initComponent();atl.getTemplate(b.decorationFile,b.decorationTemplateLoaded)};this.initComponent=function(){b.component=new window[b.componentInfo.className];b.component.populate(b.componentInfo);b.component.init()};this.decorationTemplateLoaded=function(e){b.component.decorationMarkup=b.viewName==="widget"?$(e).addClass("grid_"+b.component.columnSize):b.viewName==="content"?$(e).attr("id","pane-"+b.component.number):$(e);(e=b.determineComponentTemplate())?atl.getTemplate(e,b.componentTemplateLoaded,
b.component.content):b.componentTemplateLoaded(null)};this.componentTemplateLoaded=function(e){b.component.markup=$(e);b.ready&&b.ready.call(this,b.component)};this.determineComponentTemplate=function(){return b.component.determineComponentTemplate()}},AtlComponentSetLoader=function(){var b=this;this.componentSet=this.componentSetInfo=null;this.viewName="";this.decorationFile=this.ready=null;this.markup="";this.load=function(e,c,f){this.componentSetInfo=e;this.viewName=c;this.ready=f;f=e.name;if(e.template)f=
e.template;this.decorationFile="decoration/view_"+c+"_componentset_"+f+"_decoration";if(b.componentSetInfo.type==="static"){b.componentSetInfo.className="AtlComponent";b.componentSetClassLoaded()}else if(window[b.componentSetInfo.className]){b.initComponentSet();atl.getTemplate(b.decorationFile,b.decorationTemplateLoaded)}else{e=".js";if(window.isIE6||window.isIE7)e+="?"+(new Date).getTime();jQuery.getScript("./assets/js/atl/components/"+this.componentSetInfo.namespace+this.componentSetInfo.className+
e,b.componentSetClassLoaded)}};this.componentSetClassLoaded=function(){window[b.componentSetInfo.className]||atl.errorHandler.error("fatal","componentSet not available: "+b.componentSetInfo.className);b.initComponentSet();atl.getTemplate(b.decorationFile,b.decorationTemplateLoaded)};this.initComponentSet=function(){b.componentSet=new window[b.componentSetInfo.className];b.componentSet.populate(b.componentSetInfo);b.componentSet.init()};this.decorationTemplateLoaded=function(e){b.componentSet.markup=
$(e);b.ready&&b.ready.call(this,b.componentSet)}},AtlSectionBuilder=function(){};a=AtlSectionBuilder.prototype;a.unloadPrevSection=function(b){if(b&&b.length>0)for(var e=b.length;e--;){b[e].unload();b[e].markup=null;b[e].decorationMarkup=null;delete b[e]}atl.sectionManager.resetSectionObjects();$("#widget-container").hide().empty();$("#atl-container").hide().empty();atl.notify("section_unload")};
a.buildSection=function(b){$("#atl-container").hide();$("#widget-container").hide();this.buildViews(b.section.views,0,function(){$("#atl-container").show();$("#widget-container").show();atl.sectionManager.runSectionObjects();window.Cufon&&Cufon.refresh();atl.notify("application_loaded");AtlStateManager.lock=false;$("#loader").hide();if($("#expose-mask").length>0||$("#expose-mask").is(":visible"))var e=setTimeout(function(){clearTimeout(e);atl.getExposeApi().fit()},125)})};
a.buildViews=function(b,e,c){var f=b[e],h=this;if(f)this.buildView(f,function(){h.buildViews(b,++e,c)});else{c&&c.call();h=null}};
a.buildView=function(b,e){var c=this;if(b.checkRoles())if(b.container==="widget")this.buildComponents(b.components,b.container,0,function(f){var h=$('<div class="container_24"'+(b.id?' id="'+b.id+'"':"")+" />");$("#widget-container").append(h);c.handleComponentsMarkup(f,h);$("#widget-container").append('<hr class="clear" />');e.call(c);c=null},[]);else if(b.container==="content"||b.container==="header")c.buildComponentSets(b,e,0);else{if(b.container==="static"||b.container==="action")this.buildComponents(b.components,
b.container,0,function(f){var h=$('<div class="static-container"'+(b.id?' id="'+b.id+'"':"")+" />");$("#atl-container").append(h);c.handleComponentsMarkup(f,h);e.call(c);c=null},[])}else{e.call(c);c=null}};a.handleComponentsMarkup=function(b,e){for(var c=0;c<b.length;c++)this.handleComponentMarkup(b[c],e)};
a.handleComponentSet=function(b,e,c){var f=b.markup;$(e).append(f);e=f;var h=$(f).find(".content");if(h.length>0)e=h;h=0;for(var k=b.components.length;h<k;h++)this.handleComponentMarkup(b.components[h],e);b.markup=f;atl.sectionManager.addSectionObject(b,c)};a.handleComponentMarkup=function(b,e){var c=$(b.decorationMarkup);c.hasClass("content")?c.append(b.markup):c.find(".content").append(b.markup);b.markup=c;$(b.markup).hide();$(e).append(c)};
a.buildComponentSets=function(b,e,c){var f=this,h=b.componentSets[c];if(h===undefined){e&&e.call(f);f=null}else this.buildComponentSet(h,b.container,function(k){f.handleComponentSet(k,"#atl-container",b.container);f.buildComponentSets(b,e,++c)})};a.buildComponentSet=function(b,e,c){var f=new AtlComponentSetLoader,h=this;f.load(b,e,function(k){h.buildComponents(b.components,e,0,function(d){k.components=d;f=null;c.call(this,k);h=null},[])})};
a.buildComponents=function(b,e,c,f,h){var k=new AtlComponentLoader,d=b[c],g=this;if(d===undefined){f&&f.call(this,h);g=k=null}else k.load(d,e,function(j){if(j!==null){atl.sectionManager.addSectionObject(j,e);h.push(j)}g.buildComponents(b,e,++c,f,h)})};var AtlRoute=function(){this.url="";this.flashAction=this.flashView=null;this.method="";this.roles=[];this.wizard=null;this.overlay="";this.editwizard=false;this.requiredParams=[]};
AtlRoute.prototype.checkRoles=function(){if(this.roles.length>0)return atl.session.hasARole(this.roles);return true};AtlRoute.prototype.validateParams=function(){if(this.requiredParams.length>0)for(var b=this.requiredParams.length;b--;){var e=$.address.parameter(this.requiredParams[b]);if(e===undefined||e.length<1)return false}return true};
var AtlWizard=function(){this.components=[];this.componentSets=[]},AtlSection=function(){this.name="";this.type="page";this.url="";this.urlMappings=[];this.rebuildOnRoleChange=false;this.forceActiveUrl=true;this.roles=[];this.views=[];this.error="500"},AtlSectionManager=function(){this.lastSectionInfo=null;this.sections=[];this.sectionUrlMapping={};this.sectionObjects=[];this.sectionKeyMapping={};this.templates={}};a=AtlSectionManager.prototype;
a.addSectionObject=function(b,e){if(!this.sectionKeyMapping[b.key]){b._viewName=e;this.sectionObjects.push(b);this.sectionKeyMapping[b.key]=this.sectionObjects.length-1}};a.getDefaultSectionInfo=function(){return this.findSectionInfoByUrl(this.getDefaultSectionUrl())};a.getDefaultSectionUrl=function(){return this.sections[0].url};a.getSectionObjects=function(){return this.sectionObjects};a.findSectionObjectByKey=function(b){return this.sectionObjects[this.sectionKeyMapping[b]]};
a.resetSectionObjects=function(){this.sectionObjects=[];this.sectionKeyMapping={}};a.unloadWizardObjects=function(){for(var b=this.sectionObjects.length;b--;)if(this.sectionObjects[b]._viewName=="wizard"){this.sectionObjects[b].unload();this.sectionObjects[b].markup=null;this.sectionObjects[b].decorationMarkup=null;delete this.sectionKeyMapping[this.sectionObjects[b].key];this.sectionObjects.remove(b)}};
a.addSection=function(b){this.sectionUrlMapping[b.url]=this.sections.length;for(var e=b.urlMappings.length;e--;)this.sectionUrlMapping[b.urlMappings[e]]=this.sections.length;this.sections.push(b)};a.addTemplate=function(b,e){this.templates[b]=e};a.getTemplate=function(b){return this.templates[b]};a.sectionExists=function(b){for(var e="",c=this.sections.length;c--;)e+=this.sections[c].name+"|";e=e.substr(0,e.length-1);return b.search("^/("+e+")")>-1};a.getSections=function(){return this.sections};
a.getSectionInfoByUrl=function(b){b=this.sectionUrlMapping[b];if(b!==undefined){var e={};e.index=b;e.section=this.sections[b];return e}return null};
a.findSectionInfoByUrl=function(b){if(this.lastSectionInfo!==null&&this.lastSectionInfo.activeUrl===b)return this.lastSectionInfo;var e=this.getSectionInfoByUrl(b);if(e===null){var c="";for(var f in this.sectionUrlMapping)if(this.sectionUrlMapping.hasOwnProperty(f)){c="^"+f;if(b.search(c)>-1){e=this.getSectionInfoByUrl(f);break}}}if(e!==null){this._setActiveObjects(e,b);e.activeUrl=this._buildActiveUrl(e);this.lastSectionInfo=e}return e};
a._setActiveObjects=function(b,e){for(var c=b.section,f=false,h=c.views.length;h--&&!f;){var k=c.views[h];if(k.componentSets.length){k=k.getComponentSetByUrl(e);if(k!==null){b.componentSet=k;f=this._loopThroughComponents(b,k.components,e)}}else f=this._loopThroughComponents(b,k.components,e)}f||c.urlMappings.length&&this._setActiveObjects(b,c.urlMappings[0]);return b};
a._loopThroughComponents=function(b,e,c){for(var f=false,h=e.length;h--&&!f;){var k=e[h].routeMappings;for(var d in k)if(k.hasOwnProperty(d))if(d==c){b.component=e[h];b.componentRoute=e[h].routes[k[d]];f=true;if(!b.componentRoute.checkRoles()||!b.componentRoute.validateParams()){b.component=null;b.componentRoute=null;f=false}}}return f};a._buildActiveUrl=function(b){var e=b.section.url;if(b.componentRoute!==undefined&&b.componentRoute!==null)e+=b.componentRoute.url;return e};
a.changed=function(){for(var b=this.sectionObjects.length;b--;)this.sectionObjects[b].onChange();atl.getExposeApi().fit()};a.sessionChanged=function(){for(var b=this.sectionObjects.length;b--;)this.sectionObjects[b]!==undefined&&this.sectionObjects[b].onSessionChange()};a.roleChanged=function(){for(var b=this.sectionObjects.length;b--;){this.sectionObjects[b].onRoleChange();!this.sectionObjects[b]instanceof AtlComponentSet&&this.sectionObjects[b].handleActiveComponent()}};
a.runSectionObjects=function(){for(var b=[],e=this.sectionObjects.length;e--;)if(this.sectionObjects[e]instanceof AtlComponentSet)b.push(this.sectionObjects[e]);else{$(this.sectionObjects[e].markup).show();atl.runComponent(this.sectionObjects[e])}for(e=b.length;e--;){b[e].updateTitles();b[e].onComplete()}};a.handleComponentRoleElements=function(){for(var b=this.sectionObjects.length;b--;)!this.sectionObjects[b]instanceof AtlComponentSet&&this.sectionObjects[b].handleRoleElements()};
a.findRouteByFlashAction=function(b){var e=null;if(b.indexOf("?")>-1)b=b.substr(0,b.indexOf("?"));for(var c=this.sectionObjects.length;c--&&e===null;){var f=this.sectionObjects[c];if(f!==undefined&&f.routes)for(var h=0,k=f.routes.length;h<k;h++){var d=f.routes[h];if(d.flashAction===b)e=d}}return e};var AtlGlobalRoute=function(){this.overlay=this.method=this.url="";this.forceDefaultSection=false;this.wizard="";this.roles=[]};
AtlGlobalRoute.prototype.checkRoles=function(){if(this.roles.length>0)return atl.session.hasARole(this.roles);return true};var AtlGlobalRouteManager=function(){this.globalRoutes=[];this.globalRouteUrlMapping={}};a=AtlGlobalRouteManager.prototype;a.getGlobalRoutes=function(){return this.globalRoutes};a.getGlobalRouteUrlMapping=function(){return this.globalRouteUrlMapping};a.addGlobalRoute=function(b){this.globalRouteUrlMapping[b.url]=b;this.globalRoutes.push(b)};
a.executeGlobalRoute=function(b,e){e!==null&&e.length>1?atl.session.setProperty("returnUrl",e,false):atl.session.setProperty("returnUrl",null,false);if(b.checkRoles()){if(b.wizard!==null&&b.overlay!==undefined){e=atl.getOverlayApi(b.overlay).getOverlay().empty();atl.createWizard(b.wizard,e,function(){atl.getOverlayApi(b.overlay).load()})}jQuery.isFunction(GlobalRouteFunctions[b.method])&&GlobalRouteFunctions[b.method].call()}else{atl.session.setProperty("post_login_redirect",b.wizard,false);atl.setUrl("/login")}};
a.findGlobalRoute=function(b){if(this.globalRouteUrlMapping[b]!==undefined)return this.globalRouteUrlMapping[b];else for(var e in this.globalRouteUrlMapping)if(this.globalRouteUrlMapping.hasOwnProperty(e))if(b.indexOf(e)!==-1)return this.globalRouteUrlMapping[e];return null};
var AtlSession=function(){var b=this,e=null,c=null,f=[],h=null,k={};this.getContentTemplates=function(){return h};this.getContentTemplateById=function(d){return h[d]};this.addContentTemplate=function(d,g){if(h===null)h={};h[d]=g};this.getProperty=function(d){return k[d]};this.setProperty=function(d,g,j){k[d]=g;this.changed(j);return k[d]};this.cutProperty=function(d,g){var j=k[d];this.changed(g);k[d]=undefined;return j};this.hasARole=function(d){if(typeof d==="string")d=[d];var g=true;if(d.length>
0){g=false;for(var j=d.length;j--&&!g;)g=f.indexOf(d[j])>-1}return g};this.updateRolesByTeamId=function(d,g){var j=[];e!==null&&e.profile.isSuperAdmin&&j.push("beheerder");if(d!==null&&e!==null)for(var m=e.teamSites,n=0,o=m.length;n<o;++n)if(d===m[n].Id){d=m[n].TeamSiteRoles;m=0;for(n=d.length;m<n;++m)j.push(d[m].Name);break}this.setCurrentRoles(j,g)};this.clearCookies=function(){if(this.getRememberMeToken()===null){this.setEmail(null,false);this.setPassword(null,false);this.setMigrationToken(null,
false);this.setTeamlinksSize(null,false);this.setFacebookToken(null,false);this.setHyvesToken(null,false)}};this.changed=function(d){if(d!==false){atl.sectionManager.sessionChanged();atl.notify("session_changed")}};this.getUser=function(){return e};this.setUser=function(d,g){e=d;d!==null&&atl.session.getCurrentTeamSite()===null&&atl.session.getDefaultTeamId()?atl.connection.loadCurrentTeamSite(atl.session.getDefaultTeamId(),function(){g!==false&&b.changed()}):this.changed(g)};this.getCurrentTeamSite=
function(){return c};this.setCurrentTeamSite=function(d,g){c=d;this.changed(g);atl.updateCurrentTeamLinkBox()};this.getCurrentRoles=function(){return f};this.setCurrentRoles=function(d,g){f=d;atl.sectionManager.handleComponentRoleElements();if(g!==false){this.changed(g);atl.sectionManager.roleChanged();atl.notify("role_changed")}};this.getProperties=function(){return k};this.setProperties=function(d){k=d};this.getEmail=function(){return $.cookie("user-email")};this.setEmail=function(d,g){$.cookie("user-email",
d,{path:"/",expires:365});this.changed(g)};this.getPassword=function(){return $.cookie("user-passwd")};this.setPassword=function(d,g){$.cookie("user-passwd",d,{path:"/",expires:365});this.changed(g)};this.getDefaultTeamId=function(){var d=$.cookie("default-atl-team-id");if(d!==null&&this.getUser()!==null){for(var g=this.getUser().teamSites,j=false,m=0,n=g.length;m<n&&!j;m++)if(g[m].Id===d)j=true;if(!j){d=null;atl.session.setDefaultTeamId(d,false)}}return d};this.setDefaultTeamId=function(d,g){$.cookie("default-atl-team-id",
d,{path:"/",expires:365});this.changed(g)};this.getCurrentTeamId=function(){var d=$.cookie("current-atl-team-id");if(d)return d;else{(d=b.getDefaultTeamId())&&b.setCurrentTeamId(d,false);return d}};this.setCurrentTeamId=function(d,g){$.cookie("current-atl-team-id",d);this.updateRolesByTeamId(d,false);this.changed(g)};this.getTeamlinksSize=function(){return parseInt($.cookie("atl-teamlinks-size"),10)};this.setTeamlinksSize=function(d,g){$.cookie("atl-teamlinks-size",d,{path:"/",expires:365});this.changed(g)};
this.getMigrationToken=function(d){return $.cookie("atl-migration-token-"+d)};this.setMigrationToken=function(d,g){$.cookie("atl-migration-token-"+d,d,{path:"/",expires:7});this.changed(g)};this.getFacebookToken=function(){return $.cookie("atl-facebook-token")};this.setFacebookToken=function(d,g){$.cookie("atl-facebook-token",d,{path:"/",expires:365});this.changed(g)};this.getHyvesToken=function(){return $.cookie("atl-hyves-token")};this.setHyvesToken=function(d,g){$.cookie("atl-hyves-token",d,{path:"/",
expires:365});this.changed(g)};this.getRememberMeToken=function(){return $.cookie("atl-rememberme-token")};this.setRememberMeToken=function(d,g){$.cookie("atl-rememberme-token",d,{path:"/",expires:365});this.changed(g)}},AtlErrorHandler=function(){var b=this;this.errorCopy=null;this.init=function(){$(document).ajaxError(this.ajaxErrorHandler)};var e=function(){};this.loadErrors=function(f){e=f;f=".xml";if(window.isIE6||window.isIE7)f+="?"+(new Date).getTime();$.ajax({type:"GET",url:"./assets/xml/atl_errors"+
f,dataType:"xml",success:c})};this.ajaxErrorHandler=function(f,h,k){f="An unknown error has occurred";if(k!==undefined&&k.url!==undefined)f="AJAX error on: "+k.url;k.url.indexOf(atl.config.contentDirectory)>-1?k.success.call(this,null):b.error("fatal",f)};this.jsonErrorHandler=function(f){switch(f){case 0:case 2:atl.dialog($("#"+f,b.errorCopy).text(),{Ok:function(){$(this).dialog("close");$.address.value("/home")}});break;case 8:case 32:case 64:case 512:case 524294:case 524302:break;default:atl.dialog($("#"+
f,b.errorCopy).text())}};this.error=function(f,h,k){if(k!==undefined&&$.isFunction(k))k.call(b,h);else switch(f){case "fatal":atl.closeOverlay();h=atl.config.debug?h:"Error explanation copy for production environment";atl.runUrl("/error/"+AtlStateManager.activeSection.error);atl.addEventListener("error_"+AtlStateManager.activeSection.error,function(){$("#error-"+AtlStateManager.activeSection.error).html(h)});break;default:case "info":break}};var c=function(f){b.errorCopy=f;e.call(this)}},AtlForm=
function(){function b(c){var f=null;f=/radio|checkbox/i.test(c.attr("type"))?$("#"+e.id+" input[name="+c.attr("name")+"]:checked").val():c.val();if(!f)return"";return f}var e=this;this.id="";this.form={};this.errors=[];this.settings={strictSending:true};this.fieldsToValidate=0;this.helpHtml="";this.setId=function(c){this.id=c;return e};this.getId=function(){return this.id};this.setForm=function(c){this.form=c;return e};this.getForm=function(){return this.form};this.getFieldsToValidate=function(){return this.fieldsToValidate};
this.getData=function(){var c={};$.each(this.form,function(f){var h=$("#"+f);c[f]=h.attr("type")==="checkbox"||h.attr("type")==="radio"?$("#"+f).is(":checked"):$("#"+f).val()});return c};this.jsonify=function(c){return JSON.stringify(c)};this.setData=function(c){$.each(c,function(f,h){var k=$("#"+f);k.hasClass("initial-value")&&k.removeClass("initial-value");if($(k).is("select"))$("#"+f+" option[value="+h+"]").attr("selected","selected");else switch(k.attr("type")){case "radio":case "checkbox":k.attr("checked",
h);break;default:k.val(h);break}k.val(h)});return e};this.setFieldValue=function(c,f){e.form[c].realValue=f};this.setFieldAccessing=function(c,f){e.form[c].accessing=f};this.setSettings=function(c){this.settings=c;return e};this.validate=function(c,f){var h=true;e.errors=[];$.each(this.form,function(k,d){var g=$("#"+k),j;j=g.hasClass("initial-value")?"":b(g);$.each(d.validation,function(m,n){if(e[n.name]){m=g.parents("div.wrapper");var o=m.children("div.validation");if(e[n.name].call(e,g,j,n.params)){if(!c&&
!m.hasClass("error")){m.addClass("valid");m.removeClass("mandatory");o.html("&#160;")}}else{h=false;if(!c){o.html(n.message);m.addClass("error");m.removeClass("valid");m.removeClass("mandatory")}f&&e.errors.push({Name:j,Message:n.message})}}else atl.errorHandler.error("info","Calling an unexisting validation method ["+n.name+"]")})});return h};this.init=function(){e.helpHtml=$("div.help-container").html();e.settings.strictSending&&$("#"+e.id+" button[type=submit]").button({disabled:true});$.each(this.form,
function(c,f){var h="blur",k="focus",d="blur",g="blur",j="focus",m=$("#"+c),n=m.parents("div.wrapper"),o=n.children("div.validation");if(f.initialValue!==undefined&&f.initialValue.length>0){m.val(f.initialValue);m.addClass("initial-value")}if(f.accessing!==undefined)switch(f.accessing){case -1:n.hide();break;case 0:case 1:n.show();m.attr("disabled","disabled");break;default:n.show();m.removeAttr("disabled");break}if(f.realValue!==undefined){var p={};p[c]=f.realValue;e.setData(p)}if(f.validationEvent!==
undefined&&f.validationEvent.length>0)h=f.validationEvent;if(f.helpEventIn!==undefined&&f.helpEventIn.length>0)k=f.helpEventIn;if(f.helpEventOut!==undefined&&f.helpEventOut.length>0)d=f.helpEventOut;if(f.initialValueEventIn!==undefined&&f.initialValueEventIn.length>0)g=f.initialValueEventIn;if(f.initialValueEventOut!==undefined&&f.initialValueEventOut.length>0)j=f.initialValueEventOut;f.validation.length>0&&++e.fieldsToValidate;$.each(f.validation,function(s,r){if(/notNull|checked/.test(r.name)&&
!n.hasClass("originally_mandatory")&&r.mandatory!==false){n.addClass("originally_mandatory mandatory");return false}});m.bind(h,function(){var s=b(m);if(s.length>0){n.removeClass("error");o.html("&#160;");$.each(f.validation,function(r,q){r=false;if(q.silent)r=q.silent;if(e[q.name])if(e[q.name].call(e,m,s,q.params)){if(!r&&!n.hasClass("error")){n.addClass("valid");n.removeClass("mandatory");o.html("&#160;")}}else{n.removeClass("valid");if(!r&&!/notNull|checked|dependsOn/.test(q.name)){o.html(q.message);
n.addClass("error");n.removeClass("mandatory")}}else atl.errorHandler.error("info","Calling an unexisting validation method ["+q.name+"]")})}else{n.removeClass("valid");n.removeClass("error");n.hasClass("originally_mandatory")&&n.addClass("mandatory")}if(e.settings.strictSending){e.validate(true)?$("#"+e.id+" button[type=submit]").button({disabled:false}):$("#"+e.id+" button[type=submit]").button({disabled:true});e.enableSendButtons("ui-button-back")}});m.bind(g,function(){if(b(m).length===0)if(f.initialValue!==
undefined&&f.initialValue.length>0){m.val(f.initialValue);m.addClass("initial-value");n.removeClass("valid")}});m.bind(j,function(){if(m.hasClass("initial-value")){m.val("");m.removeClass("initial-value")}});k==="mouseenter"?n.bind(k,function(){$("div.help-container").html(f.help)}):m.bind(k,function(){$("div.help-container").html(f.help)});d==="mouseleave"?n.bind(d,function(){$("div.help-container").html(e.helpHtml)}):m.bind(d,function(){$("div.help-container").html(e.helpHtml)})})};this.reset=function(){this.cleanErrors();
this.cleanFields()};this.disableSendButton=function(){$("#"+e.id+" button[type=submit]").button({disabled:true})};this.enableSendButton=function(){$("#"+e.id+" button[type=submit]").button({disabled:false})};this.disableSendButtons=function(c){$("#"+e.id+" ."+c).button({disabled:true})};this.enableSendButtons=function(c){$("#"+e.id+" ."+c).button({disabled:false})};this.cleanErrors=function(){$.each(this.form,function(c){$("#"+c).parents("div.wrapper").removeClass("valid error").children("div.validation").html("&#160;")})};
this.cleanFields=function(){$.each(this.form,function(c){$("#"+c).val("")})};this.notNull=function(c,f){return f!==null&&f!==""};this.evaluate=function(c,f,h){return h.callback.call(e,c,f)};this.checked=function(c){switch(c.attr("type")){case "checkbox":return c.is(":checked");case "radio":return $("input[name="+c.attr("name")+"]:checked").length>0;default:return false}};this.number=function(c,f){return/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/i.test(f)};this.digits=function(c,f){return/^\d+$/i.test(f)};
this.enumeration=function(c,f,h){return f in h.elements};this.minLength=function(c,f,h){return f.length>=h.minLength};this.maxLength=function(c,f,h){return f.length<=h.maxLength};this.rangeLength=function(c,f,h){return f.length>=h.minLength&&f.length<=h.maxLength};this.minValue=function(c,f,h){return f>=h.minValue};this.maxValue=function(c,f,h){return f<=h.maxValue};this.rangeValue=function(c,f,h){return f>=h.minValue&&f<=h.maxValue};this.equalsTo=function(c,f,h){return f==h.comparation};this.notEqualsTo=
function(c,f,h){return f!=h.comparation};this.equalsToField=function(c,f,h){return f==$("#"+h.field).val()};this.email=function(c,f){return/^([A-Za-z0-9_\-\.\+])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/.test(f)};this.url=function(c,f){return/^(https?|ftp):\/\/(((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:)*@)?(((\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5])\.(\d|[1-9]\d|1\d\d|2[0-4]\d|25[0-5]))|((([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|\d|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.)+(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])*([a-z]|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])))\.?)(:\d*)?)(\/((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)+(\/(([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)*)*)?)?(\?((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|[\uE000-\uF8FF]|\/|\?)*)?(\#((([a-z]|\d|-|\.|_|~|[\u00A0-\uD7FF\uF900-\uFDCF\uFDF0-\uFFEF])|(%[\da-f]{2})|[!\$&'\(\)\*\+,;=]|:|@)|\/|\?)*)?$/i.test(f)};
this.password=function(c,f,h){if(h!==undefined&&h.orNull)if(f===""||f===null)return true;return($.browser.msie&&$.browser.version==7?/^(?=.{6,128}$)(?=.*\d)(?=.*[A-Za-z])(?!.*\s).*/i:/(?=.*\d)(?=.*[A-Za-z]).{6,128}/i).test(f)};this.telephone=function(c,f){return f!==null&&f.length>0?/^((\+?[1-9][0-9])|0) ?(6 ?-? ?[0-9\. ]{8,}|[1-9][0-9]{1,2} ?-? ?[0-9\. ]{7,}|[1-9]{2}[0-9] ?-? ?[0-9\. ]{6,})$/i.test(f):true};this.date=function(c,f){return!/Invalid|NaN/.test(new Date(f))};this.dependsOn=function(c,
f,h){var k=true;$.each(h.fields,function(d,g){c=$("#"+g);f=b(c);$.each(e.form[g].validation,function(j,m){if(m.name!=="dependsOn"&&e[m.name])e[m.name].call(e,c,f,m.params)||/notNull|checked/.test(m.name)||(k=false)})});return k};this.getErrors=function(){return e.errors}},AtlView=function(){this.container="";this.roles=[];this.components=[];this.componentSets=[];this.id="";this.componentMappings=[]};AtlView.prototype.componentSetMappings=[];
AtlView.prototype.addComponentSet=function(b){var e=b.componentMappings;for(var c in e)if(e.hasOwnProperty(c))this.componentSetMappings[c]=this.componentSets.length;this.componentSets.push(b)};AtlView.prototype.getComponentSetByUrl=function(b){b=this.componentSetMappings[b];if(b!==undefined)return this.componentSets[b];return null};AtlView.prototype.checkRoles=function(){if(this.roles.length>0)return atl.session.hasARole(this.roles);return true};
var AtlXMLPreloader=function(){var b=this;this.result=null;this.state=0;this.loadApplication=function(j){this.state++;$.get(j,null,this.parseApplicationXML)};this.parseApplicationXML=function(j){$(j).find("routes route").each(function(){var o=new AtlGlobalRoute;o.url=$(this).attr("url");o.method=$(this).attr("method");o.overlay=$(this).attr("overlay");o.forceDefaultSection=$(this).attr("forceDefaultSection")==="true";o.wizard=$(this).attr("wizard");if($(this).attr("roles"))o.roles=$(this).attr("roles").split(",");
atl.globalRouteManager.addGlobalRoute(o)});j=j.getElementsByTagName("section");for(var m=0,n=j.length;m<n;m++)e(j[m]);j=null;b.state++};var e=function(j){var m=new AtlSection;m.name=j.getAttribute("name");m.type=j.getAttribute("type");m.url=j.getAttribute("url");if(j.getAttribute("error"))m.error=j.getAttribute("error");if($(j).attr("roles"))m.roles=j.getAttribute("roles").split(",");if($(j).attr("rebuildOnRoleChange"))m.rebuildOnRoleChange=j.getAttribute("rebuildOnRoleChange")==="true";if($(j).attr("forceActiveUrl"))m.forceActiveUrl=
j.getAttribute("forceActiveUrl")==="true";j=j.getElementsByTagName("view");c(j,m);atl.sectionManager.addSection(m)},c=function(j,m){for(var n=0,o=j.length;n<o;n++)f(j[n],m)},f=function(j,m){var n=new AtlView;n.container=j.getAttribute("container");if($(j).attr("roles"))n.roles=j.getAttribute("roles").split(",");if($(j).attr("id"))n.id=j.getAttribute("id");var o=$(j).children("component");k(o,m,n);j=j.getElementsByTagName("component-set");o=0;for(var p=j.length;o<p;o++)h(j[o],n,m);m.views.push(n)},
h=function(j,m,n){if(j){var o=d(j.getAttribute("name"),"ComponentSet"),p={name:o.name,className:o.className,namespace:o.namespace,components:[],componentMappings:[],navigation:[],type:"dynamic"};if($(j).attr("type"))p.type=j.getAttribute("type");if($(j).attr("template"))p.template=j.getAttribute("template");if($(j).attr("title"))p.title=j.getAttribute("title");if($(j).attr("subtitle"))p.subtitle=j.getAttribute("subtitle");p.key=b.generateKey(p);o=j.getElementsByTagName("component");for(var s=0,r=
o.length;s<r;s++)g(o[s],s,p,n);$("navigation item",j).each(function(q){p.navigation[q]=$(this).attr("title")});m.addComponentSet(p)}},k=function(j,m,n){for(var o=0,p=j.length;o<p;o++)g(j[o],o,n,m)},d=function(j,m){m={name:j,className:m,namespace:""};if(j){if(j.indexOf(".")>0){var n=j.lastIndexOf(".");m.namespace=j.substr(0,n).replace(/\./g,"/")+"/";m.name=j=j.substr(n+1)}m.className=j.substr(0,1).toUpperCase()+j.substr(1)+m.className}return m},g=function(j,m,n,o){var p=d(j.getAttribute("name"),"Component");
m={className:p.className,namespace:p.namespace,name:p.name,type:"dynamic",routes:[],roles:[],roleTemplates:[],routeMappings:[],number:m+1,content:false};if($(j).attr("method"))m.executeMethodName=j.getAttribute("method");if($(j).attr("template"))m.template=j.getAttribute("template");if($(j).attr("title"))m.title=j.getAttribute("title");if($(j).attr("subtitle"))m.subtitle=j.getAttribute("subtitle");if($(j).attr("type"))m.type=j.getAttribute("type");if($(j).attr("columnSize"))m.columnSize=j.getAttribute("columnSize");
if($(j).attr("onshow"))m.executeOnShow=j.getAttribute("onshow")==="true";if($(j).attr("navigation"))m.navigation=j.getAttribute("navigation");if($(j).attr("id"))m.id=j.getAttribute("id");if($(j).attr("decoration"))m.decoration=j.getAttribute("decoration");if($(j).attr("roles"))m.roles=j.getAttribute("roles").split(",");if($(j).attr("roleTemplates"))m.roleTemplates=j.getAttribute("roleTemplates").split(",");if($(j).attr("content"))m.content=j.getAttribute("content")==="true";m.key=b.generateKey(m);
if(j=$(j).children("route")){p=0;for(var s=j.length;p<s;p++){var r=j[p],q=new AtlRoute;q.url=$(r).attr("url");q.method=$(r).attr("method");q.wizard=$(r).attr("wizard");q.flashView=$(r).attr("flashview");q.flashAction=$(r).attr("flashaction");q.overlay=$(r).attr("overlay");q.editwizard=$(r).attr("editwizard")==="true";if($(r).attr("roles"))q.roles=$(r).attr("roles").split(",");if($(r).attr("requiredParams"))q.requiredParams=$(r).attr("requiredParams").split(",");m.routeMappings[o.url+q.url]=m.routes.length;
m.routes.push(q);n.componentMappings[o.url+q.url]=n.components.length;o.urlMappings.push(o.url+q.url)}}n.components.push(m)};this.loadCopy=function(j){this.state++;j.load(function(){b.state++})};this.loadErrors=function(){this.state++;atl.errorHandler.loadErrors(function(){b.state++})};this.loadWizard=function(j){this.state++;var m=".xml";if(window.isIE6||window.isIE7)m+="?"+(new Date).getTime();$.get("./assets/xml/atl_wizard_"+j+m,null,this.parseWizard)};this.parseWizard=function(j){if(j=j.getElementsByTagName("wizard")[0]){var m=
j.getAttribute("name");b.initWizard(m,j)}};this.initWizard=function(j,m){j=new AtlWizard;for(var n=m.getElementsByTagName("component"),o=0,p=n.length;o<p;o++)g(n[o],o,j);o=m.getElementsByTagName("component-set");if(o.length>0){o=o[0];p=d(o.getAttribute("name"),"ComponentSet");var s={name:p.name,className:p.className,namespace:p.namespace,components:[],navigation:[]};if($(o).attr("template"))s.template=o.getAttribute("template");if($(o).attr("title"))s.title=o.getAttribute("title");if($(o).attr("subtitle"))s.subtitle=
o.getAttribute("subtitle");s.key=b.generateKey(s);n=o.getElementsByTagName("component");o=0;for(p=n.length;o<p;o++)g(n[o],o,s);$("navigation item",m).each(function(r){s.navigation[r]=$(this).attr("title")});j.componentSets.push(s)}b.result=j;b.state++};this.getState=function(){return b.state};this.generateKey=function(j){var m="";for(var n in j)if(typeof j[n]==="string")m+=j[n]+"_";return m.toLowerCase()+(new Date).getTime().toString(16)}},RemoteService=function(){this.loadJSON=function(b,e,c){this.afterLoadData=
c;$.ajax({type:"POST",data:b,url:e,jsonpCallbackString:c,dataType:"json",contentType:"application/json; charset=utf-8",success:this._ajaxSucceeded,error:this._ajaxFailed})};this.generateUrl=function(b){var e=atl.session.getCurrentTeamId();b=atl.config.serviceUrl+atl.config.url+"/"+b;if(e&&b.indexOf("TeamSiteId")<0){b+=b.indexOf("?")<0?"?":"&";b+="TeamSiteId="+e}return b};this.generateUrlRegistration=function(b){return atl.config.serviceUrl+atl.config.urlRegistration+"/"+b};this.generateUrlTeamlink=
function(b){return atl.config.serviceUrl+atl.config.urlTeamlink+"/"+b};this.generateUrlProfile=function(b){return atl.config.serviceUrl+atl.config.urlProfile+"/"+b};this.generateUrlStats=function(b){return atl.config.serviceUrl+atl.config.urlStats+"/"+b};this.generateUrlContact=function(b){return atl.config.serviceUrl+atl.config.urlContact+"/"+b};this.generateUrlAuthentication=function(b){return atl.config.serviceUrl+atl.config.urlAuthentication+"/"+b};this.generateUrlEvents=function(b){return atl.config.serviceUrl+
atl.config.urlEvents+"/"+b};this._ajaxSucceeded=function(b){b!==undefined&&b.d!==undefined&&b.d.Error!==undefined&&b.d.Error>0&&atl.errorHandler.jsonErrorHandler(b.d.Error);this.jsonpCallbackString(b)};this._ajaxFailed=function(){}},RemoteServiceFunctions=function(){var b=new RemoteService,e,c,f,h;this.getRegions=function(d){b.loadJSON('{"request":{}}',b.generateUrlRegistration("GetAvailableRegions"),d)};this.getCities=function(d,g){b.loadJSON('{"request":{"id":'+d+"}}",b.generateUrlRegistration("GetAvailableCities"),
g)};this.getClubs=function(d,g){b.loadJSON('{"request":{"id":'+d+"}}",b.generateUrlRegistration("GetAvailableClubs"),g)};this.getTeams=function(d,g,j){b.loadJSON('{"request":{"Id":"'+d+'", "IncludeDemo": "false"}}',b.generateUrlRegistration("GetAvailableTeams"),j)};this.getTeamlinks=function(d,g){b.loadJSON('{"request":{"Id":"'+d+'"}}',b.generateUrlRegistration("GetAvailableTeamSites"),g)};this.getAvailableTeams=function(d,g){b.loadJSON('{"request":{"Id":"'+d+'", "IncludeDemo": "false"}}',b.generateUrlRegistration("GetAvailableTeams"),
g)};this.search=function(d,g){b.loadJSON('{"request":{"Keyword":"'+d+'", "ClubsCount": "20", "TeamSitesCount" :"20" }}',b.generateUrlRegistration("search"),g)};this.searchClubOnly=function(d,g,j){g||(g=20);b.loadJSON('{"request":{"Keyword":"'+d+'", "ClubsCount": "'+g+'", "TeamSitesCount" :"0" }}',b.generateUrlRegistration("search"),j)};this.trackPage=function(d,g){var j="";j=d!==null?'{"request":{"TeamSiteId":"'+d+'", "Page":"0", "ClientAppId":"1"}}':'{"request":{"Page":"0", "ClientAppId":"1"}}';
b.loadJSON(j,b.generateUrlStats("TrackPage"),g)};this.getLoggedInUserInfo=function(d){e=d;b.loadJSON('{"request":{}}',b.generateUrlProfile("GetLoggedUserInfo"),d)};this.addTeamSiteToProfile=function(d,g,j){b.loadJSON('{"request":{"TeamSiteId":"'+d+'", "Role":'+g+"}}",b.generateUrlProfile("AddTeamSiteToProfile"),j)};this.removeTeamSiteFromProfile=function(d,g){b.loadJSON('{"request":{"Id":"'+d+'"}}',b.generateUrlProfile("RemoveTeamSiteFromProfile"),g)};this.createProfile=function(d,g){b.loadJSON('{"request":'+
d+"}",b.generateUrlProfile("CreateProfile"),g)};this.resendActivationEmail=function(d,g,j){d='{"request":{"Login":"'+d+'","Password":"'+g+'"}}';e=j;b.loadJSON(d,b.generateUrl("Login"),this.resendActivationEmailUserIdCallback)};this.resendActivationEmailUserIdCallback=function(d){b.loadJSON('{"request":{"Id":"'+d.d.Data.UserId+'"}}',b.generateUrlProfile("ResendActivationMail"),e)};this.activateProfile=function(d,g){json='{"request":{"Value":"'+d+'"}}';b.loadJSON(json,b.generateUrlProfile("ActivateProfile"),
g)};this.activatePlayer=function(d,g){b.loadJSON('{"request":{"Value":"'+d+'"}}',b.generateUrlProfile("ActivatePlayer"),g)};this.confirmPlayerInvitation=function(d,g){b.loadJSON('{"request":{"Id":"'+d+'"}}',b.generateUrl("ConfirmPlayerInvitation"),g)};this.finishPlayerInvitation=function(d,g){b.loadJSON('{"request":'+d+"}",b.generateUrl("FinishPlayerInvitation"),g)};this.getProfile=function(d){b.loadJSON('{"request":{}}',b.generateUrlProfile("GetProfile"),d)};this.updateProfile=function(d,g){b.loadJSON('{"request":'+
d+"}",b.generateUrlProfile("UpdateProfile"),g)};this.doContact=function(d,g){b.loadJSON('{"request":'+d+"}",b.generateUrlContact("SendContact"),g)};this.getGeneralStatistics=function(d){b.loadJSON('{"request":{}}',b.generateUrlStats("GetGeneralStatistics"),d)};this.getNewestTeamSites=function(d,g){b.loadJSON('{"request":{"id":'+d+" }}",b.generateUrlStats("GetNewestTeamSites"),g)};this.getTeamSiteMembersUsage=function(d,g,j){b.loadJSON('{"request" : {"Id":"'+d+'", "UserCount": "'+g+'"}}',b.generateUrlStats("GetTeamSiteMembersUsage"),
j)};this.getTeamSiteGoalsStatistics=function(d,g,j){b.loadJSON('{"request" : {"Id":"'+d+'", "UserCount": "'+g+'"}}',b.generateUrlStats("GetTeamSiteGoalsStatistics"),j)};this.doLogin=function(d,g,j){d='{"request":{"Login":"'+d+'","Password":"'+g+'"}}';e=j;b.loadJSON(d,b.generateUrl("Login"),this.doLoginReturn)};this.doLoginReturn=function(d){c={};c.ActiveUser=[];c.ActiveUser.IsAuthenticated=false;c.ActiveUser.UserId=0;c.ActiveUser.Error=0;c.ActiveUser.TeamSites=[];c.ActiveUser.TeamSitesAccess=[];c.ActiveUser.TeamSitesAuth=
[];if(d!==null&&d.d!==null&&d.d.Data!==null){c.ActiveUser.IsAuthenticated=d.d.Data.IsAuthenticated;c.ActiveUser.UserId=d.d.Data.UserId;c.ActiveUser.Error=d.d.Data.Error}e(c)};this.doLogout=function(d){e=d;b.loadJSON('{"request":{}}',b.generateUrl("Logout"),d)};this.isLoggedin=function(d){e=d;b.loadJSON('{"request":{}}',b.generateUrl("IsLoggedin"),d)};this.doForgotPassword=function(d,g){d='{"request":{"Value":"'+d+'"}}';e=g;b.loadJSON(d,b.generateUrl("ForgotPassword"),g)};this.doGetTeamsites=function(d,
g){e=g;if(c===undefined){c={};c.ActiveUser=[];if(f.id!==undefined){c.ActiveUser.UserId=f.id;c.ActiveUser.IsAuthenticated=true}}c.ActiveUser.TeamSites=[];c.ActiveUser.TeamSitesAccess=[];c.ActiveUser.TeamSitesAuth=[];if(c.ActiveUser.IsAuthenticated){json='{"request":{"Id": "'+c.ActiveUser.UserId+'"}}';b.loadJSON(json,b.generateUrl("GetActiveUserTeamSites"),k)}else e(c)};var k=function(d){$.each(d.d.Data.TeamSites,function(g,j){var m=c.ActiveUser.TeamSites.length;c.ActiveUser.TeamSites[m]=[];c.ActiveUser.TeamSitesAccess[m]=
[];$.each(j,function(n,o){if(n!=="__type")if(n==="Accessing")c.ActiveUser.TeamSites[m][n]=o;else{c.ActiveUser.TeamSites[m][n]=o.Value;c.ActiveUser.TeamSitesAccess[m][n]=o.Accessing}})});e(c)};this.getTeamSiteById=function(d,g){d='{"request":{"Id":"'+d+'"}}';e=g;b.loadJSON(d,b.generateUrlTeamlink("GetById"),e)};this.getTeamSiteByPath=function(d,g){d='{"request":{"Value":"'+d+'"}}';e=g;b.loadJSON(d,b.generateUrlTeamlink("GetByUrl"),e)};this.getTeamDevelopment=function(d,g){d='{"request":{"Id":"'+d+
'"}}';e=g;b.loadJSON(d,b.generateUrl("GetTeamDevelopment"),e)};this.userLoaded=function(d){atl.session.setUser(d);h&&h.call()};this.loadCurrentUser=function(d){h=d;atl.connection.isLoggedin(this.loadCurrentUserCallback)};this.loadCurrentProfile=function(d){if(d)h=undefined;atl.connection.getLoggedInUserInfo(this.loadCurrentUserInfo)};this.loadCurrentTeamSite=function(d,g){atl.connection.getTeamSiteById(d,function(j){atl.connection.loadCurrentTeamSiteCallback(j,g)})};this.loadCurrentTeamSiteByPath=
function(d,g){atl.connection.getTeamSiteByPath(d,function(j){atl.connection.loadCurrentTeamSiteCallback(j,g)})};this.setUserLoadedCallback=function(d){h=d};this.loadCurrentUserCallback=function(d){if(d!==null&&!d.d.Error)if(d.d.Data.IsAuthenticated){f={id:d.d.Data.UserId};if(atl.session.getUser()===null||atl.session.getUser().id!==f.id)atl.connection.loadCurrentProfile();else h&&h.call()}else{atl.session.clearCookies();atl.connection.userLoaded(null)}};this.loadCurrentUserInfo=function(d){if(!d.d.Error){d=
d.d.Data;var g={};g.FirstName=d.FirstName;g.MiddleName=d.MiddleName;g.LastName=d.LastName;g.MobilePhoneNumber=d.MobilePhoneNumber;g.Email=d.Email;g.Birthday=d.Birthday;g.Gender=d.Gender;g.NewsletterSubscribed=d.NewsletterSubscribed;g.Password=d.Password;g.SendWeeklyUpdates=d.SendWeeklyUpdates;var j=0,m=[],n=[],o=null,p=atl.session.getDefaultTeamId(),s=atl.session.getCurrentTeamId();$.each(d.TeamSites,function(r,q){j=m.length;m[j]=[];n[j]=[];$.each(q,function(t,u){if(t!=="__type")if(t==="Accessing"||
t==="TeamSiteRoles"||t==="TeamSiteStatus")m[j][t]=u;else{m[j][t]=u.Value;n[j][t]=u.Accessing;if(t==="Id"&&o===null)if(u.Value===s)o=j;else if(u.Value===p)o=j}})});f.fullName=g.FirstName+(g.MiddleName?" "+g.MiddleName+" ":" ")+g.LastName;f.profile=g;f.teamSites=m;f.teamSitesAccess=n;if(m.length>0){if(o===null)o=0;d=RolesHelper.parseRoles(m[o].TeamSiteRoles);atl.session.setCurrentRoles(d,false)}else atl.session.setCurrentRoles([],false);atl.session.setTeamlinksSize(f.teamSites.length);atl.connection.userLoaded(f)}};
this.loadCurrentTeamSiteCallback=function(d,g){d=d.d.Data;if(d!==null){var j={};j=d.Info;j.Stats=d.Stats;atl.session.setCurrentTeamSite(j,false)}else atl.session.setCurrentTeamSite(null,false);atl.notify("teamsite_loaded");g&&g.call()};this.doCreate=function(d,g,j){b.loadJSON('{"request":{"TeamId":"'+d+'", "TeamSiteName": "'+g+'", "InvitedMembers":[] }}',b.generateUrlTeamlink("Create"),j)};this.sendInvitationList=function(d,g,j){for(var m="[",n=0;n<g.length;n++){if(n>0)m+=",";m+='{"FirstName": "'+
g[n].FirstName+'","MiddleName":null,"LastName":null,"Email":"'+g[n].Email+'","TeamSiteRole": "2"}'}m+="]";b.loadJSON('{"request":{"TeamSiteId":"'+d+'", "InvitedMembers":'+m+"}}",b.generateUrlTeamlink("SendInvitationList"),j)};this.doGetBadges=function(d,g){b.loadJSON('{"request":{"Id":"'+d+'"}}',b.generateUrlTeamlink("GetBadges"),g)};this.doAutoLogin=function(d,g,j,m){b.loadJSON('{"request":{"SsoId":"'+d+'", "Login": "'+g+'", "Password": "'+j+'"}}',b.generateUrlAuthentication("AutoLogin"),m)};this.getSeasons=
function(d,g){b.loadJSON('{"request":{"Id":"'+d+'"}}',b.generateUrlTeamlink("GetSeasons"),g)};this.changeKNVBTeam=function(d,g,j){b.loadJSON('{"request":{"TeamSiteId":"'+d+'", "TeamId":"'+g+'" }}',b.generateUrlTeamlink("ChangeKNVBTeam"),j)};this.getProposedTeam=function(d,g){b.loadJSON('{"request":{"Id":"'+d+'"}}',b.generateUrlRegistration("GetProposedTeam"),g)};this.setTeamStatus=function(d,g,j){b.loadJSON('{"request":{"Status":"'+g+'", "Id":"'+d+'" }}',b.generateUrlTeamlink("SetStatus"),j)};this.getTeamSiteSettings=
function(d,g){b.loadJSON('{"request":{"Id":"'+d+'"}}',b.generateUrl("GetTeamSiteSettings"),g)};this.updateTeamSiteSettings=function(d,g){b.loadJSON('{"request":'+d+"}",b.generateUrl("UpdateTeamSiteSettings"),g)};this.updateTeamMemberInfo=function(d,g,j){b.loadJSON('{"request": {"MemberStatus": "'+g+'", "TeamSiteUserId": "'+d+'"}}',b.generateUrlProfile("UpdateTeamMemberInfo"),j)};this.updateTeamSiteNameAndDescription=function(d,g){b.loadJSON('{"request":'+d+"}",b.generateUrl("UpdateTeamSite"),g)};
this.getTeamSiteImages=function(d,g){b.loadJSON('{"request" : {"Id":"'+d+'"}}',b.generateUrl("GetTeamSiteImages"),g)};this.getTeamSiteProfile=function(d,g){b.loadJSON('{"request" : {"Id":"'+d+'"}}',b.generateUrlProfile("GetTeamSiteProfile"),g)};this.updateTeamSiteProfile=function(d,g){b.loadJSON('{"request":'+d+"}",b.generateUrlProfile("UpdateTeamSiteProfile"),g)};this.getPlayerPositions=function(d){b.loadJSON("{}",b.generateUrl("GetListFootballPosition"),d)};this.SaveProfileImage=function(d,g,j){if(g.error===
0){var m='{"ImageId": "'+g.result.ImageId+'", ';m+='"RelatedId":"'+d+'", ';m+='"MainImage": '+objectToJSON(g.result.MainImage)+",";m+='"ThumbImage":'+objectToJSON(g.result.ThumbImage)+",";m+='"ReplaceOriginal": "true",';m+='"RelatedType": 2';m+="}";b.loadJSON('{"request":'+m+"}",b.generateUrl("UpdateTeamSiteUserImages"),j)}else j.call()};this.SaveTeamlinkImage=function(d,g,j){if(g.error===0){var m='{"ImageId": "'+g.result.ImageId+'", ';m+='"RelatedId":"'+d+'", ';m+='"MainImage": '+objectToJSON(g.result.MainImage)+
",";m+='"ThumbImage":'+objectToJSON(g.result.ThumbImage)+",";m+='"ReplaceOriginal": "true",';m+='"RelatedType": 3';m+="}";b.loadJSON('{"request":'+m+"}",b.generateUrl("UpdateTeamSiteImages"),j)}else j.call()};this.getChangesSinceLastLogin=function(d,g){d=b.generateUrl("GetChangesSinceLastLogin");b.loadJSON("{}",d,g)};this.getTeamSiteMembersUsage=function(d,g,j){b.loadJSON('{"request" : {"Id":"'+d+'", "UserCount": "'+g+'"}}',b.generateUrlStats("GetTeamSiteMembersUsage"),j)};this.getTeamSiteGoalsStatistics=
function(d,g,j){b.loadJSON('{"request" : {"Id":"'+d+'", "UserCount": "'+g+'"}}',b.generateUrlStats("GetTeamSiteGoalsStatistics"),j)};this.getPhotoFolderBriefs=function(d,g,j,m){g=g||25;j=j||0;b.loadJSON('{"request" : {"TeamSiteId":"'+d+'","FoldersPerPage":"'+g+'","PageNumber":"'+j+'"}}',b.generateUrl("getPhotoFolderBriefs"),m)};this.getFolderInfo=function(d,g){b.loadJSON('{"request" : {"Id":"'+d+'"}}',b.generateUrl("getFolderInfo"),g)};this.addNewPhotoFolderInfo=function(d,g){b.loadJSON('{"request": {"Title": "'+
d.Title+'", "EventId": "'+d.EventId+'", "TeamSiteId": "'+d.TeamSiteId+'", "VisibleTo": "'+d.VisibleTo+'"}}',b.generateUrl("AddNewPhotoFolderInfo"),g)};this.updatePhotoFolder=function(d,g){b.loadJSON('{"request": {"Id": "'+d.Id+'", "Title": "'+d.Title+'", "EventId": "'+d.EventId+'", "TeamSiteId": "'+d.TeamSiteId+'", "VisibleTo": '+d.VisibleTo+"}}",b.generateUrl("UpdatePhotoFolder"),g)};this.getEventsWithNoPhotoFolder=function(d,g){b.loadJSON('{"request": {"Id": "'+d+'"}}',b.generateUrl("GetEventsWithNoPhotoFolder"),
g)};this.deletePhotoFolder=function(d,g){b.loadJSON('{"request": {"Id": "'+d+'"}}',b.generateUrl("DeletePhotoFolder"),g)};this.editPhoto=function(d,g,j){b.loadJSON('{"request": {"Identifier": "'+d+'", "Value": "'+g+'"}}',b.generateUrl("EditPhoto"),j)};this.deletePhoto=function(d,g){b.loadJSON('{"request": {"Id": "'+d+'" }}',b.generateUrl("DeletePhoto"),g)};this.getTeamSitePlayersSupporters=function(d,g,j){d='{"request": {"Id": "'+d+'" }}';switch(g){case "leden":b.loadJSON(d,b.generateUrl("GetTeamSitePlayers"),
j);break;case "supporters":b.loadJSON(d,b.generateUrl("GetTeamSiteSupporters"),j);break}};this.getTeamSitePlayers=function(d,g){b.loadJSON('{"request": {"Id": "'+d+'" }}',b.generateUrl("GetTeamSitePlayers"),g)};this.getTeamSiteSupporters=function(d,g){b.loadJSON('{"request": {"Id": "'+d+'" }}',b.generateUrl("GetTeamSiteSupporters"),g)};this.removeTeamSiteUser=function(d,g,j){b.loadJSON('{"request": {"Id": "'+d+'" }}',b.generateUrl("RemoveTeamSiteUser"),j)};this.updateTeamSiteUserFullInfo=function(d,
g,j){b.loadJSON('{"request":'+g+"}",b.generateUrl("UpdateTeamSiteUserFullInfo"),j)};this.getUserFullInfo=function(d,g,j){b.loadJSON('{"request": {"Id": "'+d+'" }}',b.generateUrl("GetUserFullInfo"),j)};this.getPlayerSettings=function(d,g,j){b.loadJSON('{"request": {"Id": "'+d+'" }}',b.generateUrl("GetPlayerSettings"),j)};this.getSupporterSettings=function(d,g,j){b.loadJSON('{"request": {"Id": "'+d+'" }}',b.generateUrl("GetSupporterSettings"),j)};this.updatePlayerSettings=function(d,g,j){b.loadJSON('{"request": '+
d+"}",b.generateUrl("UpdatePlayerSettings"),j)};this.updateSupporterSettings=function(d,g,j){b.loadJSON('{"request": '+d+"}",b.generateUrl("UpdateSupporterSettings"),j)};this.getEventType=function(d,g){b.loadJSON('{"request": {"Id": "'+d+'"}}',b.generateUrlEvents("GetEventType"),g)};this.createEventActivity=function(d,g){b.loadJSON('{"request":'+d+"}",b.generateUrlEvents("CreateGeneralEvent"),g)};this.updateEventActivity=function(d,g){b.loadJSON('{"request":'+d+"}",b.generateUrlEvents("UpdateGeneralEvent"),
g)};this.getEventActivity=function(d,g){b.loadJSON('{"request" : {"Id":"'+d+'"}}',b.generateUrlEvents("GetTeamSiteGeneralEventFullInfo"),g)};this.getMatchEventActivity=function(d,g){b.loadJSON('{"request" : {"Id":"'+d+'"}}',b.generateUrl("GetTeamSiteMatchEventFullInfo"),g)};this.getGeneralEventParticipants=function(d,g){b.loadJSON('{"request" : {"Id":"'+d+'"}}',b.generateUrl("GetTeamSiteGeneralEventParticipants"),g)};this.getMatchEventParticipants=function(d,g){b.loadJSON('{"request" : {"Id":"'+d+
'"}}',b.generateUrl("GetTeamSiteMatchEventParticipants"),g)};this.updateEventActivityParticipants=function(d,g,j){b.loadJSON('{"request": {"Id": "'+d+'", "Participants": '+g+"}}",b.generateUrl("UpdateTeamSiteGeneralEventParticipants"),j)};this.updateMatchEventParticipants=function(d,g,j){b.loadJSON('{"request": {"Id": "'+d+'", "Participants": '+g+"}}",b.generateUrl("UpdateTeamSiteMatchEventParticipants"),j)};this.confirmEventActivitySubsciption=function(d,g,j){b.loadJSON('{"request": {"Id": "'+d+
'", "Participants": '+g+"}}",b.generateUrl("ConfirmGeneralEventSubsciption"),j)};this.confirmMatchEventSubsciption=function(d,g,j){b.loadJSON('{"request": {"Id": "'+d+'", "Participants": '+g+"}}",b.generateUrl("ConfirmMatchEventSubsciption"),j)};this.getMatchEventReport=function(d,g){b.loadJSON('{"request" : {"Id":"'+d+'"}}',b.generateUrl("GetTeamSiteMatchEventSummary"),g)};this.updateMatchEventReport=function(d,g){b.loadJSON('{"request" : '+d+"}",b.generateUrl("UpdateTeamSiteMatchEventSummary"),
g)};this.updateMatchEventMeetingBefore=function(d,g,j){b.loadJSON('{"request" : {"Identifier":"'+d+'", "Value":"'+g+'"}}',b.generateUrl("UpdateMatchEventMeetingBefore"),j)};this.getMatchEventGoals=function(d,g){b.loadJSON('{"request" : {"Id":"'+d+'"}}',b.generateUrl("GetTeamSiteMatchEventGoals"),g)};this.updateMatchEventGoals=function(d,g){b.loadJSON('{"request": '+d+"}",b.generateUrl("UpdateTeamSiteMatchEventGoals"),g)};this.removeTeamSiteGeneralEvent=function(d,g,j){b.loadJSON('{"request": {"Id": "'+
d+'"}}',b.generateUrl("RemoveTeamSiteGeneralEvent"),j)};this.activateNewUserLogin=function(d,g,j){b.loadJSON('{"request": {"Value": "'+d+'"}}',b.generateUrl("ActivateNewUserLogin"),j)}},enableSelect=function(b){b=$("#"+b);b.attr("disabled",false);$.uniform&&$.uniform.update&&$.uniform.update(b)},updateSelect=function(b){b=$("#"+b);$.uniform&&$.uniform.update&&$.uniform.update(b)},disableSelect=function(b){b=$("#"+b);b.attr("disabled",true);$.uniform&&$.uniform&&$.uniform.update&&$.uniform.update(b)},
fillSelect=function(b,e,c){b=$("#"+b);b.append('<option value="'+e+'">'+c+"</option>");$.uniform&&$.uniform.update&&$.uniform.update(b)},autoFill=function(b,e){$(b).focus();$(b).val(e);$(b).blur()},objectToJSON=function(b){var e="{ ";for(var c in b)if(b.hasOwnProperty(c)){e+='"'+c+'": ';if(typeof b[c]==="object")b[c]=objectToJSON(b[c]);else e+=b[c]===true||b[c]===false?b[c]:'"'+b[c]+'"';e+=", "}return e.substring(0,e.length-2)+" }"},stringToDate=function(b){if(b!==undefined&&b!==null){var e=new Date;
b=b.substring(6,b.length-2);e.setTime(b);return e}return null},dateToString=function(b){return b.getMonth()+1+"/"+b.getDate()+"/"+b.getFullYear()},checkDate=function(b,e,c,f){if(e!==b.getFullYear().toString())return false;if(f!==b.getDate().toString())return false;if(c!==(b.getMonth()+1).toString())return false;return true},leadingZeros=function(b){for(;b.length<2;)b="0"+b;return b},clearSelect=function(b,e){b=$("#"+b);b.attr("disabled",true);b.children().remove();if(e===undefined)e="";e!==false&&
b.html("<option value=-1>"+e+"</option>");$.uniform.update&&$.uniform.update(b)},styleCheckboxes=function(b){$(b).find("input").each(function(){$(this).is(":checkbox")&&$(this).iToggle({onClick:function(){var e=$(this).attr("for");$("#"+e).change()},onClickOn:function(){},onClickOff:function(){}})})};function addCommas(b){b+="";x=b.split(".");x1=x[0];x2=x.length>1?"."+x[1]:"";for(b=/(\d+)(\d{3})/;b.test(x1);)x1=x1.replace(b,"$1,$2");return x1+x2}
function addPoints(b){b+="";x=b.split(".");x1=x[0];x2=x.length>1?"."+x[1]:"";for(b=/(\d+)(\d{3})/;b.test(x1);)x1=x1.replace(b,"$1.$2");return x1+x2}
var decorateButtons=function(){$("button, .button-container a, a.button").button({icons:{primary:"ui-icon-forward"}});$("button.ui-button-active, a.ui-button-active").button({icons:{primary:"ui-icon-active"}});$("button.ui-button-back, a.ui-button-back").button({icons:{primary:"ui-icon-back"}});$("button.ui-button-delete, a.ui-button-delete").button({icons:{primary:"ui-icon-delete"}});$("#header-search button").button({text:false,icons:{primary:"ui-icon-search"}});$("#team-user-list-container button").button({text:false});
$("#team-user-list-container button.ui-button-delete").button({});$("#match-standings-add-player").button({text:false,icons:{primary:"ui-icon-add"}});$("a#teamlink-mobile-link").button({icons:{primary:"ui-icon-next"}}).next().button({icons:{primary:"ui-icon-hyves"},text:false}).next().button({icons:{primary:"ui-icon-embed"},text:false}).next().button({icons:{primary:"ui-icon-twitter"},text:false});$("#registration-add-members-header a.button").button({});$("#teamlink-select-table tbody a.button").button({icons:{primary:"ui-icon-delete"},
text:false});$("#teamlink-select-table thead a.button").button({icons:{primary:"ui-icon-add"},text:false})};
function fillDateSelects(b,e,c,f,h){f=f||(new Date).getFullYear();var k=["Jan","Feb","Mar","Apr","Mei","Jun","Jul","Aug","Sep","Okt","Nov","Dec"];if(h)k=["Januari","Februari","Maart","April","Mei","Juni","Juli","Augustus","September","Oktober","November","December"];$("#"+b).uniform();$("#"+e).uniform();$("#"+c).uniform();clearSelect(b,"Dag");clearSelect(e,"Maand");clearSelect(c,"Jaar");h=ArrayHelper.range(1,31,1);var d,g;g=0;for(d=h.length;g<d;++g)fillSelect(b,h[g],h[g]);h=ArrayHelper.range(1,12,
1);g=0;for(d=h.length;g<d;++g)fillSelect(e,h[g],k[g]);h=ArrayHelper.range(f,1920,1);g=0;for(d=h.length;g<d;++g)fillSelect(c,h[g],h[g]);enableSelect(b);enableSelect(e);enableSelect(c)}var getUserName=function(b){var e=" ";if(b.MiddleName!==null&&b.MiddleName!==undefined&&b.MiddleName.Value!==null&&b.MiddleName.Value!==undefined&&b.MiddleName.Value.length>0)e=" "+b.MiddleName.Value+" ";return b.FirstName.Value+e+b.LastName.Value};
(function(b){b.GlobalRouteFunctions=new (function(){function e(){atl.connection.loadCurrentProfile(true);setTimeout(function(){atl.dialog("Je emailadres is bijgewerkt.",{Ok:function(){$(this).dialog("close");$.address.value("/team/wijzig/profiel")}})},2E3)}function c(k){var d=(new AutoLoginPaths).determinePath(k);atl.connection.loadCurrentUser(function(){atl.session.getCurrentTeamId()!==null?atl.connection.loadCurrentTeamSite(atl.session.getCurrentTeamId(),function(){atl.setUrl(d)}):atl.setUrl(d)})}
function f(){atl.connection.loadCurrentUser(function(){AtlStateManager.activeSection!==null&&AtlStateManager.activeSection.url===atl.sectionManager.getDefaultSectionUrl()?window.location.reload(true):atl.setUrl(atl.sectionManager.getDefaultSectionUrl())})}function h(){atl.dialog("Speler is successvol ge-activeerd.",{Ok:function(){$(this).dialog("close");$.address.value("/home")}})}this.autoLogin=function(){var k=$.address.pathNames(),d=null,g=0;if(k[1]!==undefined)d=k[1];if(k[2]!==undefined)g=k[2];
d!==null&&g!=1?atl.connection.doAutoLogin(d,null,null,c):atl.setUrl("/login")};this.logout=function(){atl.session.clearCookies();atl.session.setCurrentTeamId(null,false);atl.session.setCurrentTeamSite(null,false);atl.session.setCurrentRoles([],false);atl.connection.doLogout(f)};this.confirmEmail=function(){var k=$.address.pathNames(),d=null;if(k[2]!==undefined)d=k[2];d!==null?atl.connection.activateNewUserLogin(d,atl.session.getCurrentTeamId(),e):atl.setUrl("/error/404")};this.activatePlayer=function(){var k=
$.address.pathNames(),d=null;if(k[2]!==undefined)d=k[2];d!==null?atl.connection.activatePlayer(d,h):atl.setUrl("/error/404")};this.embedCode=function(){var k=atl.config.flashCommunicatorUrl;k=k.substr(0,k.indexOf("/Content"));k+="/index.widget?teamId="+atl.session.getCurrentTeamId();k='<iframe src="'+k+'" name="teamlink" scrolling="no" frameborder="no" align="center" height="500px" width="256px"></iframe>';k=StringHelper.htmlentities(k);atl.dialog(k,{Sluiten:function(){$(this).dialog("close");$.address.value("/team/home")}},
"Zet je Teamlink als widget op je eigen website. Kopieer onderstaande code en plak deze in de HTML van je website.","textarea").find("textarea").select()}})})(window);
var AutoLoginPaths=function(){this.determinePath=function(b){if(b.d.Error)return"/login";else{var e=b.d.Data.Action,c="",f=null,h=null;if(b.d.Data.IsAuthenticated){c=b.d.Data.TeamSiteId;atl.session.setCurrentTeamId(c);atl.session.setDefaultTeamId(c);switch(e){case "ShowPlanner":c="/team/wijzig/planner";break;case "ShowMatchEvent":f=b.d.Data.ParamData[0];c="/team/wijzig/planner/wedstrijd";break;case "ConfirmMatchEvent":f=b.d.Data.ParamData[0];c="/team/wijzig/planner/wedstrijd/deelnemers/bewerken";
break;case "ShowMatchEventParticipants":f=b.d.Data.ParamData[0];c="/team/wijzig/planner/wedstrijd/deelnemers";break;case "ShowManOfTheMatch":f=b.d.Data.ParamData[0];c="/team/wijzig/planner/wedstrijd/motm";break;case "ShowMatchReport":f=b.d.Data.ParamData[0];c="/team/wijzig/planner/wedstrijd/verslag";break;case "ShowSocialEvent":f=b.d.Data.ParamData[0];c="/team/wijzig/planner/activiteit";break;case "ConfirmSocialEvent":f=b.d.Data.ParamData[0];c="/team/wijzig/planner/activiteit/deelnemers";break;case "ShowSocialEventParticipants":f=
b.d.Data.ParamData[0];c="/team/wijzig/planner/activiteit/deelnemers";break;case "ShowTeam":c="/team/home";break;case "ShowSupporters":c="/team/wijzig/team/supporters";break;case "ShowPlayers":c="/team/wijzig/team/leden";break;case "ShowPhotos":c="/team/wijzig/fotos";break;case "ShowAlbum":h=b.d.Data.ParamData[0];f=b.d.Data.ParamData[1];c="/team/wijzig/fotos/album";break;case "ShowPhoto":h=b.d.Data.ParamData[0];f=b.d.Data.ParamData[1];c="/team/wijzig/fotos/detail";break;case "ShowStanding":c="/team/wijzig/stand";
break;case "ShowMessageBoard":c="/team/wijzig/prikbord";break;case "ActivatePlayer":c="/activeer/speler/"+b.d.Data.ParamData[0];break;case "ChangeEmail":c="/bevestig/email/"+b.d.Data.ParamData[0];break;default:c="/team/home";break}}else if(e=="RegisterInvitedUser"){atl.session.setProperty("register_user_id",b.d.Data.ParamData[0]);c="/wizard/registreren/uitnodiging"}else c="/login";c+="?confirm=0";if(h!==null)c+="&id="+h;if(f!==null)c+="&eventId="+f;return c}}},StringHelper={ucfirst:function(b){return b.charAt(0).toUpperCase()+
b.substr(1)},leadingZero:function(b,e){b=b.toString();var c="";if(e>b.length)for(i=0;i<e-b.length;i++)c+="0";return c+b.toString()},removeNL:function(b){for(var e="",c=0;c<b.length;c++)if(b.charAt(c)!="\n"&&b.charAt(c)!="\r"&&b.charAt(c)!="\t")e+=b.charAt(c);return e},htmlentities:function(b){return b.replace(/&/gmi,"&amp;").replace(/"/gmi,"&quot;").replace(/>/gmi,"&gt;").replace(/</gmi,"&lt;")},replaceElementVars:function(b,e){if(e!==null){e.dot=".";e.comma=",";var c=$(b).html().match(/\%(.*?)\%/gi);
if(c!==null){for(var f=$(b).html(),h=0,k=c.length;h<k;h++){var d=c[h],g=d.substr(1,d.length-2),j=e[g];if(g.indexOf(".")>-1){g=g.split(".");j=e[g[0]];for(var m=1,n=g.length;m<n;m++)if(j)j=j[g[m]]}if(j)f=f.replace(d,j)}$(b).html(f)}}}},TableGrid=function(b,e){var c=this;c.options=$.extend({columns:[],display_heading:false,data:[],mapping:[],hover:{over:function(){$(this).addClass("tr-hover")},out:function(){$(this).removeClass("tr-hover")}},selected_class:"selected"},b);c.table=e;c.displayed=false;
c.currentSelectedRow=-1;this.createTableWrapper=function(f){if(f===undefined||f===null)f="";c.table.html("");f=$('<table id="'+f+'"></table>');c.table=f.appendTo(c.table)};this.renderTable=function(){c.table.html("");c.options.columns.length>0&&c.options.display_heading&&c._renderHeading();c._renderBody();c.options.hover&&c.table.find("tbody tr").hover(c.options.hover.over,c.options.hover.out);this.displayed=true;c._renderScroll()};this.setColumns=function(f){c._mergeOptions({columns:f});c.displayed&&
c.renderTable();return c};this.displayHeading=function(f){c._mergeOptions({display_heading:f});return c};this.setData=function(f){c._mergeOptions({data:f});c.displayed&&c.renderTable();return c};this.setDataMapping=function(f){c._mergeOptions({mapping:f});c.displayed&&c.renderTable();return c};this.setHoverMethods=function(f,h){c._mergeOptions({hover:{over:f,out:h}});return c};this.setTable=function(f){c.table=f;return c};this._renderHeading=function(){for(var f=$("<thead><tr></tr></thead>"),h=0,
k=c.options.columns.length;h<k;++h){var d=c.options.columns[h].class_name?c.options.columns[h].class_name:"";f.find("tr").append('<td class="'+d+'"><div>'+c.options.columns[h].title+"</div></td>")}f.appendTo(c.table)};this._renderBody=function(){for(var f=$("<tbody></tbody>"),h=0,k=c.options.data.length;h<k;++h){var d=$("<tr></tr>").appendTo(f),g;if(c.options.mapping.length>0){g=0;for(l=c.options.mapping.length;g<l;++g){d.append(c._renderRow(c._getMappedValue(c.options.data[h],c.options.mapping[g]),
c.options.columns[g],h,g));if(c.options.columns[g]&&c.options.columns[g].type==="leading"){d.data("table_grid",{value:c._getMappedValue(c.options.data[h],c.options.mapping[g])});d.data("table_grid",{id:h});d.click(c._onRowClicked)}}}else for(g in options.data[h])if(options.data[h].hasOwnProperty(g)){d.append(c._renderRow(c.options.data[h][g],c.options.columns[g].type,h,g));if(c.options.columns[g].type=="leading"){d.data("table_grid",{value:c.options.data[h][g]});d.data("table_grid",{id:h});d.click(c._onRowClicked)}}}f.appendTo(c.table)};
this.onRowClicked=function(){};this._renderRow=function(f,h,k,d){h=$.extend({type:"plain"},h);var g=h.class_name?h.class_name:"";return'<td class="'+g+'"><div>'+c["_render_"+h.type](f,h,k,d)+"</div></td>"};this._render_plain=function(f){return f};this._render_checkbox=function(f,h,k){return'<input type="checkbox" id="'+h.name+k+'" name="'+h.name+"["+k+']" '+(f===1||f===2?"checked":"")+" />"};this._render_radiogroup=function(f,h,k,d){return'<input type="radio" name="'+h.name+k+'" value="'+(d-1)+'" '+
(f!==undefined&&(f===1||f===2)?'checked="checked"':"")+(f!==undefined&&(f===2||f===3)?'disabled="disabled"':"")+" />"};this._render_text=function(f,h,k){return'<input type="text" name="'+h.name+k+'" value="'+f+'" />'};this._render_leading=function(f,h,k,d){return c._render_plain(f,h,k,d)};this._renderScroll=function(){try{c.table.parents(".scroll-pane").jScrollPane({showArrows:true,arrowSize:5,scrollbarWidth:9,scrollbarMargin:0})}catch(f){}};this._getMappedValue=function(f,h){h=h.split(".");return h.length>
1?c._getMappedValue(f[h[0]],h.slice(1).join(".")):f[h[0]]};this._mergeOptions=function(f){c.options=$.extend(c.options,f)};this._onRowClicked=function(f){c.currentSelectedRow=$(f.currentTarget).data("table_grid").id;c.table.find("tr").removeClass(c.options.selected_class);c.onRowClicked($(f.currentTarget).data("table_grid").value)!==false&&$(f.currentTarget).addClass(c.options.selected_class)}},Url={encode:function(b){return escape(this._utf8_encode(b))},_utf8_encode:function(b){b=b.replace(/\r\n/g,
"\n");for(var e="",c=0;c<b.length;c++){var f=b.charCodeAt(c);if(f<128)e+=String.fromCharCode(f);else{if(f>127&&f<2048)e+=String.fromCharCode(f>>6|192);else{e+=String.fromCharCode(f>>12|224);e+=String.fromCharCode(f>>6&63|128)}e+=String.fromCharCode(f&63|128)}}return e},decode:function(b){b=b;for(var e,c=/(%[^%]{2})/;(match=c.exec(b))!==null&&match.length>1&&match[1]!="";){e=parseInt(match[1].substr(1),16);e=String.fromCharCode(e);b=b.replace(match[1],e)}return b}},UrlHelper={getFlashVars:function(){var b=
this.parseUrlParameters(window.location.href.slice(window.location.href.indexOf("?")+1));if(b.flashVars!==undefined)return this.parseUrlParameters(Url.decode(b.flashVars))},parseUrlParameters:function(b){for(var e=[],c=b.split("&"),f=0;f<c.length;f++){b=c[f].split("=");e.push(b[0]);e[b[0]]=b[1]}return e}},SectionValidator={checkRoles:function(b){return atl.session.hasARole(b.section.roles)}},ComponentValidator={validate:function(b){if(b===null)return b;else if(!this.checkRoles(b))return b=null;return b},
checkRoles:function(b){return atl.session.hasARole(b.roles)}},RolesHelper={determineRolesFromTeamSites:function(b,e){if(b!==undefined&&b!==null)for(var c=0;c<e.length;c++)if(b==e[c].Id)return this.parseRoles(e[c].TeamSiteRoles);return[]},parseRoles:function(b){var e=[];if(b!==undefined&&b!==null)for(var c=0;c<b.length;c++)e.push(b[c].Name);return e}},GlobalSearch=function(){function b(f){var h="";if(!(e.searchValue.length<2))if(e.lastSearchValue===e.searchValue){if($("#search-result-container").length===
0)h=$('<div class="dropdown-container" id="search-result-container"><div class="dropdown-result" id="search-results"><ul id="search-results-teams"></ul><ul id="search-results-clubs"></ul></div></div>').appendTo("#header-controls").hide();$("#search-results ul").empty();$.each(f.d.Data.TeamSites,function(k,d){k=d.Url.indexOf("teamlinks/")+10;k="#/rotw/"+d.Url.substring(k);$("#search-results-teams").append('<li><a href="'+encodeURI(k)+'">'+d.Name+"<span> "+d.CityInfo.Name+" &#8226; "+d.PlayersCount+
" Speler"+(d.PlayersCount!==1?"s":"")+"</span></a></li>")});$.each(f.d.Data.Clubs,function(k,d){k="http://"+Url.encode(d.Url.substr(7));$("#search-results-clubs").append('<li><a href="'+k+'">'+d.Name+"<span> "+d.CityInfo.Name+"</span></a></li>")});$("#search-result-container").slideDown(125)}}var e=this,c=null;this.lastSearchValue=this.searchValue=this.searchFieldId=this.searchId="";this.seachCompleteTimeout=150;this.init=function(f,h){var k=$("#"+h);k.attr("autocomplete","off");this.searchId=f;this.searchFieldId=
h;$("#"+f).bind("submit click",function(d){d.preventDefault();e.searchValue=k.val();e.search(e.searchValue);clearTimeout(c);return false});this.autoComplete();this.closeOnOutsideClick();k.val("Vind een Teamlink").addClass("default_value");k.bind({keyup:function(){e.searchValue=k.val();clearTimeout(c);e.autoComplete()},focus:function(){k.hasClass("default_value")&&k.val("").removeClass("default_value")},blur:function(){k.val()===""&&k.val("Vind een Teamlink").addClass("default_value")}})};this.autoComplete=
function(){$(".dropdown-container").not("##search-result-container").hide();if(this.searchValue.length>0)c=setTimeout(function(){e.search(e.searchValue)},e.seachCompleteTimeout);else e.remove()};this.closeOnOutsideClick=function(){$(document).click(function(f){if(!$(f.target).parents().is("#"+e.searchId)){$("#search-result-container").slideUp(125);$("#"+e.searchFieldId).val("Vind een Teamlink").addClass("default_value")}})};this.remove=function(){$("#search-result-container").fadeOut(125)};this.search=
function(f){if(f.length>1){e.lastSearchValue=e.searchValue;atl.connection.search(f,b)}}},GlobalTeamSelect=function(){var b=this;this.teamSelectId="";this.overlayTimeout=1E3;this.init=function(e){this.teamSelectId=e;$("#"+e).bind("click",function(c){c.preventDefault();c=atl.session.getUser();if(c===null)$.address.value("/login");else if(c.teamSites.length===1){c=c.teamSites[0];var f=c.Url.indexOf("teamlinks/")+10;f="/rotw/"+Url.encode(c.Url).substring(f);atl.session.setCurrentTeamId(c.Id);$.address.value(f)}else c.teamSites.length>
1&&b.showSelectOverlay();return false});this.closeOnOutsideClick()};this.closeOnOutsideClick=function(){$(document).click(function(e){$(e.target).parents().is("#"+b.teamSelectId)||$("#teams-select-container").slideUp(125)})};this.showSelectOverlay=function(){$(".dropdown-container").not("#teams-select-container").hide();$("#teams-select-container").length===0&&$('<div class="dropdown-container" id="teams-select-container"><div class="dropdown-result" id="teams-select"><ul></ul></div></div>').appendTo("#header-controls").hide();
$("#teams-select ul").empty();var e=atl.session.getUser();e!==null&&$.each(e.teamSites,function(c,f){c=f.Url.indexOf("teamlinks/")+10;c="#/rotw/"+f.Url.substring(c);$("#teams-select ul").append('<li><a href="'+c+'">'+f.Name+"</a></li>")});$("#teams-select-container").slideDown(125)}},AtlFlashCommunicator=function(){function b(c,f){if(c.indexOf("?")>0){f+=f.indexOf("?")<0?"?":"&";f+=c.substr(c.indexOf("?")+1)}return f}var e=this;this.iframe=this.teamId=this.atlUrl=null;this.iframeSelector="#atl-iframe";
this.flashView=null;this.flashLoading=this.flashLoaded=false;this.params=[];this.lastUrl="";this.init=function(){e.atlUrl=atl.config.flashCommunicatorUrl;atl.addEventListener("section_unload",function(){e.reset()});atl.addEventListener("application_loaded",function(){e.loadFlash()});if(!window.initComplete)window.initComplete=function(){e.onFlashInitialized()};if(!window.initialSwitchPage)window.initialSwitchPage=function(c){c=decodeURIComponent(c);e.onInitialSwitchPage(c)};if(!window.switchPage)window.switchPage=
function(c){c=decodeURIComponent(c);e.onSwitchPage(c)};if(!window.switchPageComplete)window.switchPageComplete=function(c){c=decodeURIComponent(c);e.onSwitchPageComplete(c)}};this.resetLastUrl=function(){this.lastUrl="/"};this.reset=function(){e.iframe=null;e.teamId=null;e.flashView=null;e.flashLoaded=false;e.flashLoading=false};this.loadFlash=function(){if(!e.flashLoading&&!e.flashLoaded){e.flashLoading=true;var c=e.buildUrl();e.iframe=$(e.iframeSelector).attr("src",c)}};this.setFlashView=function(c){e.flashView=
c;if(e.flashLoaded){c=e.buildUrl(e.flashView);e.iframe.attr("src",c);e.params=[]}};this.setTeamId=function(c){e.teamId=c;if(e.flashLoaded||e.flashLoading){e.flashLoaded=false;e.flashLoading=false;e.loadFlash()}};this.setParam=function(c,f){f===null?this.removeParam(c):e.params.push({name:c,value:f})};this.copyParams=function(c){for(var f=c.length;f--;){var h=c[f];this.setParam(h,$.address.parameter(h))}};this.removeParam=function(c){for(var f=e.params.length;f--;)e.params[f].name===c&&e.params[f].remove()};
this.buildUrl=function(c){var f=e.atlUrl;if(e.teamId)f+="&teamId="+e.teamId;if(c){f+="#"+c;for(var h=0,k=e.params.length;h<k;h++){f+=h===0&&c.indexOf("?")<0?"?":"&";f+=e.params[h].name+"="+e.params[h].value}}return f};this.setContainerOn=function(){$("#atl-iframe-container").removeClass("off").addClass("on")};this.setContainerOff=function(){$("#atl-iframe-container").removeClass("on").addClass("off")};this.refresh=function(c){this.setFlashView("/");this.setFlashView(this.lastUrl);if(c){atl.flashCommunicator.resetLastUrl();
window.switchPage(this.lastUrl)}};this.hasAtlFrame=function(){return $(e.iframeSelector).length>0};this.onFlashInitialized=function(){e.flashLoaded=true;e.flashView&&e.setFlashView(e.flashView);atl.notify("flash_initialized")};this.onInitialSwitchPage=function(c){c=e.buildUrl(c);e.iframe.attr("src",c)};this.onSwitchPage=function(c){if(AtlStateManager.activeComponent===null)e.setFlashView(c);else{e.lastUrl=c;var f=atl.sectionManager.findSectionObjectByKey(AtlStateManager.activeComponent.key),h=f.findRouteByFlashAction(c),
k=AtlStateManager.activeSection,d="";if(h!==null){d=b(c,h.url);$.address.value(k.url+d)}else{h=atl.sectionManager.findRouteByFlashAction(c);if(h!==null){d=b(c,h.url);return $.address.value(k.url+d)}h=f.findRouteByFlashView(c);if(h!==null){d=b(c,h.url);e.setFlashView(c);return $.address.value(k.url+d)}else e.setFlashView(c)}}atl.notify("flash_switch_page",c)};this.onSwitchPageComplete=function(c){atl.notify("flash_switch_page_complete",c)}};
(function(b){var e=function(){this.startTime=(new Date).getTime();this.config=new AtlConfiguration;this.connection=new RemoteServiceFunctions;this.session=new AtlSession;this.copy=null;this.sectionManager=new AtlSectionManager;this.globalRouteManager=new AtlGlobalRouteManager;this.errorHandler=new AtlErrorHandler;this.flashCommunicator=new AtlFlashCommunicator;var c=null,f=null;this.events=[];this.run=function(){this.errorHandler.init();this.flashCommunicator.init();Analytics.init();var k=false;atl.connection.loadCurrentUser(function(){k=
true});setTimeout(function(){setInterval(function(){atl.connection.isLoggedin(function(){})},3E5)},3E5);var d=new AtlXMLPreloader;d.loadErrors();var g=".xml";if(window.isIE6||window.isIE7)g+="?"+(new Date).getTime();d.loadApplication("./assets/xml/atl_application"+g);var j=atl.config.intervalTimeout,m=setInterval(function(){atl.timeoutCheck(j,50,m);if(d.getState()===6&&k||d.getState()===4&&atl.copy===null&&k){atl.notify("preloading_done");clearInterval(m);d=null;$.address.externalChange(h);$.address.internalChange(h);
var n=location.hash.substr(1);atl.runUrl(n)}},50)};this.getExposeApi=function(k,d){if(d===undefined){d=$("#exposed");if(d.length===0)d=$('<div id="exposed" />').appendTo("body").hide()}if(k!==undefined||c===null)c=$(d).expose({api:true,maskId:"expose-mask",zIndex:99,closeOnEsc:false,closeOnClick:false,loadSpeed:"fast",onClose:function(){typeof k=="function"&&k.call(this)}});return c};this.getOverlayApi=function(k){k=k||"overlay";if(f===null){var d=$('<div id="'+k+'" class="overlay" />');$("body").append(d);
f=$("#"+k).overlay({api:true,closeOnEsc:false,closeOnClick:false,onBeforeLoad:function(){atl.getExposeApi(function(){atl.notify("expose_closed")}).load();atl.notify("overlay_loaded");$(window).resize(function(){var g=$(".overlay"),j=g.outerWidth({margin:true}),m=g.outerHeight({margin:true});m=Math.max(($(window).height()-m)/2,0);j=Math.max(($(window).width()-j)/2,0);$(g).css({top:m,left:j})})}})}else f.getOverlay().attr("id")!==k&&f.getOverlay().attr("id",k);return f};this.closeOverlay=function(k,
d){$("#edit-overlay").fadeOut(125);if(d=d===undefined||false){atl.getExposeApi().close();$("#expose-mask").hide();$("#expose-mask").remove();this.exposeApi=null}atl.getOverlayApi(k).close()};var h=function(k){k=k.path;k!==AtlStateManager.currentLocation&&atl.runUrl(k)}};e.prototype.addEventListener=function(c,f){var h={};h[c]=f;return this.events.push(h)-1};e.prototype.removeEventListener=function(c){this.events[c]&&this.events.remove(c)};e.prototype.removeEventListenerByName=function(c){for(var f=
this.events.length;f--;){var h=this.events[f];h&&h[c]!==undefined&&this.events.remove(f)}};e.prototype.notify=function(c,f){for(var h=this.events.length;h--;){var k=this.events[h];if(k&&k[c]){jQuery.isArray(f)||(f=[f]);k[c].apply(this,f)}}};e.prototype.setUrl=function(c){AtlStateManager.lock=false;$.address.value(c)};window.atlLockCheck=null;e.prototype.runUrl=function(c,f){if(c.length<2)return $.address.value(atl.sectionManager.getDefaultSectionUrl());if(c.indexOf("?")>-1)c=c.substr(0,c.indexOf("?"));
if(atl.session.getUser()!==null&&c!="/logout"){var h=null,k=atl.session.getUser().teamSites;if(k.length===0&&c!=="/wizard/teamlink"&&c.indexOf("/wizard/registreren/")===-1&&c.indexOf("/season")===-1&&c.indexOf("/login")===-1){$.address.value("/wizard/teamlink");return}if(c.indexOf("/rotw")===0){for(var d=c.substr(c.indexOf("/",1)+1),g=0,j=k.length;g<j&&h===null;++g)if(k[g].Url.indexOf(d)!==-1)h=k[g];if(h!==null){atl.session.setCurrentTeamId(h.Id,false);atl.updateCurrentTeamLinkBox();if(AtlStateManager.activeSection&&
AtlStateManager.activeSection.name=="team"){$.address.value("/team/home");atl.runUrl("/team/home",true)}else $.address.value("/team/home");return}}if(atl.session.getDefaultTeamId()===null&&c!=="/default/teamlink"&&c.indexOf("/autologin")===-1&&c.indexOf("/wizard/registreren/")===-1&&c.indexOf("/season")===-1){atl.session.setTeamlinksSize(k.length,false);if(k.length===1){atl.session.setDefaultTeamId(k[0].Id,false);atl.session.setCurrentTeamId(k[0].Id)}else if(k.length>1){atl.dialog("Je hebt nog geen default teamlink, dus deze moet je nog even kiezen.",
{Uitloggen:function(){$(this).dialog("close");$.address.value("/logout")},"Teamlink selecteren":function(){$(this).dialog("close");$.address.value("/default/teamlink")}});return}}if(c.indexOf("/season")===-1){d=atl.session.getCurrentTeamId();if(atl.session.getMigrationToken(d)===null){g=0;for(j=k.length;g<j;++g)if(d==k[g].Id)h=k[g];if(h!==null&&h.TeamSiteStatus==1){k=false;d=0;for(g=h.TeamSiteRoles.length;d<g;++d)if(h.TeamSiteRoles[d].Id==3)k=true;if(k){atl.dialog("Je teamlink moet nog migreren naar het nieuwe seizoen.",
{Ok:function(){$(this).dialog("close");$.address.value("/season")}});return}}}}else{h=$.address.pathNames();h=h[h.length-1];h!==""&&h.length==36&&atl.session.setCurrentTeamId(h)}}if(AtlStateManager.lock){AtlStateManager.lockUrl=c;if(window.atlLockCheck===null){var m=atl.config.intervalTimeout;window.atlLockCheck=setInterval(function(){atl.timeoutCheck(m,10,window.atlLockCheck);if(!AtlStateManager.lock){clearInterval(window.atlLockCheck);atl.runUrl(c);window.atlLockCheck=null;AtlStateManager.lock=
false}},10)}return false}AtlStateManager.lock=true;atl.sectionManager.unloadWizardObjects();var n=this.globalRouteManager.findGlobalRoute(c);if(n!==null){jQuery(function(){atl.runGlobalRoute(n,c)});atl.trackPage()}else if(this.sectionManager.sectionExists(c)){$("html, body").animate({scrollTop:0},0);h=this.sectionManager.findSectionInfoByUrl(c);if(!h.section.forceActiveUrl||h.activeUrl===c)if(SectionValidator.checkRoles(h)){atl.runSection(c,f,h);atl.trackPage()}else if(atl.session.getUser())atl.setUrl("/error/403");
else{atl.session.setProperty("post_login_redirect",$.address.value());atl.setUrl("/login")}else atl.setUrl(h.activeUrl)}else atl.setUrl("/error/404");atl.updateCurrentTeamLinkBox()};e.prototype.runGlobalRoute=function(c,f){if(c!==null){if(f!=="/logout"&&(c.forceDefaultSection||this.sectionManager.activeSection===null))atl.runSection(this.sectionManager.getDefaultSectionUrl());else AtlStateManager.lock=false;if(c!==null){var h=f.indexOf(c.url);f=f.substring(0,h);this.globalRouteManager.executeGlobalRoute(c,
f)}}else atl.errorHandler.error("fatal","Error in atl.runGlobalRoute(), given url doesn't match a global route but address was allowed by runUrl. Given url: "+f)};e.prototype.runSection=function(c,f,h){if(this.sectionManager.sectionExists(c)){h=h||this.sectionManager.findSectionInfoByUrl(c);c=null;if(AtlStateManager.activeSection)c=AtlStateManager.activeSection.name;AtlStateManager.setBySectionInfo(h);if(h.section.name!==c||f&&h.section.rebuildOnRoleChange===true){var k=new AtlSectionBuilder;c!==
null&&k.unloadPrevSection(this.sectionManager.getSectionObjects());jQuery(function(){$("#loader").show();if($("#expose-mask").length>0||$("#expose-mask").is(":visible")){atl.closeOverlay();var d=atl.config.intervalTimeout,g=setInterval(function(){atl.timeoutCheck(d,10,g);if(!$("#expose-mask").is(":visible")){clearInterval(g);k.buildSection(h);k=null}},10)}else{k.buildSection(h);k=null}})}else{this.handleActiveComponent();this.sectionManager.changed();if(h.section.type==="page"&&($("#expose-mask").length>
0||$("#expose-mask").is(":visible")))atl.closeOverlay();else h.section.type==="exposed_page"&&atl.closeOverlay(false,false);atl.notify("application_loaded");AtlStateManager.lock=false;$("#loader").hide()}}else atl.errorHandler.error("fatal","Error in atl.runSection(), given url doesn't match a section but address was allowed by runUrl. Given url: "+c)};e.prototype.handleActiveComponent=function(){var c=AtlStateManager.activeComponent;if(c!==null){c=this.sectionManager.findSectionObjectByKey(c.key);
c!==null&&c!==undefined&&!c.executed&&!c.executeOnShow&&atl.runComponent(c)}};e.prototype.createWizard=function(c,f,h,k){k=k||"wizard";$(".loading").show();var d=new AtlXMLPreloader;d.loadWizard(c);var g=atl.config.intervalTimeout,j=setInterval(function(){atl.timeoutCheck(g,20,j);if(d.getState()===2){clearInterval(j);var m=new AtlSectionBuilder;m.buildComponentSet(d.result.componentSets[0],k,function(n){m.handleComponentSet(n,f,k);m=null;for(var o=n.components,p=o.length;p--;)atl.runComponent(o[p]);
n.updateTitles();n.onComplete()});h.call(this,d.result)}},20);$(f).append('<div class="close"></div>');$(".close",f).bind("click",function(){atl.notify("expose_closed")})};e.prototype.log=function(c){if(window.console&&this.config.debug){if(typeof c==="string")c="("+((new Date).getTime()-this.startTime)+" ms) "+c;try{console.debug(c)}catch(f){}}};e.prototype.pageTracker=function(c){window.pageTracker&&!atl.config.debug&&window.pageTracker._trackPageview(c)};e.prototype.eventTracker=function(c,f){if(window.pageTracker&&
!atl.config.debug)return window.pageTracker._trackEvent(c,f)};e.prototype.dialog=function(c,f,h,k){k=k||"text";if(f!==null&&f===false)$(".ui-dialog-buttonpane .button").css("display","none");else{f=f||{Sluiten:function(){$(this).dialog("close")}};$(".ui-dialog-buttonpane .button").css("display","block")}var d=140;if(c.length-d>0){d="auto";if(c.length>1E3)d=500}f={resizable:false,minHeight:140,height:d,modal:true,closeText:"Sluit dit venster",title:"Teamlink",buttons:f};switch(k){case "textarea":c=
"<textarea>"+c+"</textarea>";if(h!==undefined&&h!==null)c='<h2 class="h4">'+h+"</h2>"+c;$("#dialog-container").empty().html(c);return $("#dialog-container").addClass("textarea").dialog(f);case "text":if(h!==undefined&&h!==null)c='<h2 class="h4">'+h+"</h2>"+c;$("#dialog-container").empty().html(c);return $("#dialog-container").removeClass("textarea").dialog(f)}};e.prototype.confirm=function(c,f){atl.dialog(c,{Ok:function(){$(this).dialog("close");f.call()},Annuleren:function(){$(this).dialog("close")}})};
e.prototype.trackPage=function(){var c=null;if(atl.session.getCurrentTeamSite()!==null)c=atl.session.getCurrentTeamSite().Id.Value;atl.connection.trackPage(c,function(){})};e.prototype.runComponent=function(c,f){var h=AtlStateManager.activeComponentRoute;if(c.executed){h!==null&&h.wizard!==null&&h.wizard!==undefined&&atl.runRouteWizard(h,c);if(h!==null&&h.flashView!==null&&h.flashView!==undefined){atl.flashCommunicator.copyParams(h.requiredParams);atl.flashCommunicator.setFlashView(h.flashView)}}else if(!c.executeOnShow||
f!==undefined){f=AtlStateManager.activeComponent;var k=c.executeMethodName,d=null,g=null,j=[];c.onComplete();c.handleRoleElements();c.executed=true;if(f!==null&&f.name===c.name){k=h.method;d=h.flashView;g=h.wizard;j=h.requiredParams}if(c[k])c[k].call(c);else c.type==="static"?atl.errorHandler.error("info","You have defined a method in "+c.name+", but its type is static!"):atl.errorHandler.error("fatal","Method: "+k+" not defined on component: "+c.name);g!==null&&g!==undefined&&atl.runRouteWizard(h,
c);if(d!==null&&d!==undefined){atl.flashCommunicator.copyParams(j);atl.flashCommunicator.setFlashView(d)}}};e.prototype.getTemplate=function(c,f,h){h=h?atl.config.contentDirectory+"template/":"./assets/template/";var k=this.sectionManager.getTemplate(c);if(k===undefined){k=".html";if(window.isIE6||window.isIE7)k+="?"+(new Date).getTime();return jQuery.get(h+c+k,function(d){atl.sectionManager.addTemplate(c,d);f.call(this,d)})}f.call(this,k)};e.prototype.timeoutCheck=function(c,f,h){c-=f;if(c<0){clearInterval(h);
window.location=atl.config.intervalTimeoutRedirect}};e.prototype.runRouteWizard=function(c){if(c.wizard!==undefined&&c.wizard!==null){var f;if(c.overlay!==undefined){f=atl.getOverlayApi(c.overlay).getOverlay().empty();atl.createWizard(c.wizard,f,function(){atl.getOverlayApi(c.overlay).load()})}else if(c.editwizard!==undefined){f=$("#edit-overlay").empty();if(f.length===0)f=$('<div id="edit-overlay"></div>').appendTo("body");atl.createWizard(c.wizard,f,function(){$(f).show()})}}};e.prototype.updateCurrentTeamLinkBox=
function(){var c=atl.session.getCurrentTeamSite(),f=null;if(atl.session.getUser()!==null){var h=atl.session.getUser().teamSites;if(h&&c!==null&&atl.session.getUser()!==null)for(var k=0,d=h.length;k<d;++k)if(h[k].Id==c.Id.Value)f=c}f!==null&&f&&atl.session.getUser()!==null?$("#left-login-container").attr("href","./#").html(f.Name.Value).show():$("#left-login-container").html("&nbsp;").hide()};b.atl=new e})(window);window.isIE6=/msie|MSIE 6/.test(navigator.userAgent);window.isIE7=/msie|MSIE 7/.test(navigator.userAgent);
window.isIE8=/msie|MSIE 8/.test(navigator.userAgent);window.isIE9=/msie|MSIE 9/.test(navigator.userAgent);atl.run();atl.addEventListener("application_loaded",function(){decorateButtons()});atl.addEventListener("overlay_loaded",function(){decorateButtons()});atl.addEventListener("preloading_done",function(){(new GlobalSearch).init("header-search","search-input");(new GlobalTeamSelect).init("left-login-container")});
atl.addEventListener("session_changed",function(){var b=atl.session.getUser();if(b&&b.fullName){$("#middle-login-container").attr({href:"./#/team/wijzig/profiel",title:"Klik hier om je profiel en instellingen te wijzigen"}).html(b.fullName.substr(0,25));$("#right-login-container").attr("href","./#/logout").html("Uitloggen");$("body").addClass("auth")}else{$("#middle-login-container").attr("href","./#/login").html("Inloggen");$("#left-login-container").html("&nbsp;").hide();$("#right-login-container").attr("href",
"./#/wizard/registreren/aanmelden").html("Aanmelden");$("body").removeClass("auth")}});
jQuery(function(b){b("#header-controls").show();b("#loader").show();if(window.isIE6&&!b.cookie("ie6_warning")){b('<div id="ie6-warning"><p><strong>Waarschuwing: Internet Explorer 6 is een verouderde browser!</strong><span> Om Teamlink optimaal te kunnen gebruiken raden wij aan om je browser te <a href="http://www.microsoft.com/windows/internet-explorer/default.aspx">updaten</a>,<br />of gebruik te maken van een andere browser, zoals <a href="http://www.getfirefox.com/">Firefox</a>, <a href="http://chrome.google.com">Google Chrome</a>, <a href="http://www.opera.com/download/">Opera</a> of <a href="http://www.apple.com/nl/safari/download/">Apple Safari</a>.</span></p> <a class="close" title="Sluit deze waarschuwing"><img src="./assets/img/icons/ie6-close.png" alt="Sluiten" title="" /></a></div>').prependTo("#header");b("body").addClass("warning");
b("#ie6-warning .close").click(function(){b.cookie("ie6_warning",true,{path:"/",expire:7});b("#ie6-warning").remove();b("body").removeClass("warning")})}var e=jQuery.address.value;jQuery.address.value=function(c){if(c&&c.indexOf("#")>-1)c=c.substr(c.indexOf("#")+1);return e.call(jQuery.address,c)};Cufon.replace(".cufon-me, h1:not(.no-cufon), h2:not(.no-cufon), h3:not(.no-cufon), h4:not(.no-cufon), dt, .error-message p",{hover:"true"});Cufon.replace("#header-amstel a, #footer a span, .widget-content h2",
{fontFamily:"The Sans Semi Bold",hover:"true"});b("#header a[href^=http://]").attr("target","_blank");b("button[type='submit']").live("click",function(){var c=StringHelper.removeNL(b(this).find(".ui-button-text").text());c=jQuery.trim(c).toLowerCase();c=c.split(" ").join("_");atl.eventTracker("submit",b.address.value()+"/"+c)});b("#footer a").show();b("a.deeplink.internal").each(function(){b(this).attr("href","#"+b(this).attr("href"))})});
