

 function  submitApplyPendingCharges(thisForm)
{
	
	var todayDate = new Date();
   var currentMonth = todayDate.getMonth();
   var currentYear = todayDate.getFullYear(); 
   currentMonth = currentMonth + 1;
   var currentYear1 = new String(currentYear);
   currentYear1 = currentYear1.substring(2);

	if (isBlank(thisForm.cardtype.value))
	   {
		  alert('Select the card type.');
		  thisForm.cardtype.focus();
		  return (false);
	   }

     else if(isBlank(thisForm.cardnumber.value))
	   {
		  alert('Enter the card number.');
		  thisForm.cardnumber.focus();
		  return (false);
	   }
       else if(isBlank(thisForm.month.value))
	   {
		  alert('Enter the expiry month for the credit card.');
		  thisForm.month.focus();
		  return (false);
	   }
	   else if(invalidNumber(thisForm.month.value))
	   {
	 	  alert('Enter a valid expiry month for the credit card.');
		  thisForm.month.focus();
		  return (false);
	   }
	   else if( (thisForm.month.value < 1) || (thisForm.month.value > 12) )
       {
          alert('Enter a valid expiry month for the credit card.');
          thisForm.month.focus();
          return(false);
       }

	  else if(isBlank(thisForm.year.value))
	   {
		  alert('Enter a valid expiry year for the credit card.');
		  thisForm.year.focus();
		  return (false);
	   }

	   else if(invalidNumber(thisForm.year.value))
	   {
		  alert('Enter a valid expiry year for the credit card.');
		  thisForm.year.focus();
		  return (false);
	   }
	   
	   else if((thisForm.year.value) < (parseInt(currentYear1,10)) )
	   {
			alert('Enter a valid expiry year for the credit card.');
			thisForm.year.focus();
			return(false);
	   }


	   else if( ( (thisForm.year.value) ==(parseInt(currentYear1,10)) ) && ( (thisForm.month.value) < (parseInt(currentMonth,10))  ) )
	   {
			  alert('Enter a valid expiry date for the credit card.');
			  thisForm.month.focus();
    		  return (false);
	   } 	
           
      else  if(isBlank(thisForm.billingaddress.value))
	   {
		  alert('Enter a valid billing address.');
		  thisForm.billingaddress.focus();
		  return (false);
	   }
	   else if(inValidAddress(thisForm.billingaddress.value))
	   {
		  alert('Address cannot contain single quotes, double quotes and backward slash.');
		  thisForm.billingaddress.focus();
		  return (false);
	   }
   	 
	if(isBlank(thisForm.zip.value))
	{
			alert('Enter the zip code.');
			thisForm.zip.focus();
			return (false);
	}
	else if(inValidZip(thisForm.zip.value))
	{
			alert('The Zip code entered can contain characters only in the range: A-Z, a-z, 0-9, -,  _ and blank space') ;
			thisForm.zip.focus();
			return (false);
	}else
	{
	
		thisForm.action = "/idrivee/servlet/IDEPendingChargesServlet";
	    thisForm.method = "post";
	    thisForm.submit();
	}
}




function confirmSubmit1(thisForm)
{
   if(isBlank(thisForm.USERNAME.value))
   {  alert("Username or Email is required");
      thisForm.USERNAME.focus();
	  return false;
   }

   if(isBlank(thisForm.PASSWORD.value))
   {  alert("Password cannot be blank");
      thisForm.PASSWORD.focus();
	  return false;
   }
   else
   {
     return true ;
   }
}





//-->



