<!-- // Enabling and Disabling Divs

// global array object to store state of divGroups
var g_idArray = new Array(new Array());
var Subtotal = 0;
var PARENTID_IDX = 0;
var SUBID_IDX = 1;
var AMOUNT_IDX = 2;
var YES_PARENT = true;
var NO_PARENT = false;

function UpdatePricing(action, parentID, subID, amount) {

//	tmp = BREAK_ME[0]; // for breaking into debug
	//alert(action+ ' - ' + parentID+ ' - ' + subID+ ' - ' + amount);

	var i, tmp;
	var clearedAmount = 0;


	if (action == 'ADD') {

		var addArray = new Array();

		if (isNaN(amount))
			amount = 0;
		if ( g_idArray.length != 0 ) {
			for ( i = ( g_idArray.length - 1 ); i >= 0 ; i-- ) {
				if ( ( parentID == g_idArray[ i ][ PARENTID_IDX ] ) & (subID == g_idArray[ i ][ SUBID_IDX ] ) ){
					// get amount to subtract
					clearedAmount = clearedAmount + g_idArray[ i ][ AMOUNT_IDX ];
					// remove data for the matched div
					tmp = g_idArray.splice( i, 1 );
				}
			}
			Subtotal = Subtotal - clearedAmount;
		}

		addArray[ PARENTID_IDX ] = parentID;
		addArray[ SUBID_IDX ] = subID;
		addArray[ AMOUNT_IDX ] = amount;

		g_idArray.push( addArray );

		// force to numbers due to occassional string concatention instead of addition
		Subtotal = parseFloat( Subtotal ) + parseFloat( amount );

		UpdateContent('Subtotal_Info_value', formatCurrency(Subtotal) );
	}
	else if (action == 'CLEAR') {
	//alert(g_idArray.length);
		if ( g_idArray.length != 0 ) {
			for ( i = ( g_idArray.length - 1 ); i >= 0 ; i-- ) {
				if ( parentID == g_idArray[ i ][ PARENTID_IDX ] ) {
					// get amount to subtract
					clearedAmount = parseFloat(clearedAmount) + parseFloat(g_idArray[ i ][ AMOUNT_IDX ]);
					// remove data for the matched div
					tmp = g_idArray.splice( i, 1 );
				}
			}

			Subtotal = Subtotal - clearedAmount;
			UpdateContent('Subtotal_Info_value', formatCurrency(Subtotal) );
		}
	}

}


function HideDivGroup( parentID, okParent ) {

	var groupDivs;
	var parentDiv, thisDiv;
	var thisID, i;
	var idStringArray;
	var idString_prefix;

	// search for children by parent div as the parent
	parentDiv = document.getElementById( parentID );
	if ( parentDiv == null )
		return false;

	groupDivs = parentDiv.getElementsByTagName( "div" );
	if ( groupDivs.length ) {
		for( i = 0; i < groupDivs.length; i++ ) {
			thisDiv = groupDivs[ i ];
			thisID = thisDiv.id;
			idStringArray = thisID.split('_');
			idStringSuffix = idStringArray[ ( ( idStringArray.length ) - 1 ) ];
			if ( ( idStringSuffix == 'header' ) || ( idStringSuffix == 'middle' ) || ( idStringSuffix == 'image' ) || ( idStringSuffix == 'footer' ) || ( idStringSuffix == 'value' )  || ( idStringSuffix == 'display' ) ) {
				// hide and unrender the div
				hideDiv( thisID );
				unrenderDiv( thisID );
			}
		}
	}
	if ( okParent ) {
		hideDiv( parentID );
		unrenderDiv( parentID );
	}
}

function ShowDivGroup( parentID, okParent ) {

	var groupDivs;
	var parentDiv, thisDiv;
	var thisID, i;

	// search for children by parent div as the parent
	parentDiv = document.getElementById( parentID );
	if ( parentDiv == null )
		return false;

	groupDivs = parentDiv.getElementsByTagName( "div" );
	if ( groupDivs.length ) {
		for( i = 0; i < groupDivs.length; i++ ) {
			thisDiv = groupDivs[ i ];
			thisID = thisDiv.id;
			// show and render the div
			showDiv( thisID );
			renderDiv( thisID );
		}
	}
	if ( okParent ) {
		showDiv( parentID );
		renderDiv( parentID );
	}

}

function ClearDivGroup ( parentID, okParent ) {

	var groupDivs;
	var parentDiv, thisDiv;
	var thisID, i;
	var idStringArray;
	var idString_prefix;

	// search for children by parent div as the parent
	parentDiv = document.getElementById( parentID );
  //alert ('1'+parentID+'  2'+okParent);
	if ( parentDiv == null )
		return false;

	groupDivs = parentDiv.getElementsByTagName( "div" );
	if ( groupDivs.length ) {
		for( i = 0; i < groupDivs.length; i++ ) {
			thisDiv = groupDivs[ i ];
			thisID = thisDiv.id;
			idStringArray = thisID.split('_');
			idStringSuffix = idStringArray[ ( ( idStringArray.length ) - 1 ) ];
			if ( ( idStringSuffix == 'header' ) || ( idStringSuffix == 'middle' ) || ( idStringSuffix == 'image' ) || ( idStringSuffix == 'footer' ) || ( idStringSuffix == 'value' )   || ( idStringSuffix == 'display' ) ) {
				UpdateContent( thisID, '' );
			}
		}
	}
	if ( okParent ) {
		UpdateContent( parentID, '' );
	}

}

function UpdateContent(id, txt) {
	document.getElementById(id).innerHTML = txt;
}

//Original:  Cyanide_7 (leo7278@hotmail.com)
//Web Site:  http://www7.ewebcity.com/cyanide7

//This script and many more are available free online at
//The JavaScript Source!! http://javascript.internet.com

function formatCurrency(num) {
	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);
}

// -->
