<!--
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
//validate form elements upon submit, returns true or false
//<form id="test" name="test" method="post" action="./something.asp" onsubmit="return chkReqFlds(formName,strfldName,strfldDesc);">

function chkFormFields(myFormName, myFldNames, myFldDesc)
{
	var formobj = document.forms[myFormName];


//1) Enter name of mandatory fields
	//var fieldRequired = Array("FirstName", "LastName");
	var fieldRequired = myFldNames.split('»');
//2) Enter field description to appear in the dialog box
	//var fieldDescription = Array("First Name", "Last Name");
	var fieldDescription = myFldDesc.split('»');

//3) Enter dialog message
	var alertMsg = "The following fields require a valid entry to submit the form:\n";
	
	var l_Msg = alertMsg.length;
	
	for (var i = 0; i < fieldRequired.length; i++)
	{
		var obj = formobj.elements[fieldRequired[i] + 'Hid'];
		//var obj = document.getElementById([fieldRequired[i] + 'Hid')
		var obj2 = formobj.elements[fieldRequired[i]];
		
		if (obj2)
		{
			//alert(obj.type);
			switch(obj2.type)
			{
			case "select-one":
				if (obj2.selectedIndex == -1 || obj.value == "false|false" || obj.value == "false|true")
				{
					alertMsg += " - " + fieldDescription[i] + "\n";
					obj2.style.backgroundColor = ErrorBGColor;
					obj.value = "false|true"
				}
				else
				{
					obj2.style.backgroundColor = GoodBGColor;
					obj.value = "true|false"
				}
				break;
			case "select-multiple":
				if (obj2.selectedIndex == -1)
				{
					alertMsg += " - " + fieldDescription[i] + "\n";
					obj2.style.backgroundColor = ErrorBGColor;
					obj.value = "false|true"
				}
				else
				{
					obj2.style.backgroundColor = GoodBGColor;
					obj.value = "true|false"
				}
				break;
			case "password":
			case "text":
			case "textarea":
				if (obj.value == "false|false" || obj.value == "false|true")
				{
					alertMsg += " - " + fieldDescription[i] + "\n";
					obj2.style.backgroundColor = ErrorBGColor;
					obj.value = "false|true"
					//alert(obj.style.backgroundColor + ' ' + ErrorBGColor);
				}
				else
				{
					obj2.style.backgroundColor = GoodBGColor;
					obj.value = "true|false"
				}
				break;
			default:
			}
			if (obj2.type == undefined)
			{
				var blnchecked = false;
				for (var j = 0; j < obj2.length; j++)
				{
					if (obj2[j].checked)
					{
						blnchecked = true;
					}
				}
				if (!blnchecked)
				{
					alertMsg += " - " + fieldDescription[i] + "\n";
					obj2.style.backgroundColor = ErrorBGColor;
					obj.value = "false|true"
				}
				else
				{
					obj2.style.backgroundColor = GoodBGColor;
					obj.value = "true|false"
				}

			}
		}
	}

	if (alertMsg.length == l_Msg)
	{
		return true;
	}
	else
	{
		//alertMsg += " - Note: At least one set of class and weight values are required.\n";
		alert(alertMsg);
		return false;
	}
}
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
function chngFormFields(myFldNames, myStyle, myStyle2)
{
	if (document.getElementById(myFldNames + 'Hid').value == 'true|false' || document.getElementById(myFldNames + 'Hid').value == 'false|false')
	{
		document.getElementById(myFldNames).style.border = myStyle;
		document.getElementById(myFldNames).style.backgroundColor = myStyle2;
	}
	else
	{
		document.getElementById(myFldNames).style.border = myStyle;
	}
	
	
	return;
}
//--------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------
//-->