/*DETECT AND REDIRECT MOBILE VERSIONS*/
function detectAppStore(){
    if (document.location.pathname != "\/iphonefaq.html") {
        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("FacilityBlog has Gone Mobile!\r\n Try out our lightweight mobile app.")) {
                        document.cookie = "appstore_redirect=false";
                        window.location = "http://itunes.apple.com/us/app/tfm-facility-blog/id433166124?mt=8";
                    }
                    else {
                        setAppStoreCookies();
                    }
                }
                /*else 
                    if (navigator.userAgent.match(/android/i)) {
                        if (confirm("FacilityBlog has Gone Mobile!\r\n Try out our lightweight mobile app.")) {
                            document.cookie = "appstore_redirect=false";
                            window.location = "market://search?q=pname:com.bizmosis.dwlz";
                        }
                        else {
                            setAppStoreCookies();
                        }
                    }*/
            }
        }
        
    }
}
 
function setAppStoreCookies(){
    var date = new Date();
    date.setTime(date.getTime() + (90000));
    var expires = "; expires=" + date.toGMTString();
    document.cookie = "appstore_redirect=false" + expires;
}
 
detectAppStore();
