function getXmlHttp() {
        var xmlhttp;
        if (window.XMLHttpRequest) {
                xmlhttp = new XMLHttpRequest();
        }
        else {
                xmlhttp = new ActiveXObject('Microsoft.XMLHTTP');
        }
        return xmlhttp;
}


function SendGetRequest(container, url) {
        var xmlhttp = getXmlHttp();
        xmlhttp.open('GET', url, true);
        xmlhttp.onreadystatechange = function() {
                if (xmlhttp.readyState == 4) {
                        if(xmlhttp.status == 200) {
                                try {
                                        restxt = xmlhttp.responseText;
                                        document.getElementById(container).innerHTML = restxt;
                                }
                                catch(err) {
                                }
                        }
                }
        };
        xmlhttp.send(null);
}

var rated = 0;
function UpdateRate(container, url) {
        if (rated == 0) {
                SendGetRequest(container, url);
                rated = 1;
        }
}

function UpdateContainerFromUrl(container, url) {
        var xmlhttp = getXmlHttp();
        xmlhttp.open('GET', url, true);
        xmlhttp.onreadystatechange = function() {
                if (xmlhttp.readyState == 4) {
                        if(xmlhttp.status == 200) {
                                try {
                                        restxt = xmlhttp.responseText;
                                        document.getElementById(container).innerHTML = document.getElementById(container).innerHTML+restxt;
                                }
                                catch(err) {
                                }
                        }
                }
        };
        xmlhttp.send(null);
}

function ShowTab(tabnum, tabcount, tab_prefix, tab_head_prefix) {
        for (i = 1; i <= tabcount; i++) {
                if (i == tabnum) {
                        document.getElementById(tab_prefix + i).style.display = '';
                        document.getElementById(tab_head_prefix + i).className = 'active';
                }
                else {
                        document.getElementById(tab_prefix + i).style.display = 'none';
                        document.getElementById(tab_head_prefix + i).className = '';
                }
        }
}
