function RestrictLength(lengthLimit, controlName)
{
 if (document.getElementById(controlName) != null)
 {
     var chars = document.getElementById(controlName).value;
     if (chars.length > lengthLimit)
     {
         //alert('limit exceeded');
         document.getElementById(controlName).value = document.getElementById(controlName).value.substring(0, lengthLimit);
     }
 }
}

function SetAllCheckBoxes(formName, fieldName, checkValue)
{
	if(!document.forms[formName])
		return;
	var objCheckBoxes = document.forms[formName].elements[fieldName];
	if(!objCheckBoxes)
		return;
	var countCheckBoxes = objCheckBoxes.length;
	if(!countCheckBoxes)
		objCheckBoxes.checked = checkValue;
	else
		// set the check value for all check boxes
		for(var i = 0; i < countCheckBoxes; i++)
			objCheckBoxes[i].checked = checkValue;
}

function PrintWindow(url)
{
    window.open(url, "printwin", "toolbar=0,scrollbars=1,location=0,height=500,width=600");
}

