function emptyvalidation(entered, alertbox)
{
with (entered)
{
if (value==null || value=="")
{if (alertbox!="") {alert(alertbox);} return false;}
else {return true;}
}
} 


function emailvalidation(entered, alertbox)
{
with (entered)
{
apos=value.indexOf("@"); 
dotpos=value.lastIndexOf(".");
lastpos=value.lengtha;
if (apos<1 
|| dotpos-apos<2 || lastpos-dotpos>3 || lastpos-dotpos<2) 
{if (alertbox) {alert(alertbox);} return false;}
else {return true;}
}
} 

function digitvalidation(entered, min, max, alertbox, datatype)
{
// Digit Validation by Henrik Petersen / NetKontoret
// Explained at www.echoecho.com/jsforms.htm
// Please do not remove this line and the two lines above.
with (entered)
{
checkvalue=parseFloat(value);
if (datatype)
{smalldatatype=datatype.toLowerCase();
if (smalldatatype.charAt(0)=="i") 
{checkvalue=parseInt(value); if (value.indexOf(".")!=-1) {checkvalue=checkvalue+1}};
}
if ((parseFloat(min)==min && value.length<min) || (parseFloat(max)==max && value.length>max) || value!=checkvalue)
{if (alertbox!="") {alert(alertbox);} return false;}
else {return true;}
}
}

function valuevalidation(entered, min, max, alertbox, datatype)
{
// Value Validation by Henrik Petersen / NetKontoret
// Explained at www.echoecho.com/jsforms.htm
// Please do not remove this line and the two lines above.
with (entered)
{
checkvalue=parseFloat(value);
if (datatype)
{smalldatatype=datatype.toLowerCase();
if (smalldatatype.charAt(0)=="i") {checkvalue=parseInt(value)};
}
if ((parseFloat(min)==min && checkvalue<min) || (parseFloat(max)==max && checkvalue>max) || value!=checkvalue)
{if (alertbox!="") {alert(alertbox);} return false;}
else {return true;}
}
} 

function formvalidation0(thisform)
{

with (document.forms[0])
{
if (emptyvalidation(tamount,"The Amount field cannot be left blank.  Please select an Amount for a one-time donation, or select 'Other Amount' in the drop down and enter your amount on the next screen. .")==false) {tamount.focus(); return false;};
}
document.forms[0].amount.value = document.forms[0].tamount.value;
} 

function formvalidation1(thisform)
{

with (document.forms[1])
{
if (valuevalidation(a3,1,99999,"The Amount field cannot be left blank.  Please enter an amount greater than $0.","|")==false) {a3.focus(); return false;};
if (emptyvalidation(p3,"The Frequency field cannot be left blank.  Please enter the frequency of your donation.")==false) {p3.focus(); return false;};
if (emptyvalidation(t3,"The Time Frame field cannot be left blank.  Please enter the time frames of your donation.")==false) {t3.focus(); return false;};
}
} 

