function num2money(n_value) {
	// validate input
	if (isNaN(Number(n_value)))
		return 'ERROR';

	// save the sign
	var b_negative = Boolean(n_value < 0);
	n_value = Math.abs(n_value);
	
	// round to 1/100 precision, add ending zeroes if needed
	var s_result = String(Math.round(n_value*1e2)%1e2 + '00').substring(0,2);

	// separate all orders
	var b_first = true;
	var s_subresult;
	while (n_value > 1) {
		s_subresult = (n_value >= 1e3 ? '00' : '') + Math.floor(n_value%1e3);
		//s_result = s_subresult.slice(-3) + (b_first ? '.' : ',') + s_result;
		s_result = s_subresult.slice(-3) + (b_first ? '.' : '') + s_result;
		b_first = false;
		n_value = n_value/1e3;
	}
	// add at least one integer digit
	if (b_first)
		s_result = '0.' + s_result;
	
	// apply formatting and return
	return s_result;
}

function right(e) {
	if (navigator.appName == 'Netscape' && (e.which == 3 || e.which 
== 2)) {
		return false;
	} else if (navigator.appName == 'Microsoft Internet Explorer' 
&& (event.button == 2 || event.button == 3)) {
		return false;
	}
	return true;
}
document.onmousedown=right;
if (document.layers) {
	window.captureEvents(Event.MOUSEDOWN);
	window.onmousedown=right;
}

function getDeleteConfirmation(){
	return window.confirm('Are you sure you want to remove this record? This cannot be undone.');
}


function getPos(obj) {
	var curleft = curtop = 0;
	if (obj.offsetParent) {
		curleft = obj.offsetLeft;
		curtop = obj.offsetTop;
		while (obj = obj.offsetParent) {
			curleft += obj.offsetLeft;
			curtop += obj.offsetTop;
		}
	}
	return [curleft,curtop];
}

function getPageDimensions() {
	var x,y = 0;
	if (self.innerHeight) // all except Explorer
	{
		x = self.innerWidth;
		y = self.innerHeight;
	}
	else if (document.documentElement && document.documentElement.clientHeight)
		// Explorer 6 Strict Mode
	{
		x = document.documentElement.clientWidth;
		y = document.documentElement.clientHeight;
	}
	else if (document.body) // other Explorers
	{
		x = document.body.clientWidth;
		y = document.body.clientHeight;
	}
	return [x,y];
}

function getSourceElement(e) {
	var obj;
	if (!e) {
		var e = window.event;
	}
	if (e.target) {
		obj = e.target;
	}
	else if (e.srcElement) {
		obj = e.srcElement;
	}
	if (obj.nodeType == 3) { // defeat Safari bug
		obj = obj.parentNode;
	}
	return obj;
}

