
function formatCurrency(amount, dp) {
	var start = 0;
	
	if (field.lastvalue != field.value && field.value.length > 0) {
	
		if (field.value.substr(0, 1) == "-") {
			start = 1;
		}
			
		if (dp > 0 && field.value.indexOf(".") == -1) {
			field.value += ".";
		}
		
		if (field.value.substr(start, 1) == ".") {
			field.value = field.value.substr(0, start) + "0" + field.value.substr(start, field.value.length - start);
		}
		
		while (field.value.length - field.value.indexOf(".") - 1 < dp) {
			field.value += "0";
		}
		
		field.lastvalue = field.value;
	}
}

function getSelectTextValue(list) {
    return list.options[list.selectedIndex].text;
}

function getSelectValue(list) {
    return list.options[list.selectedIndex].value;
}

function getSelectObject(list) {
    return list.options[list.selectedIndex];
}