function removeSpaces(string) {
	var tstring = "";
	string = '' + string;
	splitstring = string.split(" ");
	for(i = 0; i < splitstring.length; i++)
	tstring += splitstring[i];
	return tstring;
}


var eAddrGood;
function checkEmailAddress(field) {

    var goodEmail = field.value.match(/\b(^(\S+@).+((\.com)|(\.net)|(\.edu)|(\.mil)|(\.gov)|(\.org)|(\..{2,2}))$)\b/gi);

    if (goodEmail){
        eAddrGood = true
    } else {
        eAddrGood = false
    }
} //end checkEmailAddr


function checkField(f)
{
    for (var j=0; j < f.value.length; j++)
    {
        if  (f.value.charAt(j) == "'") 
        {
            f=" ";
            alert("Do not use the single quote ( ' ) .") ;
            return false;
        }
    }
    if( f.value.length < 3 ) 
    {
        return false ;
    }
    return true;
}

function checkForm(form){
   eAddrGood = false ;
   checkEmailAddress(form.email) ;

    if(!checkField(form.fname) )
    {
        alert('Please enter your first name.') ;
        form.fname.focus() ;
        return false ;
    }
    if(!checkField(form.lname) )
    {
        alert('Please enter your last name.') ;
        form.lname.focus() ;
        return false ;
    }

    if(eAddrGood == false) 
    {
        alert('Please enter a valid email address.');
        form.email.focus() ;
        return false ;
    }

    
    if(!checkField(form.dayphone) )
    {
        alert('Please enter your day time phone number.') ;
        form.dayphone.focus() ;
        return false ;
    }
    
    if(!checkField(form.address) )
    {
        alert('Please enter your street address.') ;
        form.address.focus() ;
        return false ;
    }
    
    if(!checkField(form.city) )
    {
        alert('Please enter your city.') ;
        form.city.focus() ;
        return false ;
    }
    
    if(!checkField(form.zip) )
    {
        alert('Please enter your ZIP code.') ;
        form.zip.focus() ;
        return false ;
    }
    
	  if(!checkField(form.donateitem) )
    {
        alert('Please identify item to donate.') ;
        form.donateitem.focus() ;
        return false ;
    }
	  if(!checkField(form.retail_value) )
    {
        alert('Please enter the retail value of your donation.') ;
        form.retail_value.focus() ;
        return false ;
    }
}