// Disable JavaScript error alerts
window.onerror=null;

// --- create XMLHttpRequest object: begin
function createxmlhttp() {
    var xmlhttp; // = false;
    try {
        xmlhttp = new XMLHttpRequest();
    } catch (trymicrosoft) {
        try {
            xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
        } catch (othermicrosoft) {
            try {
                xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
            } catch (failed) {
                xmlhttp = false;
            }
        }
    }
    return xmlhttp;
}
// --- create XMLHttpRequest object: end

// --- request to download HTML events block: begin
function dorequestevents(ipoint) {
    var xmlhttp = createxmlhttp();
    var url = "/ajax/";
    var param = "ipoint=" + escape(ipoint) + "&doit=events&" + escape(Math.random());
    xmlhttp.open("POST", url, true);
    xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=utf-8");
    xmlhttp.onreadystatechange = function () {
        if (xmlhttp.readyState == 4) {
            if (xmlhttp.status == 200) {
                // var response = 0;
                var response = xmlhttp.responseText;
                if (response.length > 0) {
                    document.getElementById("block0events").innerHTML = response;
                    document.getElementById("block1events").innerHTML = response;
                }
            }
        }
    }
    xmlhttp.send(param);
return(0);
}
// --- request to download HTML events block: end

// --- hide and display of elements with CSS: begin
function csshide(thePoint,doIt) {
    var element = 'display';
    var cssRules;
    if (document.all) {
        cssRules = 'rules';
    } else if (document.getElementById) {
        cssRules = 'cssRules';
    }
    for (var S = 0; S < document.styleSheets.length; S++) {
        for (var R = 0; R < document.styleSheets[S][cssRules].length; R++) {
            if (document.styleSheets[S][cssRules][R].selectorText == thePoint) {
                if (doIt == 'show') {
                    document.styleSheets[S][cssRules][R].style[element] = 'block';
                } else if (doIt == 'none') {
                    document.styleSheets[S][cssRules][R].style[element] = 'none';
                } else if (document.styleSheets[S][cssRules][R].style[element] == 'none') {
                    document.styleSheets[S][cssRules][R].style[element] = 'block';
                } else {
                    document.styleSheets[S][cssRules][R].style[element] = 'none';
                }
            }
        }
    }
}
// --- hide and display of elements with CSS: end

// --- reload captcha image: begin
function reloadcaptcha(strin) {
    if (strin.length > 0) {
        document.getElementById(strin).src = "/apt/?tsess=" + getcookievalue("tsess") + "&" + escape(Math.random());
    }
}
// --- reload captcha image: end

// --- obtain values for the parameter name cookie: begin
function getcookievalue(strin) {
    var cookie = " " + document.cookie;
    var search = " " + strin + "=";
    var strout = null;
    var offset = 0;
    var end = 0;
    if (cookie.length > 0) {
        offset = cookie.indexOf(search);
        if (offset != -1) {
            offset += search.length;
            end = cookie.indexOf(";", offset)
            if (end == -1) {
                end = cookie.length;
            }
            strout = unescape(cookie.substring(offset, end));
        }
    }
    return(strout);
}
// --- obtain values for the parameter name cookie: end
