/* 
 * compat.js: Javascript compatiblity library.
 * Supported browsers: IE4+, NN6+, konqueror.
 *
 * Copyright (c) 2001 Geert Jansen. 
 * Copyright (c) 2002 WiseGuys Internet BV.
 * All rights reserved.
 */

function parentNode(el)
{
    if (el.parentNode)
	return el.parentNode;
    return el.parentElement;
}

function childNodes(el)
{
    if (el.childNodes)
	return el.childNodes;
    return el.children;
}

function ancestorNode(el, tagname)
{
    while (parentNode(el) &&
	    (!el.tagName || (el.tagName.toLowerCase() != tagname)))
    {
        el = parentNode(el);
    }
    return el;
}

function getElementById(id, w)
{
    if (w == null)
	w = window;
    if (w.document.getElementById)
	return w.document.getElementById(id);
    return w.document.all[id];
}

function getElementsByTagName(tagname, w)
{
    if (w == null)
	w = window;
    if (w.document.getElementsByTagName)
	return w.document.getElementsByTagName(tagname);
    return w.document.all.tags(tagname);
}

function srcElement(event)
{
    if (event.srcElement)
	return event.srcElement;
    return event.target;
}

function activecursor()
{
    if (navigator.userAgent.indexOf("MSIE") > 0)
	document.body.style.cursor = 'hand';
    else
	document.body.style.cursor = 'pointer';
}

function normalcursor()
{
    document.body.style.cursor = 'auto';
}

function tablerow()
{
    if (navigator.userAgent.indexOf("MSIE") > 0)
	return "block";
    else
	return "table-row";
}

function setStyle(el, style)
{
    if (el.style.cssText != null)
	el.style.cssText = style
    else
	el.setAttribute('style', style)
}
