function ManageMenu(thisItem) {
	objThis = document.getElementById(thisItem);
	if (objThis.className == "" || objThis.className == "hide") {
		objThis.className = "show";
	} else {
		objThis.className = "hide";
	}	
}

function PopupWindow(strURL, strTitle, intHeight, intWidth) {
	var intLeft = Math.round((window.screen.width - intWidth)/2-10);
	var intTop = Math.round((window.screen.height - intHeight)/2-50);
	
	if (intHeight == 0 || intWidth == 0) {
		newWindow = window.open(strURL, strTitle);
	} else {
		newWindow = window.open(strURL, strTitle, 'width=' + intWidth + ',height=' + intHeight + ',left=' + intLeft + ',top=' + intTop + ',resizable=yes');
	}
	
	if (window.focus) {
		newWindow.focus();
	}
}

function IsNumeric(strThis) {
	var strValChars = "0123456789.";
	var IsNumber = true;
	var thisChar;
	
	for (i = 0; i < strThis.length && IsNumber == true; i++) {
		thisChar = strThis.charAt(i);
		if (strValChars.indexOf(thisChar) == -1) {
			IsNumber = false;
		}
	}
	return IsNumber;
}

function RoundNumber(intNum, intDec) {
	var intResult = Math.round(intNum * Math.pow(10,intDec)) / Math.pow(10, intDec);
	return intResult;
}

function calcAlcByVolume(base, denominator) {
	var result = 0
	if (parseFloat(denominator) != 0) {
		result = RoundNumber(base * (1 / denominator),1);
	}
	return result;
}

function addCommas(nStr)
{
	nStr += '';
	x = nStr.split('.');
	x1 = x[0];
	x2 = x.length > 1 ? '.' + x[1] : '';
	var rgx = /(\d+)(\d{3})/;
	while (rgx.test(x1)) {
		x1 = x1.replace(rgx, '$1' + ',' + '$2');
	}
	return x1 + x2;
}