//For Free Registration process
function confirmSubmit(thisForm)
{


/**

   var i = 0; 
    var radioChecked = 0; 
	for(i=0; i<thisForm.plan_type.length; i++)
	{
           if(thisForm.plan_type[i].checked == true)
		{
			   //alert('checked');
		       radioChecked = 1; 
		}
 
	}
   */

   var todayDate = new Date();
   var currentMonth = todayDate.getMonth();
   var currentYear = todayDate.getFullYear(); 
   currentMonth = currentMonth + 1;
   var currentYear1 = new String(currentYear);
   currentYear1 = currentYear1.substring(2);

  if(thisForm.user_id.value =='')
   {  alert('Enter your Username.');
    thisForm.user_id.focus();
	return (false);
   }
   else if(invalidUserName(thisForm.user_id.value))
   {  
	   thisForm.user_id.value = thisForm.user_id.value;
	   thisForm.check1.value = 1;
       populateUserName(thisForm,'2'); 
	   alert('Username can contain only a-z, 0-9 and _ (Underscore)');
      // thisForm.user_id.focus();
	   return (false);
   }
    if(isBlank(thisForm.user_passwd.value))
   {  alert('Enter  your Password.');
      thisForm.user_passwd.focus();
	  return (false);
   }
   else if (inValidString(thisForm.user_passwd.value))
   {
       alert('Password can contain only characters A-Z, a-z, and 0-9.')
       thisForm.user_passwd.focus();
       return (false);
   }
   else if( (thisForm.user_passwd.value.length < 4) || (thisForm.user_passwd.value.length > 16))
   {
        alert('Password must contain 4 - 16 characters.');
        thisForm.user_passwd.focus();
        return(false);
   }
   else if (!containsNumeric(thisForm.user_passwd.value))
   {
       alert('Password should have at least one numeric character')
       thisForm.user_passwd.focus();
       return (false);
   }
   else if(thisForm.user_id.value == thisForm.user_passwd.value)
   {
      alert('Password and Username must be different.');
      thisForm.user_passwd.focus();
      return (false);
   }
   else if(isBlank(thisForm.user_passwd2.value))
   {  alert('Confirm your Password.');
      thisForm.user_passwd2.focus();
	  return (false);
   }
   else if(thisForm.user_passwd2.value != thisForm.user_passwd.value)
   {  alert('Confirm Password must be the same as Password.');
      thisForm.user_passwd2.focus();
     return (false);
   }

  else  if (thisForm.first_name.value =='')
   {
	  alert('Enter your First name.');
	  thisForm.first_name.focus();
	  return (false);
   }
   else if (invalidName(thisForm.first_name.value))
   {
	  alert('First name can contain only characters A-Z, a-z and blank space.');
      thisForm.first_name.focus();
	  return (false);
   }
   else if (thisForm.last_name.value == '')
   {
	  alert('Enter the last name.');
	  thisForm.last_name.focus();
	  return (false);
   }
   else if (invalidName(thisForm.last_name.value))
   {
	  alert('Last name can contain only characters A-Z, a-z and blank space.');
	  thisForm.last_name.focus();
	  return (false);
   }

/**   else if( (thisForm.rtype.value=='support')  && !isValidEmailId(thisForm.email.value))
   {
      alert('Please enter a valid Email address');
	  thisForm.email.focus();
	  return(false);
   }
   */
 else if(isBlank(thisForm.email.value))
	{
			alert('Enter your email address.');
			thisForm.email.focus();
			return (false);
	}
	else if(!isValidEmailId(thisForm.email.value))
   {
      alert('Enter a valid email address.');
      thisForm.email.focus();
      return(false);
   } 

   else if(isBlank(thisForm.phone.value))
   {
	   alert('Enter your Phone number.');
	   thisForm.phone.focus();
	   return(false);
   }
   else if(invalidPhoneNumber(thisForm.phone.value))
   {
	   alert('Phone number can contain only 0-9 x X - + ( )');
	   thisForm.phone.focus();
	   return(false);
   }
 
  
  /**
  else if (radioChecked == 0)
   {
	  
	  alert('Please choose the Plan type');
	  return (false);
   }
   */
  
  else if(thisForm.textverify.value == '')
  {
       alert('Enter the verification text.');
	   thisForm.textverify.focus();
       return(false);
  }
// no credit card validations has to be done if cardnumber is 5555999944448888, to allow support to create free trial
// accounts without valid cc details

//|| thisForm.rtype.value != 'support'
/*
if(thisForm.cardnumber.value != '5555999944448888')
	{
	  
	   if(isBlank(thisForm.cardnumber.value))
	   {
		  alert('Please enter the Card number');
		  thisForm.cardnumber.focus();
		  return (false);
	   }
       else if (invalidNumber(thisForm.cardnumber.value) )
       {
           alert('Card number must be numerals 0-9');
           thisForm.cardnumber.focus();
           return (false);
       }
	   else if (thisForm.cardnumber.value.length < 14 || thisForm.cardnumber.value.length > 16)
	   {
			alert("Card number accepts only 14 to 16 digits");
			thisForm.cardnumber.focus();
			return (false);
	   }
	   else if(isBlank(thisForm.cvv.value))
	   {
		  alert('Please enter the CVV number');
		  thisForm.cvv.focus();
		  return (false);
	   }
	   else if(invalidNumber(thisForm.cvv.value))
	   {
		  alert('CVV accepts only numerals from 0-9');
		  thisForm.cvv.focus();
		  return (false);
	   }
	 else  if(isBlank(thisForm.cardtype.value) )
	   {
		  alert('Please select the Card type');
		  thisForm.cardtype.focus();
		  return (false);
	   }
	  
	   else if(isBlank(thisForm.month.value))
	   {
		  alert('Please enter the expiry Month for the Credit card');
		  thisForm.month.focus();
		  return (false);
	   }
	   else if(invalidNumber(thisForm.month.value))
	   {
	 	  alert('Please enter a valid expiry Month for the Credit card');
		  thisForm.month.focus();
		  return (false);
	   }
	   else if( (thisForm.month.value < 1) || (thisForm.month.value > 12) )
       {
          alert('Please enter a valid expiry Month for the Credit card');
          thisForm.month.focus();
          return(false);
       }

	  else if(isBlank(thisForm.year.value))
	   {
		  alert('Please enter the expiry Year for the Credit card');
		  thisForm.year.focus();
		  return (false);
	   }

	   else if(invalidNumber(thisForm.year.value))
	   {
		  alert('Please enter valid expiry Year for the Credit card');
		  thisForm.year.focus();
		  return (false);
	   }
	   
	   else if((thisForm.year.value) < (parseInt(currentYear1)) )
	   {
			alert('Please enter a valid expiry Year for the Credit card');
			thisForm.year.focus();
			return(false);
	   }


	   else if( ( (thisForm.year.value) ==(parseInt(currentYear1)) ) && ( (thisForm.month.value) < (parseInt(currentMonth))  ) )
	   {
			  alert('Please enter a valid expiry Date for the Credit card');
			  thisForm.month.focus();
    		  return (false);
	   } 	
           
      else  if(isBlank(thisForm.address.value))
	   {
		  alert('Please enter a valid billing Address');
		  thisForm.address.focus();
		  return (false);
	   }
	   else if(inValidAddress(thisForm.address.value))
	   {
          alert('Address cannot contain Single quote, Double quote and Backward slash');
		  thisForm.address.focus();
		  return (false);
	   }
	   else if(isBlank(thisForm.zip.value))
	   {
		  alert('Please enter Zip code');
		  thisForm.zip.focus();
		  return (false);
	   }
	   else if(inValidZip(thisForm.zip.value))
	   {
			alert('Zip code can contain only A-Z, a-z, 0-9,  _ and blank space') ;
			thisForm.zip.focus();
			return (false);
	   } 
	   else
		{
           return true;
		}
	} */
   else
   { 
     return true;
   }
}


