
function FldChk(flds, form, msg)
{
	for(i=0;i<flds.length;i++)
	{
		box = eval( "document." + form + ".elements[flds[i]]");
		if(box.type=="text" || box.type=='textarea' || box.type=="password")
		{
			if(box.value=='')
			{ 
				if(msg) alert("Please fill in this required field");
				box.focus();
				return false;
			}
		}
		else if(box.type=="select-one")
		{
			seltext = box.options[box.selectedIndex].value;
			if( seltext==0 || seltext=='' )
			{
				if(msg) alert("Please select an option in this required field");
				box.focus();
				return false;
			}
		}
	}
		
	return true;
}

function CheckBoxChk( flds, form, len )
{
	var onechecked = 0;
	fsize = eval("document." + form + ".elements.length");
	for(i=0; i<fsize; i++)
	{
		box = eval("document." + form + ".elements[i]");
		//alert(box.name);
		if(box.type=="checkbox" || box.type=="radio")
		{
			t = box.name.split('[', 1);
			if(t[0]==flds)
			{
				if(box.checked) onechecked=1;
			}
		}
		
		
	}

	return onechecked;
}

function FldChk_byID(flds, msg)
{
	for(i=0;i<flds.length;i++)
	{
		box = document.getElementById( flds[i] );
		if(box.type=="text" || box.type=='textarea' || box.type=="password")
		{
			if(box.value=='')
			{ 
				if(msg) alert("Please fill in this required field");
				box.focus();
				return false;
			}
		}
		else if(box.type=="select-one")
		{
			seltext = box.options[box.selectedIndex].value;
			if(seltext==0 || seltext=='')
			{
				if(msg) alert("Please select an option in this required field");
				box.focus();
				return false;
			}
		}
	}
		
	return true;
}
