function isText(f){
	//return f.type == 'radio' || f.type == 'checkbox' || f.type == 'file'
	return f.type != 'checkbox' || f.type != 'file'
}

function validateRadioGroup(btn) {
    var cnt = -1;
    for (var i=btn.length-1; i > -1; i--) {
        if (btn[i].checked) {cnt = i; i = -1;}
    }
    if (cnt > -1) return btn[cnt].value;
    else return null;
}

function filledRadioGroup(f){
	return f.type=='radio' && validateRadioGroup(f) != null
}


function emptyRadio(btn){
	return validateRadioGroup(btn)
}

	
function Validator(theForm){
a = new Array()
a = Validator.arguments;

for(i=1; i<a.length; i++){
	f = theForm[a[i]]

	if (f != "undefined" && f != null){
if(f.type=='checkbox' && f.checked!=true){
	alert("Please fill all required fields. ("+f.name+")")
	f.focus();
	return false;
}
if (f.length>0 && f[0].type=='radio'){
	alerttxt = "Please fill all required fields. ("+f[0].name+")"
	with (f){
	 if (validateRadioGroup(f) == null){
	  alert(alerttxt);
	  f[0].focus();
	  return false;
	 }
	}
}

if (f.length>0 && f[0].type=='checkbox'){
	alerttxt = "Please fill all required fields. ("+f[0].name+")"
	with (f){
	 if (validateRadioGroup(f) == null){
	  alert(alerttxt);
	  f[0].focus();
	  return false;
	 }
	}
}
		field_name = f.name
		
		if (f.value == ""){
			f.className += " missing_field"
			alert("Please fill all required fields. ("+field_name+")");
			f.focus();
			return (false);
		}}
}
//if (jcap() == false) {
	//return (false);
//}
 return (true);
}

function disableField(el){
	f=document.getElementById(el)
	f.disabled="disabled"
}
function enableField(el){
	f=document.getElementById(el)
	f.disabled=false
}
function doit(){
	var a = doit.arguments	
	if (a && a.length > 0){
		var el = a[0]
		var sTotal = Number(a[1])
		var total_div = document.getElementById("total")
		var bill_total_div = document.getElementById("bill_total")
		var CC_processing_fee_div = document.getElementById("CC_processing_fee")
		var CC_processing_fee_2_div = document.getElementById("CC_processing_fee_2")
		
		var current_price = Number(total_div.innerHTML)
		var total = (el.checked)? (current_price + sTotal) : (current_price - sTotal);
		
		total_div.innerHTML = total				
		var CC_processing_fee = total/100 * 2
		CC_processing_fee_div.innerHTML = CC_processing_fee_2_div.innerHTML = CC_processing_fee
		bill_total_div.innerHTML = total + CC_processing_fee
		
		//alert(el.checked)
	}
}