

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
   {
	    thisForm.USERNAME.value = checkAndReplace( thisForm.USERNAME.value );
		thisForm.PASSWORD.value = checkAndReplace(thisForm.PASSWORD.value);
   //  return true ;
   }

//alert("sdsdsdsd");

var retVal=STREAMNET.logVerify.submitData3();
//alert("return value"+retVal);

//return(retVal);


}



//-->



//For Free Registration process
function confirmSubmit(thisForm)
{

   var todayDate = new Date();
   var currentMonth = todayDate.getMonth();
   var currentYear = todayDate.getYear(); 
   currentMonth = currentMonth + 1;
   var currentYear1 = new String(currentYear);
   currentYear1 = currentYear1.substring(2);

 thisForm.first_name.value = trim(thisForm.first_name.value);
thisForm.last_name.value = trim(thisForm.last_name.value);
 thisForm.first_name.value = trim(thisForm.first_name.value);
thisForm.user_id.value = trim(thisForm.user_id.value);
thisForm.email.value = trim(thisForm.email.value);

 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 your 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.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.email.focus();
       thisForm.user_id.focus();
	   return (false);
   }
     else if(isBlank(thisForm.email.value))
	{
		alert('Enter the email address.');
		thisForm.email.focus();
		return (false);
	}
	else if(!isValidEmailId(thisForm.email.value))
   {
      alert('Enter a valid email address.');
      thisForm.email.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(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.textverify.value == '')
  {
     alert('Enter the verification text.');
	 thisForm.textverify.focus();
     return(false);
  }
   else
   { 
		   //XSS
		   thisForm.first_name.value = checkAndReplace(thisForm.first_name.value);
		   thisForm.last_name.value = checkAndReplace(thisForm.last_name.value);
		   thisForm.user_id.value = checkAndReplace(thisForm.user_id.value);
		   thisForm.email.value = checkAndReplace(thisForm.email.value);
		   thisForm.user_passwd.value = checkAndReplace(thisForm.user_passwd.value);
		   thisForm.user_passwd2.value = checkAndReplace(thisForm.user_passwd2.value);
		   thisForm.textverify.value = checkAndReplace(thisForm.textverify.value);
		   ////

      return (true);  

   }
}












//////////////////////////////////////////////////



function verifytext(thisForm)
{

	 if(thisForm.textverify.value == '')
  {
     alert('Please enter the text');
	 thisForm.textverify.focus();
     return(false);
  }
   else
   { 
	  
	  //STREAMNET.txtVerify.submitData1();
     var retVal=STREAMNET.txtVerify.submitData1();
	// alert(retVal);
	 return(retVal);
	
   }
}



///////////////////////////////////////////////
//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.getYear(); 
   currentMonth = currentMonth + 1;
   var currentYear1 = new String(currentYear);
   currentYear1 = currentYear1.substring(2);

////////////////////////////



    thisForm.first_name.value = trim(thisForm.first_name.value);
thisForm.last_name.value = trim(thisForm.last_name.value);
 thisForm.first_name.value = trim(thisForm.first_name.value);
thisForm.user_id.value = trim(thisForm.user_id.value);
thisForm.email.value = trim(thisForm.email.value);


