var currentBrowser;

function isUnsupportedDesktopBrowser(browserName, browserVersion) {
    if (typeof (browserVersion) !== 'undefined' && browserVersion !== null) {
        if (browserName === 'MSIE' && browserVersion >= 6 && browserVersion <= 10) {
            currentBrowser = 'MSIE';
            return true;
        } else if (browserName === 'Firefox' && browserVersion <= 23) {
            currentBrowser = 'Firefox';
            return true;
        } else if (strStartsWith(browserName, 'Opera') && browserVersion >= 5 && browserVersion <= 9) {
            currentBrowser = 'Opera';
            return true;
        } else if (browserName === 'Chrome' && browserVersion <= 29) {
            currentBrowser = 'Chrome';
            return true;
        } else if (browserName === 'Safari' && browserVersion <= 6) {
            currentBrowser = 'Safari';
            return true;
        } else if(['MSIE','Firefox','Opera','Chrome','Safari'].indexOf(browserName)== -1) {
            currentBrowser = 'Unknown';
            return true;
        }
    }
    return false;
}
function isUnsupportedMobileBrowser(browserName,browserVersion){
    if (typeof (browserVersion) !== 'undefined' && browserVersion !== null) {
        if (browserName === 'MSIE' && browserVersion <= 10) {
            currentBrowser = 'MSIE';
            return true;
        } else if (browserName === 'Firefox' && browserVersion <= 26) {
            currentBrowser = 'Firefox';
            return true;
        } else if (strStartsWith(browserName, 'Opera') && browserVersion <= 13) {
            currentBrowser = 'Opera';
            return true;
        } else if (browserName === 'Chrome' && browserVersion <= 21) {
            currentBrowser = 'Chrome';
            return true;
        } else if (browserName === 'Safari' && browserVersion <= 4) {
            currentBrowser = 'Safari';
            return true;
        } else if(['MSIE','Firefox','Opera','Chrome','Safari'].indexOf(browserName)== -1){
            currentBrowser = 'Unknown';
            return true;
        }
    }
    return false;
}
function strStartsWith(str, prefix) {
    return str.indexOf(prefix) === 0;
}
var isMobile = {
    Android: function () {
        return navigator.userAgent.match(/Android/i);
    },
    BlackBerry: function () {
        return navigator.userAgent.match(/BlackBerry/i);
    },
    iOS: function () {
        return navigator.userAgent.match(/iPhone|iPad|iPod/i);
    },
    Opera: function () {
        return navigator.userAgent.match(/Opera Mini|Opera Mobi/i);
    },
    Windows: function () {
        return navigator.userAgent.match(/IEMobile/i);
    },
    any: function () {
        return (isMobile.Android() || isMobile.BlackBerry() || isMobile.iOS() || isMobile.Opera() || isMobile.Windows());
    }
};

navigator.sayswho = (function () {
    var ua = navigator.userAgent, tem,
        M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || [];
    if (/trident/i.test(M[1])) {
        tem = /\brv[ :]+(\d+)/g.exec(ua) || [];
        return 'IE ' + (tem[1] || '');
    }
    if (M[1] === 'Chrome') {
        tem = ua.match(/\bOPR\/(\d+)/);
        if (tem !== null)
            return 'Opera ' + tem[1];
    }
    M = M[2] ? [M[1], M[2]] : [navigator.appName, navigator.appVersion, '-?'];
    if ((tem = ua.match(/version\/(\d+)/i)) != null)
        M.splice(1, 1, tem[1]);
    return M.join(',');
})();

