var vBrowserType = "";
if (window.navigator.userAgent.indexOf("Firefox") != -1) vBrowserType = "Firefox";
if (window.navigator.userAgent.indexOf("MSIE") != -1) vBrowserType = "IE";
if (window.navigator.userAgent.indexOf("SV1") != -1) vBrowserType = "IESP2";
if (vBrowserType)
{
	var w = screen.availWidth;
	var h = screen.availHeight;
}
function openWindow(url, name, width, height, scrollbar)
{
	self.name = "main"; 
	var leftPos = (w-width)/2, topPos = (h-height)/2;
	popupWin = window.open(url, name, "width=" + width + ",height=" + height + ",scrollbars=" + scrollbar + ",top=" + topPos + ",left=" + leftPos + ",toolbar=no,directories=no,menubar=no");
}

function openWin(winName, urlLoc) {
	l = (screen.availWidth - 620)/2;
	t = (screen.availHeight - 540)/2;
	features  = "toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,dependent,height=540,width=620,left=" + l + ",top=" + t;
	winName = winName.replace(/[^a-z]/gi,"_");
	return window.open(urlLoc,winName,features);
}

function cleanNum(n,zeroReturn)
{
	n = n + '';
	n = n.replace(/[\,]/,"");
	n = n.replace(/[\$]/,"");
	n = n.replace(/[\%]/,"");
	if (zeroReturn == 1 && n == "")
	{
		return 0;
	} else {
		if (isNaN(n))
		{
			return n;
		} else {
			return parseFloat(n);
		}
	}
}

function FormatCurrency(num)
{
	num = num.toString().replace(/\$|\,/g,'');
	if(isNaN(num)) num = "0";
	var sign = (num == (num = Math.abs(num)));
	num = Math.floor(num*100+0.50000000001);
	var 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));
		num = num.replace(/\$|\,/g,'');
	return (num + '.' + cents);
}
	
