// JavaScript Document

function writeTextTo(elementName, text) {
	document.getElementById(elementName).innerHTML = text; 	
}

function trapEnter(event, funcToCall) {
	if(event && event.which == 13) {
		funcToCall();
		return false;
	} else if (window.event && window.event.keyCode == 13) {
		funcToCall();
		return false;
	}
	return true;
}

function makeChart(total, curr, divId, divTotalWidth) {

	if(total>=curr) {
		var rate = null;
		if(total==0 || curr==0) {
			rate = 0;
		} else {
			rate = curr / total;
		}
		var newSize = divTotalWidth * rate;
		var intSize = Math.round(newSize);
		document.getElementById(divId).style.width = intSize + "px";
	}
}

