// Copyright (C) 2008 Pete Hall
	var validHash = '0';
	var hashId = 0;
	this.domain = 'cleansweepfarm.com';
//	this.domain = 'hall.tld';
	
	function loaded() {
		document.domain = this.domain;
	}
	
	function testHash() {
		var content = null;
		try {
		 	var obj = document.getElementById("comarea");
		 	if (obj.contentDocument) {
				content = obj.contentDocument;
			} else {	
				content = obj.contentWindow.document;
			}	
			validHash = content.getElementById('result').innerHTML;
			validate();
		} catch (e) { }
	}
	 
	function getSecureImage() {
		var secureImage = document.getElementById('secure_image');
		var comarea = null;
		secureImage.src = 'captcha' + new Date().valueOf() + '.jpg';
		comarea = document.getElementById('comarea');
		if (window.addEventListener) { // Mozilla, FF, NS
			comarea.addEventListener('load', testHash, false) ;
		} else { 
			comarea.attachEvent('onload', testHash);
		}
	}
	
	function requestHash() {
		var obj = document.getElementById("comarea");
	 	validHash = '0';
	 	okToContinue = false;
	 	obj.src='scripts/test_hash.php?hash='+hex_md5(trim(document.getElementById('security_code').value));
	 }
	 
	function isEmpty(aName) {
		if (trim(document.getElementById(aName).value) == '') {
			return true;
		} else {
			return false;
		}
	}

	function trim(theString) {
		var aString = theString.replace( /^\s+/g, "" );
		return aString.replace( /\s+$/g, "" );
	}

