// show the info popup
function showInfo(infoText)
{
    alert(infoText);
    return false;
}

// Sets the window status text that will appear in the browser's status bar.
function setStatus(statusText)
{
    window.status = statusText;
    return true;
}

// Sets the href of the window
function setWindowLocation(location)
{
    window.location.href = location;
    return false;
}

// Displays the help in a separate window
function openHelp(helpUrl)
{
    var helpWindow = window.open(helpUrl, "RAHelpWindow", "width=850,status=no,toolbar=no,menubar=no,location=no,scrollbars=yes,resizable=yes", false);
    helpWindow.focus();
    return false;
}

// Enables or disables buttons
function enableButton(btn, enable)
{
    if (btn == null)
    {
        return;
    }
	
    if (enable)
    {
        btn.disabled  = false;
        btn.className = "";
    }
    else
    {
        btn.disabled  = true;
        btn.className = "disabledButton";
    }
}


function isUndefined(a) {
    return typeof a == 'undefined';
}

function addBookMark(url, title)
{
    // user agent sniffing is bad in general, but this is one of the times
    // when it's really necessary
    var ua=navigator.userAgent.toLowerCase();
    var isKonq=(ua.indexOf('konqueror')!=-1);
    var isSafari=(ua.indexOf('webkit')!=-1);
    var isMac=(ua.indexOf('mac')!=-1);
    var buttonStr=isMac?'Command/Cmd':'CTRL';

    if(window.external && (!document.createTextNode ||
    (typeof(window.external.AddFavorite)=='unknown'))) {
      // IE4/Win generates an error when you
      // execute "typeof(window.external.AddFavorite)"
      // In IE7 the page must be from a web server, not directly from a local
      // file system, otherwise, you will get a permission denied error.
      window.external.AddFavorite(url, title); // IE/Win
    } else if(isKonq) {
    alert('You need to press CTRL + B to bookmark our site.');
    } else if(window.home || isSafari) { // Firefox, Netscape, Safari, iCab
    alert('You need to press '+buttonStr+' + D to bookmark this page.');
    } else if(!window.print || isMac) { // IE5/Mac and Safari 1.0
    alert('You need to press Command/Cmd + D to bookmark this page.');
    } else {
    alert('In order to bookmark this page you need to do so manually '+
      'through your browser.');
    }
}

function displayPreferences()
{
    var win = window.open("preferences.html", null,"top=270,left=250,height=270,width=628,status=yes,toolbar=no,menubar=no,location=no,scrollbars=no,resizable=no");
    win.focus();
}

function getPreviousSibling(node)
{
    var ret = node.previousSibling;
    while(ret != null && ret.nodeName == "#text")
    {
        ret = ret.previousSibling;
    }

    return ret;
}

function getNextSibling(node)
{
    var ret = node.nextSibling;
    while(ret != null && ret.nodeName == "#text")
    {
        ret = ret.nextSibling;
    }

    return ret;
}

