// CONTAINS COMMONLY USED FUNCTIONS

// Function to check the maximum and 0 number of characters for any field...  
// (Kapil - 20/11)
function fnCheckLength(strMsg,strVal,inMin,inMax)
{
	stItemValue = strVal.value;
	inItemLength = stItemValue.length;
	
	// Validate the control's minimum value.
	if (inMin != 0)
	{
		if (inItemLength < 1) 
		{
			alert(strMsg + " cannot be Blank!. Please retry.");
			strVal.focus();
			strVal.select();
			return(false);
		}
	}
	if  (inItemLength > inMax) 	// Validate the control's maximum value.
	{
		alert(strMsg + " cannot be of more than " + inMax + " characters. Please retry.");
		strVal.focus();
		strVal.select();
		return(false);
	}
	return(true);
}


// Function to check that only numbers are entered
// (Kapil - 20/11)
function fnCheckNumeric(strMsg,strVal,inCheckNeg)
{
	//alert(strVal);
	stItemValue = strVal.value;
	//alert(stItemValue);
	//stItemValue="432df"
		
	if (isNaN(stItemValue) == true)
	{
			alert(strMsg + " can only have numeric data!. Please retry.");
			strVal.focus();
			strVal.select();
			return(false);
	}
	
	if (inCheckNeg == 1)
	{
		if (!(fnCheckNeg(strMsg,strVal)))
			return (false);
	}
	
	return(true);

}


// Function to check that number is not negative
// (Kapil - 31/01/2001)
function fnCheckNeg(strMsg,strVal)
{
	stItemValue = strVal.value;
		
	if (parseInt(stItemValue) < 0)
	{
			alert(strMsg + " cannot be negative!. Please retry.");
			strVal.focus();
			strVal.select();
			return(false);
	}
	return(true);

}

function logout()
{
	ans = confirm("Are you sure you want to log out.");
	if (ans)
		location.href="../../uk/admin/logout.asp";
}

// Function to check that only numbers are entered
// (Kapil - 20/11)
function fnCheckNumeric(strMsg,strVal)
{
	//alert(strVal);
	stItemValue = strVal.value;
	//alert(stItemValue);
	//stItemValue="432df"
		
	if (isNaN(stItemValue) == true)
	{
			alert(strMsg + " can only have numeric data!. Please retry.");
			strVal.focus();
			strVal.select();
			return(false);
	}
	return(true);

}





