function DM_setCookie(cookieName,cookieValue,nSeconds) { var today = new Date(); var expire = new Date(); if (nSeconds==null || nSeconds==0) nSeconds=1000; expire.setTime(today.getTime() + 1000*nSeconds); document.cookie = cookieName+"="+escape(cookieValue) + ";expires="+expire.toGMTString()+ ";path=/;"; } function DM_redirect(MobileURL, Home){ try { // avoid loops within mobile site if(document.getElementById("dmRoot") != null) { return; } var CurrentUrl = location.href var noredirect = document.location.search; if (noredirect.indexOf("no_redirect=true") < 0 ){ if(document.cookie.indexOf("dmNoRedirect") < 0) { if ((navigator.userAgent.match(/(iPhone|iPod|BlackBerry|Android.*Mobile|BB10.*Mobile|webOS|Windows CE|IEMobile|Opera Mini|Opera Mobi|HTC|LG-|LGE|SAMSUNG|Samsung|SEC-SGH|Symbian|Nokia|PlayStation|PLAYSTATION|Nintendo DSi)/i)) ) { if(Home){ location.replace(MobileURL); } else { location.replace(MobileURL + "?url=" + encodeURIComponent(CurrentUrl)); } } } } else { DM_setCookie("dmNoRedirect", "1", 60*60); } } catch(err){} }