// remove error
function no_error(){return true;}
window.onerror=no_error;

//display a text in the status bar
function display_status_bar(text)
{window.status = text;}

//open a popup
function open_popup(page,width,Height)
{window.open(page,"Popup","status=no,scrollbars=no,resizable=no,width="+width+",height="+Height+",top=0,left=0");}

function closeWindow() 
{window.close();}

function loadFragmentInToElement(fragment_url, element_id)
{ 
    var thisElement = document.getElementById(element_id); 

    xmlhttp = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP");

    xmlhttp.open("GET", fragment_url); 
    xmlhttp.onreadystatechange = function()
    {
        if ( xmlhttp.readyState == 4 && xmlhttp.status == 200 )
        {
            thisElement.innerHTML = xmlhttp.responseText; 
        } 
    } 
    xmlhttp.send(null); 
} 

function consoleRefresh()
{ 
    loadFragmentInToElement('rpc/chat/chattxt.php', 'idconsole');
    setTimeout('consoleRefresh()',10000);
} 

function consoleAddMsg(sid, msg)
{
    loadFragmentInToElement('rpc/chat/chat.php?sid=' + sid + '&msg=' + escape(msg), 'idconsole');
} 

