var IsHistoryImplemented=true,IsIEBrowserLessThan10=false,IsPushURLManually=false,IsBrowserBackForwardButtonClicked=false,RouteProviderHistory=function(){this.HistoryAdapterBind=function(){History.Adapter.bind(window,"statechange",function(){if(IsHistoryImplemented){var b=History.getState().url,e=GetURLWithoutHash().split("#")[0],c=false,a=History.getState().data.routeName,d=History.getState().data.index;if(!isNaN(d))c=d>-1;if(c)if(!IsIEBrowserLessThan10)sessionStorage.setItem("withindex",e.split("?")[1]);else sessionStorage.setItem("withindex",b.split("?")[1]);else a!="login"&&a!=""&&a!="loggedInAsDifferentUser"&&sessionStorage.setItem("withindex",-1);if(!a)a="home";if(!IsPushURLManually)if(c)if(History.pushState){if(a!=undefined&&a!="login"&&sessionStorage.getItem("LastRouteName")!="login")if(sessionStorage.getItem("RefreshPage")=="1"||sessionStorage.getItem("LastRouteName")=="wrdbookView"&&a=="inlineReaderFromTOC"){sessionStorage.setItem("RefreshPage","0");sessionStorage.setItem("LastRouteName",a);location.href=b}else{sessionStorage.setItem("LastRouteName",a);IsBrowserBackForwardButtonClicked=true;RouteProvider.config(a);IsBrowserBackForwardButtonClicked=false}else if(sessionStorage.getItem("LastRouteName")=="login"||a=="login"){sessionStorage.setItem("LastRouteName",a);sessionStorage.setItem("IsFirstCall",false);location.href=b}}else sessionStorage.setItem("LastRouteName",a);else if(sessionStorage.getItem("LastRouteName")!=null&&sessionStorage.getItem("LastRouteName")!=a&&History.pushState){if(a&&a!="login"&&sessionStorage.getItem("LastRouteName")!="login")if(sessionStorage.getItem("RefreshPage")=="1"){sessionStorage.setItem("RefreshPage","0");sessionStorage.setItem("LastRouteName",a);BrowserStorage.setRedireceFrom(a);location.href=b}else{sessionStorage.setItem("LastRouteName",a);BrowserStorage.setRedireceFrom(a);IsBrowserBackForwardButtonClicked=true;RouteProvider.config(a);IsBrowserBackForwardButtonClicked=false}else if(sessionStorage.getItem("LastRouteName")=="login"||a=="login"||a.toLowerCase()=="termsandconditions"){sessionStorage.setItem("LastRouteName",a);BrowserStorage.setRedireceFrom(a);location.href=b}}else{if(a){sessionStorage.setItem("LastRouteName",a);if(a=="login"||a.toLowerCase()=="termsandconditions"||a.toLowerCase()=="forgotpassword")location.href=b}else{a="Home";sessionStorage.setItem("LastRouteName",a)}BrowserStorage.setRedireceFrom(a)}else if(a&&a=="login"){sessionStorage.setItem("LastRouteName",a);location.href=b}IsPushURLManually=false}})};this.ReplaceState=function(b,d){var h=BrowserStorage.getDataCollection()?BrowserStorage.getDataCollection().length:0;sessionStorage.setItem("LastRouteName",b);var c=History.getState();if(c&&c.data&&c.data.routeName==b&&b!="home")return;var f={routeName:b},e="The Institution of Engineering and Technology - The IETTV",g=d;if(!IsIEBrowserLessThan10){var a=History.createStateObject(f,e,g);History.storeState(a);History.expectedStateId=a.id;history.pushState(a.id,a.title,a.url)}else History.pushState({routeName:b,index:h},"The Institution of Engineering and Technology - The IETTV",d)};this.HistoryPushInternalUrl=function(e,a,b,d){if(IsHistoryImplemented)if(d){if(!IsBrowserBackForwardButtonClicked){var c=BrowserStorage.getDataCollection()?BrowserStorage.getDataCollection().length:0;IsPushURLManually=true;sessionStorage.setItem("LastRouteName",a);History.pushState({routeName:a,index:c},"The Institution of Engineering and Technology - The IETTV",b)}}else if(a!=sessionStorage.getItem("LastRouteName")&&History.pushState){var c=-1;a!=""&&sessionStorage.setItem("LastRouteName",a);IsPushURLManually=true;History.pushState({routeName:a,index:c},"The Institution of Engineering and Technology - The IETTV",b)}};this.HistoryPushExternalUrl=function(a,b){localStorage.setItem("AdditionalLogin","false");if(IsHistoryImplemented){var e=GetURLWithoutHash(),c=e.split("#")[0],f=c.split("?")[0],d=c.split("?")[1];if(a!=d&&History.pushState){sessionStorage.setItem("LastRouteName",a);History.pushState({routeName:a,index:-1},"The Institution of Engineering and Technology - The IETTV",b)}}else location.href=b};this.Add=function(c,b,h){if(c.routeName!="logout"&&c.routeName!="paymentsuccess"&&c.routeName!="paymentfail"){var f=true;f=parseBool($(b).data("changeAddressBarURL")||$(b).attr("changeAddressBarURL"));if(f==undefined)f=true;if(f){var k=GetURLWithoutHash(),j=k.split("?")[0],i=$(b).data("data-redirectroutename")||$(b).attr("data-redirectroutename");if(!i)i=c.routeName;var g=parseBool($(b).data("data-hasIndex")||$(b).attr("data-hasIndex")),d="";if(b!=undefined)d=j+"?"+c.routeName.toLowerCase();else{d=j+"?"+h.toLowerCase();if(h!="home"&&BrowserStorage.getDataCollection().length>0)d+="&index="+BrowserStorage.getDataCollection().length}if(b&&c.configuration.routeParam){var e=$(b).data(c.configuration.routeParam);if(!IsNullOrEmpty(e)){if(isNaN($(b).data(c.configuration.routeParam)))e=e.toLowerCase().replace(/\ /g,"-");d+="="+e}}if(g!=undefined&&!g){if(sessionStorage.getItem("withindex")&&sessionStorage.getItem("withindex"))d="?"+sessionStorage.getItem("withindex")}else if(IsBrowserBackForwardButtonClicked){var l=BrowserStorage.getDataCollection()?BrowserStorage.getDataCollection().length:0;g=l>0}a.HistoryPushInternalUrl(h,c.routeName,d.replace("#",""),g)}}};var a=this},RouteProvider={deaultSetting:{routeName:"",configuration:{templateUrl:"",controller:function(){},isURLWithQueryString:false,updateURL:true}},settings:[],config:function(k,d){var e=this,a=null;document.title="The Institution of Engineering and Technology - The IETTV";var c=GetURLWithoutHash(),h=function(){var g=new LoginRepository;if(IsNullOrEmpty(a.routeName))return;if(!d){if(a){if(IsIEBrowserLessThan10&&c.indexOf("?")>-1&&!IsNullOrEmpty(a.configuration.routeParam))if(IsNullOrEmpty(window.location.hash)){c=c.replace("?","#?");location.href=c;var h=a.configuration.controller.arguments[0].routeName.toString();h!="home"&&g.EmergencyInformation();return}var e=new RouteProviderHistory;e.ReplaceState(a.routeName,window.location.hash.replace("#",""))}return}var f=a.configuration.updateURL?a.configuration.updateURL:true;if(a.configuration.updateURL==true||a.configuration.updateURL==false)f=a.configuration.updateURL;if(f){var e=new RouteProviderHistory;e.Add(a,d,b)}},b=c.split("?")[1];if(b!=undefined)b=b.split("#")[0];else b="home";if(b.indexOf("=")>-1)b=b.split("=")[0];for(i=0;i<this.settings.length;i++){var g=this.settings[i];if(g.routeName.toLowerCase()==k.toLowerCase())a=g;!IsNullOrEmpty(g.configuration.routeParam)&&g.routeName.toLowerCase()==b&&sessionStorage.setItem("lastRouteParam",g.configuration.routeParam)}if(a==null)a=this.deaultSetting;if(a.routeName!="VideoId"){sessionStorage.removeItem("Clip_Id");sessionStorage.removeItem("Clip_StartTime");sessionStorage.removeItem("Clip_EndTime");sessionStorage.removeItem("Clip_isClipPlay")}a.routeName!="VideoId"&&a.routeName!="landscapesearchResult"&&a.routeName!="searchFacets"&&a.routeName!="evilandscapesearchResult"&&a.routeName!="searchBySorting"&&a.routeName!="searchResult"&&a.routeName!="potraitsearchResult"&&a.routeName!="series"&&a.routeName!="event"&&a.routeName!="SpeakerAccessId"&&a.routeName!="pagination"&&sessionStorage.setItem("searchTranscriptTerm","");var f=window.innerWidth>0?window.innerWidth:screen.width;$(document).ready(function(){if(a.routeName=="landing"){$("#searchbar").css("display","none");$("#ChannelFooter").css("display","none");$("#SearchToggle").css("display","none");$("#chkSearch").prop("checked",false);$("#chkSearchMob").prop("checked",false);localStorage.setItem("eviSearchRoute","false");localStorage.setItem("eviSearchToggle","false");localStorage.setItem("SearchTerm","");$("#btnSearchNew").removeAttr("data-innerroutename");$("#btnSearchNew").attr("data-innerroutename","landscapesearchResult");$("#btnSearchNewMob").removeAttr("data-innerroutename");$("#btnSearchNewMob").attr("data-innerroutename","potraitsearchResult");$("#Search_button").removeAttr("disabled");$("#Mobile-btn").removeAttr("disabled");if(f>=360&&f<991){$("#VideoToolsMob").css("display","none");$("#SearchBarMob").css("display","none")}}else{$("#searchbar").css("display","block");$("#SearchToggle").css("display","block");if(f>768)$("#ChannelFooter").css("display","block");else $("#ChannelFooter").css("display","none");$(window).resize(function(){if(window.innerWidth>991)if(a.routeName=="landing")$("#ChannelFooter").css("display","none");else $("#ChannelFooter").css("display","block");else $("#ChannelFooter").css("display","none")});if(f>=360&&f<991){$("#divVideoToolsMobile").removeClass("in");if(a.routeName=="DownloadAttachment"||a.routeName=="eventvideoid"||a.routeName=="VideoId"||a.routeName=="seriesvideoid"||a.routeName=="series")$("#VideoToolsMob").css("display","block");else $("#VideoToolsMob").css("display","none");$("#SearchBarMob").css("display","block")}}});if(!a.configuration.isURLWithQueryString){var l=c.split("?")[0];isLazy=a.configuration.isLazy?a.configuration.isLazy:false;if(a.configuration.isPartial)$.ajax({url:a.configuration.templateUrl,success:function(b){$(".purchase-final-price-div-container").remove();$("#viewContent").html(b);e.bindInnerRoutes();a.configuration.controller(a,e,d);h()}});else{$("#purchase-final-price-div-container").remove();a.configuration.controller(a,e,d);h()}}else{var l=c.split("?")[0],b=c.split("?")[1];if(b!=undefined)b=b.split("#")[0];if(b!=undefined)b=b.split("&")[0];var j=a.configuration.templateUrl+"?"+b;if(a.configuration.isPartial)$.ajax({url:j,success:function(b){$("#viewContent").html(b);e.bindInnerRoutes();a.configuration.controller(a,e,d);h()}});else{a.configuration.controller(a,e,d);h()}}},when:function(a,b){this.settings.push({routeName:a,configuration:b,isDefaultRoute:false});return this},otherwise:function(b){for(i=0;i<this.settings.length;i++){var a=this.settings[i];if(a.routeName==b.redirectTo){a.isDefaultRoute=true;b.redirectTo="";this.deaultSetting=a}}return this},getInternetExplorerVersion:function(){var a=-1;if(navigator.appName=="Microsoft Internet Explorer"){var c=navigator.userAgent,b=new RegExp("MSIE ([0-9]{1,}[.0-9]{0,})");if(b.exec(c)!=null)a=parseFloat(RegExp.$1)}else if(navigator.appName=="Netscape"){var c=navigator.userAgent,b=new RegExp("Trident/.*rv:([0-9]{1,}[.0-9]{0,})");if(b.exec(c)!=null)a=parseFloat(RegExp.$1)}return a},bindRoutes:function(){var a=this;$("[data-routeName]").unbind("click");$("[data-routeName]").bind("click",function(){var b=$(this).data("routeName");if(!b)b=$(this).attr("data-routeName");a.config(b,this)});return this},bindInnerRoutes:function(){var a=this;$("[data-innerRouteName]").unbind("click");$("[data-innerRouteName]").bind("click",function(){var b=$(this).data("innerRouteName");if(!b)b=$(this).attr("data-innerRouteName");a.config(b,this)});return this},bindPopState:function(){var a=this},apply:function(){$.browser={};var a="",b=GetURLWithoutHash();if(b.split("?").length>1){a=b.split("?")[1];a=a.split("#")[0];if(a.split("&").length>1)a=a.split("&")[0];a=a.split("=")[0]}if(!a)a="landing";this.config(a);this.bindRoutes();this.bindPopState();return this}}