
function jsCheckString(prmUserID, prmPwd)
{
	var ch;
	var mynval = 0;
	var bValid = true;

	for (var i = 0; i < prmUserID.value.length; i++)
	{
		ch = prmUserID.value.substring(i, i + 1);
		if ((ch >= "A" && ch <= "Z") || (ch >= "a" && ch <= "z") || (ch >= "0" && ch <= "9"))
		{
			mynval = mynval +1;
		}
		else
		{
			bValid = false;
		}
	}

	ch = "";

	for (var t = 0; t < prmPwd.value.length; t++)
	{
		ch = prmPwd.value.substring(t, t + 1);
		if ((ch >= "A" && ch <= "Z") || (ch >= "a" && ch <= "z") || (ch >= "0" && ch <= "9"))
		{
			mynval = mynval +1;
		}
		else
		{
			bValid = false;
		}
	}
	if (!bValid)
	{
		alert ("Please Enter only numbers or/and letters in the User ID or Password box.");
	}
	return bValid;
}


function comparePassWD(theField1, theField2)
{
	if (theField1.value != theField2.value)
	{
		alert ("Please re-enter the same password in both fields");
		return false;
	}
	else
	{
		return true;
	}
}

function CheckLogonInfo(pUserId, pPassWd) {

	if (pUserId.value == "" || pPassWd.value == "")
	{
		alert("User ID and Password must not be empty.");
		return false;
	}
	else 
	{
		return true;
	}
}

function CheckField(iInputValue)
{
	var bValid = true


	if(isNaN(iInputValue))
	{
		alert("Please Enter Number Only in the Quantity Box");
		bValid = false;
	}
	else
	{
		var ch;
		var mynval = 0;

		if (iInputValue !="" && iInputValue < 1)
		{
			alert ("Please Enter a Positive Number in the Quantity Box");
			bValid = false;
		}

		if (bValid)
		{
			for (var i = 0; i < iInputValue.length; i++)
			{
				ch = iInputValue.substring(i, i + 1);
			    if (ch != "." && ch != "-")
			    {
				     mynval = mynval +1;
			    }
			    else
			    {
				  alert ("Please Enter a Whole Number in the Quantity Box");
		          bValid = false;
		          return false;
			    }
			}
	    }
	}

    if(bValid)
    {
    	return true;
    }
}


function CheckInfo(theForm, itemA, itemB, itemC, itemD)
{
	var bValid = true;

    var requiredFields = new Array(itemA,itemB,itemC,itemD);
    var reqNum = 0;









    for(var fieldNum=0; fieldNum < requiredFields.length; fieldNum++)
    {
    	//Original one
        //if (theForm.elements[requiredFields[fieldNum]].type == "text" && theForm.elements[requiredFields[fieldNum]].value.length != 0)
        if (theForm.elements[requiredFields[fieldNum]].type == "text" && theForm.elements[requiredFields[fieldNum]].value.length != 0 || theForm.elements[requiredFields[fieldNum]].type == "hidden" && theForm.elements[requiredFields[fieldNum]].value.length != 0)
      
        {
			reqNum++;
        }
    }

   if (reqNum == 0)
	{
		bValid = false;
		alert("Please Enter the Number of Containers in the Quantity Box(es)");
	}

	if (bValid)
	{
		for(var i=0; i < requiredFields.length; i++)
		{

			if(bValid && theForm.elements[requiredFields[i]].type == 'text')
			{
				if (!CheckField(theForm.elements[requiredFields[i]].value))
				{
					bValid = false;
					theForm.elements[requiredFields[i]].focus();
					theForm.elements[requiredFields[i]].select();

				}
			}
		}
	}

	if (bValid)
		return true;
	else
		return false;
}



