
//DETECT AND REDIRECT MOBILE VERSIONS
function detectAppStore(){
    if (document.cookie.indexOf("appstore_redirect=false") < 0) {
        if (!navigator.userAgent.match(/Opera/i)) {
            if ((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i))) {
                  if (confirm("RMR has Gone Mobile!\r\n Check out our Free Application")) {
                    document.cookie = "appstore_redirect=false";
                    window.location = "http://itunes.apple.com/us/app/rmr-mobile/id451810270?mt=8";
                }
                else {
                    setAppStoreCookies();
                }
            }
            else 
                if (navigator.userAgent.match(/android/i)) {
                    if (confirm("RMR has Gone Mobile!\r\n Check out our Free Application")) {
                        document.cookie = "appstore_redirect=false";
                        window.location = "market://search?q=pname:com.bizmosis.dwlz";
                    }
                    else {
                        setAppStoreCookies();
                    }
                }
      
           
			
        }
    }
}

function setAppStoreCookies(){
    var date = new Date();
    var days = 1;
    date.setTime(date.getTime() + (days * 24 * 60 * 60 * 1000));
    var expires = "; expires=" + date.toGMTString();
    document.cookie = "appstore_redirect=false" + expires;
}

detectAppStore();


