<!--
var off= 0;
var NOWstartTime	= (new Date ())/1000;
var STARTtime = "2009:12:31:23:59";

var startAmountNational =  75152000000;
var startAmountHousehold = 48485.16129;
var startAmountPerson = 16852.86928;

var YearlyRateNational = 18.700;
var YearlyRateHousehold = 12064.51613;
var YearlyRatePerson = 4193.483282;

var perSecNational = YearlyRateNational*1000000000/(365*24*60*60);
var perSecHousehold = YearlyRateHousehold/(365*24*60*60);
var perSecPerson = YearlyRatePerson/(365*24*60*60);

var CURstartNational = startAmountNational + perSecNational*(NOWstartTime - str2date(STARTtime,off));
var CURstartHousehold	= startAmountHousehold + perSecHousehold*(NOWstartTime - str2date(STARTtime,off));
var CURstartPerson	= startAmountPerson + perSecPerson*(NOWstartTime - str2date(STARTtime,off));


function loop(type)
{
  var perSec;
  var separator;
  switch(type){
    case 'national':
      CURstart = CURstartNational;
      perSec = perSecNational;
      separator = '.';
    break;
    case 'household':
      CURstart = CURstartHousehold;
      perSec = perSecHousehold;
      separator = ',';
    break;
    case 'person':
      CURstart = CURstartPerson;
      perSec = perSecPerson;
      separator = ',';
    break;
  }
  
  var secs = (new Date ())/1000 - NOWstartTime;
	document.getElementById(type).firstChild.nodeValue = ( num2strC(CURstart + perSec*secs, separator) );
	setTimeout("loop('"+type+"');", 125);
}

function str2date(str,off)
{
  var s = str;
  var dA = new Array(7);
  for(i=1; i<7; i++){ 
    if(s.length){
      ndx = s.indexOf(':')
      if(ndx==-1){ s0 = s; s = ''; }
	    else s0 = s.substring(0, ndx);
    }else s0 = 0;
    if(i==2) s0 -= 1;
    dA[i] = s0;
    s = s.substring(ndx+1);
  }
  dA[4] =dA[4]*1 + off;
  return (Date.UTC(dA[1], dA[2], dA[3], dA[4], dA[5], dA[6]))/1000;
}

function num2strC(xNum, separator)
{  var sign = "";
  if (xNum < 0)	{ xNum = -xNum; sign = "-"; }
  xEuros = Math.floor(xNum);
  var sDols = xEuros.toString ();
  DLen = sDols.length;
  dCom = ""
  while (DLen > 3)
  { digits3 = sDols.substr(DLen-3, 3);
    sDols   = sDols.substr(0, DLen-3);
	 DLen = DLen -3;
  	 dCom = separator + digits3 + dCom;
  }
  dCom = sDols + dCom;
	return sign + dCom;
}
function setup(containerID)
{
  var img_path = 'http://www.finegael.org/images/debt/';
  document.getElementById(containerID).innerHTML = 
  "<table width='306' border='0' cellpadding='0' cellspacing='0' style='font-family:Arial,Helvetica,sans-serif;font-size:12px;color:#333333;'>"+
  "<tr>"+
    "<td><img src='"+img_path+"debt_01.gif' width='8' height='35'></td>"+
    "<td height='35' colspan='2' align='left' background='"+img_path+"debt_05.gif'>&nbsp;&nbsp;<img src='"+img_path+"flag.gif' width='21' height='15'> <span style='font-size:16px;font-weight:bold;color:#F8F8F8;'>Ireland's National Debt</span> </td>"+
    "<td><img src='"+img_path+"debt_03.gif' width='7' height='35'></td>"+
  "</tr>"+
  "<tr bgcolor='#f6f6f6'>"+
    "<td width='8' height='25'>&nbsp;</td>"+
    "<td width='125' height='25' align='left' valign='bottom'><strong>Total National Debt</strong></td>"+
    "<td width='166' height='25' align='left' valign='bottom'><span style='font-size:16px;color:#EC0000;font-weight:bold;'>&nbsp;&euro;</span> <span style='font-size:16px;color:#EC0000;font-weight:bold;' id='national'>Loading...</span><br/></td>"+
    "<td width='7' height='25'>&nbsp;</td>"+
  "</tr>"+
  "<tr bgcolor='#f6f6f6'>"+
    "<td width='8' height='25'>&nbsp;</td>"+
    "<td width='125' height='25' align='left' valign='bottom'><strong>Debt per Household</strong></td>"+
    "<td width='166' height='25' align='left' valign='bottom'><span style='font-size:16px;color:#EC0000;font-weight:bold;'>&nbsp;&euro;</span> <span style='font-size:16px;color:#EC0000;font-weight:bold;' id='household'>Loading...</span><br/></td>"+
    "<td width='7' height='25'>&nbsp;</td>"+
  "</tr>"+
  "<tr bgcolor='#f6f6f6'>"+
    "<td width='8' height='25'>&nbsp;</td>"+
    "<td width='125' height='25' align='left' valign='bottom'><strong>Debt per Person</strong></td>"+
    "<td width='166' height='25' align='left' valign='bottom'><span style='font-size:16px;color:#EC0000;font-weight:bold;'>&nbsp;&euro;</span> <span style='font-size:16px;color:#EC0000;font-weight:bold;' id='person'>Loading...</span><br/></td>"+
    "<td width='7' height='25'>&nbsp;</td>"+
  "</tr>"+
  "<tr bgcolor='#f6f6f6'>"+
    "<td width='8' height='30'>&nbsp;</td>"+
    "<td height='30' colspan='2' align='left' valign='bottom'> For more details please go to <a href='http://www.nationaldebt.ie' target='new'>www.nationaldebt.ie</a></td>"+
    "<td width='7' height='30'>&nbsp;</td>"+
  "</tr>"+
  "<tr>"+
    "<td><img src='"+img_path+"debt_11.gif' width='8' height='7'></td>"+
    "<td height='7' colspan='2' bgcolor='#f6f6f6'></td>"+
    "<td><img src='"+img_path+"debt_13.gif' width='7' height='7'></td>"+
  "</tr>"+
  "</table>";  
  loop('national');
  loop('household');
  loop('person');
}
document.write("<div id='indicator'></div>");setup('indicator');
//-->
