var a;
(function(b){var d=function(){this.currentLocation="/";this.activeComponentRoute=this.activeComponent=this.activeComponentSet=this.activeRoute=this.prevLocation=this.activeSection=null;this.lock=false;this.lockUrl=""};d.prototype.setCurrentLocation=function(c){this.prevLocation=this.currentLocation||c;this.currentLocation=c};d.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 d})(window);var ArrayHelper={range:function(b,d,c){var e=[];c=c||1;var g=false;if(!isNaN(b)&&!isNaN(d)){b=b;d=d}else if(isNaN(b)&&isNaN(d)){g=true;b=b.charCodeAt(0);d=d.charCodeAt(0)}else{b=isNaN(b)?0:b;d=isNaN(d)?0:d}if(b<=d)for(;b<=d;){e.push(g?String.fromCharCode(b):b);b+=c}else for(;b>=d;){e.push(g?String.fromCharCode(b):b);b-=c}return e}};
Array.prototype.remove=function(b,d){d=this.slice((d||b)+1||this.length);this.length=b<0?this.length+b:b;return this.push.apply(this,d)};if(!Array.prototype.indexOf)Array.prototype.indexOf=function(b,d){var c=this.length;d=Number(d)||0;d=d<0?Math.ceil(d):Math.floor(d);if(d<0)d+=c;for(;d<c;d++)if(d in this&&this[d]===b)return d;return-1};
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.enabled=true;this.navigation="default";this.decoration="";this.executed=false;this.serviceLoadingState=0;this.isShowed=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;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.enabled!==undefined)this.enabled=b.enabled;if(b.navigation)this.navigation=b.navigation;if(b.flashView)this.flashView=b.flashView;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.getFlashView=function(){return this.flashView};a.unload=function(){atl.errorHandler.error("info","You called the unload method from abstract class AtlComponent: implement method in "+this.name)};
a.determineComponentTemplate=function(){var b="component_"+this.name;if(this.template)b+="_"+this.template;var d=this.roleTemplates;if(d.length>0)for(var c=false,e=0,g=d.length;e<g&&!c;e++)if(c=atl.session.getCurrentRoles().indexOf(d[e])>-1)b+="_"+d[e];else if(atl.session.getUser()!==null)b+="_"+d[e];return b};a.loadServices=function(){};
a.checkLoading=function(b){if(this.serviceLoadingState===0)b.call(this);else var d=this,c=setInterval(function(){if(d.serviceLoadingState===0){clearInterval(c);b.call(d)}},20)};a.setLoadingState=function(b){this.serviceLoadingState=b};a.decreaseLoadingState=function(){--this.serviceLoadingState};a.increaseLoadingState=function(){++this.serviceLoadingState};
a.handleRoleElements=function(){for(var b=atl.session.getCurrentRoles(),d=this.markup.find(".roles"),c=d.length;c--;)for(var e=b.length,g=0;g<e;){$(d[c]).hasClass(b[g])?$(d[c]).show():$(d[c]).hide();++g}};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};a=AtlComponentSet.prototype;
a.populate=function(b){this.name=b.name;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,d){if(d===undefined||d!==false){$(b.markup).find(".pane").hide();$(".loading").show()}var c=b.components[b.activeComponentIndex];c.loadServices();c.checkLoading(function(){c.onLoadReady();c.handleRoleElements();$(b.markup).find(".pane").eq(b.activeComponentIndex).fadeIn(125,function(){window.Cufon&&Cufon.refresh();if(c.isShowed)c.onChange();else{c.onShow();c.isShowed=true}setTimeout(function(){$(".loading").hide()},100);atl.getExposeApi().fit()})})};
a.generateOverlayMenu=function(b){$(b.markup).find(".form-steps").empty().addClass("step-count-"+b.navigation.length);for(var d=b.navigation.indexOf(b.componentsInfo[b.activeComponentIndex].navigation),c=0,e=b.navigation.length;c<e;c++){var g=$('<li class="step"><a><span>'+(c+1)+". "+b.navigation[c]+"</span></a></li>");c===0&&$(g).addClass("first");if(c===d)$(g).addClass("active");else if(c<d){$(g).addClass("visited");c+1===d&&$(g).addClass("step-before-active")}c+1===b.navigation.length&&$(g).addClass("last");
$(b.markup).find(".form-steps").append(g)}};a.getComponentByName=function(b){for(var d=this.components.length;d--;)if(this.components[d].name==b)return this.components[d];return false};a.setActiveComponentIndexByName=function(b){for(var d=this.components.length;d--;)if(this.components[d].name==b)this.activeComponentIndex=d};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(d,c,e){this.componentInfo=ComponentValidator.validate(d);if(this.componentInfo===null)return e.call(this,null);this.ready=e;this.viewName=c;this.decorationFile="view_"+(d.decoration?d.decoration:c)+"_component_decoration";if(d.type==="static"){d.className=
"AtlComponent";this.componentClassLoaded()}else if(window[b.componentInfo.className]){b.initComponent();atl.getTemplate(b.decorationFile,b.decorationTemplateLoaded)}else{d=".js";if(window.isIE6||window.isIE7)d+="?"+(new Date).getTime();jQuery.getScript("./assets/js/atl/components/"+this.componentInfo.className+d,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(d){b.component.decorationMarkup=b.viewName==="widget"?$(d).addClass("grid_"+b.component.columnSize):b.viewName==="content"?$(d).attr("id","pane-"+b.component.number):$(d);d=b.determineComponentTemplate();atl.getTemplate(d,b.componentTemplateLoaded)};this.componentTemplateLoaded=
function(d){b.component.markup=$(d);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(d,c,e){this.componentSetInfo=d;this.viewName=c;this.ready=e;e=d.name;if(d.template)e=d.template;this.decorationFile="view_"+c+"_componentset_"+e+"_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{d=".js";if(window.isIE6||window.isIE7)d+="?"+(new Date).getTime();jQuery.getScript("./assets/js/atl/components/"+this.componentSetInfo.className+d,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(d){b.componentSet.markup=$(d);b.ready&&b.ready.call(this,b.componentSet)}},AtlSectionBuilder=function(){};a=AtlSectionBuilder.prototype;
a.unloadPrevSection=function(b){if(b&&b.length>0)for(var d=b.length;d--;){b[d].unload();b[d].markup=null;b[d].decorationMarkup=null;delete b[d]}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 d=setTimeout(function(){clearTimeout(d);atl.getExposeApi().fit()},125)})};
a.buildViews=function(b,d,c){var e=b[d],g=this;if(e)this.buildView(e,function(){g.buildViews(b,++d,c)});else{c&&c.call();g=null}};
a.buildView=function(b,d){var c=this;if(b.container==="widget")this.buildComponents(b.components,b.container,0,function(e){var g=$('<div class="container_24"'+(b.id?' id="'+b.id+'"':"")+" />");$("#widget-container").append(g);c.handleComponentsMarkup(e,g);$("#widget-container").append('<hr class="clear" />');d.call(c);c=null},[]);else if(b.container==="content"||b.container==="header")this.buildComponentSet(b.componentSets[0],b.container,function(e){c.handleComponentSets(e,"#atl-container");d.call(c);
c=null});else if(b.container==="static"||b.container==="action")this.buildComponents(b.components,b.container,0,function(e){var g=$('<div class="static-container"'+(b.id?' id="'+b.id+'"':"")+" />");$("#atl-container").append(g);c.handleComponentsMarkup(e,g);d.call(c);c=null},[])};a.handleComponentsMarkup=function(b,d){for(var c=0;c<b.length;c++)this.handleComponentMarkup(b[c],d)};
a.handleComponentSets=function(b,d){var c=b.markup;$(d).append(c);d=c;var e=$(c).find(".content");if(e.length>0)d=e;e=0;for(var g=b.components.length;e<g;e++)this.handleComponentMarkup(b.components[e],d);b.markup=c;atl.sectionManager.addSectionObject(b)};a.handleComponentMarkup=function(b,d){var c=$(b.decorationMarkup);c.hasClass("content")?c.append(b.markup):c.find(".content").append(b.markup);b.markup=c;$(b.markup).hide();$(d).append(c)};
a.buildComponentSet=function(b,d,c){var e=new AtlComponentSetLoader,g=this;e.load(b,d,function(k){g.buildComponents(b.components,d,0,function(f){k.components=f;e=null;c.call(this,k);g=null},[])})};a.buildComponents=function(b,d,c,e,g){var k=new AtlComponentLoader,f=this;if(b[c]===undefined){e&&e.call(this,g);f=k=null}else k.load(b[c],d,function(h){if(h!==null){atl.sectionManager.addSectionObject(h);g.push(h)}f.buildComponents(b,d,++c,e,g)})};
var AtlConfiguration=function(){this.debug=false;this.version="1.9.0.1";this.hyvesConsumerKey="NjU4OF_7zD21XTR8cQ-JRy_uaM4G";this.hyvesConsumerSecret="NjU4OF8-tAdsrDbUQRqHXrz4SK28";this.hyvesCallbackUrl=SWFAddress.getBaseURL()+"/hyves_callback.html";this.baseUrl=window.location.href.split("#")[0];this.imgUrl="https://services.teamlink.nl/Image?name=";this.flashCommunicatorUrl="http://widget.teamlink.nl/Content/index_atl.html?u="+this.baseUrl;this.cookieExpire=365;this.googleTracker="UA-9816972-1";
this.url="/webservices/widgetwebservice.asmx/";this.urlRegistration="/webservices/KNVB.v.1.2.asmx/";this.urlTeamlink="/webservices/TeamSite.v.1.1.asmx/";this.urlProfile="/webservices/Profiles.v.1.0.asmx/";this.urlStats="/webservices/Statistics.v.1.0.asmx/";this.urlContact="/webservices/Contact.v.1.0.asmx/";this.urlAuthentication="/webservices/Authentication.v.1.0.asmx/"},AtlRoute=function(){this.url="";this.flashView=null;this.method=""},AtlWizard=function(){this.components=[];this.componentSets=
[]},AtlSection=function(){this.name="";this.type="page";this.url="";this.urlMappings=[];this.state=0;this.rebuildOnRoleChange=false;this.forceActiveUrl=true;this.roles=[];this.views=[]},AtlSectionManager=function(){this.lastSectionInfo=null;this.sections=[];this.sectionUrlMapping={};this.sectionObjects=[];this.sectionKeyMapping={};this.templates={}};a=AtlSectionManager.prototype;
a.addSectionObject=function(b){if(!this.sectionKeyMapping[b.key]){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.addSection=function(b){this.sectionUrlMapping[b.url]=this.sections.length;for(var d=b.urlMappings.length;d--;)this.sectionUrlMapping[b.urlMappings[d]]=this.sections.length;this.sections.push(b)};a.addTemplate=function(b,d){this.templates[b]=d};a.getTemplate=function(b){return this.templates[b]};
a.sectionExists=function(b){for(var d="",c=this.sections.length;c--;)d+=this.sections[c].name+"|";d=d.substr(0,d.length-1);return b.search("^/("+d+")")>-1};a.getSections=function(){return this.sections};a.getSectionInfoByUrl=function(b){b=this.sectionUrlMapping[b];if(b!==undefined){var d={};d.index=b;d.section=this.sections[b];return d}return null};
a.findSectionInfoByUrl=function(b){if(this.lastSectionInfo!==null&&this.lastSectionInfo.activeUrl===b)return this.lastSectionInfo;var d=this.getSectionInfoByUrl(b);if(d===null){var c="";for(var e in this.sectionUrlMapping)if(this.sectionUrlMapping.hasOwnProperty(e)){c="^"+e;if(b.search(c)>-1){d=this.getSectionInfoByUrl(e);break}}}if(d!==null){this._setActiveObjects(d,b);d.activeUrl=this._buildActiveUrl(d);this.lastSectionInfo=d}return d};
a._setActiveObjects=function(b,d){for(var c=b.section,e=false,g=c.views.length;g--&&!e;){var k=c.views[g];if(k.componentSets.length){k=k.getComponentSetByUrl(d);if(k!==null)e=this._loopThroughComponents(b,k.components,d)}else e=this._loopThroughComponents(b,k.components,d)}e||c.urlMappings.length&&this._setActiveObjects(b,c.urlMappings[0]);return b};
a._loopThroughComponents=function(b,d,c){for(var e=false,g=d.length;g--&&!e;){var k=d[g].routeMappings;for(var f in k)if(k.hasOwnProperty(f))if(f==c){b.component=d[g];b.componentRoute=d[g].routes[k[f]];e=true}}return e};a._buildActiveUrl=function(b){var d=b.section.url;if(b.componentSet!==undefined&&b.componentSet!==null)d+=b.componentSet.url;if(b.componentRoute!==undefined&&b.componentRoute!==null)d+=b.componentRoute.url;return d};
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=[],d=this.sectionObjects.length;d--;)if(this.sectionObjects[d]instanceof AtlComponentSet)b.push(this.sectionObjects[d]);else{$(this.sectionObjects[d].markup).show();atl.runComponent(this.sectionObjects[d])}for(d=b.length;d--;){b[d].updateTitles();b[d].onComplete()}};a.handleComponentRoleElements=function(){for(var b=this.sectionObjects.length;b--;)!this.sectionObjects[b]instanceof AtlComponentSet&&this.sectionObjects[b].handleRoleElements()};
var AtlGlobalRoute=function(){this.overlay=this.method=this.url=""},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]={method:b.method};if(b.overlay!==undefined)this.globalRouteUrlMapping[b.url].overlay=b.overlay;this.globalRoutes.push(b.url)};
a.executeGlobalRoute=function(b,d){var c=this.globalRouteUrlMapping[b];if(d!==null&&d.length>1){atl.log("=========================================== TRUE  parentRoute: "+d);atl.session.setProperty("returnUrl",d)}else{atl.log("=========================================== FALSE parentRoute: "+d);atl.session.setProperty("returnUrl",null)}c.overlay!==undefined&&atl.getOverlayApi(c.overlay).getOverlay().empty();GlobalRouteFunctions[c.method](function(){c.overlay!==undefined&&atl.getOverlayApi(c.overlay).load()})};
a.globalRouteExists=function(b){if(this.globalRouteUrlMapping[b]!==undefined)return true;else{var d="";for(var c in this.globalRouteUrlMapping)if(this.globalRouteUrlMapping.hasOwnProperty(c)){d=c;if(b.search(d)>-1)return true}}return false};a.findGlobalRoute=function(b){if(this.globalRouteUrlMapping[b]!==undefined)return b;else for(var d in this.globalRouteUrlMapping)if(this.globalRouteUrlMapping.hasOwnProperty(d))if(b.indexOf(d)!==-1)return d;return null};
var AtlSession=function(){var b=null,d=null,c=[],e={};this.getProperty=function(g){return e[g]};this.setProperty=function(g,k){e[g]=k;this.changed();return e[g]};this.cutProperty=function(g){var k=e[g];this.changed();e[g]=undefined;return k};this.hasARole=function(g){var k=true;if(g.length>0){k=false;for(var f=g.length;f--&&!k;)k=c.indexOf(g[f])>-1}return k};this.updateRolesByTeamId=function(g,k){var f=[];if(g!==null&&b!==null)for(var h=b.teamSites,j=0,m=h.length;j<m;++j)if(g===h[j].Id){g=h[j].TeamSiteRoles;
h=0;for(j=g.length;h<j;++h)f.push(g[h].Name);break}this.setCurrentRoles(f,k)};this.clearCookies=function(){if(this.getRememberMeToken()===null){this.setEmail(null);this.setPassword(null);this.setDefaultTeamId(null);this.setMigrationToken(null);this.setTeamlinksSize(null);this.setFacebookToken(null);this.setHyvesToken(null)}};this.changed=function(){atl.sectionManager.sessionChanged();atl.notify("session_changed")};this.getUser=function(){return b};this.setUser=function(g){b=g;this.changed()};this.getCurrentTeamSite=
function(){return d};this.setCurrentTeamSite=function(g,k){d=g;k!==false&&this.changed()};this.getCurrentRoles=function(){return c};this.setCurrentRoles=function(g,k){g.length===0&&atl.log("================================================= ROLES ARE EMPTY !!!!!!!!!!!!!!!");c=g;atl.sectionManager.handleComponentRoleElements();if(k!==false){this.changed();atl.sectionManager.roleChanged();atl.notify("role_changed")}};this.getProperties=function(){return e};this.setProperties=function(g){e=g};this.getEmail=
function(){return $.cookie("user-email")};this.setEmail=function(g){$.cookie("user-email",g,{path:"/",expire:356});this.changed()};this.getPassword=function(){return $.cookie("user-passwd")};this.setPassword=function(g){$.cookie("user-passwd",g,{path:"/",expire:356});this.changed()};this.getDefaultTeamId=function(){return $.cookie("default-atl-team-id")};this.setDefaultTeamId=function(g){$.cookie("default-atl-team-id",g,{path:"/",expire:356});this.changed()};this.getTeamlinksSize=function(){return parseInt($.cookie("atl-teamlinks-size"),
10)};this.setTeamlinksSize=function(g){$.cookie("atl-teamlinks-size",g,{path:"/",expire:356});this.changed()};this.getMigrationToken=function(g){return $.cookie("atl-migration-token-"+g)};this.setMigrationToken=function(g){$.cookie("atl-migration-token-"+g,g,{path:"/",expire:7});this.changed()};this.getFacebookToken=function(){return $.cookie("atl-facebook-token")};this.setFacebookToken=function(g){$.cookie("atl-facebook-token",g,{path:"/",expire:356});this.changed()};this.getHyvesToken=function(){return $.cookie("atl-hyves-token")};
this.setHyvesToken=function(g){$.cookie("atl-hyves-token",g,{path:"/",expire:356});this.changed()};this.getRememberMeToken=function(){return $.cookie("atl-rememberme-token")};this.setRememberMeToken=function(g){$.cookie("atl-rememberme-token",g,{path:"/",expire:356});this.changed()}},AtlErrorHandler=function(){var b=this;this.errorCopy=null;this.init=function(){$(document).ajaxError(this.ajaxErrorHandler)};var d=function(){};this.loadErrors=function(e){d=e;e=".xml";if(window.isIE6||window.isIE7)e+=
"?"+(new Date).getTime();$.ajax({type:"GET",url:"./assets/xml/atl_errors"+e,dataType:"xml",success:c})};this.ajaxErrorHandler=function(e,g,k){e="An unknown error has occurred";if(k!==undefined&&k.url!==undefined)e="AJAX error on: "+k.url;b.error("fatal",e)};this.jsonErrorHandler=function(e){switch(e){case 0:case 2:atl.dialog($("#"+e,b.errorCopy).text(),{Ok:function(){$(this).dialog("close");SWFAddress.setValue("/home")}});break;case 8:case 32:case 64:case 512:case 524294:case 524302:break;default:atl.dialog($("#"+
e,b.errorCopy).text())}};this.error=function(e,g,k){if(k!==undefined&&$.isFunction(k))k.call(b,g);else switch(e){case "fatal":atl.closeOverlay();g=atl.config.debug?g:"Error explanation copy for production environment";atl.runUrl("/error/500");atl.addEventListener("error_500",function(){$("#error-500").html(g)});break;default:case "info":break}};var c=function(e){b.errorCopy=e;d.call(this)}},AtlForm=function(){function b(c){var e=null;e=/radio|checkbox/i.test(c.attr("type"))?$("#"+d.id+" input[name="+
c.attr("name")+"]:checked").val():c.val();if(!e)return"";return e}var d=this;this.id="";this.form={};this.errors=[];this.settings={strictSending:true};this.fieldsToValidate=0;this.helpHtml="";this.setId=function(c){this.id=c;return d};this.getId=function(){return this.id};this.setForm=function(c){this.form=c;return d};this.getForm=function(){return this.form};this.getFieldsToValidate=function(){return this.fieldsToValidate};this.getData=function(){var c={};$.each(this.form,function(e){var g=$("#"+
e);c[e]=g.attr("type")==="checkbox"?$("#"+e).is(":checked"):$("#"+e).val()});return c};this.jsonify=function(c){return JSON.stringify(c)};this.setData=function(c){$.each(c,function(e,g){var k=$("#"+e);k.hasClass("initial-value")&&k.removeClass("initial-value");if($(k).is("select"))$("#"+e+" option[value="+g+"]").attr("selected","selected");else switch(k.attr("type")){case "radio":case "checkbox":k.attr("checked",g);break;default:k.val(g);break}k.val(g)});return d};this.setFieldValue=function(c,e){d.form[c].realValue=
e};this.setSettings=function(c){this.settings=c;return d};this.validate=function(c,e){var g=true;d.errors=[];$.each(this.form,function(k,f){var h=$("#"+k),j;j=h.hasClass("initial-value")?"":b(h);$.each(f.validation,function(m,n){if(d[n.name]){m=h.parents("div.wrapper");var o=m.children("div.validation");if(d[n.name].call(d,h,j,n.params)){if(!c&&!m.hasClass("error")){m.addClass("valid");o.html("&#160;")}}else{g=false;if(!c){o.html(n.message);m.addClass("error");m.removeClass("valid")}e&&d.errors.push({Name:j,
Message:n.message})}}else atl.errorHandler.error("info","Calling an unexisting validation method ["+n.name+"]")})});return g};this.init=function(){d.helpHtml=$("div.help-container").html();d.settings.strictSending&&$("#"+d.id+" button[type=submit]").button({disabled:true});$.each(this.form,function(c,e){var g="blur",k="focus",f="blur",h="blur",j="focus",m=$("#"+c),n=m.parents("div.wrapper"),o=n.children("div.validation");if(e.initialValue!==undefined&&e.initialValue.length>0){m.val(e.initialValue);
m.addClass("initial-value")}if(e.realValue!==undefined){var p={};p[c]=e.realValue;d.setData(p)}if(e.validationEvent!==undefined&&e.validationEvent.length>0)g=e.validationEvent;if(e.helpEventIn!==undefined&&e.helpEventIn.length>0)k=e.helpEventIn;if(e.helpEventOut!==undefined&&e.helpEventOut.length>0)f=e.helpEventOut;if(e.initialValueEventIn!==undefined&&e.initialValueEventIn.length>0)h=e.initialValueEventIn;if(e.initialValueEventOut!==undefined&&e.initialValueEventOut.length>0)j=e.initialValueEventOut;
e.validation.length>0&&++d.fieldsToValidate;m.bind(g,function(){var q=b(m);if(q.length>0){n.removeClass("error");o.html("&#160;");$.each(e.validation,function(s,r){s=false;if(r.silent)s=r.silent;if(d[r.name])if(d[r.name].call(d,m,q,r.params)){if(!s&&!n.hasClass("error")){n.addClass("valid");o.html("&#160;")}}else{n.removeClass("valid");if(!s&&!/notNull|checked|dependsOn/.test(r.name)){o.html(r.message);n.addClass("error")}}else atl.errorHandler.error("info","Calling an unexisting validation method ["+
r.name+"]")})}else{n.removeClass("valid");n.removeClass("error")}if(d.settings.strictSending)d.validate(true)?$("#"+d.id+" button[type=submit]").button({disabled:false}):$("#"+d.id+" button[type=submit]").button({disabled:true})});m.bind(h,function(){if(b(m).length===0)if(e.initialValue!==undefined&&e.initialValue.length>0){m.val(e.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(e.help)}):m.bind(k,function(){$("div.help-container").html(e.help)});f==="mouseleave"?n.bind(f,function(){$("div.help-container").html(d.helpHtml)}):m.bind(f,function(){$("div.help-container").html(d.helpHtml)})})};this.reset=function(){this.cleanErrors();this.cleanFields()};this.disableSendButton=function(){$("#"+d.id+" button[type=submit]").button({disabled:true})};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,e){return e!==null&&e!==""};this.evaluate=function(c,e,g){return g.callback.call(d,c,e)};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,e){return/^-?(?:\d+|\d{1,3}(?:,\d{3})+)(?:\.\d+)?$/i.test(e)};this.digits=function(c,e){return/^\d+$/i.test(e)};
this.enumeration=function(c,e,g){return e in g.elements};this.minLength=function(c,e,g){return e.length>=g.minLength};this.maxLength=function(c,e,g){return e.length<=g.maxLength};this.rangeLength=function(c,e,g){return e.length>=g.minLength&&e.length<=g.maxLength};this.minValue=function(c,e,g){return e>=g.minValue};this.maxValue=function(c,e,g){return e<=g.maxValue};this.rangeValue=function(c,e,g){return e>=g.minValue&&e<=g.maxValue};this.equalsTo=function(c,e,g){return e==g.comparation};this.notEqualsTo=
function(c,e,g){return e!=g.comparation};this.equalsToField=function(c,e,g){return e==$("#"+g.field).val()};this.email=function(c,e){return/^([a-zA-Z0-9_.\-])+@(([a-zA-Z0-9\-])+.)+([a-zA-Z0-9]{2,4})+$/.test(e)};this.url=function(c,e){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(e)};
this.password=function(c,e,g){if(g!==undefined&&g.orNull)if(e===""||e===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(e)};this.telephone=function(c,e){return e!==null&&e.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(e):true};this.date=function(c,e){return!/Invalid|NaN/.test(new Date(e))};this.dependsOn=function(c,
e,g){var k=true;$.each(g.fields,function(f,h){c=$("#"+h);e=b(c);$.each(d.form[h].validation,function(j,m){if(m.name!=="dependsOn"&&d[m.name])d[m.name].call(d,c,e,m.params)||/notNull|checked/.test(m.name)||(k=false)})});return k};this.getErrors=function(){return d.errors}},AtlView=function(){this.container="";this.roles=[];this.components=[];this.componentSets=[];this.id="";this.componentMappings=[]};AtlView.prototype.componentSetMappings=[];
AtlView.prototype.getComponentByUrl=function(b){b=this.componentMappings[b];if(b!==undefined)return this.components[b];return null};AtlView.prototype.addComponentSet=function(b){var d=b.componentMappings;for(var c in d)if(d.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};
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");atl.globalRouteManager.addGlobalRoute(o)});j=j.getElementsByTagName("section");for(var m=0,n=j.length;m<n;m++)d(j[m]);j=null;b.state++};var d=function(j){var m=
new AtlSection;m.name=j.getAttribute("name");m.type=j.getAttribute("type");m.url=j.getAttribute("url");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++)e(j[n],m)},e=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")[0];g(j,n,m);m.views.push(n)},g=function(j,m,n){if(j){var o=f(j.getAttribute("name")),p={name:j.getAttribute("name"),className:o,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 q=0,s=o.length;q<s;q++)h(o[q],q,p,n);$("navigation item",j).each(function(r){p.navigation[r]=$(this).attr("title")});m.addComponentSet(p)}},k=function(j,m,n){for(var o=0,p=j.length;o<p;o++)h(j[o],o,n,m)},f=function(j){var m="ComponentSet";if(j)m=j.substr(0,1).toUpperCase()+j.substr(1)+m;
return m},h=function(j,m,n,o){var p=j.getAttribute("name");m={className:p.substr(0,1).toUpperCase()+p.substr(1)+"Component",name:p,type:"dynamic",routes:[],roles:[],roleTemplates:[],routeMappings:[],number:m+1};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("enabled"))m.enabled=j.getAttribute("enabled")==="true";if($(j).attr("navigation"))m.navigation=j.getAttribute("navigation");if($(j).attr("flashview"))m.flashView=j.getAttribute("flashview");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(",");
m.key=b.generateKey(m);if(j=$(j).children("route")){p=0;for(var q=j.length;p<q;p++){var s=j[p],r=new AtlRoute;r.url=$(s).attr("url");r.method=$(s).attr("method");if($(s).attr("flashview"))r.flashView=$(s).attr("flashview");m.routeMappings[o.url+r.url]=m.routes.length;m.routes.push(r);n.componentMappings[o.url+r.url]=n.components.length;o.urlMappings.push(o.url+r.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++)h(n[o],o,j);o=m.getElementsByTagName("component-set");
if(o.length>0){o=o[0];p=f(o.getAttribute("name"));var q={name:o.getAttribute("name"),className:p,components:[],navigation:[]};if($(o).attr("template"))q.template=o.getAttribute("template");if($(o).attr("title"))q.title=o.getAttribute("title");if($(o).attr("subtitle"))q.subtitle=o.getAttribute("subtitle");q.key=b.generateKey(q);n=o.getElementsByTagName("component");o=0;for(p=n.length;o<p;o++)h(n[o],o,q);$("navigation item",m).each(function(s){q.navigation[s]=$(this).attr("title")});j.componentSets.push(q)}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()}},RemoteService=function(){this.loadJSON=function(b,d,c){this.afterLoadData=c;atl.log("LOADING JSON:"+d);$.ajax({type:"POST",data:b,url:d,jsonpCallbackString:c,dataType:"json",contentType:"application/json; charset=utf-8",success:this._ajaxSucceeded,error:this._ajaxFailed})};this.generateUrl=function(b){return atl.config.url+"/"+b};
this.generateUrlRegistration=function(b){return atl.config.urlRegistration+"/"+b};this.generateUrlTeamlink=function(b){return atl.config.urlTeamlink+"/"+b};this.generateUrlProfile=function(b){return atl.config.urlProfile+"/"+b};this.generateUrlStats=function(b){return atl.config.urlStats+"/"+b};this.generateUrlContact=function(b){return atl.config.urlContact+"/"+b};this.generateUrlAuthentication=function(b){return atl.config.urlAuthentication+"/"+b};this._ajaxSucceeded=function(b){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,d,c,e,g;this.getRegions=function(f){b.loadJSON('{"request":{}}',b.generateUrlRegistration("GetAvailableRegions"),f)};this.getCities=function(f,h){b.loadJSON('{"request":{"id":'+f+"}}",b.generateUrlRegistration("GetAvailableCities"),h)};this.getClubs=function(f,h){b.loadJSON('{"request":{"id":'+f+"}}",
b.generateUrlRegistration("GetAvailableClubs"),h)};this.getTeams=function(f,h,j){b.loadJSON('{"request":{"Id":"'+f+'", "IncludeDemo": "false"}}',b.generateUrlRegistration("GetAvailableTeams"),j)};this.getTeamlinks=function(f,h){b.loadJSON('{"request":{"Id":"'+f+'"}}',b.generateUrlRegistration("GetAvailableTeamSites"),h)};this.getAvailableTeams=function(f,h){b.loadJSON('{"request":{"Id":"'+f+'", "IncludeDemo": "false"}}',b.generateUrlRegistration("GetAvailableTeams"),h)};this.search=function(f,h){b.loadJSON('{"request":{"Keyword":"'+
f+'", "ClubsCount": "20", "TeamSitesCount" :"20" }}',b.generateUrlRegistration("search"),h)};this.searchClubOnly=function(f,h,j){h||(h=20);b.loadJSON('{"request":{"Keyword":"'+f+'", "ClubsCount": "'+h+'", "TeamSitesCount" :"0" }}',b.generateUrlRegistration("search"),j)};this.trackPage=function(f,h){var j="";j=f!==null?'{"request":{"TeamSiteId":"'+f+'", "Page":"0", "ClientAppId":"1"}}':'{"request":{"Page":"0", "ClientAppId":"1"}}';b.loadJSON(j,b.generateUrlStats("TrackPage"),h)};this.getLoggedInUserInfo=
function(f){d=f;b.loadJSON('{"request":{}}',b.generateUrlProfile("GetLoggedUserInfo"),f)};this.addTeamSiteToProfile=function(f,h,j){b.loadJSON('{"request":{"TeamSiteId":"'+f+'", "Role":'+h+"}}",b.generateUrlProfile("AddTeamSiteToProfile"),j)};this.removeTeamSiteFromProfile=function(f,h){b.loadJSON('{"request":{"Id":"'+f+'"}}',b.generateUrlProfile("RemoveTeamSiteFromProfile"),h)};this.createProfile=function(f,h){b.loadJSON('{"request":'+f+"}",b.generateUrlProfile("CreateProfile"),h)};this.resendActivationEmail=
function(f,h,j){f='{"request":{"Login":"'+f+'","Password":"'+h+'"}}';d=j;b.loadJSON(f,b.generateUrl("Login"),this.resendActivationEmailUserIdCallback)};this.resendActivationEmailUserIdCallback=function(f){b.loadJSON('{"request":{"Id":"'+f.d.Data.UserId+'"}}',b.generateUrlProfile("ResendActivationMail"),d)};this.activateProfile=function(f,h){json='{"request":{"Value":"'+f+'"}}';b.loadJSON(json,b.generateUrlProfile("ActivateProfile"),h)};this.activatePlayer=function(f,h){b.loadJSON('{"request":{"Value":"'+
f+'"}}',b.generateUrlProfile("ActivatePlayer"),h)};this.confirmPlayerInvitation=function(f,h){b.loadJSON('{"request":{"Id":"'+f+'"}}',b.generateUrl("ConfirmPlayerInvitation"),h)};this.finishPlayerInvitation=function(f,h){b.loadJSON('{"request":'+f+"}",b.generateUrl("FinishPlayerInvitation"),h)};this.getProfile=function(f){b.loadJSON('{"request":{}}',b.generateUrlProfile("GetProfile"),f)};this.updateProfile=function(f,h){b.loadJSON('{"request":'+f+"}",b.generateUrlProfile("UpdateProfile"),h)};this.doContact=
function(f,h){b.loadJSON('{"request":'+f+"}",b.generateUrlContact("SendContact"),h)};this.getGeneralStatistics=function(f){b.loadJSON('{"request":{}}',b.generateUrlStats("GetGeneralStatistics"),f)};this.getNewestTeamSites=function(f,h){b.loadJSON('{"request":{"id":'+f+" }}",b.generateUrlStats("GetNewestTeamSites"),h)};this.getTeamSiteMembersUsage=function(f,h,j){b.loadJSON('{"request" : {"Id":"'+f+'", "UserCount": "'+h+'"}}',b.generateUrlStats("GetTeamSiteMembersUsage"),j)};this.getTeamSiteGoalsStatistics=
function(f,h,j){b.loadJSON('{"request" : {"Id":"'+f+'", "UserCount": "'+h+'"}}',b.generateUrlStats("GetTeamSiteGoalsStatistics"),j)};this.doLogin=function(f,h,j){f='{"request":{"Login":"'+f+'","Password":"'+h+'"}}';d=j;b.loadJSON(f,b.generateUrl("Login"),this.doLoginReturn)};this.doLoginReturn=function(f){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(f!==
null&&f.d!==null&&f.d.Data!==null){c.ActiveUser.IsAuthenticated=f.d.Data.IsAuthenticated;c.ActiveUser.UserId=f.d.Data.UserId;c.ActiveUser.Error=f.d.Data.Error}d(c)};this.doLogout=function(f){d=f;b.loadJSON('{"request":{}}',b.generateUrl("Logout"),f)};this.isLoggedin=function(f){d=f;b.loadJSON('{"request":{}}',b.generateUrl("IsLoggedin"),f)};this.doForgotPassword=function(f,h){f='{"request":{"Value":"'+f+'"}}';d=h;b.loadJSON(f,b.generateUrl("ForgotPassword"),h)};this.doGetTeamsites=function(f,h){d=
h;if(c===undefined){c={};c.ActiveUser=[];if(e.id!==undefined){c.ActiveUser.UserId=e.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 d(c)};var k=function(f){$.each(f.d.Data.TeamSites,function(h,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}})});d(c)};this.getTeamSiteById=function(f,h){f='{"request":{"Id":"'+f+'"}}';d=h;b.loadJSON(f,b.generateUrlTeamlink("GetById"),d)};this.getTeamSiteByPath=function(f,h){f='{"request":{"Value":"'+f+'"}}';d=h;b.loadJSON(f,b.generateUrlTeamlink("GetByUrl"),d)};this.getTeamDevelopment=function(f,h){f='{"request":{"Id":"'+f+
'"}}';d=h;b.loadJSON(f,b.generateUrl("GetTeamDevelopment"),d)};this.userLoaded=function(f){atl.session.setUser(f);g&&g.call()};this.loadCurrentUser=function(f){g=f;atl.connection.isLoggedin(this.loadCurrentUserCallback)};this.loadCurrentProfile=function(f){if(f)g=undefined;atl.connection.getLoggedInUserInfo(this.loadCurrentUserInfo)};this.loadCurrentTeamSite=function(f,h){atl.connection.getTeamSiteById(f,function(j){atl.connection.loadCurrentTeamSiteCallback(j,h)})};this.loadCurrentTeamSiteByPath=
function(f,h){atl.connection.getTeamSiteByPath(f,function(j){atl.connection.loadCurrentTeamSiteCallback(j,h)})};this.setUserLoadedCallback=function(f){g=f};this.loadCurrentUserCallback=function(f){if(f!==null&&!f.d.Error)if(f.d.Data.IsAuthenticated){e={id:f.d.Data.UserId};if(atl.session.getUser()===null||atl.session.getUser().id!==e.id)atl.connection.loadCurrentProfile();else g&&g.call()}else{atl.session.clearCookies();atl.connection.userLoaded(null)}};this.loadCurrentUserInfo=function(f){if(!f.d.Error){f=
f.d.Data;var h={};h.FirstName=f.FirstName;h.MiddleName=f.MiddleName;h.LastName=f.LastName;h.MobilePhoneNumber=f.MobilePhoneNumber;h.Email=f.Email;h.Birthday=f.Birthday;h.Gender=f.Gender;h.NewsletterSubscribed=f.NewsletterSubscribed;h.Password=f.Password;h.SendWeeklyUpdates=f.SendWeeklyUpdates;var j=0,m=[],n=[],o=null,p=atl.session.getDefaultTeamId(),q=atl.session.getCurrentTeamSite()?atl.session.getCurrentTeamSite().Id.Value:null;$.each(f.TeamSites,function(s,r){j=m.length;m[j]=[];n[j]=[];$.each(r,
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===q)o=j;else if(u.Value===p)o=j}})});e.fullName=h.FirstName+(h.MiddleName?" "+h.MiddleName+" ":" ")+h.LastName;e.profile=h;e.teamSites=m;e.teamSitesAccess=n;if(m.length>0){if(o===null)o=0;f=RolesHelper.parseRoles(m[o].TeamSiteRoles);atl.session.setCurrentRoles(f,false)}else atl.session.setCurrentRoles([],false);atl.session.setTeamlinksSize(e.teamSites.length);
atl.connection.userLoaded(e)}};this.loadCurrentTeamSiteCallback=function(f,h){f=f.d.Data;if(f!==null){var j={};j=f.Info;j.Stats=f.Stats;atl.session.setCurrentTeamSite(j,false)}else atl.session.setCurrentTeamSite(null,false);atl.notify("teamsite_loaded");h&&h.call()};this.doCreate=function(f,h,j){f='{"request":{"TeamId":"'+f+'", "TeamSiteName": "'+h+'", "InvitedMembers":[{"FirstName":"me","MiddleName":"mem","LastName":"me","Email":"me@me.com","TeamSiteRole":"1"}] }}';atl.log(f);b.loadJSON(f,b.generateUrlTeamlink("Create"),
j)};this.sendInvitationList=function(f,h,j){for(var m="[",n=0;n<h.length;n++){if(n>0)m+=",";m+='{"FirstName": "'+h[n].FirstName+'","MiddleName":null,"LastName":null,"Email":"'+h[n].Email+'","TeamSiteRole": "2"}'}m+="]";b.loadJSON('{"request":{"TeamSiteId":"'+f+'", "InvitedMembers":'+m+"}}",b.generateUrlTeamlink("SendInvitationList"),j)};this.doGetBadges=function(f,h){b.loadJSON('{"request":{"Id":"'+f+'"}}',b.generateUrlTeamlink("GetBadges"),h)};this.doAutoLogin=function(f,h,j,m){b.loadJSON('{"request":{"SsoId":"'+
f+'", "Login": "'+h+'", "Password": "'+j+'"}}',b.generateUrlAuthentication("AutoLogin"),m)};this.getSeasons=function(f,h){b.loadJSON('{"request":{"Id":"'+f+'"}}',b.generateUrlTeamlink("GetSeasons"),h)};this.changeKNVBTeam=function(f,h,j){b.loadJSON('{"request":{"TeamSiteId":"'+f+'", "TeamId":"'+h+'" }}',b.generateUrlTeamlink("ChangeKNVBTeam"),j)};this.getProposedTeam=function(f,h){b.loadJSON('{"request":{"Id":"'+f+'"}}',b.generateUrlRegistration("GetProposedTeam"),h)};this.setTeamStatus=function(f,
h,j){b.loadJSON('{"request":{"Status":"'+h+'", "Id":"'+f+'" }}',b.generateUrlTeamlink("SetStatus"),j)};this.getTeamSiteSettings=function(f,h){b.loadJSON('{"request":{"Id":"'+f+'"}}',b.generateUrl("GetTeamSiteSettings"),h)};this.updateTeamSiteSettings=function(f,h){b.loadJSON('{"request":'+f+"}",b.generateUrl("UpdateTeamSiteSettings"),h)};this.getPhotoFolderBriefs=function(f,h,j,m){h=h||25;j=j||0;b.loadJSON('{"request" : {"TeamSiteId":"'+f+'","FoldersPerPage":"'+h+'","PageNumber":"'+j+'"}}',b.generateUrl("getPhotoFolderBriefs"),
m)};this.getTeamSiteProfile=function(f,h){b.loadJSON('{"request" : {"Id":"'+f+'"}}',b.generateUrlProfile("GetTeamSiteProfile"),h)};this.updateTeamSiteProfile=function(f,h){b.loadJSON('{"request":'+f+"}",b.generateUrlProfile("UpdateTeamSiteProfile"),h)};this.getPlayerPositions=function(f){b.loadJSON("{}",b.generateUrl("GetListFootballPosition"),f)};this.SaveProfileImage=function(f,h,j){if(h.error===0){var m='{"ImageId": "'+h.result.ImageId+'", ';m+='"RelatedId":"'+f+'", ';m+='"MainImage": '+objectToJSON(h.result.MainImage)+
",";m+='"ThumbImage":'+objectToJSON(h.result.ThumbImage)+",";m+='"ReplaceOriginal": "true",';m+='"RelatedType": 2';m+="}";b.loadJSON('{"request":'+m+"}",b.generateUrl("UpdateTeamSiteUserImages"),j)}else j.call()};this.getChangesSinceLastLogin=function(f,h){f=b.generateUrl("GetChangesSinceLastLogin")+"?TeamSiteId="+f;b.loadJSON("{}",f,h)};this.getTeamSiteMembersUsage=function(f,h,j){b.loadJSON('{"request" : {"Id":"'+f+'", "UserCount": "'+h+'"}}',b.generateUrlStats("GetTeamSiteMembersUsage"),j)};this.getTeamSiteGoalsStatistics=
function(f,h,j){b.loadJSON('{"request" : {"Id":"'+f+'", "UserCount": "'+h+'"}}',b.generateUrlStats("GetTeamSiteGoalsStatistics"),j)}},enableSelect=function(b){b=$("#"+b);b.attr("disabled",false);$.uniform.update(b)},disableSelect=function(b){b=$("#"+b);b.attr("disabled",true);$.uniform.update(b)},fillSelect=function(b,d,c){b=$("#"+b);b.append('<option value="'+d+'">'+c+"</option>");$.uniform.update(b)},autoFill=function(b,d){$(b).focus();$(b).val(d);$(b).blur()},objectToJSON=function(b){var d="{ ";
for(var c in b)if(b.hasOwnProperty(c)){d+='"'+c+'": ';if(typeof b[c]==="object")b[c]=objectToJSON(b[c]);else d+=b[c]===true||b[c]===false?b[c]:'"'+b[c]+'"';d+=", "}return d.substring(0,d.length-2)+" }"},stringToDate=function(b){if(b!==undefined&&b!==null){var d=new Date;b=b.substring(6,b.length-2);d.setTime(b);return d}return null},dateToString=function(b){return b.getMonth()+1+"/"+b.getDate()+"/"+b.getFullYear()},checkDate=function(b,d,c,e){if(d!==b.getFullYear().toString())return false;if(e!==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,d){b=$("#"+b);b.attr("disabled",true);b.children().remove();if(d===undefined)d="";d!==false&&b.html("<option value=-1>"+d+"</option>");$.uniform.update(b)},styleCheckboxes=function(b){$(b).find("input").each(function(){$(this).is(":checkbox")&&$(this).iToggle({onClick:function(){var d=$(this).attr("for");$("#"+d).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(){atl.log("Decorating buttons");$("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"}});$("#header-search button").button({text:false,icons:{primary:"ui-icon-search"}});$("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(b){b.GlobalRouteFunctions=new (function(){function d(k){var f=(new AutoLoginPaths).determinePath(k);atl.connection.loadCurrentUser(function(){atl.setUrl(f)})}function c(){atl.connection.loadCurrentUser(function(){AtlStateManager.activeSection!==null&&AtlStateManager.activeSection.url===atl.sectionManager.getDefaultSectionUrl()?window.location.reload(true):atl.setUrl(atl.sectionManager.getDefaultSectionUrl())})}function e(k){var f="";if($("#search-result-container").length===0)f=$('<div id="search-result-container"><div id="search-results"><ul id="search-results-clubs"></ul><ul id="search-results-teams"></ul></div></div>').appendTo("#header-controls").hide();
$("#search-results ul").empty();$.each(k.d.Data.Clubs,function(h,j){$("#search-results-clubs").append("<li>"+j.Name+"</li>")});$.each(k.d.Data.TeamSites,function(h,j){$("#search-results-teams").append("<li>"+j.Name+"</li>")});$("#search-result-container").show()}function g(){atl.dialog("Speler is successvol ge-activeerd.",{Ok:function(){$(this).dialog("close");SWFAddress.setValue("/home")}})}this.login=function(k){var f=atl.getOverlayApi("login-overlay").getOverlay().empty();atl.createWizard("login",
f,function(){k.call()})};this.defaultTeamlink=function(k){var f=atl.getOverlayApi("login-overlay").getOverlay().empty();atl.createWizard("defaultTeamlink",f,function(){k.call()})};this.autoLogin=function(){var k=SWFAddress.getPathNames(),f=null,h=0;if(k[1]!==undefined)f=k[1];if(k[2]!==undefined)h=k[2];f!==null&&h!=1?atl.connection.doAutoLogin(f,null,null,d):atl.setUrl("/login")};this.logout=function(){atl.session.clearCookies();atl.connection.doLogout(c)};this.search=function(){var k=SWFAddress.getPathNames()[1];
if(k===undefined)k="";k.length>2&&atl.connection.search(k,e)};this.activatePlayer=function(){var k=SWFAddress.getPathNames(),f=null;if(k[2]!==undefined)f=k[2];f!==null?atl.connection.activatePlayer(f,g):atl.setUrl("/error/404")};this.createAccount=function(k){var f=atl.getOverlayApi().getOverlay().empty();atl.createWizard("registerAccount",f,function(){k.call()})};this.createAccountInvitation=function(k){var f=atl.getOverlayApi().getOverlay().empty();atl.createWizard("registerAccountInvitation",f,
function(){k.call()})};this.activateAccount=function(k){var f=atl.getOverlayApi().getOverlay().empty();atl.createWizard("registerActivation",f,function(){k.call()})};this.changeSeason=function(k){var f=atl.getOverlayApi("season-overlay").getOverlay().empty();atl.createWizard("season",f,function(){k.call()})};this.wizardTeamlink=function(k){if(atl.session.getUser()!==null){var f=atl.getOverlayApi().getOverlay().empty();atl.createWizard("teamlink",f,function(){k.call()})}else{atl.session.setProperty("post_login_redirect",
"/wizard/teamlink");atl.setUrl("/login")}};this.contact=function(k){var f=atl.getOverlayApi().getOverlay().empty();atl.createWizard("contact",f,function(){k.call()})};this.voorwaarden=function(k){var f=atl.getOverlayApi().getOverlay().empty();atl.createWizard("voorwaarden",f,function(){k.call()})};this.privacy=function(k){var f=atl.getOverlayApi().getOverlay().empty();atl.createWizard("privacy",f,function(){k.call()})}})})(window);
var AutoLoginPaths=function(){this.determinePath=function(b){if(b.d.Error)return"/login";else{var d=b.d.Data.Action,c="";if(b.d.Data.IsAuthenticated){c=b.d.Data.TeamSiteId;atl.session.setDefaultTeamId(c);atl.session.updateRolesByTeamId(c);switch(d){case "ShowPlanner":c="/team/planner";break;case "ShowMatchEvent":atl.flashCommunicator.setParam("eventId",b.d.Data.ParamData[0]);c="/team/match";break;case "ConfirmMatchEvent":atl.flashCommunicator.setParam("eventId",b.d.Data.ParamData[0]);atl.flashCommunicator.setParam("confirm",
1);c="/team/match/confirm";break;case "ShowMatchEventParticipants":atl.flashCommunicator.setParam("eventId",b.d.Data.ParamData[0]);c="/team/match/participants";break;case "ShowManOfTheMatch":atl.flashCommunicator.setParam("eventId",b.d.Data.ParamData[0]);c="/team/match/motm";break;case "ShowMatchReport":atl.flashCommunicator.setParam("eventId",b.d.Data.ParamData[0]);c="/team/match/report";break;case "ShowSocialEvent":atl.flashCommunicator.setParam("eventId",b.d.Data.ParamData[0]);c="/team/social";
break;case "ConfirmSocialEvent":atl.flashCommunicator.setParam("eventId",b.d.Data.ParamData[0]);atl.flashCommunicator.setParam("confirm",1);c="/team/social/confirm";break;case "ShowSocialEventParticipants":atl.flashCommunicator.setParam("eventId",b.d.Data.ParamData[0]);c="/team/social/participants";break;case "ShowTeam":c="/team";break;case "ShowSupporters":c="/team/supporters";break;case "ShowPlayers":c="/team/players";break;case "ShowPhotos":c="/team/photos";break;case "ShowAlbum":atl.flashCommunicator.setParam("id",
b.d.Data.ParamData[0]);atl.flashCommunicator.setParam("eventId",b.d.Data.ParamData[1]);c="/team/photos/album";break;case "ShowPhoto":atl.flashCommunicator.setParam("id",b.d.Data.ParamData[0]);atl.flashCommunicator.setParam("eventId",b.d.Data.ParamData[1]);c="/team/photos/detail";break;case "ShowStanding":c="/team/standings";break;case "ShowMessageBoard":c="/team/shoutbox";break;default:c="/team/home";break}}else if(d=="RegisterInvitedUser"){atl.session.setProperty("register_user_id",b.d.Data.ParamData[0]);
c="/wizard/registreren/uitnodiging"}else c="/login";return c}}},StringHelper={leadingZero:function(b,d){b=b.toString();var c="";if(d>b.length)for(i=0;i<d-b.length;i++)c+="0";return c+b.toString()}},TableGrid=function(b,d){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=d;c.displayed=false;c.currentSelectedRow=-1;this.createTableWrapper=
function(e){if(e===undefined||e===null)e="";c.table.html("");e=$('<table id="'+e+'"></table>');c.table=e.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(e){c._mergeOptions({columns:e});c.displayed&&c.renderTable();return c};this.displayHeading=
function(e){c._mergeOptions({display_heading:e});return c};this.setData=function(e){c._mergeOptions({data:e});c.displayed&&c.renderTable();return c};this.setDataMapping=function(e){c._mergeOptions({mapping:e});c.displayed&&c.renderTable();return c};this.setHoverMethods=function(e,g){c._mergeOptions({hover:{over:e,out:g}});return c};this.setTable=function(e){c.table=e;return c};this._renderHeading=function(){for(var e=$("<thead><tr></tr></thead>"),g=0,k=c.options.columns.length;g<k;++g){var f=c.options.columns[g].class_name?
c.options.columns[g].class_name:"";e.find("tr").append('<td class="'+f+'"><div>'+c.options.columns[g].title+"</div></td>")}e.appendTo(c.table)};this._renderBody=function(){for(var e=$("<tbody></tbody>"),g=0,k=c.options.data.length;g<k;++g){var f=$("<tr></tr>").appendTo(e),h;if(c.options.mapping.length>0){h=0;for(l=c.options.mapping.length;h<l;++h){f.append(c._renderRow(c._getMappedValue(c.options.data[g],c.options.mapping[h]),c.options.columns[h],g,h));if(c.options.columns[h]&&c.options.columns[h].type===
"leading"){f.data("table_grid",{value:c._getMappedValue(c.options.data[g],c.options.mapping[h])});f.data("table_grid",{id:g});f.click(c._onRowClicked)}}}else for(h in options.data[g])if(options.data[g].hasOwnProperty(h)){f.append(c._renderRow(c.options.data[g][h],c.options.columns[h].type,g,h));if(c.options.columns[h].type=="leading"){f.data("table_grid",{value:c.options.data[g][h]});f.data("table_grid",{id:g});f.click(c._onRowClicked)}}}e.appendTo(c.table)};this.onRowClicked=function(){};this._renderRow=
function(e,g,k,f){g=$.extend({type:"plain"},g);var h=g.class_name?g.class_name:"";return'<td class="'+h+'"><div>'+c["_render_"+g.type](e,g,k,f)+"</div></td>"};this._render_plain=function(e){return e};this._render_checkbox=function(e,g,k){return'<input type="checkbox" name="'+g.name+"["+k+']" '+(e?"checked":"")+" />"};this._render_radiogroup=function(e,g,k){return'<input type="radio" name="'+g.name+k+'" '+(e?"checked":"")+" />"};this._render_text=function(e,g,k){return'<input type="text" name="'+g.name+
k+'" value="'+e+'" />'};this._render_leading=function(e,g,k,f){return c._render_plain(e,g,k,f)};this._renderScroll=function(){try{c.table.parents(".scroll-pane").jScrollPane({showArrows:true,arrowSize:5,scrollbarWidth:9,scrollbarMargin:0})}catch(e){}};this._getMappedValue=function(e,g){g=g.split(".");return g.length>1?c._getMappedValue(e[g[0]],g.slice(1).join(".")):e[g[0]]};this._mergeOptions=function(e){c.options=$.extend(c.options,e)};this._onRowClicked=function(e){c.currentSelectedRow=$(e.currentTarget).data("table_grid").id;
c.table.find("tr").removeClass(c.options.selected_class);c.onRowClicked($(e.currentTarget).data("table_grid").value)!==false&&$(e.currentTarget).addClass(c.options.selected_class)}};function URLDecode(b){b=b;for(var d,c=/(%[^%]{2})/;(match=c.exec(b))!==null&&match.length>1&&match[1]!="";){d=parseInt(match[1].substr(1),16);d=String.fromCharCode(d);b=b.replace(match[1],d)}return b}
var UrlHelper={getFlashVars:function(){var b=this.parseUrlParameters(window.location.href.slice(window.location.href.indexOf("?")+1));if(b.flashVars!==undefined)return this.parseUrlParameters(URLDecode(b.flashVars))},parseUrlParameters:function(b){for(var d=[],c=b.split("&"),e=0;e<c.length;e++){b=c[e].split("=");d.push(b[0]);d[b[0]]=b[1]}return d}},SectionValidator={checkRoles:function(b){return atl.session.hasARole(b.section.roles)},checkTeam:function(){if(atl.session.getUser()===null)return true;
var b=atl.session.getDefaultTeamId();if(b=b!==undefined&&b!==null)b=(b=atl.session.getCurrentTeamSite())&&b.ClubName!==undefined;return b}},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,d){if(b!==undefined&&b!==null)for(var c=0;c<d.length;c++)if(b==d[c].Id)return this.parseRoles(d[c].TeamSiteRoles);return[]},parseRoles:function(b){var d=
[];if(b!==undefined&&b!==null)for(var c=0;c<b.length;c++)d.push(b[c].Name);return d}},AtlFlashCommunicator=function(){var b=this;this.iframe=this.teamId=this.atlUrl=null;this.iframeSelector="#atl-iframe";this.flashView=null;this.flashLoading=this.flashLoaded=false;this.params=[];this.init=function(){b.atlUrl=atl.config.flashCommunicatorUrl;atl.addEventListener("section_unload",function(){b.reset()});atl.addEventListener("application_loaded",function(){b.loadFlash()});if(!window.initComplete)window.initComplete=
function(){b.onFlashInitialized()};if(!window.initialSwitchPage)window.initialSwitchPage=function(d){d=decodeURIComponent(d);b.onInitialSwitchPage(d)};if(!window.switchPage)window.switchPage=function(d){d=decodeURIComponent(d);b.onSwitchPage(d)};if(!window.switchPageComplete)window.switchPageComplete=function(d){d=decodeURIComponent(d);b.onSwitchPageComplete(d)}};this.reset=function(){b.iframe=null;b.teamId=null;b.flashView=null;b.flashLoaded=false;b.flashLoading=false};this.loadFlash=function(){if(!b.flashLoading&&
!b.flashLoaded){b.flashLoading=true;var d=b.buildUrl();b.iframe=$(b.iframeSelector).attr("src",d)}};this.setFlashView=function(d){b.flashView=d;if(b.flashLoaded){d=b.buildUrl(b.flashView);b.iframe.attr("src",d);b.params=[]}};this.setTeamId=function(d){b.teamId=d;if(b.flashLoaded||b.flashLoading){b.flashLoaded=false;b.flashLoading=false;b.loadFlash()}};this.setParam=function(d,c){c===null?this.removeParam(d):b.params.push({name:d,value:c})};this.removeParam=function(d){for(var c=b.params.length;c--;)b.params[c].name===
d&&b.params[c].remove()};this.buildUrl=function(d){var c=b.atlUrl;if(b.teamId)c+="&teamId="+b.teamId;if(d){c+="#"+d;for(var e=0,g=b.params.length;e<g;e++){c+=e===0&&d.indexOf("?")<0?"?":"&";c+=b.params[e].name+"="+b.params[e].value}}return c};this.setContainerOn=function(){$("#atl-iframe-container").removeClass("off").addClass("on")};this.setContainerOff=function(){$("#atl-iframe-container").removeClass("on").addClass("off")};this.onFlashInitialized=function(){b.flashLoaded=true;b.flashView&&b.setFlashView(b.flashView);
atl.notify("flash_initialized")};this.onInitialSwitchPage=function(d){d=b.buildUrl(d);b.iframe.attr("src",d)};this.onSwitchPage=function(d){b.setFlashView(d);atl.notify("flash_switch_page",d)};this.onSwitchPageComplete=function(d){atl.notify("flash_switch_page_complete",d)};this.hasAtlFrame=function(){return $(b.iframeSelector).length>0}};
(function(b){var d=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,e=null;this.events=[];this.run=function(){this.errorHandler.init();this.flashCommunicator.init();var k=false;atl.connection.loadCurrentUser(function(){k=
true});setTimeout(function(){setInterval(function(){atl.connection.isLoggedin(function(){})},3E5)},3E5);var f=new AtlXMLPreloader;f.loadErrors();var h=".xml";if(window.isIE6||window.isIE7)h+="?"+(new Date).getTime();f.loadApplication("./assets/xml/atl_application"+h);var j=setInterval(function(){if(f.getState()===6&&k||f.getState()===4&&atl.copy===null&&k){clearInterval(j);f=null;SWFAddress.addEventListener(SWFAddressEvent.EXTERNAL_CHANGE,g);SWFAddress.addEventListener(SWFAddressEvent.INTERNAL_CHANGE,
g);var m=location.hash.substr(1);atl.runUrl(m)}},50)};this.getExposeApi=function(k,f){if(f===undefined){f=$("#exposed");if(f.length===0)f=$('<div id="exposed" />').appendTo("body").hide()}if(k!==undefined||c===null)c=$(f).expose({api:true,maskId:"expose-mask",zIndex:99,closeOnEsc:false,closeOnClick:false,onClose:function(){typeof k=="function"&&k.call(this)}});return c};this.getOverlayApi=function(k){k=k||"overlay";if(e===null){var f=$('<div id="'+k+'" class="overlay" />');$("body").append(f);e=$("#"+
k).overlay({api:true,closeOnEsc:false,closeOnClick:false})}else e.getOverlay().attr("id")!==k&&e.getOverlay().attr("id",k);var h=e.load;if(!e.isOverriden){e.isOverriden=true;e.load=function(){atl.getExposeApi(function(){atl.notify("expose_closed")}).load();h.call(this);atl.notify("overlay_loaded");$(window).resize(function(){var j=$(".overlay"),m=j.outerWidth({margin:true}),n=j.outerHeight({margin:true});n=Math.max(($(window).height()-n)/2,0);m=Math.max(($(window).width()-m)/2,0);$(j).css({top:n,
left:m})})}}return e};this.closeOverlay=function(k,f){if(f=f===undefined||false){atl.getExposeApi().close();$("#expose-mask").hide();$("#expose-mask").remove();this.exposeApi=null}atl.getOverlayApi(k).close()};var g=function(k){k=k.path;k!==AtlStateManager.currentLocation&&atl.runUrl(k)}};d.prototype.addEventListener=function(c,e){var g={};g[c]=e;return this.events.push(g)-1};d.prototype.removeEventListener=function(c){this.events[c]&&this.events.remove(c)};d.prototype.removeEventListenerByName=function(c){for(var e=
this.events.length;e--;){var g=this.events[e];g&&g[c]!==undefined&&this.events.remove(e)}};d.prototype.notify=function(c,e){for(var g=this.events.length;g--;){var k=this.events[g];k&&k[c]&&k[c].call(this,e)}};d.prototype.setUrl=function(c){AtlStateManager.lock=false;SWFAddress.setValue(c)};window.atlLockCheck=null;d.prototype.runUrl=function(c,e){if(c.length<2)return SWFAddress.setValue(atl.sectionManager.getDefaultSectionUrl());if(atl.session.getUser()!==null&&c!="/logout"){var g=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){SWFAddress.setValue("/wizard/teamlink");return}if(c.indexOf("/rotw")===0){for(var f=c.substr(c.indexOf("/",1)+1),h=0,j=k.length;h<j&&g===null;++h)if(k[h].Url.indexOf(f)!==-1)g=k[h];if(g!==null){atl.session.setDefaultTeamId(g.Id);atl.session.updateRolesByTeamId(g.Id);if(AtlStateManager.activeSection&&AtlStateManager.activeSection.name=="team"){SWFAddress.setValue("/team/home");
atl.runUrl("/team/home",true)}else SWFAddress.setValue("/team/home");return}}if(atl.session.getDefaultTeamId()===null&&c!="/default/teamlink"&&c.indexOf("/wizard/registreren/")===-1&&c.indexOf("/season")===-1){atl.session.setTeamlinksSize(k.length);if(k.length===1){atl.session.setDefaultTeamId(k[0].Id);atl.session.updateRolesByTeamId(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");SWFAddress.setValue("/logout")},
"Teamlink selecteren":function(){$(this).dialog("close");SWFAddress.setValue("/default/teamlink")}});return}}if(c.indexOf("/season")===-1){f=atl.session.getDefaultTeamId();if(atl.session.getMigrationToken(f)===null){h=0;for(j=k.length;h<j;++h)if(f==k[h].Id)g=k[h];if(g!==null&&g.TeamSiteStatus==1){k=false;f=0;for(h=g.TeamSiteRoles.length;f<h;++f)if(g.TeamSiteRoles[f].Id==3)k=true;if(k){atl.dialog("Je teamlink moet nog migreren naar het nieuwe seizoen.",{Ok:function(){$(this).dialog("close");SWFAddress.setValue("/season")}});
return}}}}else{g=$(location).attr("href").split("season/");g=g[g.length-1].split("/")[0];g!==""&&g.length==36&&atl.session.setDefaultTeamId(g)}}if(AtlStateManager.lock){AtlStateManager.lockUrl=c;if(window.atlLockCheck===null)window.atlLockCheck=setInterval(function(){if(!AtlStateManager.lock){clearInterval(window.atlLockCheck);atl.runUrl(c);window.atlLockCheck=null;AtlStateManager.lock=false}},100);return false}AtlStateManager.lock=true;if(this.globalRouteManager.globalRouteExists(c)){jQuery(function(){atl.runGlobalRoute(c)});
atl.trackPage()}else if(this.sectionManager.sectionExists(c)){$("html, body").animate({scrollTop:0},"slow");g=this.sectionManager.findSectionInfoByUrl(c);if(!g.section.forceActiveUrl||g.activeUrl===c)if(SectionValidator.checkRoles(g)){atl.runSection(c,e);atl.trackPage()}else atl.session.getUser()?atl.setUrl("/error/403"):atl.setUrl("/login");else atl.setUrl(g.activeUrl)}else atl.setUrl("/error/404")};d.prototype.runGlobalRoute=function(c){if(this.globalRouteManager.globalRouteExists(c)){c!=="/logout"&&
atl.runSection(this.sectionManager.getDefaultSectionUrl());var e=this.globalRouteManager.findGlobalRoute(c);if(e!==null){var g=c.indexOf(e);c=c.substring(0,g);this.globalRouteManager.executeGlobalRoute(e,c)}}else atl.errorHandler.error("fatal","Error in atl.runUrl(), given url doesn't match a global route but address was allowed by runUrl. Given url: "+c)};d.prototype.runSection=function(c,e){if(this.sectionManager.sectionExists(c)){var g=this.sectionManager.findSectionInfoByUrl(c);c=null;if(AtlStateManager.activeSection)c=
AtlStateManager.activeSection.name;AtlStateManager.setBySectionInfo(g);if(g.section.name!==c||e&&g.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 f=setInterval(function(){clearInterval(f);if(!$("#expose-mask").is(":visible")){k.buildSection(g);k=null}},10)}else{k.buildSection(g);k=null}})}else{this.handleActiveComponent();
this.sectionManager.changed();if(g.section.type==="page"&&($("#expose-mask").length>0||$("#expose-mask").is(":visible")))atl.closeOverlay();else g.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.runUrl(), given url doesn't match a section but address was allowed by runUrl. Given url: "+c)};d.prototype.handleActiveComponent=function(){var c=AtlStateManager.activeComponent;
if(c!==null){c=this.sectionManager.findSectionObjectByKey(c.key);if(c!==null&&c!==undefined)if(c.executed){c=AtlStateManager.activeComponentRoute;c!==null&&c.flashView!==undefined&&c.flashView!==null&&atl.flashCommunicator.setFlashView(c.flashView)}else atl.runComponent(c)}};d.prototype.createWizard=function(c,e,g){var k=new AtlXMLPreloader;k.loadWizard(c);var f=setInterval(function(){if(k.getState()===2){clearInterval(f);var h=new AtlSectionBuilder;h.buildComponentSet(k.result.componentSets[0],"wizard",
function(j){h.handleComponentSets(j,e);h=null;for(var m=j.components,n=m.length;n--;)atl.runComponent(m[n]);j.updateTitles();j.onComplete()});g.call(this,k.result)}},20);$(e).append('<div class="close"></div>');$(".close",e).bind("click",function(){atl.notify("expose_closed")})};d.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(e){}}};d.prototype.dialog=function(c,e){e=e||{Sluiten:function(){$(this).dialog("close")}};
$("#dialog-container").empty().html(c);var g=140;if(c.length-g>0){g="auto";if(c.length>1E3)g=500}$("#dialog-container").dialog({resizable:false,minHeight:140,height:g,modal:true,closeText:"Sluit dit venster",title:"Teamlink",buttons:e})};d.prototype.confirm=function(c,e){atl.dialog(c,{Ok:function(){$(this).dialog("close");e.call()},Annuleren:function(){$(this).dialog("close")}})};d.prototype.trackPage=function(){var c=null;if(atl.session.getCurrentTeamSite()!==null)c=atl.session.getCurrentTeamSite().Id.Value;
atl.connection.trackPage(c,function(){})};d.prototype.runComponent=function(c,e){if(!c.executed){var g=AtlStateManager.activeComponentRoute,k=AtlStateManager.activeComponent,f=c.executeMethodName,h=null;if(c.enabled||e!==undefined){c.onComplete();c.handleRoleElements();c.executed=true;if(k!==null&&k.name===c.name){f=g.method;h=g.flashView}if(c[f])c[f].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: "+f+" not defined on component: "+c.name);h!==null&&h!==undefined&&atl.flashCommunicator.setFlashView(h)}}};d.prototype.getTemplate=function(c,e){var g=this.sectionManager.getTemplate(c);if(g===undefined){g=".html";if(window.isIE6||window.isIE7)g+="?"+(new Date).getTime();return jQuery.get("./assets/template/"+c+g,function(k){atl.sectionManager.addTemplate(c,k);e.call(this,k)})}e.call(this,g)};b.atl=new d})(window);
