// JavaScript Document // TODO: deprecated - delete to reduce js file size readcookie = function(name) { var nameEQ = name + "="; var ca = document.cookie.split(';'); for(var i=0;i < ca.length;i++) { var c = ca[i]; while (c.charAt(0)==' ') c = c.substring(1,c.length); if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length); } return null; } var mobileSnifferCheckRedirect = function() { var MobileSnifferCookieName, userAgent, forceAgents, i, n; MobileSnifferCookieName = "ford_mobile_sniffer_forcefullsite"; if (readcookie(MobileSnifferCookieName) === null) { if (MobileHomePageRedirectURL != 'null') { // Check user agent if (ForceRedirectUserAgents !== 'null') { userAgent = window.navigator.userAgent.toLowerCase(); forceAgents = ForceRedirectUserAgents.split(","); for (i = 0, n = forceAgents.length; i < n; i++) { if (userAgent.indexOf(forceAgents[i].toLowerCase()) > -1) { redirect(); } } } // Check width if (ForceRedirectMinWidth !== 'null' && screen !== undefined && screen.width !== undefined) { if (screen.width < Number(ForceRedirectMinWidth)) { redirect(); } } } } }; var redirect = function(){ var path = window.location.pathname; //Redirect for nwp homepage on mobile devices //eg: www.ford.co.uk //www.ford.co.uk/ or www.ford.co.uk/home////// // DEPRECATED - TODO: remove this whole file from GroupedJS and test application var pattern=new RegExp("^/+(home/*)$","i"); if(path=="/" || path.search(pattern) != -1){ //window.location.href = MobileHomePageRedirectURL; } else if(MobileRedirectURL) { //window.location.href = MobileRedirectURL; } }; try { mobileSnifferCheckRedirect(); } catch (ignore) { }