function email_request(form){ http('post','actions.cfc?method=badEmail',email_response,'email='+form.email.value); }
function email_response(obj){
	if(obj)
		alert('We could not validate the email address you provided.\nPlease try another.');
	else
		validate_feedback(document.feedbackform);	
}

function send_request(form){ http('post','actions.cfc?method=sendFeedback',send_response,form); }
function send_response(obj){
	if(obj){
		alert('Your email has been sent.');
		location.reload();
	}else{
		alert('Your email could not be sent right now. Please try again later.');
	}
	
}

function validate_feedback(form){
	if(wordCount(form.email.value) && wordCount(form.subject.value) && wordCount(form.subject.value))
		send_request(form);
	else
		alert("Please add text to all the fiels before proceeding.");	
}

//pass any string into this and it will return how many words are in the string.
function wordCount(obj){
  	if(obj.length == 0){
		wordTotal = 0;
   	}else{
		regSpace = /\s/g;
  		aWords = obj.split(regSpace);
  		wordTotal = aWords.length;
	}	
return wordTotal;	
} 

