function toggle(chkbx,cont,hidA) {

    
    if(!chkbx.checked) {
        document.getElementById(cont).style.display="none";
        //document.getElementById("aba2").style.display="none";
        hidA.value = 1;
    }
    else {
     document.getElementById(cont).style.display="block";   
     //document.getElementById("aba2").style.display="block";
            hidA.value = 2;
         }
}


function checkCC(cardno) {
        var space=" "
        var dash="-"
        var pspace = cardno.indexOf(space);
        var pdash = cardno.indexOf(dash);
        
        if(pspace>=0 || pdash>=0)
        return false;
        return true;
}

function validateForm() {

var form;
form = document.frmDonate;

if(form.amount.value.length<1) {
        alert("Please enter the donation amount you want to make.");
        form.amount.focus();
        return false;
}

if(isNaN(form.amount.value)) {
    alert("Please enter the donation amount correctly.");
        form.amount.focus();
        return false;

}


if(parseInt(form.amount.value)<1) {
        alert("Please enter the donation amount correctly.");
        form.amount.focus();
        return false;

}

if(form.txtNameOnCard.value.length<1)

    {
        alert("Please enter the first name specified on your card!");
        form.txtNameOnCard.focus();
        return false;
    }

if(form.txtLastName.value.length<1)

    {
        alert("Please enter the last name specified on your card!");
        form.txtLastName.focus();
        return false;
    }
    
if(form.email.value.length<1)

    {
        alert("Please enter the email address!");
        form.email.focus();
        return false;
    }


if(form.txtBillingAddress1.value.length<1)

    {
        alert("Please enter the card billing address");
        form.txtBillingAddress1.focus();
        return false;
    }   

if(form.txtCity.value.length<1)

    {
        alert("Please enter the city");
        form.txtCity.focus();
        return false;
    }
    
    
if(form.txtState.value.length<1)

    {
        alert("Please enter the State");
        form.txtState.focus();
        return false;
    }
    
if(form.txtZipCode.value.length<1)

    {
        alert("Please enter the zip code");
        form.txtZipCode.focus();
        return false;
    }
        
    
    
if(form.phone.value.length<1)

    {
        alert("Please enter the phone number");
        form.phone.focus();
        return false;
    }
    
    

if(form.txtCardType.value=="0")

    {
        alert("Please select a card!");
        form.txtCardType.focus();
        return false;
    }


    
if(form.txtCardNumber.value.length<1)

    {
        alert("Please enter the card number!");
        form.txtCardNumber.focus();
        return false;       
    }


if(!checkCC(form.txtCardNumber.value))

    {
        alert("Please donot enter spaces and dashes in card number!");
        form.txtCardNumber.focus();
        return false;       
    }

if(form.expDateMonth.value=='0')

    {
        alert("Please enter the expiry month.");
        form.expDateMonth.focus();
        return false;       
    }

if(form.expDateYear.value=='0')

    {
        alert("Please enter the expiry year.");
        form.expDateYear.focus();
        return false;       
    }

    
if(form.txtVeriNumber.value.length<3)

    {
        alert("Please enter the verification code!");
        form.txtVeriNumber.focus();
        return false;
    }   

    
    if(form.cbxhonor.checked) {
                                    
            if(form.FirstNameHonor.value.length<1)
               {
                    alert("Please enter the in honor of first name.");
                    form.FirstNameHonor.focus();
                    return false;
                }   
            
            
            if(form.LastNameHonor.value.length<1)
        
            {
                alert("Please enter the in honor of last name");
                form.LastNameHonor.focus();
                return false;
            }
            
            
    }
    
    if(form.cbxnotify.checked) {
        if(form.FirstNameNotify.value.length<1)
               {
                    alert("Please enter the notification first name.");
                    form.FirstNameNotify.focus();
                    return false;
                }   
            
            
            if(form.LastNameNotify.value.length<1)
        
            {
                alert("Please enter the notification last name.");
                form.LastNameNotify.focus();
                return false;
            }
        
    
            if(form.StreetAddrNotify.value.length<1)
        
            {
                alert("Please enter the notification address.");
                form.StreetAddrNotify.focus();
                return false;
            }
    
    
            if(form.CityNotify.value.length<1)
        
            {
                alert("Please enter the notification city");
                form.CityNotify.focus();
                return false;
            }
            
            
        if(form.StateNotify.value.length<1)
        
            {
                alert("Please enter the notification state");
                form.StateNotify.focus();
                return false;
            }
            
        if(form.PostalCodeNotify.value.length<1)
        
            {
                alert("Please enter the notification zip code");
                form.PostalCodeNotify.focus();
                return false;
            }

    
    
    
    }
    return true;

}