Utils = {
    addLoadEvent : function(func) {
        var oldonload = window.onload;
        if (typeof window.onload != 'function') {
            window.onload = func;
        }
        else {
            window.onload = function() {
                oldonload();
                func();
            }
        }
    }
}

AjaxUtils = {
    replaceInnerHTMLWithUrl : function(targetElementId,url) {
        var targetElement = document.getElementById(targetElementId);
        targetElement.innerHTML = "<img src='images/spinner.gif'>";
        var callback = {
        //if our XHR call is successful, we want to make use of the returned data and create child nodes.
            success: function(oResponse) {
                var targetElement = document.getElementById(targetElementId);
                var responseText = oResponse.responseText;
                if(targetElement != null) {
                    targetElement.innerHTML = responseText;
                    YAHOO.log("innerHTML added sucessfully", "info", "example");
                }
            },

            failure: function(oResponse) {
                YAHOO.log("Failed to process XHR transaction.", "info", "example");
            },

            argument: {

            },

            timeout: 30000,

            cache: false
        };
        YAHOO.util.Connect.asyncRequest('GET', url, callback);
    }

}
