		var poopage = 1;
		function getCheckedValue(radioObj) {
			if(!radioObj)
				return "";
			var radioLength = radioObj.length;
			if(radioLength == undefined)
				if(radioObj.checked)
					return radioObj.value;
				else
					return "";
			for(var i = 0; i < radioLength; i++) {
				if(radioObj[i].checked) {
					return radioObj[i].value;
				}
			}
			return "";
		}
		function joinNewsletter(obj) {
				var url = "/actions/process_newsletter.php";
				var params = "ajax=1&name=" + encodeURI( document.getElementById("nlname").value ) +
					    "&email=" + encodeURI( document.getElementById("nlemail").value );
				var aj = new Ajax.Request(
								url,
								{
									method: 'post',
									parameters: params,
									onSuccess: updateNLDiv
								});
				return false;
		}
		function updateNLDiv(response) {
			$('newsletter').innerHTML = '<div style="float:left; width:auto; font-family:Verdana, Arial, Helvetica, sans-serif; font-weight:bold; color:#fff; text-align:center; padding-top:16px; margin:auto; margin-left: 300px">Thank you for joining the newsletter!</div>';
			// response.responseText
		}
		function submitPoll(obj, pollid) {
			var url = "/actions/process_poll2.php";
			var params = "ajax=1&pollid=" + pollid + "&voteid=" + obj;
			var aj = new Ajax.Request(
							url,
							{
								method: 'post',
								parameters: params,
								onSuccess: updatePoll
							});
			return false;
		}
		function updatePoll(response) {
			$('thepoll').innerHTML = response.responseText;
			// response.responseText
		}
		function morePoos(pp) {
			var url = "/actions/ajax_poos.php";
			var params = "ajax=1&disp=2&poopage=" + pp;
			var aj = new Ajax.Request(
							url,
							{
								method: 'post',
								parameters: params,
								onSuccess: updatePoos
							});
			return false;
		}
		function updatePoos(response) {
			$('homepoos').innerHTML = response.responseText;
			//alert($$('.poo')[0].id);
			$('go_poos').innerHTML = "<img style=\"cursor:pointer\" onclick=\"javascript:morePoos("+$$('.poo')[0].id+")\" alt=\"\" src=\"images/go.png\" width=\"54\" height=\"55\" />";
			$('go_poos_2').innerHTML = "<span onclick=\"morePoos("+$$('.poo')[0].id+")\">VIEW MORE POSTS!</span>";
			//<span onclick="morePoos(2)">VIEW MORE POSTS!</span>
			// response.responseText
		}
		
function validate_required(field,alerttxt) {
	with (field) {
		if (value==null||value=="")
		  {alert(alerttxt);return false;}
		else {return true}
	}
}

function validate_email(field,alerttxt) {
	with (field) {
		apos=value.indexOf("@");
		dotpos=value.lastIndexOf(".");
		if (apos<1||dotpos-apos<2) 
		  {alert(alerttxt);return false;}
		else {return true;}
	}
}

function validate_form(thisform) {
	with (thisform) {
		if (validate_required(tofname,"What's in a name? ...Nothing at the moment. Please tell us the receiver's first name.")==false)
		  {tofname.focus();return false;}
		if (validate_required(tolname,"Please tell us the receiver's last name, even if it is Poohead.")==false)
		  {tolname.focus();return false;}
		if (validate_required(toaddy1,"This is real poo we're dealing with, not internet poo. Please provide an address.")==false)
		  {toaddy1.focus();return false;}
		if (validate_required(tocity,"There once was a city of poo... only we don't know what city that is, so please tell us.")==false)
		  {tocity.focus();return false;}
		if (validate_required(tozip,"We need a zip code to send the poo to.")==false)
		  {tozip.focus();return false;}
		if (validate_required(code,"Those letters and numbers down there on that scratchy background... that's for you to type into the little box.")==false)
		  {code.focus();return false;}
		if (validate_required(fromemail,"We require an email address in order to send Poo. Don’t worry, it won’t be sold to a Nigerian Prince.")==false)
		  {fromemail.focus();return false;}
		if (validate_email(fromemail,"That doesn't look like a real email address. Who are you trying to fool?")==false)
		  {fromemail.focus();return false;}
	}
}
