String.prototype.trim = function() 
{
	return( this.replace(/^\s*([\s\S]*\S+)\s*$|^\s*$/,'$1') ); 
}

function CountWords(content){
	var i=0;
	var numberofwords=1;

	while(i<=content.length) {

		if (content.substring(i,i+1) == " ") {
			numberofwords++;
			i++; 
			// extra i++ makes it skip double spaces, or space/return
		}
		if (content.substring(i,i+1) == "\n") {
			numberofwords++;
			i++;
			// extra i++ makes it skip double spaces, or space/return
		}
	i++;
	}

return numberofwords;
}

function ClientValidate(source, arguments) { 
	if (document.all.chkConfirmation.status == true)
	{
		arguments.IsValid = true; 
	}
	else
	{
		alert('Please confirm you are authorised to give this details before continuing');
		arguments.IsValid = false; 
	}
} 

// check to see if no of words is less than or equal to 10
function CheckWords(oSrc, args){
	var str=args.Value;
	if(CountWords(str.trim())>10){
		args.IsValid = false;
	}
	else
	{
		args.IsValid = true;
	}
		
}
