  function ajaxUpdate( divName, url, params, onSuccessFunction, onFailureFunction, method, onCompleteFunction, async )
  {
    method = getMethod( method );
    params = getParams( method, params );
    onFailureFunction = getOnFailureFunction( onFailureFunction );
    onSuccessFunction = getOnSuccessFunction( onSuccessFunction );
    onCompleteFunction = getOnCompleteFunction( onCompleteFunction );
    async = getAsync( async );
    var loadedDiv = $( divName );
    if( !loadedDiv )
    {
      throw new Error( 'Unable to find div for <' + divName + '>' );
    }
    new Ajax.Updater( { success: divName },
                      url,
                      {
                        asynchronous: async,
                        method: method,
                        parameters: params,
                        onFailure: onFailureFunction,
                        onSuccess: onSuccessFunction,
                        onComplete: onCompleteFunction,
                        evalScripts: true
                      }
                    );
  }
  function ajaxRequest( url, params, onSuccessFunction, onFailureFunction, method, async )
  {
    method = getMethod( method );
    params = getParams( method, params );
    onFailureFunction = getOnFailureFunction( onFailureFunction );
    onSuccessFunction = getOnSuccessFunction( onSuccessFunction );
    async = getAsync( async );
    new Ajax.Request( url,
                      {
                        asynchronous: async,
                        method: method,
                        parameters: params,
                        onFailure: onFailureFunction,
                        onSuccess: onSuccessFunction,
                        evalScripts: true
                      }
                    );
  }
  function getOnSuccessFunction( onSuccessFunction )
  {
    if( !onSuccessFunction )
    {
      onSuccessFunction = defaultOnSuccess;
    }
    return onSuccessFunction;
  }
  function getOnFailureFunction( onFailureFunction )
  {
    if( !onFailureFunction )
    {
      onFailureFunction = defaultOnFailure;
    }
    return onFailureFunction;
  }
  function getOnCompleteFunction( onCompleteFunction )
  {
    if( !onCompleteFunction )
    {
      onCompleteFunction = defaultOnComplete;
    }
    return onCompleteFunction;
  }
  function getParams( method, params )
  {
    if( method == 'get' )
    {
      params = params + '&foo=' + makeRandomString();
    }
    return params;
  }
  function getMethod( method )
  {
    if( !method || method == '' )
    {
      method = 'post';
    }
    return method;
  }
  function getAsync( async )
  {    
    if( async == null )
    {
      async = true;
    }
    return async;
  }
  function defaultOnComplete( request )
  {
    //do nothing
  }
  function defaultOnSuccess( request )
  {
    //do nothing
  }
  //the divId param will never be passed by the default
  //call, but this allows to pass this param down
  //manually if we so desire (see editProfile.js)
  function defaultOnFailure( request, divId )
  {
    var errText = getStatusText( request );
    if( errText && errText.length > 0 )
    {
      setErrorInlineReceipt( errText, divId );
    }
    else
    {
      setErrorInlineReceipt( 'Internal Error.', divId );
    }
  }
  
  function getStatusText( request )
  {
    return decodeURIComponent( request.statusText );
  }
