var u8=u8||{};(function(){u8.StartPageRedirect={evaluateAndRedirect:function(){var e=this;var r=this._getAgentInformation();var n=document.getElementById("redirectMap").innerHTML;var t=this._toXmlDocument(n);var i=t&&t.querySelectorAll("Condition");var a=i&&Array.prototype.slice.apply(i)||[];var o=a.some(function(n){var t=e._evaluateCondition(n,r);if(t){e._redirect(t)}return!!t});if(!o){this._redirect("crm/start")}},_redirect:function(e){var r=window.location.search;if(r){if(e.indexOf("?")<0){e+=r}else{e+="&"+r.substr(1)}}window.location.replace(e)},_toXmlDocument:function(e){var r=new DOMParser;var n=r.parseFromString(e,"application/xml");var t=n.parseError;if(t&&t.errorCode!=0||n.querySelector("parsererror")){return null}else{return n}},_evaluateCondition:function(e,r){var n=e.attributes&&e.attributes["url"]&&e.attributes["url"].value;var t=[i.bind(null,"Browser","name",r.browser.name),a.bind(null,"Browser","webkit",r.browser.webkit),a.bind(null,"Browser","mozilla",r.browser.mozilla),i.bind(null,"Browser","userAgent",r.browser.userAgent),o.bind(null,"Browser","minVersion",r.browser.majorVersion),o.bind(null,"Browser","maxVersion",r.browser.majorVersion),i.bind(null,"Platform","name",r.platform),o.bind(null,"Screen","minWidth",r.screen.width),o.bind(null,"Screen","maxWidth",r.screen.width),o.bind(null,"Screen","minHeight",r.screen.height),o.bind(null,"Screen","maxHeight",r.screen.height),o.bind(null,"Screen","minWidthInches",r.screen.widthInches),o.bind(null,"Screen","maxWidthInches",r.screen.widthInches),o.bind(null,"Screen","minHeightInches",r.screen.heightInches),o.bind(null,"Screen","maxHeightInches",r.screen.heightInches),o.bind(null,"Screen","minDiagonalInches",r.screen.diagonalInches),o.bind(null,"Screen","maxDiagonalInches",r.screen.diagonalInches),a.bind(null,"Device","pointer",r.device.pointer),a.bind(null,"Device","touch",r.device.touch),a.bind(null,"Device","mouse",r.device.mouse),a.bind(null,"Device","ios",r.device.ios)];function i(r,n,t){var i=e.querySelector(r);if(!i||!i.hasAttribute(n)){return true}var a=i.attributes[n].value;var o=new RegExp(a,"i");return o.test(t)}function a(r,n,t){var i=e.querySelector(r);if(!i||!i.hasAttribute(n)){return true}var a=i.attributes[n].value;if(a==="true"){return t===true}else if(a==="false"){return t===false}return true}function o(r,n,t){var i=e.querySelector(r);if(!i||!i.hasAttribute(n)){return true}var a=i.attributes[n].value;var o=parseInt(a,10);if(isNaN(o)){return true}else if(n.match(/^min/)){return t>=o}else if(n.match(/^max/)){return t<=o}else{return t===o}}return t.every(function(e){return e()})?n:false},_getAgentInformation:function(){var e={userAgent:navigator.userAgent,webkit:navigator.userAgent.indexOf("AppleWebKit/")>-1,mozilla:navigator.userAgent.indexOf("Gecko")>-1&&navigator.userAgent.indexOf("KHTML")==-1};var r=navigator.userAgent,n,t=r.match(/(opera|chrome|safari|firefox|msie|phantomjs|trident(?=\/))\/?\s*([\d\.]+)/i)||[];if(/trident/i.test(t[1])){n=/\brv[ :]+(\d+(\.\d+)?)/g.exec(r)||[];t=["msie",n[1]]}else{t=t[2]?[t[1],t[2]]:[navigator.appName,navigator.appVersion,"-?"];n=r.match(/version\/([\.\d]+)/i);if(n){t[2]=n[1]}}e.name=t[0].toLowerCase();e.version=t[1];e.majorVersion=parseInt(t[1],10);var i=!!((navigator.pointerEnabled||navigator.msPointerEnabled)&&(navigator.msMaxTouchPoints||navigator.maxTouchPoints));var a=!!("ontouchstart"in window||i);var o=!("ontouchstart"in window&&r.match(/mobile|tablet|ip(ad|hone|od)|android/i));var s=!!r.match(/ip(ad|hone|od)/i);var u={pointer:i,touch:a,mouse:o,ios:s};return{device:u,browser:e,platform:navigator.platform,screen:this._getScreenSize()}},_getScreenSize:function(){var e=window.screen.width;var r=window.screen.height;var n=document.createElement("div");n.style.width="1in";n.style.height="1in";var t=document.getElementsByTagName("body")[0];t.appendChild(n);var i=document.defaultView.getComputedStyle(n,null);var a=parseFloat(i.getPropertyValue("width"));var o=parseFloat(i.getPropertyValue("height"));var s=e/a;var u=r/o;var l=Math.sqrt(s*s+u*u);return{width:e,height:r,widthInches:s,heightInches:u,diagonalInches:l}}}})();