var info_http = false;
function wbids_info_init()
{
    var body = document.getElementsByTagName('body')[0];

    var info_div = document.createElement('div');
    info_div.id = 'info_div';
    info_div.style.position = 'absolute';
    info_div.style.left = '0px';
    info_div.style.top = '0px';
    info_div.style.padding = '0px';

    // div style
    info_div.style.backgroundImage = 'url("layout/img/popupbg.png")';
    info_div.style.border = '1px solid black';
    info_div.style.display = 'none';
    info_div.style.fontSize = '12px';
    info_div.style.fontFamily = 'Arial';
    info_div.style.color = 'black';
    info_div.style.width = '500px';
    info_div.style.textAlign = 'left';
    info_div.style.padding = '10px';

    // top bar
    var bar = document.createElement('div');
    bar.id = 'info_div_bar';
    bar.style.width = '494px';
    bar.style.height = '14px';
    bar.style.fontSize = '12px';
    bar.style.lineHeight = '14px';
    //bar.style.borderBottom = '1px solid black';
    bar.style.fontWeight = 'bold';
    bar.style.padding = '3px';
    bar.innerHTML = lang_arr['INFORMATION'];

    // close button
    var button = document.createElement('div');
    button.id = 'info_div_button';
    button.style.position = 'absolute';
    button.style.top = '3px';
    button.style.right = '3px';
    button.style.fontSize = '12px';
    button.style.lineHeight = '12px';
    button.style.fontWeight = 'bold';
    button.style.cursor = 'pointer';
    button.innerHTML = '['+lang_arr['CLOSE']+']';
    button.onclick = wbids_info_hide;

    var content = document.createElement('div');
    content.id = 'info_div_content';
    content.style.padding = '3px';
    content.style.lineHeight = '14px';

    info_div.appendChild(bar);
    info_div.appendChild(content);
    info_div.appendChild(button);
    body.appendChild(info_div);

    if( typeof XMLHttpRequest == "undefined" ) XMLHttpRequest = function() {
        try { return new ActiveXObject("Msxml2.XMLHTTP.6.0") } catch(e) {}
        try { return new ActiveXObject("Msxml2.XMLHTTP.3.0") } catch(e) {}
        try { return new ActiveXObject("Msxml2.XMLHTTP") } catch(e) {}
        try { return new ActiveXObject("Microsoft.XMLHTTP") } catch(e) {}
        throw new Error( "This browser does not support XMLHttpRequest." );
    };

    info_http = new XMLHttpRequest();
}

function wbids_info(msg)
{
    var info_div = document.getElementById('info_div');
    var info_div_content = document.getElementById('info_div_content');

    var tmp = msg;
    tmp = tmp.replace(/</g, "&lt;");
    tmp = tmp.replace(/>/g, "&gt;");
    tmp = tmp.replace(/\n/g, "<br />");

    info_div.style.left = '50%';
    info_div.style.marginLeft = '-250px';
    info_div.style.top = '100px';
    info_div_content.innerHTML = tmp;
    info_div.style.display = 'block';
}

function wbids_info_hide()
{
    var info_div = document.getElementById('info_div');
    info_div.style.display = 'none';

    // do AJAX here (OKAY, just a HTTP request, geez...)
    if(!info_http) {
        wbids_info_init();
    }

    info_http.open('GET', 'infoset.php', false);
    info_http.send('');
}

/* vim:set et sw=4 sts=4: */