///////////////////////////////////////////////
//For Pro Registration process
function confirmProSubmit(thisForm)
{




   var i = 0; 
    var radioChecked = 0; 
	for(i=0; i<thisForm.plan_type.length; i++)
	{
           if(thisForm.plan_type[i].checked == true)
		{
			   //alert('checked');
		       radioChecked = 1; 
		}
 
	}
   

   var todayDate = new Date();
   var currentMonth = todayDate.getMonth();
   var currentYear = todayDate.getFullYear(); 
   currentMonth = currentMonth + 1;
   var currentYear1 = new String(currentYear);
   currentYear1 = currentYear1.substring(2);

  if(thisForm.user_id.value =='')
   {  alert('Enter your Username.');
    thisForm.user_id.focus();
	return (false);
   }
   else if(invalidUserName(thisForm.user_id.value))
   {  
	   thisForm.user_id.value = thisForm.user_id.value;
	   thisForm.check1.value = 1;
       populateUserName(thisForm,'2'); 
	   alert('Username can contain only characters a-z, 0-9 and _ (Underscore).');
      // thisForm.user_id.focus();
	   return (false);
   }
    if(isBlank(thisForm.user_passwd.value))
   {  alert('Enter your Password.');
      thisForm.user_passwd.focus();
	  return (false);
   }
   else if (inValidString(thisForm.user_passwd.value))
   {
       alert('Password can contain only characters A-Z, a-z, and 0-9.')
       thisForm.user_passwd.focus();
       return (false);
   }
   else if( (thisForm.user_passwd.value.length < 4) || (thisForm.user_passwd.value.length > 16))
   {
        alert('Password must contain 4 - 16 characters.');
        thisForm.user_passwd.focus();
        return(false);
   }
   else if (!containsNumeric(thisForm.user_passwd.value))
   {
       alert('Password should have at least one numeric character')
       thisForm.user_passwd.focus();
       return (false);
   }
   else if(thisForm.user_id.value == thisForm.user_passwd.value)
   {
      alert('Password and Username must be different.');
      thisForm.user_passwd.focus();
      return (false);
   }
   else if(isBlank(thisForm.user_passwd2.value))
   {  alert('Confirm your Password.');
      thisForm.user_passwd2.focus();
	  return (false);
   }
   else if(thisForm.user_passwd2.value != thisForm.user_passwd.value)
   {  alert('Confirm Password must be same as Password');
      thisForm.user_passwd2.focus();
     return (false);
   }

  else  if (thisForm.first_name.value =='')
   {
	  alert('Enter the First name.');
	  thisForm.first_name.focus();
	  return (false);
   }
   else if (invalidName(thisForm.first_name.value))
   {
	  alert('First name can contain only characters A-Z, a-z and blank space.');
      thisForm.first_name.focus();
	  return (false);
   }
   else if (thisForm.last_name.value == '')
   {
	  alert('Enter the last name.');
	  thisForm.last_name.focus();
	  return (false);
   }
   else if (invalidName(thisForm.last_name.value))
   {
	  alert('Last name can contain only characters A-Z, a-z and blank space.');
	  thisForm.last_name.focus();
	  return (false);
   }

/**   else if( (thisForm.rtype.value=='support')  && !isValidEmailId(thisForm.email.value))
   {
      alert('Please enter a valid Email address');
	  thisForm.email.focus();
	  return(false);
   }
   */
 else if(isBlank(thisForm.email.value))
	{
			alert('Enter your email address.');
			thisForm.email.focus();
			return (false);
	}
	else if(!isValidEmailId(thisForm.email.value))
   {
      alert('Invalid email address.');
      thisForm.email.focus();
      return(false);
   } 

   else if(isBlank(thisForm.phone.value))
   {
	   alert('Enter your phone number.');
	   thisForm.phone.focus();
	   return(false);
   }
   else if(invalidPhoneNumber(thisForm.phone.value))
   {
	   alert('Phone number can contain only 0-9 x X - + ( )');
	   thisForm.phone.focus();
	   return(false);
   }
 
  
  
  else if (radioChecked == 0)
   {
	  
	  alert('Choose a plan.');
	  return (false);
   }
   
  
  else if(thisForm.textverify.value == '')
  {
       alert('Enter the verification text.');
	   thisForm.textverify.focus();
       return(false);
  }
// no credit card validations has to be done if cardnumber is 5555999944448888, to allow support to create free trial
// accounts without valid cc details

//|| thisForm.rtype.value != 'support'

if(thisForm.cardnumber.value != '5555999944448888')
	{
	  
	   if(isBlank(thisForm.cardnumber.value))
	   {
		  alert('Enter the card number.');
		  thisForm.cardnumber.focus();
		  return (false);
	   }
       else if (invalidNumber(thisForm.cardnumber.value) )
       {
           alert('The card number can contain only digits 0-9.');
           thisForm.cardnumber.focus();
           return (false);
       }
	   else if (thisForm.cardnumber.value.length < 14 || thisForm.cardnumber.value.length > 16)
	   {
			alert("The card number can contain only 14 - 16 digits.");
			thisForm.cardnumber.focus();
			return (false);
	   }
	   else if(isBlank(thisForm.cvv.value))
	   {
		  alert('Enter the CVV number.');
		  thisForm.cvv.focus();
		  return (false);
	   }
	   else if(invalidNumber(thisForm.cvv.value))
	   {
		  alert('CVV accepts only digits 0-9.');
		  thisForm.cvv.focus();
		  return (false);
	   }
	 else  if(isBlank(thisForm.cardtype.value) )
	   {
		  alert('Select the card type.');
		  thisForm.cardtype.focus();
		  return (false);
	   }
	  
	   else if(isBlank(thisForm.month.value))
	   {
		  alert('Enter the expiry month for the credit card.');
		  thisForm.month.focus();
		  return (false);
	   }
	   else if(invalidNumber(thisForm.month.value))
	   {
	 	  alert('Enter a valid expiry month for the credit card.');
		  thisForm.month.focus();
		  return (false);
	   }
	   else if( (thisForm.month.value < 1) || (thisForm.month.value > 12) )
       {
          alert('Enter a valid expiry month for the credit card.');
          thisForm.month.focus();
          return(false);
       }

	  else if(isBlank(thisForm.year.value))
	   {
		  alert('Enter a valid expiry year for the credit card.');
		  thisForm.year.focus();
		  return (false);
	   }

	   else if(invalidNumber(thisForm.year.value))
	   {
		  alert('Enter a valid expiry year for the credit card.');
		  thisForm.year.focus();
		  return (false);
	   }
	   
	   else if((thisForm.year.value) < (parseInt(currentYear1,10)) )
	   {
			alert('Enter a valid expiry year for the credit card.');
			thisForm.year.focus();
			return(false);
	   }


	   else if( ( (thisForm.year.value) ==(parseInt(currentYear1,10)) ) && ( (thisForm.month.value) < (parseInt(currentMonth,10))  ) )
	   {
			  alert('Enter a valid expiry date for the credit card.');
			  thisForm.month.focus();
    		  return (false);
	   } 	
           
      else  if(isBlank(thisForm.address.value))
	   {
		  alert('Enter a valid billing address.');
		  thisForm.address.focus();
		  return (false);
	   }
	   else if(inValidAddress(thisForm.address.value))
	   {
          alert('Address cannot contain single quotes, double quotes and backward slash.');
		  thisForm.address.focus();
		  return (false);
	   }
	   else if(isBlank(thisForm.zip.value))
	   {
		  alert('Enter the zip code.');
		  thisForm.zip.focus();
		  return (false);
	   }
	   else if(inValidZip(thisForm.zip.value))
	   {
			alert('Zip code can contain only A-Z, a-z, 0-9, -,  _ and blank space') ;
			thisForm.zip.focus();
			return (false);
	   } 
	   else
		{
           return true;
		}
	} 
   else
   { 
     return true;
   }
}


