function validateCaptcha(hash,answer,formname) {
	// call the validate captcha function in our CFC passing the form values for the hash and the answer
	DWREngine._execute(_ajaxConfig._cfscriptLocation,null,'validateCaptcha',captchaValidated,hash,answer,formname);
}

// this function is called when the result is returned from the component
function captchaValidated(result) {
	if (result.valid == false) {
		alert("You have entered the incorrect captcha text, please try again");
	}
	else {
		document[result.formname].submit();
	}
}

// this function allows you to display a new captcha to the user in case they cannot read the current one
function newCaptcha(name,formname) {
	DWREngine._execute(_ajaxConfig._cfscriptLocation,null,'getNewCaptchaHash',showNewCaptcha,name,formname);
}

function showNewCaptcha(result) {
	// reload the image source with the newly generated hash and replace the hash in the hidden form field
	document[result.formname]['captchaImage_'+result.name].src = "http://www.dcprint.co.uk/dcprint-displayCaptcha.cfm?hashReference="+result.ref;
	document[result.formname]['hashRef_'+result.name].value = result.ref;
}

/*

**Note!!!!!!
'captchaService.cfc' function 'validateCaptcha' has been modified to allow the passing of the form name supplied,
this is used to allow the same script to process multiple forms without too much modification to 'CFC_dcprint-Display.cfc'

<cffunction name="validateCaptcha" access="public" returntype="struct" output="false"
	hint="Validates a captcha by hash and user response text.">
	<cfargument name="hash" type="string" required="true" />
	<cfargument name="text" type="string" required="true" />
	<cfargument name="formName" type="string" required="true" />
	<cfset variables.result.valid=NOT Compare(arguments.hash, getHash(arguments.text))>
	<cfset variables.result.formName=arguments.formName>
	<cfreturn variables.result />
</cffunction>

*/