ContentInfo = "";
var mouse_X;
var mouse_Y;
var tip_active = 0;

function update_tip_pos()
{
    document.getElementById('ToolTip').style.left = mouse_X + 15;
    document.getElementById('ToolTip').style.top  = mouse_Y;
}

var ie = document.all?true:false;
    document.onmousemove = getMouseXY;
function getMouseXY(e)
{
    if (ie)
    { // grab the x-y pos.s if browser is IE
        mouse_X = event.clientX + document.body.scrollLeft;
        mouse_Y = event.clientY + document.body.scrollTop;
    }
    else
    { // grab the x-y pos.s if browser is NS
        mouse_X = e.pageX;
        mouse_Y = e.pageY;
    }

    if (mouse_X < 0){mouse_X = 0;}
    if (mouse_Y < 0){mouse_Y = 0;}
    if(tip_active){update_tip_pos();}
}

function EnterContent(TContent)
{
    ContentInfo = ''+TContent+'';
}

function tip_it(which, TContent)
{
	if(which)
	{
		update_tip_pos();
		tip_active = 1;
		document.getElementById('ToolTip').style.visibility = "visible";
		EnterContent(TContent);
		document.getElementById('ToolTip').innerHTML = ContentInfo;
	}
	else
	{
		tip_active = 0;
		document.getElementById('ToolTip').style.visibility = "hidden";
	}
}

function toggle(nr)
{
    toggle_el(nr);
}

function toggle_el(nr)
{
    if (document.getElementById(nr).style.display == 'block')
        document.getElementById(nr).style.display = 'none';
    else
        document.getElementById(nr).style.display = 'block';
}

var AJAXxmlHttpObj = false;
var AJAXxmlHttpObjBusy = false;
var AJAXElementToUpdate = null;

function AJAXcreateObject()
{
    try
    {
        AJAXxmlHttpObj = new ActiveXObject("Msxml2.XMLHTTP");
    }
    catch (e)
    {
        try
        {
            AJAXxmlHttpObj = new ActiveXObject("Microsoft.XMLHTTP");
        }
        catch (E)
        {
            AJAXxmlHttpObj = false;
        }
    }

    if (!AJAXxmlHttpObj && typeof XMLHttpRequest!='undefined')
    {
        AJAXxmlHttpObj = new XMLHttpRequest();
    }
}

function AJAXprocessResponseEval()
{
    if (!AJAXxmlHttpObj)
		 return;

    if (AJAXxmlHttpObj.readyState == 4)
    {
        AJAXxmlHttpObjBusy = false;
        if (AJAXxmlHttpObj.responseText != "")
        {
            try
            {
                eval(AJAXxmlHttpObj.responseText);
            }
            catch(E)
            {
                // do nothing
            }
        }
    }
}

function AJAXmakeRequest(request_url)
{
    if (AJAXxmlHttpObjBusy || !AJAXxmlHttpObj)
        return;

    AJAXxmlHttpObjBusy = true;
    AJAXxmlHttpObj.open("GET", request_url);
    AJAXxmlHttpObj.onreadystatechange = AJAXprocessResponseEval;
    AJAXxmlHttpObj.send(null);
}

function AJAXprocessResponseWithUpdate()
{
    if (!AJAXxmlHttpObj)
         return;

    if (AJAXxmlHttpObj.readyState == 4)
    {
        AJAXxmlHttpObjBusy = false;
        if (AJAXxmlHttpObj.responseText != "" && AJAXElementToUpdate)
            AJAXElementToUpdate.innerHTML = AJAXxmlHttpObj.responseText;
        else
            AJAXElementToUpdate.innerHTML = "error";
    }
}

function AJAXmakeRequestAndUpdate(request_url, element_id)
{
    AJAXElementToUpdate = null;
    if (AJAXxmlHttpObjBusy || !AJAXxmlHttpObj)
        return;

    AJAXElementToUpdate = document.getElementById(element_id);

    AJAXxmlHttpObjBusy = true;
    AJAXxmlHttpObj.open("GET", request_url);
    AJAXxmlHttpObj.onreadystatechange = AJAXprocessResponseWithUpdate;
    AJAXxmlHttpObj.send(null);
}

function AJAXinit()
{
    AJAXcreateObject();
    AJAXxmlHttpObjBusy = false;
}

AJAXinit();