/////////////////////////////////

/////////////////////////////////
//forgot password
/////////////////////////////////




/***************************************************************************/

////////////////////////////////
/////==========

//For Edit profile process
function editprofileSubmit(thisForm)
{
     

 if(!isBlank(thisForm.password.value))
     {
		 if (inValidString(thisForm.password.value))
		 {
			 alert('Password can contain only characters A-Z, a-z, and 0-9.')
			 thisForm.password.focus();
			 return (false);
		 }
		 else if( (thisForm.password.value.length < 4) || (thisForm.password.value.length > 16))
		 {
			  alert('Password must contain 4 - 16 characters.');
		  
			  thisForm.password.focus();
			  return(false);
		 }
		 else if (!containsNumeric(thisForm.password.value))
		 {
			 alert('Password should have atleast one numeric character (0-9)')
		  
			 thisForm.password.focus();
			 return (false);
		 }
		 else if(thisForm.password1.value != thisForm.password.value)
		 {  alert('Confirm Password must be same as Password');
			thisForm.password1.focus();
			return (false);
		 }
	 }
     if (thisForm.firstname.value =='')
     {
		 alert('Enter the First name.');
		 thisForm.firstname.focus();
		 return (false);
     }
     else if (invalidName(thisForm.firstname.value))
     {
		alert('First name can contain only characters A-Z, a-z and blank space.');
		thisForm.firstname.focus();
		return (false);
     }
     else if (thisForm.lastname.value == '')
     {
		alert('Enter the last name.');
		thisForm.lastname.focus();
		return (false);
     }
     else if (invalidName(thisForm.lastname.value))
     {
		alert('Last name can contain only characters A-Z, a-z and blank space.');
		thisForm.lastname.focus();
		return (false);
     }

 
		 else if(!isValidEmailId(thisForm.email.value))
		 {
				alert('Enter a valid email address.');
				thisForm.email.focus();
				return(false);
		 }
		 else if(isBlank(thisForm.phone.value))
		 {
			   alert('Enter your phone number.');
			   thisForm.phone.focus();
			   return(false);
		}

		else if(invalidPhoneNumber(thisForm.phone.value))
		 {
			   alert('Phone number can contain only 0-9 x X - + ( )');
			   thisForm.phone.focus();
			   return(false);
		}
		else
		{
		   return true;
		}
    
	
  

}

