var tabs = Array();

function formatCurrency(num)
{
	num = num.toString().replace(/\$|\,/g,'');

	if (isNaN(num)) {
		num = "0";
	}

	sign = (num == (num = Math.abs(num)));
	num = Math.floor(num * 100 + 0.50000000001);
	cents = num % 100;
	num = Math.floor(num/100).toString();

	if (cents < 10) {
		cents = "0" + cents;
	}

	for (var i = 0; i < Math.floor((num.length-(1 + i)) / 3); i++) {
		num = num.substring(0, num.length-(4 * i + 3)) + ',' + num.substring(num.length-(4 * i + 3));
	}

	return (((sign)?'':'-') + '$' + num + '.' + cents);
}

function toggleVis(whichLayer)
{
	if (document.getElementById) {
		var style2 = document.getElementById(whichLayer).style;
	} else if (document.all) {
		var style2 = document.all[whichLayer].style;
	} else if (document.layers) {
		var style2 = document.layers[whichLayer].style;
	}

	if (style2.display == "block") {
		style2.display = "none";
	} else {
		style2.display = "block";
	}

}


function hideDiv(whichLayer)
{
	if (document.getElementById) {
		var style2 = document.getElementById(whichLayer).style;
	} else if (document.all) {
		var style2 = document.all[whichLayer].style;
	} else if (document.layers) {
		var style2 = document.layers[whichLayer].style;
	}

	style2.display = "none";
}

function showDiv(whichLayer)
{
	if (document.getElementById) {
		var style2 = document.getElementById(whichLayer).style;
	} else if (document.all) {
		var style2 = document.all[whichLayer].style;
	} else if (document.layers) {
		var style2 = document.layers[whichLayer].style;
	}

	style2.display = "block";
}

/* Define tabs thusly:	var tabs = Array('form1','form2','form3','land'); */

function switchToTab(name)
{
	for (var t = 0; t < tabs.length; t++) {
		if (tabs[t] == name) showDiv(tabs[t]); else hideDiv(tabs[t]);
	}
}