/*
  	Author:		Jose Sousa 
  */
  
  function StartCountUp(myDiv,myValue,myRate)
  {
	var secs = new Number((new Date()).getTime());
	var value = Number(myValue);
	var rate = Number(myRate);
    if (value != NaN && rate != NaN) {
		CountUpTill(myDiv, secs, value, rate);
	} else {
		document.write("Error!");
	}
  }
  
  function CountUp(myDiv, secs, value, rate)
  {
    var DisplayStr = new String();
	DisplayStr = value+Math.floor((((new Date()).getTime()-secs)*rate)/3600000);
    document.getElementById(myDiv).innerHTML = DisplayStr;
    setTimeout("CountUp('" + myDiv + "'," + secs + "," + value + "," + rate + ");", 90);
  }

  function StartCountUpTill(myDiv,myValue,myRate,max)
  {
	var secs = new Number((new Date()).getTime());
	var value = Number(myValue);
	var rate = Number(myRate);
    if (value != NaN && rate != NaN) {
		CountUpTill(myDiv, secs, value, rate, max);
	} else {
		document.write("Error!");
	}
  }

  function CountUpTill(myDiv, secs, value, rate, max)
  {
	var DisplayStr = new String();
	DisplayStr = value+Math.floor((((new Date()).getTime()-secs)*rate)/3600000);
	if (DisplayStr<max) {
		document.getElementById(myDiv).innerHTML = DisplayStr;
		setTimeout("CountUpTill('" + myDiv + "'," + secs + "," + value + "," + rate + "," + max + ");", 90);
	} else {
		DisplayStr = max;
		document.getElementById(myDiv).innerHTML = DisplayStr;
	}
  }