var mobile = (/iphone|ipad|ipod|android|blackberry|mini|windows\sce|palm/i.test(navigator.userAgent.toLowerCase())); if(mobile) { var mobileVersionByDefault = getCookie("mobileVersionByDefault"); if(mobileVersionByDefault !== null) { if(mobileVersionByDefault == "true") { // check what page var file = document.location.pathname; var search = document.location.search; if(!(/\/mobile\//).test(file)) document.location.href = "/mobile" + file + search; } } else { if(typeof(chooserPopupText) != "undefined") { Event.observe(window, 'load', function() { if(confirm(chooserPopupText)) setMobileVersion(true); else setMobileVersion(false); }); } else { document.location.href = "/modules/mobilepage/"; } } } function setMobileVersion(isMobileVersion) { value = isMobileVersion ? "true" : "false"; var date = new Date(); date.setTime(date.getTime() + (1 * 24 * 60 * 60 * 1000)); var expires = "; expires=" + date.toGMTString(); document.cookie = "mobileVersionByDefault=" + value + "; path=/"; if(isMobileVersion) { document.location.href = "/mobile/"; } }