/***************************************************
Author: Brian Dausman
URL:	mybridgepoint.com
email:  bdausman@mybridgepoint.com
***************************************************/

jQuery.noConflict();

jQuery(document).ready(function(){


    jQuerybrowser = navigator.appName;
    
    if (jQuery.browser.msie && jQuery.browser.version.substr(0, 1) < 9) {
        
        jQuery('body').prepend('<link rel="stylesheet" href="/Sites/bpTest/upgrade.css"><div class="upgrade"><div><a href="#" class="close">&nbsp;</a><a href="http://www.google.com/chrome" target="_blank" class="chrome">&nbsp;</a><a href="http://www.mozilla.com/en-US/firefox/new/" target="_blank" class="firefox">&nbsp;</a><a href="http://windows.microsoft.com/en-US/internet-explorer/downloads/ie" target="_blank" class="ie">&nbsp;</a>You are using an outdated browser. For a faster, safer and overall better experience please upgrade. </div></div>');
   
        //create the cookie
        jQuery.cookie('hideIt');
    
        //hide it on click and set the cookie to not show again for a day
        jQuery('.close').click(function(){
            jQuery('.upgrade').addClass('hideIt');
            jQuery('.upgrade').slideUp('fast');
            jQuery.cookie('hideIt', 'hidden', { expires: 7 });
        });

        //set the cookie to a variable 
        var hideIt = jQuery.cookie('hideIt');
    
        //if its hidden, keep it hidden until it expires
        if(hideIt == 'hidden'){
            jQuery('.upgrade').hide();
        }
    
    }

});




///////////////////////////
//cookie information
/////////////////////////// 
/**
 * jQuery Cookie plugin
 *
 * Copyright (c) 2010 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 */
jQuery.cookie = function (key, value, options) {

    // key and at least value given, set cookie...
    if (arguments.length > 1 && String(value) !== "[object Object]") {
        options = jQuery.extend({}, options);

        if (value === null || value === undefined) {
            options.expires = -1;
        }

        if (typeof options.expires === 'number') {
            var days = options.expires, t = options.expires = new Date();
            t.setDate(t.getDate() + days);
        }

        value = String(value);

        return (document.cookie = [
            encodeURIComponent(key), '=',
            options.raw ? value : encodeURIComponent(value),
            options.expires ? '; expires=' + options.expires.toUTCString() : '', // use expires attribute, max-age is not supported by IE
            options.path ? '; path=' + options.path : '',
            options.domain ? '; domain=' + options.domain : '',
            options.secure ? '; secure' : ''
        ].join(''));
    }

    // key and possibly options given, get cookie...
    options = value || {};
    var result, decode = options.raw ? function (s) { return s; } : decodeURIComponent;
    return (result = new RegExp('(?:^|; )' + encodeURIComponent(key) + '=([^;]*)').exec(document.cookie)) ? decode(result[1]) : null;
};

