function updateCharCount( textField, displayArea, maxChars ){
	if ( textField.value.length > maxChars ){
		textField.value = textField.value.slice(0, maxChars);
	}
	displayArea.innerHTML = textField.value.length + " characters (maximum of "+maxChars+")";
}

function restrictTextLength( textField, displayArea, maxChars ){
	if ( textField.value.length > maxChars ){
		textField.value = textField.value.slice(0, maxChars);
	}
	displayArea.innerHTML = (maxChars - textField.value.length) + " characters left.";
}

// Open a new popup window with the specificed url content
// Disable all the controls, toolbar, etc. Good for help message
function PopUpHelpMessage(url, title, height, width)
{
	window.open(url, title, "scrollbars=yes,menubar=no,height=" + height + ",width=" + width + ",resizable=yes,toolbar=no,location=no,status=no");
}

function SetObjDisplay(objName, displayVal)
{
	document.getElementById(objName).style.display = displayVal;
}

// Open a new popup window with the specificed url content
// Good for invoice window
function PopUpInvoiceWindow(url, title, height, width)
{
	window.open(url, title, "scrollbars=yes,menubar=yes,height=" + height + ",width=" + width + ",resizable=yes,toolbar=no,location=no,status=no");
}

function confirmBeforeSubmit(question)
{
	if(confirm(question))
		return true;
	else
		return false; 
}

function ClearContainerHTML(container)
{
	document.getElementById(container).innerHTML = "";
}