function IsNumber(sText)
{
   var ValidChars = "0123456789.,-";
   var IsNumber=true;
   var Char;

 
   for (i = 0; i < sText.length && IsNumber == true; i++) 
      { 
      Char = sText.charAt(i); 
      if (ValidChars.indexOf(Char) == -1) 
         {
         IsNumber = false;
         }
      }
   return IsNumber;
   
}

// function for calculating maximum day 
function max_day(mn, yr)
{
  var mDay;
  if((mn == 4) || (mn == 6) || (mn == 9) || (mn == 11))
  { 
    mDay = 30;
  }
  else if(mn == 2)
  {
    //calling leap year function 
    mDay = isLeapYear(yr) ? 29 : 28;    
  }
  else
  {
    mDay = 31;
  }
  
//  alert(mDay);
  return mDay; 
}

// function to check leap year
function isLeapYear(yr)
{
  if      (yr % 4 != 0)   return false;
  else if (yr % 400 == 0) return true;
  else if (yr % 100 == 0) return false;
  else                    return true;
}

function inputform()
{
  // Name
  str = porm.tname.value;
  if (str == "") {
    alert("Please enter your Name.");
    porm.tname.focus();
    return false;
  }
  //Email
  str = porm.temail.value;
  if (str == "") {
    alert("Please enter a Valid Email Address.");
    porm.temail.focus();
    return false;
  }
  // Card Number
  str = porm.tcard_no1.value;
  if (str != "") {
	 if ( !IsNumber(str)) {
		 alert("Only numbers are allowed for Card Number.")
		 porm.tcard_no1.focus();
		 return false;
	 }  
  }

  str = porm.tcard_no2.value;
  if (str != "") {
	 if ( !IsNumber(str)) {
		 alert("Only numbers are allowed for Card Number.")
		 porm.tcard_no2.focus();
		 return false;
	 }  
  }

  str = porm.tcard_no3.value;
  if (str != "") {
	 if ( !IsNumber(str)) {
		 alert("Only numbers are allowed for Card Number.")
		 porm.tcard_no3.focus();
		 return false;
	 }  
  }

  str = porm.tcard_no4.value;
  if (str != "") {
	 if ( !IsNumber(str)) {
		 alert("Only numbers are allowed for Card Number.")
		 porm.tcard_no4.focus();
		 return false;
	 }  
  }

  str = porm.tcard_no1.value;
  if (str == "") {
    alert("Please put your Card Number.");
    porm.tcard_no1.focus();
    return false;
  }

  str = porm.tcard_no2.value;
  if (str == "") {
    alert("Please put your Card Number properly.");
    porm.tcard_no2.focus();
    return false;
  }

  str = porm.tcard_no3.value;
  if (str == "") {
    alert("Please put your Card Number properly.");
    porm.tcard_no3.focus();
    return false;
  }

  str = porm.tcard_no4.value;
  if (str == "") {
    alert("Please put your Card Number properly.");
    porm.tcard_no4.focus();
    return false;
  }
  
  // Details of credit card you wish to transfer your balance from:

  // Credit Card Number
  str = porm.tcard_no.value;
  if (str == "") {
	 alert("Please put your Transfer Credit Card Number.")
	 porm.tcard_no.focus();
	 return false;
  }
  if (str != "") {
	 if ( !IsNumber(str)) {
		 alert("Only numbers and '-' are allowed for Transfer Credit Card Number.")
		 porm.tcard_no.focus();
		 return false;
	 }  
  }

  // Credit Card Company
  str = porm.tcccompany.value;
  if (str == "") {
    alert("Please put Company Credit Card.");
    porm.tcccompany.focus();
    return false;
  }

  // Issue Date
  str = porm.tissuedate.value;
  if (str == "") {
    alert("Please put Issue Date/Member Since.");
    porm.tissuedate.focus();
    return false;
  }

  // Credit Limit
  str = porm.tlimit.value;
  if (str == "") {
    alert("Please put Credit Limit.");
    porm.tlimit.focus();
    return false;
  }

  // Current Outstanding Balance
  str = porm.tbalance.value;
  if (str == "") {
    alert("Please put your Current Outstanding Balance.");
    porm.tbalance.focus();
    return false;
  }

  // Amount Requested
  str = porm.tamt_req.value;
  if (str == "") {
    alert("Please put Balance Transfer Amount Requested.");
    porm.tamt_req.focus();
    return false;
  }

  // Payment Term
  str = porm.__variant_select.value;
  if (str == "0") {
    alert("Please choose Payment Term.");
    porm.__variant_select.focus();
    return false;
  }

  //  alert("Your application is placed in your 'Outbox'. Please click 'Send Mail'.");
  return true;
}
