<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function GetXmlHttpObject()
{
	var xmlHttp=null;

	try
 	{
 		// Firefox, Opera 8.0+, Safari
 		xmlHttp=new XMLHttpRequest();
 	}
	catch (e)
 	{
 		// Internet Explorer
 		try
  		{
  			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
  		}
 		catch (e)
  		{
  			xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
  		}
 	}
	return xmlHttp;
}

// Form Validation
function validatePledge() 
{
	var field = document.forms.signup.pamount;

	if (!document.forms.signup.donationtype[1].checked)
	{
		alert('Please select \"Pledge per mile\" as your donation type.');
		field.focus();
		field.select();
		return false;
	}	if ( (parseFloat(field.value) != field.value))
	{
		alert('Please enter a number in the pledge amount field.');
		field.focus();
		field.select();
		return false;
	}
	if (field.value < .1)
	{
		alert('Please note that pledge amount is in cents, not dollars. The minimum pledge value is .1 (1 tenth of one cent).');
		field.focus();
		field.select();
		return false;
	}
	if (field.value > 300)
	{
		alert('The pledge amount is too generous.  Please lower.');
		field.focus();
		field.select();
		return false;
	}
	
	return true;
}

function validateDonation() 
{
	var field = document.forms.signup.damount;

	if ( (parseFloat(field.value) != field.value))
	{
		alert('Please enter a number in the the donation amount field.');
		field.focus();
		field.select();
		return false;
	}
	if (field.value > 10001)
	{
		alert('The donation amount is too generous.  Please lower.');
		field.focus();
		field.select();
		return false;
	}
	if (field.value < 1)
	{
		alert('Thank you for your interest.  However, we can not accept donations below $1 at this time.');
		field.focus();
		field.select();
		return false;
	}
	
	return true;
}

function validateZip(field) 
{
	var valid = "0123456789";
	
	if (field.value.length != 5) 
	{
		alert("Please enter your 5 digit zip code, numbers only.  If you are from a foreign country, please enter '000000'.");
		return false;
	}

	for (var i = 0; i < field.value.length; i++) 
	{
		temp = "" + field.value.substring(i, i+1);
		if (valid.indexOf(temp) == "-1") 
		{
			alert("Invalid characters in your zip code (5 digits only).  Please try again.");
			return false;
		}
	}

	return true;
}

function validateNumber(field, msg, min, max) 
{
	if (!min) { min = 0 }
	if (!max) { max = 255 }

	if ( (parseInt(field.value) != field.value) || field.value.length < min || field.value.length > max) 
	{
		alert(msg);
		field.focus();
		field.select();
		return false;
	}

	return true;
}

function validateString(field, msg, min, max) 
{
	if (!min) { min = 1 }
	if (!max) { max = 65535 }

	if (!field.value || field.value.length < min || field.value.max > max) 
	{
		alert(msg);
		field.focus();
		field.select();
		return false;
	}

	return true;
}

function validateState(field, msg) 
{
	if (!field.value || field.value.length != 2) 
	{
		alert(msg);
		field.focus();
		return false;
	}

	return true;
}

function validateEmail(email, email2, msg) 
{
	var re_mail = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-])+\.)+([a-zA-Z])+$/;
	if (!re_mail.test(email.value)) 
	{
		alert(msg);
		email.focus();
		email.select();
		return false;
	}
	if (email.value != email2.value)
	{
		alert('Your two email entries do not match.');
		email.focus();
		email.select();
		return false;		
	}

	return true;
}

function validatePledgeForm()
{
	if (!document.forms.signup.donationtype[1].checked && !document.forms.signup.donationtype[0].checked)
	{
		alert('Please choose type of donation.');
		return false;
	}
	if (document.forms.signup.donationtype[1].checked)
	{
		return validatePledge();
	}
	return validateDonation();
}

function checkPAmt()
{
	document.forms.signup.donationtype[1].checked = true;
}

function checkDAmt()
{
	document.forms.signup.donationtype[0].checked = true;
}

function updatePledge()
{
	// Clear invalid information (if needed).
	clearInvalidValues();
	calculatePledge();
	document.forms.signup.pamount.focus();
	document.forms.signup.pamount.select();
}

function updateDonation()
{
	clearInvalidValues();
	document.forms.signup.damount.focus();
	document.forms.signup.damount.select();
}

function clearInvalidValues()
{
	if (document.forms.signup.damount.value == "" || !document.forms.signup.donationtype[0].checked || !validateDonation())
	{
		document.forms.signup.damount.value = ""; 
	}
	if (document.forms.signup.pamount.value == "" || !document.forms.signup.donationtype[1].checked || !validatePledge())
	{
		document.getElementById('tpp').innerHTML="&nbsp;";
		document.forms.signup.pamount.value = ""; 
	}
	return;
}

function calculatePledge()
{

	if (!document.forms.signup.pamount.value == "" || document.forms.signup.donationtype[1].checked || validatePledge())
	{
		var pledge = document.forms.signup.pamount.value;
		pledge = pledge*30;
		document.getElementById('tpp').innerHTML="&nbsp;$" + pledge;
	}
	
	return;
}
//-->