// JavaScript Document

// getCheckedValue function thanks to http://www.somacon.com/p143.php
function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";  // if there isn't a radio button  return empty string
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return ""; // unchecked
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return ""; // if all else fails 
}

function getRadix (form) {
	rad = parseInt(form.radBox.value, getCheckedValue(form.radixCheck));
	
	dec = (rad).toString(10);
    bin = (rad).toString(2);
    hex = (rad).toString(16);
    oct = (rad).toString(8);

	form.decBox.value = dec;
    form.binBox.value = bin;
    form.hexBox.value = hex;
    form.octBox.value = oct;
}


