﻿            
  function formatCurrency(num) {
num = num.toString().replace(/\$|\,/g,'');
if(isNaN(num))
num = "0";
sign = (num == (num = Math.abs(num)));
num = Math.floor(num*100+0.50000000001);
cents = num%100;
num = Math.floor(num/100).toString();
if(cents<10)
cents = "0" + cents;
for (var i = 0; i < Math.floor((num.length-(1+i))/3); i++)
num = num.substring(0,num.length-(4*i+3))+','+
num.substring(num.length-(4*i+3));
//return (((sign)?'':'-') + '$' + num + '.' + cents);
return (((sign)?'':'-') + '$' + num );
}


	///////////////////////////////////////////////////////////////////
//this function opens and center a window
	function winBRopen(theURL, Name, popW, popH, scroll, resize) { // V 1.0
	var winleft = (screen.width - popW) / 2;
	var winUp = (screen.height - popH) / 2;
	winProp = 'width='+popW+',height='+popH+',left='+winleft+',top='+winUp+',scrollbars='+scroll+',resizable='+resize+'';
	Win = window.open(theURL, Name, winProp);
	Win.window.focus();
}
/////////////////////////////////////////////////////////

///////////////////////////////////////////////////////////////////
//this function opens and center a window
	function winBRopenLA(theURL, Name, popW, popH, scroll, resize) { // V 1.0
	var winleft = (screen.width - popW) / 2;
	var winUp = (screen.height - popH) / 2;
	winProp = 'toolbar=1,location=1,width='+popW+',height='+popH+',left='+winleft+',top='+winUp+',scrollbars='+scroll+',resizable='+resize+'';
	Win = window.open(theURL, Name, winProp);
	Win.window.focus();
}
/////////////////////////////////////////////////////////

/////////////////////////////////////////////////////////

function hideElementByVisible(obj) {
    document.getElementById(obj).style.visibility = "hidden";
}

function showElementByVisible(obj) {
    document.getElementById(obj).style.visibility = "visible";
}

function hideElementByDisplay(obj) {
    if (document.getElementById(obj).style.display == "none") {
        document.getElementById(obj).style.display = "inline";
    }
    else if (document.getElementById(obj).style.display == "inline") {
        document.getElementById(obj).style.display = "none";
    }
}

function showElementDisplay(obj) {
    document.getElementById(obj).style.display = "inline";
}

////////////////////////////////////////////////////

