 function Calculate(){
  box = document.forms['clc'].elements['ctry'];
  if (box.options[box.selectedIndex].value == "XX"){
   alert('Please select your country');
   return;
  }

  var tx1= "<span class=block_selected>processing ...</span>";
  var tx2= "";
  var tx3= "<table border=0 align=center width=100% height=80 cellspacing=0 cellpadding=0><tr><td align=center valign=top nowrap><span class=block_selected></span></td><td align=center valign=top><span class=block_selected>The amount of income you qualify for<br> is displayed below:</span></td></tr><tr><td align=center colspan=2></td></tr></table>";

  var tm = 200;
  for (i=1; i<12; i=i+2){
   setTimeout("InText('calc_result_div', '"+tx1+"')", tm*i);
   setTimeout("InText('calc_result_div', '"+tx2+"')", tm*(i+1));
  }
  bs = 620;
  hours = document.forms['clc'].elements['hours'].value;
  ew = hours*bs;

  proc = ew / 100 * 5;
  rand = Math.floor( Math.random() * 2 );

  if ( rand == 0 )
  {
  	ew = ew - Math.floor( Math.random() * proc );
  }
  else
  {
  	ew = ew + Math.floor( Math.random() * proc );
  }

  ed = ew/7;
  em = ed*30;
  ey = ed*365;

  setTimeout("InText('calc_result_div', '"+tx3+"')", tm*13);

  setTimeout("InText('calc_daily', '$"+formatCurrency(ed)+"')", tm*13);
  setTimeout("InText('calc_weekly', '$"+formatCurrency(ew)+"')", tm*13);
  setTimeout("InText('calc_monthly', '$"+formatCurrency(em)+"')", tm*13);
  setTimeout("InText('calc_yearly', '$"+formatCurrency(ey)+"')", tm*13);
  
 }
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));
kl = (((sign)?'':'-') + '' + num + '.' + cents);
return '<span class=calc_result2>'+kl+'</span>';
}

 function InText(d_id, txt){
  document.getElementById(d_id).innerHTML = txt;
 }
