(function($){
    $.fn.noIE6 = function(options) {

        return this.each(function() {
            var el = $(this);
            if (el.data('noIE6')) return; 		// Return early if already exists on this element
            var badIE = new noIE6(this, options);       // Create object from our class
            el.data('noIE6', badIE);			// store the object as data() attached to target jquery object

            badIE.init();
        });
    };

    var noIE6 = function(el, options) {

        var obj = this;		// Ref to class
        var badIE = $(el);      // DOM element we are working with

        var settings = $.extend({
            // Add : custom,
            // vars : here
        }, options || {});

        this.init = function() {

            $('body').children().remove();

            $('head').append('<link rel="stylesheet" href="/js/noIE6/noie6.css" type="text/css" />');

            var markup = '\
                <div id="ie6isbad">\n\
                    <div id="wrap">\n\
                        <h1>You are using an old browser</h1>\n\
                        <p>This is a modern website and requires a modern browser to be fully functional. You can download one of the following web browsers free of charge.</p>\n\
                        <div id="browserIcons">\n\
                            <a id="ie" href="http://www.microsoft.com/windows/internet-explorer/worldwide-sites.aspx">Download Internet Explorer</a>\n\
                            <a id="safari" href="http://www.apple.com/safari/download/">Download Safari</a>\n\
                            <a id="chrome" href="http://www.google.co.uk/chrome">Download Google Chrome</a>\n\
                            <a id="firefox" href="http://www.mozilla.com/en-US/firefox/">Download Firefox</a>\n\
                        </div>\n\
                    </div>\n\
               </div>';

            $('body').prepend(markup);

            // Create overlay
            $('#ie6isbad').css({
               'position'   : 'absolute',
               'zIndex'     : '999',
               'backgroundColor' : '#000',
               'width' : $(window).width(),
               'height' : $(window).height(),
               'textAlign' : 'center',
               'paddingTop' : '150px'
            });
        };

    };
})(jQuery);

