YAHOO.namespace("ezHandler");


/**
 * Generic asynch response handler.  It will set the specified arg objects
 * argument.responseArea values innerHTML to the responseText.
 * @param object
 * @return void
 * @since 2006.10.13
 */
YAHOO.ezHandler.ezHandleSuccess = function(o) {

    content = o.argument.responseArea;
    contentArea = document.getElementById(content);
    contentArea.innerHTML = o.responseText;

};


/**
 * This will handle a generic asynch failure.  In the argument object passed
 * to the request you can specify a errorMessage property to define a custom
 * error message.
 * @param object
 * @return void
 * @since 2006.10.13
 */
YAHOO.ezHandler.ezHandleFailure = function(o) {

    content = o.argument.responseArea;
    contentArea = document.getElementById(content);

    if (o.responseText !== undefined) {
        if (o.argument.errorMessage !== undefined) {
            contentArea.innerHTML = o.argument.errorMessage;
        } else {
            contentArea.innerHTML = "There was a problem updating the data.  Please try again.";
        }
    }
};
