function invalid() {

	var why = "";

	if (document.frmSubscribe.x_subscriber_name.value=="") {
		why += "Your name is required.  Please re-enter.\n"
	}
	if (document.frmSubscribe.x_subscriber_email.value=="") {
		why += "Email address is required.  Please re-enter.\n"
	}
	if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(frmSubscribe.x_subscriber_email.value)){
		// valid email address so do nothing
		}else{
			why += "Please enter a valid email address.\n"
	}
	if(document.frmSubscribe.txtInput.value == ""){
		why += "Please enter the security code.\n";
	}
	if(document.frmSubscribe.txtInput.value != ""){
		if(ValidCaptcha(document.frmSubscribe.txtInput.value) == false){
			why += "Security code did not match.\n";
		}
	}

	if(why != ""){
		alert(why);
		return false;
	}
}

// Validate the Entered input aganist the generated security code function   
function ValidCaptcha(){
	var str1 = removeSpaces(document.getElementById('txtCaptcha').value);
	var str2 = removeSpaces(document.getElementById('txtInput').value);
	if (str1 == str2){
		return true;	
	}else{
		return false;
	}
}

// Remove the spaces from the entered and generated code
function removeSpaces(string){
	return string.split(' ').join('');
}

