// return the value of the radio button that is checked
// return an empty string if none are checked, or
// there are no radio buttons
function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}

//Variables for Displaying Hidden Sections
var isIE=document.all?true:false;
var isDOM=document.getElementById?true:false;
var isNS4=document.layers?true:false;

// Display and Hide forms for stocks and bond
function displaySubs(stockbond){

if (getCheckedValue(stockbond)=="bond"){
//	Set the Bond div fields to be visible
//	Clear all values found in the bond field including stocknum and stockname
	if (isDOM) {
		document.getElementById("bonddiv").style.visibility='visible';
		document.getElementById("stockdiv").style.visibility='hidden';
	}
	else if (isIE) {	
		eval("document.all.bonddiv.style.visibility='visible';");
		eval("document.all.stockdiv.style.visibility='hidden';");
	}
	else if(isNS4) {
		eval("document.layers[bonddiv].visibility='show';");
		eval("document.layers[stockdiv].visibility='hide';");
	}	
	document.form1.stocknum.value="";
	document.form1.stockname.value="";
	return
}
//	Set the Stock div fields to be visible
//	Clear all values found in the bond field including bondamt and bondname
	if (isDOM) {
		document.getElementById("bonddiv").style.visibility='hidden';
		document.getElementById("stockdiv").style.visibility='visible';
	}
	else if (isIE) {	
		eval("document.all.bonddiv.style.visibility='hidden';");
		eval("document.all.stockdiv.style.visibility='visible';");
	}
	else if(isNS4) {
		eval("document.layers[bonddiv].visibility='hide';");
		eval("document.layers[stockdiv].visibility='show';");
	}	
	document.form1.bondamt.value="";
	document.form1.bondname.value="";
	return
}

function displaySubs2(amount){
if (getCheckedValue(amount)=="other"){
//	Set the Other Amount div fields to be visible
//	Clear all values found in the bond field including stocknum and stockname
//	eval("document.all.otheramtdiv.style.visibility='visible';");
	if (isDOM) {
		document.getElementById("otheramtdiv").style.visibility='visible';
	}
	else if (isIE) {	
		eval("document.all.otheramtdiv.style.visibility='visible';");
	}
	else if(isNS4) {
		eval("document.layers[otheramtdiv].visibility='show';");
	}	
	return
}
//	Set the Amount div fields to be visible
//	Clear all values found in the bond field including bondamt and bondname
//	eval("document.all.otheramtdiv.style.visibility='hidden';");
	
	if (isDOM) {
		document.getElementById("otheramtdiv").style.visibility='hidden';
	}
	else if (isIE) {	
		eval("document.all.otheramtdiv.style.visibility='hidden';");
	}
	else if(isNS4) {
		eval("document.layers[otheramtdiv].visibility='hide';");
	}	
	document.donationform.otheramt.value="Enter amount";
	return
}
