function isblank(strval)
{
	var len = strval.length;
	for (var i = 0; i < len; i++)
	{
      if (strval.charAt(i) != " ")
      {
	     return false;				// If there is any non-space character, isblank() returns false
      }
   }
   return true;
}



function checkLength(strval,minlength,maxlength)
{
	if((strval.length < minlength) || (strval.length > maxlength))
	{
		return false;
	}
	return true;
}

function isDuplicate(strval1,strval2)
{
	if(strval1 != strval2)
	{
		return false;
	}
	return true;
}

function validEmail(strval)
{
	var filter  = /^([a-zA-Z0-9_\.\-])+\@(([a-zA-Z0-9\-]{2,4})+\.)+([a-zA-Z0-9]{2,4})+$/;
	if (filter.test(strval)) 
		return false;
	else 
		return true;
}

function isNumeric(strval)
{
	if(isNaN(strval))
	{
		return false;
	}
	return true;
}

function checkAmount(strval)
{
	if(Math.round(strval) > '100000')
	{
		return false;
	}
	return true;
}

function checkPositive(strval)
{
	/*if(Math.round(strval) <= '0')
	{
		return false;
	}*/
	if(parseFloat(strval) <= '0')
	{
		return false;
	}
	return true;
}

function isDate(day, mon, year)
{
	//alert(day + ' ' + mon + ' ' + year);
	// Check any of them are blanks
	dtcorrect = true;
	if (isblank(day) || isblank(mon) || isblank(year) )
	{
	   dtcorrect = false;
	}

	if ((year % 4) == 0)
	{
		if (mon == '02')
		{
			if (day > 29)
			{
				dtcorrect = false;
			}
		}
	}
	else
	{
		if (mon == '02')
		{
			if (day > 28)
			{
				dtcorrect = false;
			}
		}
	}
	switch (mon)
	{
		case '04':
		case '06':
		case '09':
		case '11': if (day > 30)
					{
						dtcorrect = false;
					}
	}
	return dtcorrect;
}