//////////////////////

   if (thisForm.first_name.value =='')
   {
	  alert('Please 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('Please 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.user_id.value =='')
   {  alert('Please enter 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);
   }
   else if(isBlank(thisForm.email.value))
	{
		alert('Please enter your email ID');
		thisForm.email.focus();
		return (false);
	}
	else if(!isValidEmailId(thisForm.email.value))
   {
      alert('Please enter a valid email ID');
      thisForm.email.focus();
      return(false);
   } 
    if(isBlank(thisForm.user_passwd.value))
   {  alert('Please enter Password');
      thisForm.user_passwd.focus();
	  return (false);
   }
   else if (inValidString(thisForm.user_passwd.value))
   {
       alert('Password can contain only A-Z, a-z, and 0-9 as characters')
       thisForm.user_passwd.focus();
       return (false);
   }
   else if( (thisForm.user_passwd.value.length < 4) || (thisForm.user_passwd.value.length > 16))
   {
        alert('Password must be between 4 to 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 cannot be same as Username');
      thisForm.user_passwd.focus();
      return (false);
   }
   else if(isBlank(thisForm.user_passwd2.value))
   {  alert('Please 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.textverify.value == '')
  {
       alert('Please enter the Verification text');
	   thisForm.textverify.focus();
       return(false);
  }
   
  else if (radioChecked == 0)
   {
	  
	  alert('Please choose the Plan type');
	  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,10)) )
	   {
			alert('Please 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('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
		{
		   //XSS
		   thisForm.first_name.value = checkAndReplace(thisForm.first_name.value);
		   thisForm.last_name.value = checkAndReplace(thisForm.last_name.value);
		   thisForm.user_id.value = checkAndReplace(thisForm.user_id.value);
		   thisForm.email.value = checkAndReplace(thisForm.email.value);
		   thisForm.user_passwd.value = checkAndReplace(thisForm.user_passwd.value);
		   thisForm.user_passwd2.value = checkAndReplace(thisForm.user_passwd2.value);
		   thisForm.textverify.value = checkAndReplace(thisForm.textverify.value);
		   thisForm.cardnumber.value = checkAndReplace(thisForm.cardnumber.value);
		   thisForm.cvv.value = checkAndReplace(thisForm.cvv.value);
		   thisForm.month.value = checkAndReplace(thisForm.month.value);
		   thisForm.year.value = checkAndReplace(thisForm.year.value);
		   thisForm.address.value = checkAndReplace(thisForm.address.value);
		   thisForm.zip.value = checkAndReplace(thisForm.zip.value);
		   //
         return true;
	      //return verifytext(document.form1); //uncommented now
		}
	} 
   else
   { 
	   //XSS
		   thisForm.first_name.value = checkAndReplace(thisForm.first_name.value);
		   thisForm.last_name.value = checkAndReplace(thisForm.last_name.value);
		   thisForm.user_id.value = checkAndReplace(thisForm.user_id.value);
		   thisForm.email.value = checkAndReplace(thisForm.email.value);
		   thisForm.user_passwd.value = checkAndReplace(thisForm.user_passwd.value);
		   thisForm.user_passwd2.value = checkAndReplace(thisForm.user_passwd2.value);
		   thisForm.textverify.value = checkAndReplace(thisForm.textverify.value);
		   thisForm.cardnumber.value = checkAndReplace(thisForm.cardnumber.value);
		   thisForm.cvv.value = checkAndReplace(thisForm.cvv.value);
		   thisForm.month.value = checkAndReplace(thisForm.month.value);
		   thisForm.year.value = checkAndReplace(thisForm.year.value);
		   thisForm.address.value = checkAndReplace(thisForm.address.value);
		   thisForm.zip.value = checkAndReplace(thisForm.zip.value);
		   //
    return true;
	   //return verifytext(document.form1);//uncommented now
   }
}


/////////////////////////////////

/////////////////////////////////
//forgot password
/////////////////////////////////


function forgotValidate(thisForm)
{
if (isBlank(thisForm.user_name.value)&&(isBlank(thisForm.email.value)))
{
  alert('Please enter the username or email id');
  thisForm.user_name.focus();
  return (false);
}

else if( !isBlank(thisForm.email.value) && (thisForm.email.value).indexOf('@')== -1)
{
 alert('Please enter a valid email ID');
  thisForm.email.focus();
  return (false);
}
else
 {
  return(true);
 }
}

////////////////////////////////
/////==========

//For Edit profile process
function editprofileSubmit(thisForm)
{
     

 if(!isBlank(thisForm.password.value))
     {
		 if (inValidString(thisForm.password.value))
		 {
			 alert('Password can contain only A-Z, a-z, and 0-9 as characters')
			 thisForm.password.focus();
			 return (false);
		 }
		 else if( (thisForm.password.value.length < 4) || (thisForm.password.value.length > 16))
		 {
			  alert('Password must be between 4 to 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('Please 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('Please 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('Please enter a valid Email address');
				thisForm.email.focus();
				return(false);
		 }
	/*	 else if(isBlank(thisForm.phone.value))
		 {
			   alert('Please enter 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.getYear(); 
   currentMonth = currentMonth + 1;
   var currentYear1 = new String(currentYear);
   currentYear1 = currentYear1.substring(2);

/*
var btn = valButton(thisForm.plan_type);
if (btn == null) 
	 {
	alert('Please select a plan Type');
	return (false);
	 }

function valButton(btn) {
    var cnt = -1;
    for (var i=btn.length-1; i > -1; i--) {
        if (btn[i].checked) {cnt = i; i = -1;}
    }
    if (cnt > -1) return btn[cnt].value;
    else return null;
}

*/

    
 
   if(isBlank(thisForm.cardnumber.value))
	   {
		  alert('Please enter the Card number');
		  thisForm.cardnumber.focus();
		  return (false);
	   }
    else if(thisForm.cardnumber.value.indexOf('*')== -1)
	 {
		  if (invalidNumber(thisForm.cardnumber.value) )
		   {
		   alert('Card number must be numerals 0-9');
		  thisForm.cardnumber.focus();
					 return (false);
		  }
	 }
  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);
   }

 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(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);
       }

	   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,10)) )
	   {
			alert('Please 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('Please enter a valid expiry Date for the Credit card');
			  thisForm.month.focus();
    		  return (false);
	   } 	
           
      if(isBlank(thisForm.billaddr.value))
	   {
		  alert('Please enter a valid billing Address');
		  thisForm.billaddr.focus();
		  return (false);
	   }
	   else if(inValidAddress(thisForm.billaddr.value))
	   {
		  alert('Address cannot contain Single quote, Double quote and Backward slash');
		  thisForm.billaddr.focus();
		  return (false);
	   }

	 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;
	   }
 }


 function IDEditcc(thisForm)
 {

   var todayDate = new Date();
   var currentMonth = todayDate.getMonth();
   var currentYear = todayDate.getYear(); 
   currentMonth = currentMonth + 1;
   var currentYear1 = new String(currentYear);
   currentYear1 = currentYear1.substring(2);


 if(isBlank(thisForm.cardnumber.value))
	   {
		  alert('Please enter the Card number');
		  thisForm.cardnumber.focus();
		  return (false);
	   }

	 else if(thisForm.cardnumber.value.indexOf('*')== -1)
	 {
	 if (invalidNumber(thisForm.cardnumber.value) )
       {
       alert('Card number must be numerals 0-9');
      thisForm.cardnumber.focus();
                 return (false);
      }
	 }
    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);
	   }*/
	 if (isBlank(thisForm.cardtype.value))
	   {
		  alert('Please select the Card type');
		  thisForm.cardtype.focus();
		  return (false);
	   }
	    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);
       }

	  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,10)) )
	   {
			alert('Please 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('Please enter a valid expiry Date for the Credit card');
			  thisForm.month.focus();
    		  return (false);
	   } 	
           
      if(isBlank(thisForm.billingaddress.value))
	   {
		  alert('Please enter a valid billing Address');
		  thisForm.billingaddress.focus();
		  return (false);
	   }
	   else if(inValidAddress(thisForm.billingaddress.value))
	   {
		  alert('Address cannot contain Single quote, Double quote and Backward slash');
		  thisForm.billingaddress.focus();
		  return (false);
	   }
      
 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);
	 }

 }


 function IDApplyPending(thisForm)
 {
 }


 function IDSupport(thisForm) 
{ 

thisForm.email.value = trim(thisForm.email.value);

if(isBlank(thisForm.user_id.value)) 
   {  
	   
	  alert("Please enter Username");
      thisForm.user_id.focus();
	  return false; 
   } 
  else if(invalidUserName(thisForm.user_id.value))
   {
	  alert('Username can contain only 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(!isValidEmailId(thisForm.email.value))
   {
      alert('Please enter a valid Email address');
      thisForm.email.focus();
      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('Please enter the Problem/Questions/Comments');
	   return (false);   
	}
    else
    { 
		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 ;
    }
}

function IDCancel(thisForm)
{
   
   if(isBlank(thisForm.username.value))
   {
      alert('Please enter Username or email');
      thisForm.username.focus();
      return (false);
   }

   if(thisForm.username.value.indexOf('@')!=-1)
	{
       if(!isValidEmailId(thisForm.username.value))
		{
		   alert('Please enter a valid Email address');
 		   thisForm.username.focus();
	       return (false);

		}
	}
	if(thisForm.username.value.indexOf('@')==-1)
	{
		if(invalidUserName(thisForm.username.value))
		{
			alert('Please enter a valid Username');
			thisForm.username.focus();
	        return (false);
		}

	}
	 if(isBlank(thisForm.password.value))
   {
      alert('Please enter Password');
      thisForm.password.focus();
      return (false);
   }
   else if (inValidString(thisForm.password.value))
   {
       alert('Password can contain only A-Z, a-z, and 0-9 as characters')
       thisForm.password.focus();
       return (false);
   }
   else if( (thisForm.password.value.length < 4) || (thisForm.password.value.length > 16))
   {
        alert('Password must be between 4 to 16 characters');
        thisForm.password.focus();
        return(false);
   }
   else   if (thisForm.reason.value =='')
	{
		thisForm.reason.focus();
		alert('Please select a reason for cancelling the IDrive-E 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('Please 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)
 {
	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
	{
		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('Please enter Password');
	  thisForm.user_passwd.focus();
      return (false);
   }
   else if (inValidString(thisForm.user_passwd.value))
   {
       alert('Password can contain only A-Z, a-z, and 0-9 as characters')
       thisForm.user_passwd.focus();
       return (false);
   }
   else if( (thisForm.user_passwd.value.length < 4) || (thisForm.user_passwd.value.length > 16))
   {
       alert('Password must be between 4 to 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);
   }
}



function populateUserName(thisForm,check)
{


 var fname = thisForm.first_name.value;
 var lname = thisForm.last_name.value;
 var firname = '';
 var lasname = '' ;
 var ch;
 var userallowed = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";

 
     //alert('check1'+thisForm.check1.value);

    if( (check==1) && (thisForm.check1.value=='') )
	{
          
             if((fname!='') && (lname!=''))
		     {

						  thisForm.user_id.value = ' ';
						  
						  for (var loop = 0;loop<fname.length ; loop++)
						  {
							  ch = fname.charAt(loop);
							  if(userallowed.indexOf(ch)!= -1)
							  {  firname = firname + ch; }

						  }

                          if(firname=='' || firname!='')
                          {fname = firname;}						  
							  
						  for (var loop = 0;loop<lname.length ; loop++)
						  {
							  ch = lname.charAt(loop);
							  if(userallowed.indexOf(ch)!= -1)
							  { lasname = lasname + ch; }
						  }

						  if(lasname=='' || lasname!='')
				          {lname = lasname;}
							 
						 

						 fname = fname.toLowerCase();
						 lname = lname.toLowerCase();

						  if(fname.length > 10)
						 {
							  fname = fname.substring(0,10).toLowerCase();
						 }

						 if(lname.length >=10)
						 {
							  lname = lname.substring(0,9).toLowerCase();
						 }

						 if(fname=='' && lname=='')
				         { thisForm.user_id.value = ''; }
						 else
				         {thisForm.user_id.value = fname + "_" + lname;
				          }

/*

     var nameTemp=thisForm.user_id.value;
   
	var unameInputobjref=document.getElementById("useridInput");
	unameInputobjref.innerHTML="<input name='user_id'  id='userId' type='text' class='txtcontent'  size='25' value='"+nameTemp+"' >";
*/
document.form1.email.focus();

 var forSlect=document.getElementById("userId");
 forSlect.select();
 validateUserName();
				//	thisForm.user_id.select();
				
			 }	 

	}// end of check==1
	else if( (check == 2) && (thisForm.check1.value == 1) )
	{
       thisForm.user_id.value = thisForm.user_id.value;
	   thisForm.check1.value = 1;

  // 
////////////


 //var unametxt=document.getElementById("user_id");
	  
	

//////////


	   thisForm.user_id.select();

	}
   
}







/********************************************PARTNER FREE AND PRO REGISTRAYTION****************/
function confirmPartnerSubmit(thisForm)
{

 var radioChecked = 0; 

var accType;

    var i = 0; 
  
	for(i=0; i<thisForm.plan_type.length; i++)
	{
           if(thisForm.plan_type[i].checked == true)
		{
			   //alert('checked');
		       radioChecked = 1; 

			   if(thisForm.plan_type[i].value=="partfree")
			{   
                accType="free";
				 break;
			}else
			{
				accType="pro";
				break;
			}
		}
 
	}



   var todayDate = new Date();
   var currentMonth = todayDate.getMonth();
   var currentYear = todayDate.getYear(); 
   currentMonth = currentMonth + 1;
   var currentYear1 = new String(currentYear);
   currentYear1 = currentYear1.substring(2);

     thisForm.email.value = trim(thisForm.email.value);
  thisForm.user_id.value = trim(thisForm.user_id.value);

   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 your 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.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);
   }
   else if(isBlank(thisForm.email.value))
	{
		alert('Enter the email address.');
		thisForm.email.focus();
		return (false);
	}
	else if(!isValidEmailId(thisForm.email.value))
   {
      alert('Enter a valid email address.');
      thisForm.email.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.textverify.value == '')
  {
       alert('Enter the verification text.');
	   thisForm.textverify.focus();
       return(false);
  }
    else if(radioChecked == 0 ){
	  alert('Choose the Plan type');
	  return (false);
	  }
  
  
if(accType!="free"){

if(thisForm.cardnumber.value != '5555999944448888')
	{
	  
	   if(isBlank(thisForm.cardnumber.value))
	   {
		  alert('Enter the card number.');
		  thisForm.cardnumber.focus();
		  return (false);
	   }
       else if (invalidNumber(trim(thisForm.cardnumber.value)) )
       {
           alert('The card number can contain only digits 0-9.');
           thisForm.cardnumber.focus();
           return (false);
       }
	   else 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('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
		{
		   //XSS
		   thisForm.first_name.value = checkAndReplace(thisForm.first_name.value);
		   thisForm.last_name.value = checkAndReplace(thisForm.last_name.value);
		   thisForm.user_id.value = checkAndReplace(thisForm.user_id.value);
		   thisForm.email.value = checkAndReplace(thisForm.email.value);
		   thisForm.user_passwd.value = checkAndReplace(thisForm.user_passwd.value);
		   thisForm.user_passwd2.value = checkAndReplace(thisForm.user_passwd2.value);
		   thisForm.textverify.value = checkAndReplace(thisForm.textverify.value);
		   thisForm.cardnumber.value = checkAndReplace(trim(thisForm.cardnumber.value));
		   thisForm.cvv.value = checkAndReplace(thisForm.cvv.value);
		   thisForm.month.value = checkAndReplace(thisForm.month.value);
		   thisForm.year.value = checkAndReplace(thisForm.year.value);
		   thisForm.address.value = checkAndReplace(thisForm.address.value);
		   thisForm.zip.value = checkAndReplace(thisForm.zip.value);
		   //
       //  return true;
	      //return verifytext(document.form1); //uncommented now
		}

	} 
   else  //card no is 5555999944448888
   { 
	   //XSS


		   thisForm.first_name.value = checkAndReplace(thisForm.first_name.value);
		   thisForm.last_name.value = checkAndReplace(thisForm.last_name.value);
		   thisForm.user_id.value = checkAndReplace(thisForm.user_id.value);
		   thisForm.email.value = checkAndReplace(thisForm.email.value);
		   thisForm.user_passwd.value = checkAndReplace(thisForm.user_passwd.value);
		   thisForm.user_passwd2.value = checkAndReplace(thisForm.user_passwd2.value);
		   thisForm.textverify.value = checkAndReplace(thisForm.textverify.value);


           if(accType=="free"){
	   {
		   thisForm.cardnumber.value = checkAndReplace(trim(thisForm.cardnumber.value));
		   thisForm.cvv.value = checkAndReplace(thisForm.cvv.value);
		   thisForm.month.value = checkAndReplace(thisForm.month.value);
		   thisForm.year.value = checkAndReplace(thisForm.year.value);
		   thisForm.address.value = checkAndReplace(thisForm.address.value);
		   thisForm.zip.value = checkAndReplace(thisForm.zip.value);
	   }
		   //
   // return true;
	   //return verifytext(document.form1);//uncommented now
   }


}//end of if paid.


}



for(i=0; i<thisForm.signuptype.length; i++)
	{
           if(thisForm.signuptype[i].checked == true)
		{
			 

			   if(thisForm.signuptype[i].value=="mac")
			{   
                signuptype="mac";
				 break;
			}else
			{
              signuptype="win";
			}
		}

		//alert("signup tupe"+signuptype);
 
	}

//alert("acctype is-----"+accType);
//alert("signup is-----"+signuptype);
//var os=thisForm.signuptype.checked;

//alert("THe OS is "+os);



var partId=thisForm.p.value;
//alert(partId);

if(accType=="free" && signuptype=="mac")
	{
	//alert("freeRegServ");
document.form1.action="https://www.idrive.com/idrivee/servlet/IDEFreeRegistrationServlet_mac?p="+partId;

//alert("sdsds");
//document.form1.Submit();
return true;
	}
else if(accType!="free" && signuptype=="mac" )
	{
	//	alert("proregserve");
document.form1.action="https://www.idrive.com/idrivee/servlet/IDEProRegistrationServlet_mac?p="+partId;
return true;
//document.form1.Submit();
	}



}
