// +-----------------+
// | Les traductions |
// +-----------------+

// Copyright Frank Milard - http://www.asaisir.com/a-la-page
// Vous pouvez utiliser ou modifier ce script librement
// sous reserve de laisser le copyright visible
// Last modified by Yann-Gaël Guéhéneuc, 00/10/22.
// Last modified by Yann-Gaël Guéhéneuc, 11/10/15.

// IE4      = (document.all)    ? 1 : 0;
// NS4      = (document.layers) ? 1 : 0;
// VERSION4 = (IE4 | NS4)       ? 1 : 0;

if (!(document.all || document.layers || document.getElementById)) {
    event = null;
}

function helpDown () {
    if (document.all) {
        // MSIE4
        document.all.helpBox.style.visibility = "hidden";
    }
    else if (document.layers) {
        // NS4
        document.helpBox.visibility = "hidden";
    }
    else {
        document.getElementById("helpBox").style.display = "none";
    }
}

function helpOver (event, text) {
    if (!(document.all || document.layers || document.getElementById)) {
        return;
    }

    var ptrObj, ptrLayer;
    if (document.all) {
        // MSIE4
        ptrObj = event.srcElement;
        ptrLayer = document.all.helpBox;
    } 
    else if (document.layers) {
        // NS4
        ptrObj = event.target;
        ptrLayer = document.helpBox;
    }
    else {
        ptrObj = event.target;
        ptrLayer = document.getElementById("helpBox");
        var strValue = "";
        if(document.defaultView && document.defaultView.getComputedStyle) {
            document.defaultView.getComputedStyle(ptrLayer, null);
        }
        else if(ptrLayer.currentStyle) {
            // For IE
        }
    }

    if (!ptrObj.onmouseout) {
        ptrObj.onmouseout = helpDown;
    }

    var mouseX, mouseY;
    if (document.all) {
        // MSIE4
        mouseX = window.event.clientX + document.body.scrollLeft;
        mouseY = window.event.clientY + document.body.scrollTop;
    }
    else {
        // NS4
        mouseX = event.pageX;
        mouseY = event.pageY;
    }
    
    var str = "<DIV CLASS='helpBoxDIV'>" + text + "</DIV>";
    if (document.all) {
        // MSIE4
        ptrLayer.innerHTML = str;
        ptrLayer.style.left = mouseX + 20;
        ptrLayer.style.top  = mouseY + 20;
        ptrLayer.style.visibility = "visible";
    } 
    else if (document.layers) {
        // NS4
        ptrLayer.document.write(str);
        ptrLayer.document.close();
        ptrLayer.left = mouseX + 20;
        ptrLayer.top  = mouseY + 20;
        ptrLayer.visibility = "show";
    }
    else {
        ptrLayer.innerHTML = str;
        ptrLayer.style.display = 'block'; 
        ptrLayer.style.top = mouseY - 20 + 'px'; 
        ptrLayer.style.left = mouseX + 10 + 'px'; 
    }
}

function helpOverPlus (event, frenchText, englishText, germanText, portugueseText, russianText) {
    var newText = "";
    if (frenchText != "") {
        newText += "<IMG WIDTH='18' HEIGHT='12' SRC='/Images/FlagFrance.gif' BORDER='0'></IMG>&#160;" + frenchText;
    }
    if (englishText != "") {
        if (newText != "") {
            newText += "<BR>";
        }
        newText += "<IMG WIDTH='18' HEIGHT='12' SRC='/Images/FlagUnitedKingdom.gif' BORDER='0'></IMG>&#160;" + englishText;
    }
    if (germanText != "") {
        if (newText != "") {
            newText += "<BR>";
        }
        newText += "<IMG WIDTH='18' HEIGHT='12' SRC='/Images/FlagGermany.gif' BORDER='0'></IMG>&#160;" + germanText;
    }
    if (portugueseText != "") {
        if (newText != "") {
            newText += "<BR>";
        }
        newText += "<IMG WIDTH='18' HEIGHT='12' SRC='/Images/FlagBrazil.gif' BORDER='0'></IMG>&#160;" + portugueseText;
    }
    if (russianText != "") {
        if (newText != "") {
            newText += "<BR>";
        }
        newText += "<IMG WIDTH='18' HEIGHT='12' SRC='/Images/FlagRussia.gif' BORDER='0'></IMG>&#160;<FONT FACE='ER Bukinist 1251'>" + russianText + "</FONT>";
    }

    helpOver (
        event,
        newText
    );
}

function changeContent(language) {
    if (this.location.href.indexOf('?') == -1) {
        this.location = this.location.href.split("?language=")[0] + "?language=" + language;
    }
    else {
        if (this.location.href.indexOf('?language') > -1) {
            this.location = this.location.href.split("?language=")[0] + "?language=" + language;
        }
        else {
            this.location = this.location.href.split("&language=")[0] + "&language=" + language;
        }
    }
}

