/*
 * CAPTCHA management functions for the YAHOO.applegate.captcha namespace.
 * Assumes that the namespace is already created (see global-layout.js)
 */

(function(){
  YAHOO.namespace("applegate.captcha");
  var Dom = YAHOO.util.Dom,
  captcha = YAHOO.applegate.captcha,
  lang = YAHOO.lang;

  /**
   * Handle refreshing the CAPTCHA image
   */
  captcha.handleNewCaptcha = function() {
    Dom.get('challenge').src = 'challenge.captcha?t=' + captcha.bustCache();
  };

  /**
   * Prevent IE from caching result
   */
  captcha.bustCache = function() {
    var date = new Date();
    return date.getMilliseconds() + Math.random();
  };

})();