////////====

 
 
 function IDUpgrade(thisForm)
 {
 
   var todayDate = new Date();
   var currentMonth = todayDate.getMonth();
   var currentYear = todayDate.getFullYear(); 
   currentMonth = currentMonth + 1;
   var currentYear1 = new String(currentYear);
   currentYear1 = currentYear1.substring(2);

  var i = 0; 
    var radioChecked = 0; 
	for(i=0; i<thisForm.plan_type.length; i++)
	{
           if(thisForm.plan_type[i].checked == true)
		{
			   //alert('checked');
		       radioChecked = 1; 
		}
 
	}

    if (radioChecked == 0)
   { 	  
	  alert('Choose a plan.');
	  return (false);
   }    
 
   else if(isBlank(thisForm.cardnumber.value))
	   {
		  alert('Enter the card number.');
		  thisForm.cardnumber.focus();
		  return (false);
	   }
    else if(thisForm.cardnumber.value.indexOf('*')== -1)
	 {
		  if (invalidNumber(trim(thisForm.cardnumber.value)) )
		   {
		   alert('The card number can contain only digits 0-9.');
		  thisForm.cardnumber.focus();
					 return (false);
		  }
	 }
  if (trim(thisForm.cardnumber.value).length < 14 || trim(thisForm.cardnumber.value).length > 16)
   {
		alert("The card number can contain only 14 - 16 digits.");
		thisForm.cardnumber.focus();
		return (false);
   }

 if(isBlank(thisForm.cvv.value))
	  {
		  alert('Enter the CVV number.');
		  thisForm.cvv.focus();
		  return (false);
	   }
   else if(invalidNumber(thisForm.cvv.value))
	   {
		  alert('CVV accepts only digits 0-9.');
		  thisForm.cvv.focus();
		  return (false);
	   }

	   if(invalidNumber(thisForm.month.value))
	   {
	 	  alert('Enter the expiry month for the credit card.');
		  thisForm.month.focus();
		  return (false);
	   }
	   else if( (thisForm.month.value < 1) || (thisForm.month.value > 12) )
       {
          alert('Enter a valid expiry month for the credit card.');
          thisForm.month.focus();
          return(false);
       }

	   if(isBlank(thisForm.year.value))
	   {
		  alert('Enter a valid expiry year for the credit card.');
		  thisForm.year.focus();
		  return (false);
	   }
   else if(invalidNumber(thisForm.year.value))
	   {
		  alert('Enter a valid expiry year for the credit card.');
		  thisForm.year.focus();
		  return (false);
	   }
	    else if((thisForm.year.value) < (parseInt(currentYear1,10)) )
	   {
			alert('Enter a valid expiry year for the credit card.');
			thisForm.year.focus();
			return(false);
	   }


	   else if( ( (thisForm.year.value) ==(parseInt(currentYear1,10)) ) && ( (thisForm.month.value) < (parseInt(currentMonth,10))  ) )
	   {
			  alert('Enter a valid expiry date for the credit card.');
			  thisForm.month.focus();
    		  return (false);
	   } 	
           
      if(isBlank(thisForm.billaddr.value))
	   {
		  alert('Enter a valid billing address.');
		  thisForm.billaddr.focus();
		  return (false);
	   }
	   else if(inValidAddress(thisForm.billaddr.value))
	   {
		  alert('Address cannot contain single quotes, double quotes and backward slash.');
		  thisForm.billaddr.focus();
		  return (false);
	   }

	 if(isBlank(thisForm.zip.value))
	   {
		  alert('Enter the zip code.');
		  thisForm.zip.focus();
		  return (false);
	   }
	   else if(inValidZip(thisForm.zip.value))
	   {
			alert('Zip code can contain only A-Z, a-z, 0-9, -,  _ and blank space') ;
			thisForm.zip.focus();
			return (false);
	   }
	   else
	   {
		   return true;
	   }
 }


 function IDEditcc(thisForm)
 {

   var todayDate = new Date();
   var currentMonth = todayDate.getMonth();
   var currentYear = todayDate.getFullYear(); 
   currentMonth = currentMonth + 1;
   var currentYear1 = new String(currentYear);
   currentYear1 = currentYear1.substring(2);


 if(isBlank(thisForm.cardnumber.value))
	   {
		  alert('Enter the card number.');
		  thisForm.cardnumber.focus();
		  return (false);
	   }

	 else if(thisForm.cardnumber.value.indexOf('*')== -1)
	 {
	 if (invalidNumber(trim(thisForm.cardnumber.value)) )
       {
       alert('The card number can contain only digits 0-9.');
      thisForm.cardnumber.focus();
                 return (false);
      }
	 }
    if (trim(thisForm.cardnumber.value).length < 14 || trim(thisForm.cardnumber.value).length > 16)
   {
		alert("The card number can contain only 14 - 16 digits.");
		thisForm.cardnumber.focus();
		return (false);
   }
	   /*else if(isBlank(thisForm.cvv.value))
	  {
		  alert('Please enter the CVV number');
		  thisForm.cvv.focus();
		  return (false);
	   }
   else if(invalidNumber(thisForm.cvv.value))
	  {
		  alert('CVV accepts only numerals from 0-9');
		  thisForm.cvv.focus();
		  return (false);
	   }*/
	 if (isBlank(thisForm.cardtype.value))
	   {
		  alert('Select the card type.');
		  thisForm.cardtype.focus();
		  return (false);
	   }
	    if(isBlank(thisForm.month.value))
	   {
		  alert('Enter a valid expiry month for the credit card.');
		  thisForm.month.focus();
		  return (false);
	   }
	   else if(invalidNumber(thisForm.month.value))
	   {
	 	  alert('Enter a valid expiry month for the credit card.');
		  thisForm.month.focus();
		  return (false);
	   }
	   else if( (thisForm.month.value < 1) || (thisForm.month.value > 12) )
       {
          alert('Enter a valid expiry month for the credit card.');
          thisForm.month.focus();
          return(false);
       }

	  if(isBlank(thisForm.year.value))
	   {
		  alert('Enter a valid expiry year for the credit card.');
		  thisForm.year.focus();
		  return (false);
	   }

	   else if(invalidNumber(thisForm.year.value))
	   {
		  alert('Enter a valid expiry year for the credit card.');
		  thisForm.year.focus();
		  return (false);
	   }
	   
	   else if((thisForm.year.value) < (parseInt(currentYear1,10)) )
	   {
			alert('Enter a valid expiry year for the credit card.');
			thisForm.year.focus();
			return(false);
	   }

     else if( ( (thisForm.year.value) ==(parseInt(currentYear1,10)) ) && ( (thisForm.month.value) < (parseInt(currentMonth,10))  ) )
	   {
			  alert('Enter a valid expiry date for the credit card.');
			  thisForm.month.focus();
    		  return (false);
	   } 	
           
      if(isBlank(thisForm.billingaddress.value))
	   {
		  alert('Enter a valid billing address.');
		  thisForm.billingaddress.focus();
		  return (false);
	   }
	   else if(inValidAddress(thisForm.billingaddress.value))
	   {
		  alert('Address cannot contain single quotes, double quotes and backward slash.');
		  thisForm.billingaddress.focus();
		  return (false);
	   }
      
 if(isBlank(thisForm.zip.value))
	{
			alert('Enter the zip code.');
			thisForm.zip.focus();
			return (false);
	}
	else if(inValidZip(thisForm.zip.value))
	{
			alert('Zip code can contain only A-Z, a-z, 0-9, -,  _ and blank space') ;
			thisForm.zip.focus();
			return (false);
	}
	else
	 {
       return (true);
	 }

 }


 function IDApplyPending(thisForm)
 {
 }


 function IDSupport(thisForm) 
{ 
   
   
   if(thisForm.validateEmail.value!='true')
	{
   
   //if(!isValidEmailId(thisForm.email.value) && thisForm.invEmail.value != "true";)
   if(!isValidEmailId(thisForm.email.value))
   {
      thisForm.invEmail.value = "";
	  alert('Enter a valid email address.');
      thisForm.email.focus();
      return(false);
   }
   else if(thisForm.user_id.value!='' && invalidUserName(thisForm.user_id.value))
	{
	   alert('Username can contain only characters a-z, 0-9 and _ (Underscore).');
	   thisForm.user_id.focus();
	   return false;

	}
	else if((thisForm.invUser.value=="too") && isBlank(thisForm.user_id.value)) 
   {  
	  alert("Enter the username to identify your IDrive account");
      thisForm.user_id.focus();
	  return false; 
   }
    else if((thisForm.invUser.value=="too") && (invalidUserName(thisForm.user_id.value)))
   {
	  alert('Username can contain only characters a-z, 0-9 and _ (Underscore).');
      thisForm.user_id.focus();
	  return false;
   } 
   else if( (thisForm.phone.value!='') && (invalidSecurityPhNum(thisForm.phone.value)))
   {
	   thisForm.phone.focus();
	   alert('Phone number can contain only 0-9 x X - +.');
	   return(false);
   }
    
 /** else if((thisForm.os.value=='choose'))
   {
     alert('Please select the OS');
   //  thisForm.os_others.focus();
     thisForm.os.focus();
     return (false);   
   }
   */

 /**  else if((thisForm.os.value=='Others') && (thisForm.os_others.value==''))
   {
     alert('Please specify the OS');
     //thisForm.os_others.focus();
     thisForm.os_others.focus();
     return (false);   
   }
   else if( (thisForm.program.value=='') || (thisForm.program.value=='choose') )
	{
	   alert('Please choose your Issue');
	   thisForm.program.focus();
	   return (false);   
	}
	*/

	else if( (thisForm.program.value=='Others') && (thisForm.otherinfo.value=='') )
	{
	   thisForm.otherinfo.focus();
	   alert('Enter your technical issues/ feedback .');
	   return (false);   
	}

	if(thisForm.invEmail.value=="true")
	{
	   STREAMNET.idrive.emailVerifySyn(thisForm);
	   return(false);
	}

    { 
		thisForm.user_id.value = checkAndReplace(thisForm.user_id.value);
		thisForm.phone.value = checkAndReplace(thisForm.phone.value);
		thisForm.email.value = checkAndReplace(thisForm.email.value);
		//thisForm.os_others.value = checkAndReplace(thisForm.os_others.value);
		thisForm.otherinfo.value = checkAndReplace(thisForm.otherinfo.value);
		return true ;
    }

	}
	else
	{
		return false;
	}
}

