<!--
/* SVN FILE: $Id: captcha.js 57 2008-09-03 10:26:21Z Chris $ */
/**
 * Allows refreshing of the captcha image
 *
 * Displays the refresh link and adds the onclick event to it
 *
 * @copyright    Copyright 2008 PBM Web Development - All Rights Reserved
 * @package      app
 * @subpackage   app.webroot.js
 * @since        V1.0.0
 * @version      $Revision: 57 $
 * @modifiedby   $LastChangedBy: Chris $
 * @lastmodified $Date: 2008-09-03 11:26:21 +0100 (Wed, 03 Sep 2008) $
 */

function captcha(url) {
  if (!document.getElementById || !document.images) return false;

  document.write('<div class="rollover refresh"><a id="refresh-captcha" title="Get a new CAPTCHA image"><img src="/css/img/refresh.png" alt="Refresh CAPTCHA" /></a></div>');

  refreshLink = document.getElementById("refresh-captcha");

  refreshLink.onclick = function() {
   document.images.captcha.src = url + '?' + (Math.round(Math.random(0)* 1000) + 1).toString();
  }
}
// -->