<!--
//////////////////////////////////////////////
//	Validate Form Function
///////////////////////////////////////

function ValidateForm() 		
{
	formObj = document.forms(0);
	x=trim(formObj.BP.value);
	y=trim(formObj.BPwithDP.value);
	
	if ((x=="") &&   (y==""))
	    {
 	      alert("Please enter either Basic Pension without DP OR Basic Pension with DP.");
	      formObj.BP.select();	
	   	  return false;  
	  	 } 
		
	if (x!="" )
		if (!isNumeric(x)){
				alert("Error : Invalid Basic Pension without DP")
				return false;}
		else
			if ((x > 15000) ||( x < 1275) || ((x>13000) && (x<15000)) ) {
				alert("Error : Basic Pension (without DP) range is 1275 to 13000 & 15000")
				return false;}
			
			
	if (y!="")
		if (!isNumeric(y)){
				alert("Error : Invalid Basic Pension with DP")
				return false;}
		else
			if ((y > 22500) || (y < 1913 ) ||( (y>19500)&&(y<22500) )  ) {
				alert("Error : Basic Pension (with DP) range is 1913 to 19500 & 22500")				
				return false;}


//Qualifying Service Years	
	PensionType=trim(formObj.ddlPensionType.value);

	if (PensionType=='N')
	{
		x=trim(formObj.QualifyingServiceYr.value);
		y=trim(formObj.QualifyingServiceMonth.value);
		z=trim(formObj.QualifyingServiceDays.value);
	
		if (x!="" )
			{
			if (!isNumeric(x)){
					alert("Error : Invalid Qualifying Service Years");
					return false;}
			else
				if (x < 10) {
					alert("Error : Qualifying Service Years can not be less than 10 Years");
					return false;}	
			}		
		else {
				alert("Error : Qualifying Service Years can not be left blank");
				return false;	}			
				
		if (y!="" )
			if (!isNumeric(y)){
					alert("Error : Invalid Qualifying Service Months");
					return false;}
			else
				if (y > 11) {
					alert("Error : Qualifying Service Months can not be greater than 11 Months");
					return false;}						

		if (z!="" )
			if (!isNumeric(z)){
					alert("Error : Invalid Qualifying Service Days");
					return false;}
			else
				if (z > 30) {
					alert("Error : Qualifying Service Days can not be greater than 30 Days");
					return false;}						

	}
	
	return true;
}

//////////////////////////////////////////////
//	Trim Function
///////////////////////////////////////
function trim(thisvalue)
{
 var result;
 var i=0;
 var j=thisvalue.length-1;
 while ((thisvalue.charCodeAt(i) == 32) && (i<thisvalue.length))
  i++;
 while ((thisvalue.charCodeAt(j) == 32) && (j>0))
  j--;
 j++;
 result=thisvalue.substring(i,j);
 return(result);
}

//////////////////////////////////////////////////////////////////////////
//               isNumeric Function
//////////////////////////////////////////////////////////////////////////
 function isNumeric(checkvalue)
{ 
  var checkOK = "0123456789";
  var checkStr = checkvalue;
  var allValid = true;  

  if (checkStr=="")
	return true;

  for (i = 0;  i < checkStr.length;  i++) {
    ch = checkStr.charAt(i);
    for (j = 0;  j < checkOK.length;  j++)
      if (ch == checkOK.charAt(j))
        break;
    if (j == checkOK.length) {
      allValid = false;
      break;			     }
										 }
  if (!allValid)
    return (false);

  return true
}

//////////////isNumeric Function Ends Here


//===========================================
// Trapping Key strokes in Various Fields
//===========================================


function CheckNumeric() {
// Allowed 0-9 
if (event.keyCode < 48 || event.keyCode >57) 
   event.returnValue =false;
}









//-->