function IDCancel(thisForm)
{
   
   if(isBlank(thisForm.username.value))
   {
      alert('Enter your username or email address.');
      thisForm.username.focus();
      return (false);
   }

   if(thisForm.username.value.indexOf('@')!=-1)
	{
       if(!isValidEmailId(thisForm.username.value))
		{
		   alert('Enter a valid email address.');
 		   thisForm.username.focus();
	       return (false);

		}
	}
	if(thisForm.username.value.indexOf('@')==-1)
	{
		if(invalidUserName(thisForm.username.value))
		{
			alert('Enter a valid Username.');
			thisForm.username.focus();
	        return (false);
		}

	}
	 if(isBlank(thisForm.password.value))
   {
      alert('Enter your Password.');
      thisForm.password.focus();
      return (false);
   }
   else if (inValidString(thisForm.password.value))
   {
       alert('Password can contain only characters A-Z, a-z, and 0-9.')
       thisForm.password.focus();
       return (false);
   }
   else if( (thisForm.password.value.length < 4) || (thisForm.password.value.length > 16))
   {
        alert('Password must contain 4 - 16 characters.');
        thisForm.password.focus();
        return(false);
   }
   else   if (thisForm.reason.value =='')
	{
		thisForm.reason.focus();
		alert('Please select a reason for cancelling the IDrive account.');
		return (false);
	}

	else    if ( (thisForm.reason.value =='Others') && (thisForm.Others.value ==''))
	{
		thisForm.Others.focus();
		alert('Please enter your Comments');
		return (false);
	}


   if( (thisForm.email.value!='') && (!isValidEmailId(thisForm.email.value)) )
   {
      thisForm.email.focus();
	  alert('Enter a valid email address.');
      return(false);
   }
   else
   {
      thisForm.reason.value = checkAndReplace(thisForm.reason.value);
	  thisForm.Others.value = checkAndReplace(thisForm.Others.value);
	  return true ;
   }


}



