//popup window
function openWindow(windowURL,windowName,windowWidth,windowHeight,scroll,center) {
	newWindow = window.open(windowURL,windowName,'width='+windowWidth+',height='+windowHeight+',toolbar=0,location=0,directories=0,status=0,menuBar=0,scrollbars='+scroll+',resizable=0');
	newWindow.focus(); 
   if (center) {
      newWindow.moveTo((screen.width-windowWidth)/2,(screen.height-windowHeight)/2)
   }
}
String.prototype.trim = function() { return this.replace(/^\s+|\s+$/g, ''); }
//change css style
function changeStyle(id,styleSelector,value){
	eval("document.getElementById(id).style."+styleSelector+"='"+value+"';");
}
//show element
function showElement(id) {
	document.getElementById(id).style.display = "block";
}
//hide element
function hideElement(id) {
   document.getElementById(id).style.display = "none";
}
//toggle element
function toggleElement(id) {
   var display = document.getElementById(id).style.display;
   document.getElementById(id).style.display = display == "none" ? "block" : "none";
}
         
         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);
         }