/**
 * Loads new captcha image
 * 
 * <img src="/captcha.php" id="captchImg" />  
 * 
 * @version $Id$
 *  
 */
 
function captcha() {
  if(document.getElementById)
  {
		thesrc = document.getElementById("captchaImg").src;
		// extract image name from image source (i.e. cut off ?randomness)
    q =  thesrc.lastIndexOf('?');

    if(q != -1)
    {
      thesrc = thesrc.substring(0, q);
    }
		document.getElementById("captchaImg").src = thesrc + "?" + Math.round(Math.random() * 100000);    
	}
  else 
  {
    alert("Sorry, cannot autoreload image\nSubmit the form and a new image will be loaded");
	}
  
}