function isBlank(Str)
 {
   while(''+Str.charAt(0)==' ')
   Str=Str.substring(1,Str.length);
   while(''+Str.charAt(Str.length-1)==' ')
   Str=Str.substring(0,Str.length-1);
   if (Str == '')
   { return(true);
   }
   else
   { return(false);
   };
 }



function invalidName(Str)
 {
     var alloweduser = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz ";

     for(var count = 0; count < Str.length; count++)
     {
        if(alloweduser.indexOf(Str.substring(count, count + 1)) == -1)
        {
            return(true);
        }
     };

 }



function containsNumeric(Str)
 {
	 var alloweduser = "0123456789";
         var totcount = 0;
	 for(var count = 0; count < Str.length; count++)
	 {
		if(alloweduser.indexOf(Str.substring(count, count + 1)) != -1)
		{
		  totcount++;
		}
	 };

	 if(totcount!=0)
	 {
	   return(true);
	 }
     return(false);
 }







function isValidEmailId(email)
 {

//alert("-"+email+"-");

email= email.replace(/^\s+|\s+$/g, '') ;

//alert("-"+email+"-");


	if (email == null)
	{
		return(false);
	}
	else if(email == '')
	{
		return(false) ;
	}
	else if ( (trim(email).indexOf('@') == -1) ||
			  (trim(email).indexOf('@') == 0) ||
			  (trim(email).indexOf('@') == (trim(email).length-1) ||  trim(email).indexOf('@',(trim(email).indexOf('@')+1))!=-1))
	{
		return(false);
	}
	else if (hasSpecChar(email))
	{
		return(false) ;
	}
	else if(trim(email).indexOf(' ') != -1)
	 {
	   return(false);
	 }
	else
	{
		return(true) ;
	};
 }





