function registerRow(idnum) {
	var idarray = idnum.split("_",2);
	var id = idarray[1];
	
	var linecost = document.getElementById('cost_' + id).value;

	
	if ( document.getElementById('row_' + id + 'A').className == 'altOn' ) {
		document.getElementById('row_' + id + 'A').className = 'altOnSelected';
		document.getElementById('row_' + id + 'B').className = 'altOnSelected';
		document.getElementById('row_' + id + 'C').className = 'altOnSelected';
		document.getElementById('row_' + id + 'C').style.fontWeight = 'bold';
		addTotal(linecost);
	}
	else if ( document.getElementById('row_' + id + 'A').className == 'altOff' ) {
		document.getElementById('row_' + id + 'A').className = 'altOffSelected';
		document.getElementById('row_' + id + 'B').className = 'altOffSelected';
		document.getElementById('row_' + id + 'C').className = 'altOffSelected';
		document.getElementById('row_' + id + 'C').style.fontWeight = 'bold';
		addTotal(linecost);
	}
	else if ( document.getElementById('row_' + id + 'A').className == 'altOnSelected' ) {
		document.getElementById('row_' + id + 'A').className = 'altOn';
		document.getElementById('row_' + id + 'B').className = 'altOn';
		document.getElementById('row_' + id + 'C').className = 'altOn';
		document.getElementById('row_' + id + 'C').style.fontWeight = 'normal';
		subtractTotal(linecost);
	}
	else if ( document.getElementById('row_' + id + 'A').className == 'altOffSelected' ) {
		document.getElementById('row_' + id + 'A').className = 'altOff';
		document.getElementById('row_' + id + 'B').className = 'altOff';
		document.getElementById('row_' + id + 'C').className = 'altOff';
		document.getElementById('row_' + id + 'C').style.fontWeight = 'normal';
		subtractTotal(linecost);
	}			
	
}

function subtractTotal(amount) {
	var totalcost = document.getElementById('totalRegistrationCost').value;
	var newtotalcost = totalcost - amount;
	
	document.getElementById('totalRegistrationCost').value = formatCurrency(newtotalcost);
	document.getElementById('totalRegistrationCostLabel').innerHTML = '$ ' + formatCurrency(newtotalcost);
	
}

function addTotal(amount) {
	var totalcost = document.getElementById('totalRegistrationCost').value;
	var newtotalcost = Number(totalcost) + Number(amount);

	document.getElementById('totalRegistrationCost').value = formatCurrency(newtotalcost);
	document.getElementById('totalRegistrationCostLabel').innerHTML = '$ ' + formatCurrency(newtotalcost);
}


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

	blnSign = (dblValue == (dblValue = Math.abs(dblValue)));
	dblValue = Math.floor(dblValue*100+0.50000000001);
	intCents = dblValue%100;
	strCents = intCents.toString();
	dblValue = Math.floor(dblValue/100).toString();
	if(intCents<10)
		strCents = "0" + strCents;
	//for (var i = 0; i < Math.floor((dblValue.length-(1+i))/3); i++)
	//	dblValue = dblValue.substring(0,dblValue.length-(4*i+3))+','+
	//	dblValue.substring(dblValue.length-(4*i+3));
	return ( dblValue + '.' + strCents);
}

function processingForm()
{
document.getElementById('Submit').value = 'Processing...';
document.getElementById('Submit').disabled = true;
document.getElementById('Submit').color = '#000000';
}


