
 function initialize(divId) {
 	
 	//divId = 'sample';
	thedivId = document.getElementById(divId);
	//el valor del porcentaje de la barra sobre 100
	var percentage = thedivId.innerHTML;
	
	var nu1 = new String(percentage);
	var num1 = nu1.replace(/,/g,".");
	var num12 = parseFloat(num1);
	//el valor del porcentaje de la barra sobre 10
	var perc2 = redondea(num12/10,2);
	document.getElementById(divId).innerHTML = perc2;
	thedivId.style.backgroundColor="#52A6BF";
	brim(divId,parseInt(percentage),parseInt(percentage));

	
}


function setWidth(o, start) {
	o.style.width = start+"%";
}


function brim(Id,start,percentage) {
	if (document.getElementById) {
		o = document.getElementById(Id);
		if (start <= percentage) {
			setWidth(o, start);
			start += 1;
			window.setTimeout("brim('"+Id+"',"+start+","+percentage+")", 50);
		}
	}
}

function redondea(sVal, nDec){
	var n = parseFloat(sVal);
    var s = "0.00";
    if (!isNaN(n)){
     n = Math.round(n * Math.pow(10, nDec)) / Math.pow(10, nDec);
     s = String(n);
     s += (s.indexOf(".") == -1? ".": "") + String(Math.pow(10, nDec)).substr(1);
     s = s.substr(0, s.indexOf(".") + nDec + 1);
    }
    return s;
} 
