﻿function fechaAlert(){
    document.getElementById('OverAlertIE6').style.display = 'none';
    document.getElementById('ContAlertIE6').style.display = 'none';
}

var ie6block = {

    vNum: 6, // the version number of the browser

    init: function() {
        var x = navigator;
        ie6block.vNum = parseFloat(x.appVersion.split("MSIE")[1]);

        if( ie6block.vNum < 7 ) {
            ie6block.createBlocker();
        }
    },

    createBlocker: function() {
        var notice = document.createElement("div");
        notice.innerHTML = "<div align=center style='font-size: 16px;'>Seu navegador é o <b>Internet Explorer " + ie6block.vNum +".0,</b> o qual não é adequado para as novas tecnologias da internet."
                         + "  Para uma melhor experiência digital sugerimos que faça o download gratuito de um dos navegadores abaixo.</div><br />"
                         + "<ul>"
                         + "<li><a href='http://www.microsoft.com/Windows/internet-explorer/'>Internet Explorer 8</a></li>"
                         + "<li><a href='http://www.opera.com/download/'>Opera Web Browser</a></li>"
                         + "<li><a href='http://www.apple.com/safari/download/'>Safari Web Browser</a></li>"
                         + "<li><a href='http://www.mozilla.com/firefox/'>Mozilla Firefox</a></li>"
                         + "<li><a href='http://www.google.com/chrome'>Google Chrome</a></li>"
                         + "</ul><br />"
                         + "<center>Obrigado por ajudar a construir uma internet melhor!</center>"
                         +"<br /> Caso queira manter seu navegador atual e visitar o site com erros de visualização <br /> <a href='#a' style='color: #000;' onClick='fechaAlert()';> <em>clique aqui</em></a>"
                         + "</div>";
        
        var content = document.createElement("div");
        content.style.position = "absolute";
        content.style.left = "25%";
        content.style.marginTop = "100px";
        content.style.marginLeft = "10%";
        content.style.marginRight = "0";
        content.style.height = "260px";
        content.style.width = "580px";
        content.style.padding = "20px";
        content.style.fontFamily = "Trebuchet MS";
        content.style.fontSize = "13px";
        content.style.backgroundColor = "#FFF";
        content.style.border = "solid #ccc 1px";
        content.style.zIndex = 800;
        content.style.opacity = 1.0;
        content.style.filter = "alpha(opacity=100)";
        content.appendChild( notice );

        var overlay = document.createElement("div");
        overlay.style.position = "absolute";
        overlay.style.width = "100%";
        overlay.style.height = "100%";
        overlay.style.backgroundColor = "#000";
        overlay.style.opacity = 0.7;
        overlay.style.filter = "alpha(opacity=70)";
        overlay.style.zIndex = 600;

        overlay.appendChild( content );
        
        var html = document.getElementsByTagName("html")[0];
        html.style.width = "100%";
        html.style.height = "100%";

        var body = document.getElementsByTagName("body")[0];

        body.insertBefore(overlay, body.firstChild);
        body.insertBefore(content, overlay);
        body.style.width = "100%";
        body.style.height = "100%";
        
        overlay.setAttribute("id", "OverAlertIE6");
        content.setAttribute("id", "ContAlertIE6");

    },

    // Created by: Simon Willison
    // http://simon.incutio.com/archive/2004/05/26/addLoadEvent
    addLoadEvent: function(func) {
        var oldonload = window.onload;
        if (typeof window.onload != 'function') {
            window.onload = func;
        } else {
            window.onload = function() {
                if (oldonload) {
                    oldonload();
                }

                func();
            }
        }
    }
};

ie6block.addLoadEvent( ie6block.init );