function createRequestObj() {
    var xhr = false;
    try {
        xhr = new ActiveXObject("Microsoft.XMLHTTP");
    } catch (e) {
        xhr = new XMLHttpRequest();
    }
    return xhr;
}


function callWS(url, div)
{
    document.getElementById(div).innerHTML = '';
    var httpObj = createRequestObj();
    httpObj.onreadystatechange = function()
    {
         if (httpObj.readyState == 4) {
             if (httpObj.status == 200) {
                 document.getElementById(div).innerHTML = httpObj.responseText;
            } else {
                 document.getElementById(div).innerHTML = 'Http error: '  + httpObj.status;
            }
        }
    };

    httpObj.open('GET', url, true);
    httpObj.send(null);
}


function toggle(div)
{
    if (document.getElementById(div).innerHTML == '') {
        url = 'ws/' + div + '.html';
        callWS(url, div);
    } else {
        document.getElementById(div).innerHTML = '';
    }
}


