//---------------------------------------------------------------------
gJsPromo_rebatePerSec	= 0;
gJsPromo_rebateNow		= 0;
gJsPromo_rebateT0		= 0;
//---------------------------------------------------------------------
//addBodyOnLoadCallback( xxx );
//---------------------------------------------------------------------
function js_promo_startChrono( valStart, valPerSec )
{
	gJsPromo_rebatePerSec	= valPerSec;
	gJsPromo_rebateNow		= valStart;
	gJsPromo_rebateT0		= (new Date).getTime();
	//alert( "gJsPromo_rebateT0="+gJsPromo_rebateT0 );
	setInterval( "js_promo_callback()", 1000 );
	//setTimeout( "js_promo_callback()", 1000 );
}
//---------------------------------------------------------------------
function js_promo_callback()
{
	//alert( "js_promo_callback" );
	el  = document.getElementById( 'idPromoRebate' );
	el2 = document.getElementById( 'idPromoRebateCent' );
	
	tDiff 	= (new Date).getTime() - gJsPromo_rebateT0;
	tDiff 	= tDiff / 1000;
	//alert( "tDiff="+tDiff );
	valCash	= gJsPromo_rebateNow - tDiff*gJsPromo_rebatePerSec;

	val1 = parseInt( valCash*100 ) / 100;
	pos  = (''+val1).indexOf( '.' );
	nb   = (''+val1).length - pos;
	//alert( "nb="+nb );
	if( nb < 3 )
		val1 += '0';
	val1 = '$' + val1;

	val2 = valCash - parseInt( valCash*100 )/100;
	val2 = parseInt( val2*10000 );
	if( val2 < 10 )
		val2 = '0' + val2;
	
	el.innerHTML  = val1;	// base save price
	el2.innerHTML = val2;	// cents
}
//---------------------------------------------------------------------
function addBodyOnLoadCallback( cb )
{
	//alert( "addBodyOnLoadCallback(): " + cb );
	if( window.addEventListener ) //DOM method for binding an event
		window.addEventListener( "load", cb, false );
	else if( window.attachEvent ) //IE exclusive method for binding an event
		window.attachEvent( "onload", cb );
	else if( document.getElementById ) //support older modern browsers
		window.onload = cb;
}
//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------

