var sbtl = 0;
var tax = 0;
var shipping = 0;
var total = 0;
var pre = "";
var post = "";

if (document.layers) {
	//Netscape 4 specific code
	pre = 'document.';
	post = '';
}
if (document.getElementById) {
	//Netscape 6 specific code
	pre = 'document.getElementById("';
	post = '").style';
}
if (document.all) {
	//IE4+ specific code
	pre = 'document.all.';
	post = '.style';
}

function TallyTotal (ctl, type, amt) {
	var rate = .0826;
	sbtl = new Number(sbtl);
	tax = new Number(tax);
	shipping = new Number(shipping);
	total = new Number(total);
	
	if (ctl) {
		if (ctl.checked == 0) {
			amt *= -1;
		}
	}
	else {
		
	}
	
	if (type == 0) {
		sbtl += amt;
		var xxx = (rate * sbtl);
		xxx *= 100;
		tax = ((Math.round(xxx)) / 100);
	}
	if (type == 1) {
	}
	if (type == 2) {
		shipping += amt;
	}
	total = sbtl + tax + shipping;
	
	sbtl = new String(sbtl);
	if (sbtl.indexOf(".") != -1) {
		var toy = new Array();
		toy = sbtl.split(".");
		if (toy[1].length < 2) {
			sbtl += "0";
		}
		sbtl = sbtl.substring(0, (sbtl.indexOf(".") + 3));
	}
	else {
		sbtl += ".00";
	}
	
	tax = new String(tax);
	if (tax.indexOf(".") != -1) {
		var toy = new Array();
		toy = tax.split(".");
		if (toy[1].length < 2) {
			tax += "0";
		}
		tax = tax.substring(0, (tax.indexOf(".") + 3));
	}
	else {
		tax += ".00";
	}
	
	shipping = new String(shipping);
	if (shipping.indexOf(".") != -1) {
		var toy = new Array();
		toy = shipping.split(".");
		if (toy[1].length < 2) {
			shipping += "0";
		}
		shipping = shipping.substring(0, (shipping.indexOf(".") + 3));
	}
	else {
		shipping += ".00";
	}
	
	total = new String(total);
	if (total.indexOf(".") != -1) {
		var toy = new Array();
		toy = total.split(".");
		if (toy[1].length < 2) {
			total += "0";
		}
		total = total.substring(0, (total.indexOf(".") + 3));
	}
	else {
		total += ".00";
	}
	
	
	document.LiveWoman.SbTl.value = sbtl;
	document.LiveWoman.Tax.value = tax;
	document.LiveWoman.Shipping.value = shipping;
	document.LiveWoman.Total.value = total;
}

function DivSwitch (it) {
	var d = eval (pre + "AltInvoice" + post);
	if (it.checked == 0) {
		d.display = "none";
		d.visibility = "hidden";
	}
	else {
		d.display = "block";
		d.visibility = "visible";
	}
}

function FireSelect (show) {
	var v = eval (pre + "SeminarBookChoice" + post);
	
	if (show) {
		v.display = "block";
		v.visibility = "visible";
	}
	else {
		v.display = "none";
		v.visibility = "hidden";
	}
}

function CheckForm () {
    var radios = document.forms.LiveWoman.elements.PayOption;
    for(var i = 0; i < radios.length; i++){
        if(radios[i].checked) {
	        if ((radios[i].value == "CreditCard") || (radios[i].value == "PayPal")) {
		        document.Fizzorm.amount.value = total;
		        document.Fizzorm.submit.click();
	        }
        }
    }
}