function trim(Str)
 {
   if (!(isBlank(Str)))
   {
	  while(''+Str.charAt(0)==' ')
	  Str=Str.substring(1,Str.length);
	  while(''+Str.charAt(Str.length-1)==' ')
	  Str=Str.substring(0,Str.length-1);
	  return(Str);
   }
   else
   { return ('');
   };
 }



 function hasSpecChar(Str)
 {
	var alloweduser = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_@.-";

	 for(var count = 0; count < Str.length; count++)
	 {
		if(alloweduser.indexOf(Str.substring(count, count + 1)) == -1)
		{
		  return(true);
		}

	 };
	 return(false);
 }




 function inValidString(Str)
 {
	 var alloweduser = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";

	 for(var count = 0; count < Str.length; count++)
	 {
		if(alloweduser.indexOf(Str.substring(count, count + 1)) == -1)
		{
		  return(true);
		}

	 };
	 return(false);
 }



 function invalidNumber(Str)
 {
	 var alloweduser = "0123456789";
         var totcount = 0;
	 for(var count = 0; count < Str.length; count++)
	 {
		if(alloweduser.indexOf(Str.substring(count, count + 1)) == -1)
		{
		  totcount++;
		}
	 };
	 if(totcount!=0)
	 {
	   return(true);
	 }
   return(false);
 }


 function invalidPhoneNumber(Str)
 {
	 var alloweduser = "0123456789()- xX+";
         var totcount = 0;
	 for(var count = 0; count < Str.length; count++)
	 {
		if(alloweduser.indexOf(Str.substring(count, count + 1)) == -1)
		{
		  totcount++;
		}
	 };
	 if(totcount!=0)
	 {
	   return(true);
	 }
   return(false);
 }




















 function invalidUserName(Str)
 {
	 var alloweduser = "abcdefghijklmnopqrstuvwxyz0123456789_";

	 for(var count = 0; count < Str.length; count++)
	 {
		if(alloweduser.indexOf(Str.substring(count, count + 1)) == -1)
		{
			return(true);
		}
	 };

 }

function inValidZip(Str)
 {
	 var alloweduser = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_ ";
         var totcount = 0;
	 for(var count = 0; count < Str.length; count++)
	 {
		if(alloweduser.indexOf(Str.substring(count, count + 1)) == -1)
		{
		  totcount++;
		}

	 };
	 if(totcount!=0)
	 {
	   return(true);
	 }
	 return(false);
 }
 
 
 function invalidSecurityPhNum(Str)
{
	 var alloweduser = "0123456789- xX+";
         var totcount = 0;
	 for(var count = 0; count < Str.length; count++)
	 {
		if(alloweduser.indexOf(Str.substring(count, count + 1)) == -1)
		{
		  totcount++;
		}
	 };
	 if(totcount!=0)
	 {
	   return(true);
	 }
   return(false);
 }

function inValidAddress(Str)
{
   if( (Str.indexOf('"') != -1)  ||	(Str.indexOf('\'') != -1) || (Str.indexOf('\\') != -1) )
   { return(true);
   }
   else
   { return (false);
   }
}


function checkAndReplace(str)
{
	var ch ='';
	var j;
	
	if(str=='')
	{
		return '';
	}
	else
	{
	
		for(var i=0;i<str.length;i++)
		{
			
			j = 0;
			if(str.charAt(i)=='\'')
			{
				j++;
			}

			if(str.charAt(i)=='<')
			{
				j++;
			}

			if(str.charAt(i)=='>')
			{
				j++;
				
			}

			if(str.charAt(i)=='(')
			{
				j++;
				
			}

			if(str.charAt(i)==')')
			{
				j++;
				
			}

			if(str.charAt(i)=='%')
			{
				j++;
				
			}
			if(str.charAt(i)=='+')
			{
				j++;
				
			}

			if(str.charAt(i)=='"')
			{
				j++;
				
			}

			if(str.charAt(i)=='&')
			{
				j++;
				
			}

			if(j == 0)
			{
				ch = ch + str.charAt(i);
			}
			j = 0;
			
		}
	}

	return ch;
}

 

function confirmChangePwd(thisForm) 
{ 
   if(isBlank(thisForm.user_passwd.value))
   {
      alert('Enter your Password.');
	  thisForm.user_passwd.focus();
      return (false);
   }
   else if (inValidString(thisForm.user_passwd.value))
   {
       alert('Password can contain only characters A-Z, a-z, and 0-9.')
       thisForm.user_passwd.focus();
       return (false);
   }
   else if( (thisForm.user_passwd.value.length < 4) || (thisForm.user_passwd.value.length > 16))
   {
       alert('Password must contain 4 - 16 characters.');
       thisForm.user_passwd.focus();
       return(false);
   }
  /* else if (!containsNumeric(thisForm.user_passwd.value))
   {
       alert('Password should have at least one numeric character')
       thisForm.user_passwd.focus();
       return (false);
   }*/
   else if(thisForm.user_passwd2.value != thisForm.user_passwd.value)
   {  alert('Confirm Password must be same as Password');
      thisForm.user_passwd2.focus();
      return (false);
   }
   else
   { 
      return (true);
   }
}




