//====== silly floating menu 

var timer;
var minpos = 85;
var topoffset = 119;

function truebody() {
	return (document.compatMode=="CSS1Compat")
		    ? document.documentElement 
		    : document.body;
}
function scrolltop() {
	doctop = parseInt(truebody().scrollTop);
	if (doctop > topoffset + minpos) {
		document.getElementById('scrollmenu').style.top = (doctop - topoffset) + 'px';
	} else {
		document.getElementById('scrollmenu').style.top = minpos + 'px';
	}
	timer=setTimeout("scrolltop()",750);
}
function stopscrolltop() {
	clearTimeout(timer);
}

//====== this one used to swap out divs for options and included parts

var activeDiv = '';

function swapOptionDiv(theDiv) {
	if (activeDiv != '') {
		document.getElementById(activeDiv).style.display = "none";
	}
	if (activeDiv == theDiv) {
		document.getElementById(theDiv).style.display = "none";
		activeDiv = '';
	} else {
		document.getElementById(theDiv).style.display = "block";
		activeDiv = theDiv;
	}
	return false;
}


//==== this for adding in extra cost for oversized carry case

function controlCarryCaseExtraShipping (thePrice) {
	var twidth = "";
	var tlength = "";
	numwidths = document.forms[0].Opt_generic_table_width.length;
	numlengths = document.forms[0].Opt_generic_table_length.length;

	i = 0;
	while (i < numwidths && !document.forms[0].Opt_generic_table_width[i].checked) {
		i += 1;
	}
	if (i < numwidths) {
		twidth = document.forms[0].Opt_generic_table_width[i].value;
	}
	i = 0;
	while (i < numlengths && !document.forms[0].Opt_generic_table_length[i].checked) {
		i += 1;
	}
	if (i < numlengths) {
		tlength = document.forms[0].Opt_generic_table_length[i].value;
	}

//alert("width = " + twidth + " -- length = " + tlength);
	if (twidth == "cc2_w33" || twidth == "cc2_w36" || tlength == "cc2_l78") {
		document.getElementById("Opt_generic_case_cost").checked = true;
		alert("NOTE: the carry case for extra wide AND/OR extra long\n       tables adds " + thePrice + " to the package cost.");
	} else {
		document.getElementById("Opt_generic_case_cost").checked = false;
	}
}