String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g,""); }

function submitSignup() {
	ColdFusion.Ajax.submitForm('emailform', '/ajaxAction.cfm', signupSuccess,signupError);
}

function signupSuccess(text) {
	thankstext = "<div id='body_text_no_p'>Thank you for your interest in Education Nation!</div>";
	document.getElementById('emailsignup').innerHTML = thankstext;
	//alert(text);
}

function signupError(code,msg) {
	errortext = "<div id='body_text_no_p'>There was a problem submitting your address. Please try again soon.</div>";
	document.getElementById('emailsignup').innerHTML = errortext;
}

// For Teacher Townhall Email Signup
function submitTTHSignup() {
	ColdFusion.Ajax.submitForm('emailform', '/ajaxAction.cfm', signupTTHSuccess, signupTTHError)
		
}

function signupTTHSuccess(text) {
	thankstext = "<div id='body_text_no_p'>Thank you! We look forward to your participation in the 2011 Teacher Town Hall.</div>";
	document.getElementById('emailsignup_tth').innerHTML = thankstext;
	//alert(text);
}

function signupTTHError(code,msg) {
	errortext = "<div id='body_text_no_p'>There was a problem submitting your address. Please try again soon.</div>";
	document.getElementById('emailsignup_tth').innerHTML = errortext;
}

//For Scholastic Sweepstakes
function submitScholSweeps(){
	ColdFusion.Ajax.submitForm('scholasticForm','/members/ajaxAction2011.cfm',scholSuccess,scholError);
}

function scholSuccess(text) {

	var x = text.trim();
	//alert(x);
	if (x == 0){
		thankstext = "<div id='body_text_no_p'>You must be an educator and logged into EducationNation.com to enter.</div>";	
	}else{
		thankstext = "<div id='body_text_no_p'>Thank you! You have been entered in the sweepstakes.</div>";	
	}

	
	document.getElementById('schol_text').innerHTML = thankstext;
	//alert(text);
}

function scholError(code,msg) {
	errortext = "<div id='body_text_no_p'>There was a problem submitting your entry. Please try again soon.</div>";
	document.getElementById('schol_text').innerHTML = errortext;
}


