
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 "";
}

function get_check_value()
{
var c_value = "";
for (var i=0; i < document.orderform.music.length; i++)
   {
   if (document.orderform.music[i].checked)
      {
      c_value = c_value + document.orderform.music[i].value + "\n";
      }
   }
}


function popUp() {
	f = document.forms.tankchart;

	if(getCheckedValue(f.shape) == "Cylinder") {
		if(f.diameter.value != "" && f.length.value != "" && !isNaN(f.diameter.value) && !isNaN(f.length.value)) {
	
			strurl = "/tank-capacity/tankchart.php?";
			strurl = strurl + "diameter=" + f.diameter.value;
			strurl = strurl + "&length=" + f.length.value;
			strurl = strurl + "&increment=" + getCheckedValue(f.increment);
			strurl = strurl + "&hv=" + getCheckedValue(f.hv);
			strurl = strurl + "&shape=" + getCheckedValue(f.shape);
			if (f.rows_print_ignore.checked == false ) {
				strurl = strurl + "&rows=" + f.rows_print.value;
			}
		
			window.open(strurl,"hall_tank_chart","height=600,width=800,toolbar=yes,menubar=yes,status=yes,scrollbars=yes,resizable=yes");

			return true;
		} else {
			alert('Please enter a Diameter and Length (Numbers Only)');
		}
		
	}
	
	if(getCheckedValue(f.shape) == "Rectangular") {
		if(f.length.value != "" && f.width.value != "" && f.height.value != "" && !isNaN(f.length.value) && !isNaN(f.width.value) && !isNaN(f.height.value)) {
	
			strurl = "/tank-capacity/tankchart.php?";
			strurl = strurl + "length=" + f.length.value;
			strurl = strurl + "&width=" + f.width.value;
			strurl = strurl + "&height=" + f.height.value;
			strurl = strurl + "&increment=" + getCheckedValue(f.increment);
			strurl = strurl + "&hv=" + getCheckedValue(f.hv_rect);
			strurl = strurl + "&shape=" + getCheckedValue(f.shape);
			if (f.rows_print_ignore.checked == false ) {
				strurl = strurl + "&rows=" + f.rows_print.value;
			}
		
			window.open(strurl,"hall_tank_chart","height=600,width=800,toolbar=yes,menubar=yes,status=yes,scrollbars=yes,resizable=yes");

			return true;
		} else {
			alert('Please enter a Length, Width and Height (Numbers Only)');
		}
		
	}
}

function tank_shape() {
	f = document.forms.tankchart;
	var cylobj = document.getElementById("tankchart_cyl");
	var rectobj = document.getElementById("tankchart_rect");
	
	if(getCheckedValue(f.shape) == "Cylinder") {
		cylobj.style.display = "";
		tankorient_cyl.style.display = "";
		rectobj.style.display = "none";
		tankorient_rect.style.display = "none";
	}
	
	if(getCheckedValue(f.shape) == "Rectangular") {
		cylobj.style.display = "none";
		tankorient_cyl.style.display = "none";
		rectobj.style.display = "";
		tankorient_rect.style.display = "";
	}
}
var previous_row;

function rows_ignore() {
	f = document.forms.tankchart;
	if (f.rows_print_ignore.checked == true) {
		previous_row = f.rows_print.value;
		f.rows_print.disabled=true;
		f.rows_print.value = "";
	} else {
		f.rows_print.disabled=false;
		f.rows_print.value = previous_row;
	}
}
