function replaceAll(stringValue, replaceValue, newValue) { var functionReturn = new String(stringValue); while ( true ) { var currentValue = functionReturn; functionReturn = functionReturn.replace(replaceValue, newValue); if ( functionReturn == currentValue ) break; } return functionReturn; } function draw_content_quantity(el, increase) { initial = 1391876; //Mb initial_on = 1266274800; diff = 1280562140 - initial_on; speed = 0.0077; //Mb/sec container = document.getElementById(el); if (container == undefined) return false; str = initial + ( (diff+increase) * speed ) + ''; tmp = str.split("."); m_p = tmp[0]; if (tmp[1] == undefined) { m_f = "0000"; } else { m_f = tmp[1].split("", 2).join().toString(); m_f = replaceAll(m_f, ",", ""); if (m_f.length < 2) { add = 2 - m_f.length; for(i=1; i<=add; i++) { m_f = m_f + '0'; } m_f = m_f.replace(",", ""); } } container.innerHTML = m_p + '.' + m_f.substr(0, 2) + ''; increase = increase + 1; setTimeout('draw_content_quantity("'+el+'", '+increase+')', 1000); } draw_content_quantity("counter_container", 0);