/**
 *  Add a function to the onload event
 *  
 *  @param function Function to add
 *  @return void
 */
function addOnload(newFunction) {
    var oldOnload = window.onload;
    
    if (typeof oldOnload == "function") {
        window.onload = function() {
            if (oldOnload) {
                oldOnload();
            }
            newFunction();
        }
    } else {
        window.onload = newFunction;
    } 
}

/**
 *  Set the default text for a search box
 *  
 *  @param string Search box id
 *  @param string Search box text
 *  @return void
 */
function prepareSearchBox(searchBoxId,searchBoxText) {
    if ('' != searchBoxText && document.getElementById(searchBoxId)) {
        
        if ('' == document.getElementById(searchBoxId).value)
            document.getElementById(searchBoxId).value = searchBoxText;
        
        document.getElementById(searchBoxId).onfocus = function()
        {
            if (this.value == searchBoxText) this.value = '';
        }
        document.getElementById(searchBoxId).onblur = function()
        {
            if (this.value == '') this.value = searchBoxText;
        }
    }
}
