var royalSocietyObj;window.fbAsyncInit=function(){FB.init({appId:royalSocietyObj.fbAppId,xfbml:!0,version:"v2.7"})},function(n,t,i){var r,u=n.getElementsByTagName(t)[0];n.getElementById(i)||(r=n.createElement(t),r.id=i,r.src="//connect.facebook.net/en_US/sdk.js",u.parentNode.insertBefore(r,u))}(document,"script","facebook-jssdk");royalSocietyObj={};royalSocietyObj.isLoaded=!1;royalSocietyObj.dependenciesLoaded=!1;royalSocietyObj.version="?version=565465";var fbAppId=document.getElementById("fbAppId"),enableDebugging=document.getElementById("enableDebugging"),baseUrl=document.getElementById("baseUrl"),jsonDataUrl=document.getElementById("jsonDataUrl"),environment=document.getElementById("environment");royalSocietyObj.mainIsLoaded=!1;royalSocietyObj.fbAppId=fbAppId?fbAppId.value:"1227409314066422";royalSocietyObj.enableDebugging=enableDebugging?enableDebugging.value==="true":!1;royalSocietyObj.baseUrl=baseUrl?baseUrl.value:"";royalSocietyObj.jsonDataUrl=jsonDataUrl?jsonDataUrl.value:"/data/data.json";royalSocietyObj.environment=environment?environment.value:"test";royalSocietyObj.intervalTries=0;royalSocietyObj.loadCSS=function(n,t){n=royalSocietyObj.environment.toLocaleLowerCase()==="live"&&t?n.replace(".css",".min.css"):n;var i=document.createElement("link");i.rel="stylesheet";i.href=n;document.getElementsByTagName("head")[0].appendChild(i)};royalSocietyObj.clearLoadInterval=function(){clearInterval(royalSocietyObj.loadScript)};royalSocietyObj.getScript=function(n,t){$.ajax({url:n,type:"get",dataType:"script",success:function(){console.log("loaded:",n);t!==null&&t!==undefined&&t()},error:function(n){console.log(n);alert("Sorry an error occurred")}})};royalSocietyObj.fixIE9Console=function(){for(var n,u=function(){},t=["assert","clear","count","debug","dir","dirxml","error","exception","group","groupCollapsed","groupEnd","info","log","markTimeline","profile","profileEnd","table","time","timeEnd","timeStamp","trace","warn"],i=t.length,r=window.console=window.console||{};i--;)n=t[i],r[n]||(r[n]=u)}();royalSocietyObj.loadCSS(royalSocietyObj.baseUrl+"/css/vendor/bootstrap.min.css",!1);royalSocietyObj.loadCSS(royalSocietyObj.baseUrl+"/css/modular.css",!0);royalSocietyObj.loadCSS(royalSocietyObj.baseUrl+"/css/main.css",!0);royalSocietyObj.loadCSS(royalSocietyObj.baseUrl+"/css/responsive.css",!0);royalSocietyObj.loadCSS(royalSocietyObj.baseUrl+"/css/royal.css",!0);royalSocietyObj.loadScript=setInterval(function(){(royalSocietyObj.intervalTries++,console!==undefined&&console!==null)&&(royalSocietyObj.enableDebugging,window.jQuery!==null&&window.angular!==null&&typeof rsApp!="undefined"&&rsApp!==undefined&&(royalSocietyObj.isLoaded===!1&&rsApp!==null&&(royalSocietyObj.getScript(royalSocietyObj.baseUrl+"/scripts/directives/browser-detection.js"+royalSocietyObj.version,function(){royalSocietyObj.browserDetectionLoaded=!0}),royalSocietyObj.getScript(royalSocietyObj.baseUrl+"/scripts/vendor/bootstrap.min.js"+royalSocietyObj.version,function(){royalSocietyObj.bootstrapLoaded=!0}),royalSocietyObj.getScript(royalSocietyObj.baseUrl+"/scripts/directives/svg.js"+royalSocietyObj.version,function(){royalSocietyObj.svgLoaded=!0}),royalSocietyObj.getScript(royalSocietyObj.baseUrl+"/scripts/directives/scroller.js"+royalSocietyObj.version,function(){royalSocietyObj.scrollerLoaded=!0}),royalSocietyObj.getScript(royalSocietyObj.baseUrl+"/scripts/factory/timerFactory.js"+royalSocietyObj.version,function(){royalSocietyObj.timerFactoryLoaded=!0}),royalSocietyObj.getScript(royalSocietyObj.baseUrl+"/scripts/factory/carousel.js"+royalSocietyObj.version,function(){royalSocietyObj.carouselFactoryLoaded=!0}),royalSocietyObj.getScript(royalSocietyObj.baseUrl+"/scripts/factory/photoChallenge.js"+royalSocietyObj.version,function(){royalSocietyObj.photoChallengeFactoryLoaded=!0}),royalSocietyObj.getScript(royalSocietyObj.baseUrl+"/scripts/factory/machineLearningQuiz.js"+royalSocietyObj.version,function(){royalSocietyObj.machineLearningQuizFactoryLoaded=!0}),royalSocietyObj.getScript(royalSocietyObj.baseUrl+"/scripts/controllers/CopyController.js"+royalSocietyObj.version,function(){royalSocietyObj.copyLoaded=!0}),royalSocietyObj.getScript(royalSocietyObj.baseUrl+"/scripts/controllers/carousel.js"+royalSocietyObj.version,function(){royalSocietyObj.carouselLoaded=!0}),royalSocietyObj.getScript(royalSocietyObj.baseUrl+"/scripts/controllers/photoChallenge.js"+royalSocietyObj.version,function(){royalSocietyObj.photoChallengeLoaded=!0}),royalSocietyObj.getScript(royalSocietyObj.baseUrl+"/scripts/controllers/driverless-car.js"+royalSocietyObj.version,function(){royalSocietyObj.driverlessCarLoaded=!0}),royalSocietyObj.getScript(royalSocietyObj.baseUrl+"/scripts/controllers/machineLearningQuiz.js"+royalSocietyObj.version,function(){royalSocietyObj.machineLearningQuizLoaded=!0}),royalSocietyObj.getScript(royalSocietyObj.baseUrl+"/scripts/controllers/infographicController.js"+royalSocietyObj.version,function(){royalSocietyObj.infographicLoaded=!0}),royalSocietyObj.isLoaded=!0),royalSocietyObj.copyLoaded&&royalSocietyObj.timerFactoryLoaded&&royalSocietyObj.carouselFactoryLoaded&&royalSocietyObj.photoChallengeFactoryLoaded&&royalSocietyObj.machineLearningQuizFactoryLoaded&&royalSocietyObj.infographicLoaded&&royalSocietyObj.carouselLoaded&&royalSocietyObj.photoChallengeLoaded&&royalSocietyObj.driverlessCarLoaded&&royalSocietyObj.machineLearningQuizLoaded&&royalSocietyObj.browserDetectionLoaded&&royalSocietyObj.svgLoaded&&royalSocietyObj.scrollerLoaded&&royalSocietyObj.bootstrapLoaded&&royalSocietyObj.sectionLazyLoadingLoaded!==!0&&(royalSocietyObj.sectionLazyLoadingLoaded=!0,royalSocietyObj.getScript(royalSocietyObj.baseUrl+"/scripts/directives/section-lazy-loading.js"+royalSocietyObj.version,function(){console!=undefined&&royalSocietyObj.enableDebugging&&console.log("section lazy loading Loaded!");!royalSocietyObj.appCMSLoaded&&royalSocietyObj.sectionLazyLoadingLoaded&&royalSocietyObj.getScript(royalSocietyObj.baseUrl+"/scripts/controllers/appCMS.js"+royalSocietyObj.version,function(){royalSocietyObj.dependenciesLoaded=!0;royalSocietyObj.appCMSLoaded=!0;console!=undefined&&royalSocietyObj.enableDebugging&&royalSocietyObj.dependenciesLoaded&&console.log("Dependencies Loaded!")})}))),royalSocietyObj.isLoaded&&royalSocietyObj.dependenciesLoaded&&royalSocietyObj.clearLoadInterval())},200)