
// The following navigator properties are available:
// navigator.appCodeName
// navigator.appName
// navigator.appVersion
// navigator.cookieEnabled
// navigator.language
// navigator.onLine
// navigator.platform
// navigator.userAgent

var ua = window.navigator.userAgent;
var details=null;


function get_browser() {
    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 {name:'IE',version:(tem[1]||'')};
        }   
    if(M[1]==='Chrome'){
        tem=ua.match(/\bOPR|Edge\/(\d+)/)
        if(tem!=null)   {return {name:'Opera', version: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 {
      name: M[0],
      version: M[1]
    };
 }

var browser=get_browser();
var ver = parseInt(browser.version);

if (browser.name == "MSIE" && ver < 11){
    // Create the notification
    $('<BrowserVersionNotice>' + 
    '<div class="BrowserNoticeContent">The browser you are using ' +
    '(' + browser.name + ' ' + ver + ')' +
    ' is a version earlier than recommended.<br/>' + 
    'Some elements may not function or appear as expected.<br/>' + 
    'Recommended browsers: Chrome, Edge, Internet Explorer 11</div></BrowserVersionNotice>').insertBefore('header');
    $('.BrowserVersionNotice').css({
        'display' : 'flex',
        'position' : 'absolute',
        'top' : '0px',
        'width' : '100%',
        'background-color' : 'darkgray'
    });
    $('.BrowserNoticeContent').css({
        'margin' : 'auto',
        'background-color' : 'black',
        'color' : 'white',
        'padding' : '10px',
        'text-align' : 'center'
    });
}
