	var Captcha = new function() {
		this.captcha = null;
		this.form = null;
		
		this.init = function() {
		
			var self = Captcha;
			self.form = document.getElementById('mailform');
			self.captcha = document.getElementById('captcha');        
		
			self.captcha.innerHTML = "<img id='captcha_img' src='http://www4.lib.purdue.edu/captcha/image.php?id=55&auth=a52511c7d664c98df32b4b18f056c2e6&image=get' /><br /><b>Please enter the text you see in the image above</b><br /><input id='captcha_text' type='text' name='user_cap' /><br /><br />";
		};
	};

	function refreshImage(){
		var img = document.getElementById('captcha_img');
		var txt = document.getElementById('captcha_text');
		
		var time = new Date().getTime();	//to append to img src
		if (img && txt){
			img.src = img.src + '?rand=' + time;
			txt.value = '';
		}
	}
	refreshImage();
	
	function appendOnLoad(func){
		var exist = window.onload;
		if (exist)
			window.onload = function() { exist(); func(); }
		else
			window.onload = func;
	}
	
	window.onload = Captcha.init;
	