//Generic function to bump a new function into the body onLoad='...' queue
function addLoadEvent(func) 
{ 
    var oldonload = window.onload; 
    if (typeof window.onload != 'function') 
        window.onload = func; 
    else 
        window.onload = function() 
        { 
            if (oldonload) 
                oldonload(); 
             
            func(); 
        } 
} 


//Generic function to bump a new function into the body onunload='...' queue
function addUnloadEvent(func) 
{ 
    var oldonunload = window.onunload; 
    if (typeof window.onunload != 'function') 
        window.onunload = func; 
    else 
        window.onunload = function() 
        { 
            if (oldonunload) 
                oldonunload(); 
             
            func(); 
        } 
} 







/**
 * Javascript code for dynamically hiding and showing objects
 *
 * These are some library javascript functions that you can use to easily
 * change the visibitity of objects based just on their ID value. 
 *
 * This code will work in all the basic browsers.
 *
 * @Copyright: ©2007 Daniel Trembath. All rights reserved. See http://www.314.net.au/software_licensing.php for details.
 * @author Daniel Trembath <danielt@314.net.au> January 2007
 */


/* HIDE/SHOW Div tags code */

//Make a DIV tag visible
function showItem(id)
{
    document.getElementById(id).style.visibility = "visible";
    document.getElementById(id).style.display = "";
}

//Make a DIV tag invisible
function hideItem(id)
{
    document.getElementById(id).style.visibility = "hidden";
    document.getElementById(id).style.display = "none";
}

function toggleItemsVisibility(id)
{
    //Work out if the item is visible at the moment
    var currentVisibility;
    var currentDisplay;
    currentVisibility = document.getElementById(id).style.visibility;
    currentDisplay = document.getElementById(id).style.display;

    //Toggle that state
    if (currentVisibility == "visible")// || currentDisplay == "" )
        hideItem(id);
    else
        showItem(id);
}