function verifyEmail() {
    if (document.checkout.email.value != document.checkout.email_confirm.value) {
        alert("The Email fields must match in order to continue.");
        return false;
    }
}

function verifyFormForPayPal(_CF_this) {

    //reset on submit
    _CF_error_exists = false;
    _CF_error_messages = new Array();
    _CF_error_fields = new Object();
    _CF_FirstErrorField = null;

    //form element accept_terms_and_conditions required check
    if( !_CF_hasValue(_CF_this['accept_terms_and_conditions'], "CHECKBOX", false ) )
    {
        _CF_onError(_CF_this, "accept_terms_and_conditions", _CF_this['accept_terms_and_conditions'].value, "You must accept the Terms and Conditions to continue.");
        _CF_error_exists = true;
    }
    
    //display error messages and return success
    if( _CF_error_exists )
    {
        if( _CF_error_messages.length > 0 )
        {
            // show alert() message
            _CF_onErrorAlert(_CF_error_messages);
            // set focus to first form error, if the field supports js focus().
            if( _CF_this[_CF_FirstErrorField].type == "text" )
            { _CF_this[_CF_FirstErrorField].focus(); }

        }
    }else {
        document.getElementById('paypalCheckout').submit();
    }
}

function handlePayType() {
    e = document.getElementById('paytype2')
    if (e.checked) {
		document.getElementById('ccinfo').style.visibility='visible';
        document.getElementById('paymentBtn').style.display='inline';
        document.getElementById('paymentBtn').style.visibility='visible';
        document.getElementById('paypalBtn').style.display='none';
        document.getElementById('paypalBtn').style.visibility='hidden'; 
    }
    else {
		document.getElementById('ccinfo').style.visibility='hidden';
		//if the selected value is paypal, show the paypal button
		p = document.getElementById('paytype1');
		//paypal
		if (p.checked) {
			document.getElementById('paymentBtn').style.display='none';
			document.getElementById('paymentBtn').style.visibility='hidden';
			document.getElementById('paypalBtn').style.display='inline';
			document.getElementById('paypalBtn').style.visibility='visible';
		}
		//checks
		else {
			document.getElementById('paymentBtn').style.display='inline';
			document.getElementById('paymentBtn').style.visibility='visible';
			document.getElementById('paypalBtn').style.display='none';
			document.getElementById('paypalBtn').style.visibility='hidden'; 
		}
    }
}

