var message_en="<p>\
    We detected you may be currently using Internet Explorer.\
    Internet Explorer does not support many important web standards defined\
    by competent international organizations, or supports them in a wrong way.\
    To improve your browsing experience and your security, please download \
    <a href=\"http://www.mozilla.com\">Firefox</a>.<br/ >\
    If you are not really using Internet Explorer but your browser is set\
    to pretend to be IE, you can disable this message by letting your browser\
    identify with it's own user agent.\
</p>"
var message_it = "<p>\
    Abbiamo rilevato che potresti stare usando Internet Explorer.\
    Internet Explorer non supporta molti importanti standard web definiti\
    dalle organizzazioni internazionali preposte, o li supporta in modo erroneo.\
    Per migliorare la tua navigazione e la tua sicurezza, scarica \
    <a href=\"http://www.mozilla.com\">Firefox</a>.<br />\
    Se non stai usando davvero internet Explorer, ma semplicemente il tuo\
    browser si identifica come tale, puoi disabilitare questo messaggio\
    facendo indetificare il tuo browser con il corretto User-Agent.\
</p>";

var head = "<div id=\"closeButton\" onclick=\"closeAndKeepClosed();\">X</div>";

function getLanguage() {
    if (navigator.userLanguage) {
	return(navigator.userLanguage);
    } else if (navigator.language) {
	return(navigator.language);
    } else {
	return("(Not supported)");
    }
}

var language = getLanguage();

/**
 * Sets a Cookie with the given name and value.
 *
 * name       Name of the cookie
 * value      Value of the cookie
 * [expires]  Expiration date of the cookie (default: end of current session)
 * [path]     Path where the cookie is valid (default: path of calling document)
 * [domain]   Domain where the cookie is valid
 *              (default: domain of calling document)
 * [secure]   Boolean value indicating if the cookie transmission requires a
 *              secure transmission
 */
 function setCookie(name, value, expires, path, domain, secure)
{
    document.cookie= name + "=" + escape(value) +
        ((expires) ? "; expires=" + expires.toGMTString() : "") +
        ((path) ? "; path=" + path : "") +
        ((domain) ? "; domain=" + domain : "") +
        ((secure) ? "; secure" : "");
}

/**
 * Gets the value of the specified cookie.
 *
 * name  Name of the desired cookie.
 *
 * Returns a string containing value of specified cookie,
 *   or null if cookie does not exist.
 */
function getCookie(name)
{
    var dc = document.cookie;
    var prefix = name + "=";
    var begin = dc.indexOf("; " + prefix);
    if (begin == -1)
    {
        begin = dc.indexOf(prefix);
        if (begin != 0) return null;
    }
    else
    {
        begin += 2;
    }
    var end = document.cookie.indexOf(";", begin);
    if (end == -1)
    {
        end = dc.length;
    }
    return unescape(dc.substring(begin + prefix.length, end));
}

function closeAndKeepClosed(){
    ierr = document.getElementById("ieerror");
    ierr.style.display = "none";
    var date = new Date();
    var days = 10;
    date.setTime(date.getTime()+(days*24*60*60*1000));
    setCookie("hasClosed", "true", date, "/");
}

function iecheck(){

    if (is_ie5 || is_ie5_5 || (is_ie && is_mac)) {
        alert("This website is not compatible with IE 5 and older.\n Please     download Firefox: www.mozilla.com");
    }
    var message;
    var show;
    
    if (language.indexOf("it") != -1){
        message = head + message_it;
    } else {
        message = head + message_en;
    }
    
    if (getCookie("hasClosed")=="true"){
        show = false;
    } else {
        show = true;
    }
    
    if (is_ie6up && show){
        ierr = document.getElementById("ieerror");
        ierr.style.display = "block";
        ierr.innerHTML = message;
    }
}

/* document.write('<div id="banner"><script language="javascript" src="http://ad.altervista.org/alternet.ad?c=19&f=1&'+new Date().getTime()+'"><\/script></div>'); */
