function trim(text){
	text = text.replace(/^\s+/, "");
	text = text.replace(/\s+$/, "");
	text = text.replace(/\s+/g, " ");
	return text;
}

function checkFeedbackForm(){		
	
	if (trim($("#text_01").val()).length < 2){
		alert("Please enter your first name.");
		$("#text_01").val(trim($("#text_01").val()));
		$("#text_01").focus();
		return false;
	}
	
	if (trim($("#text_05").val()).length < 2){
		alert("Please enter your message.");
		$("#text_05").val(trim($("#text_05").val()));
		$("#text_05").focus();
		return false;
	}
	
	return true;
}

function checkSubscribeForm(){		
	
	if (trim($("#newssign-name").val()).length < 2){
		alert("Please enter your first name.");
		$("#newssign-name").val(trim($("#newssign-name").val()));
		$("#newssign-name").focus();
		return false;
	}
	
	if (!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(trim($("#newssign-email").val())))){
		alert("Please enter a valid email address.");
		$("#newssign-email").val(trim($("#newssign-email").val()));
		$("#newssign-email").focus();
		return false;
	}
	
	return true;
}
