 var agt=navigator.userAgent.toLowerCase();

function  submitApplyPendingCharges(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 (agt.indexOf("msie") != -1){
	currentYear1 = currentYear1.substring(2);
	}else{
	currentYear1 = currentYear1.substring(1);
	}

	if (isBlank(thisForm.cardtype.value))
	   {
		  alert('カードの種類をお選びください。');
		  thisForm.cardtype.focus();
		  return (false);
	   }

     else if(isBlank(thisForm.cardnumber.value))
	   {
		  alert('カード番号を入力してください。');
		  thisForm.cardnumber.focus();
		  return (false);
	   }
       else if(isBlank(thisForm.month.value))
	   {
		  alert('クレジットカードの有効期限の月を入力してください。');
		  thisForm.month.focus();
		  return (false);
	   }
	   else if(invalidNumber(thisForm.month.value))
	   {
	 	  alert('クレジットカードの有効な月を入力してください。');
		  thisForm.month.focus();
		  return (false);
	   }
	   else if( (thisForm.month.value < 1) || (thisForm.month.value > 12) )
       {
          alert('クレジットカードの有効な月を入力してください。 ');
          thisForm.month.focus();
          return(false);
       }

	  else if(isBlank(thisForm.year.value))
	   {
		  alert('クレジットカードの有効な年を入力してください。');
		  thisForm.year.focus();
		  return (false);
	   }

	   else if(invalidNumber(thisForm.year.value))
	   {
		  alert('クレジットカードの有効な年を入力してください。');
		  thisForm.year.focus();
		  return (false);
	   }
	   
	   else if((thisForm.year.value) < (parseInt(currentYear1,10)) )
	   {
			alert('クレジットカードの有効な年を入力してください。');
			thisForm.year.focus();
			return(false);
	   }


	   else if( ( (thisForm.year.value) ==(parseInt(currentYear1,10)) ) && ( (thisForm.month.value) < (parseInt(currentMonth,10))  ) )
	   {
			  alert('クレジットカードの有効な日付を入力してください。');
			  thisForm.month.focus();
    		  return (false);
	   } 	
           
      else  if(isBlank(thisForm.billingaddress.value))
	   {
		  alert('有効な請求先住所を入力してください。');
		  thisForm.billingaddress.focus();
		  return (false);
	   }
	   else if(inValidAddress(thisForm.billingaddress.value))
	   {
		  alert('住所は一重・二重引用符および逆斜線はご利用できません。 ');
		  thisForm.billingaddress.focus();
		  return (false);
	   }
   	 
	if(isBlank(thisForm.zip.value))
	{
			alert('郵便番号を入力してください。');
			thisForm.zip.focus();
			return (false);
	}
	else if(inValidZip(thisForm.zip.value))
	{
			alert('郵便番号は以下を含む文字でなければなりません：A-Z、a-z、0-9、 -、 _ 、余白') ;
			thisForm.zip.focus();
			return (false);
	}
	else if(thisForm.phone && invalidPhoneNumber(trim(thisForm.phone.value)))
	{ 
		 alert('Enter valid phone number.');
	     thisForm.phone.focus();
	     return (false);
	}
	else
	{
	
		thisForm.action = "/idrivee/servlet/IDEPendingChargesServlet";
	    thisForm.method = "post";
	    thisForm.submit();
	}
}




function confirmSubmit1(thisForm)
{
   if(isBlank(thisForm.USERNAME.value))
   {  alert(" ユーザー名またはＥメールアドレスが必要です。");
      thisForm.USERNAME.focus();
	  return false;
   }

   if(isBlank(thisForm.PASSWORD.value))
   {  alert("パスワードが入力されていません。 ");
      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.getYear(); 
   currentMonth = currentMonth + 1;
   var currentYear1 = new String(currentYear);
  //currentYear1 = currentYear1.substring(2);
  if (agt.indexOf("msie") != -1){
	currentYear1 = currentYear1.substring(2);
	}else{
	currentYear1 = currentYear1.substring(1);
	}

  if(thisForm.user_id.value =='')
   {  alert('ユーザー名を入力してください。');
    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('ユーザー名はa-z、0-9、 _ (下線)でなければなりません。');
      // thisForm.user_id.focus();
	   return (false);
   }
    if(isBlank(thisForm.user_passwd.value))
   {  alert('パスワードを入力してください。 ');
      thisForm.user_passwd.focus();
	  return (false);
   }
   else if (inValidString(thisForm.user_passwd.value))
   {
       alert('パスワードはA-Z、a-z、0-9を含む文字でなければなりません。')
       thisForm.user_passwd.focus();
       return (false);
   }
   else if( (thisForm.user_passwd.value.length < 4) || (thisForm.user_passwd.value.length > 16))
   {
        alert('パスワードは4～16文字出なければなりません。');
        thisForm.user_passwd.focus();
        return(false);
   }

   else if(thisForm.user_id.value == thisForm.user_passwd.value)
   {
       alert('パスワードとユーザー名は同じものをご利用できません。');
      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('再入力されたパスワードは、入力されたパスワードと同じでなければなりません。');
      thisForm.user_passwd2.focus();
     return (false);
   }

  else  if (thisForm.first_name.value =='')
   {
	  alert('名を入力してください。');
	  thisForm.first_name.focus();
	  return (false);
   }
   else if (invalidName(thisForm.first_name.value))
   {
	  alert('名は A-Z、a-zを含む文字、及び余白でなければなりません。 ');
      thisForm.first_name.focus();
	  return (false);
   }
   else if (thisForm.last_name.value == '')
   {
	  alert('姓を入力してください。');
	  thisForm.last_name.focus();
	  return (false);
   }
   else if (invalidName(thisForm.last_name.value))
   {
	  alert('姓は A-Z、a-zを含む文字、及び余白でなければなりません。');
	  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('Ｅメールアドレスを入力してください。 ');
			thisForm.email.focus();
			return (false);
	}
	else if(!isValidEmailId(thisForm.email.value))
   {
      alert('有効なＥメールアドレスを入力してください。');
      thisForm.email.focus();
      return(false);
   } 

   else if(isBlank(thisForm.phone.value))
   {
	   alert('有効なＥメールアドレスを入力してください。');
	   thisForm.phone.focus();
	   return(false);
   }
   else if(invalidPhoneNumber(thisForm.phone.value))
   {
	   alert('電話番号は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('確認テストを入力してください。');
	   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'

   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.getYear(); 
   currentMonth = currentMonth + 1;
   var currentYear1 = new String(currentYear);
   //currentYear1 = currentYear1.substring(2);

   if (agt.indexOf("msie") != -1){
	currentYear1 = currentYear1.substring(2);
	}else{
	currentYear1 = currentYear1.substring(1);
	}

  if(thisForm.user_id.value =='')
   {  alert('ユーザー名を入力してください。');
    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('ユーザー名はa-z、0-9、 _ (下線)でなければなりません。 ');
      // thisForm.user_id.focus();
	   return (false);
   }
    if(isBlank(thisForm.user_passwd.value))
   {  alert('パスワードを入力してください。 ');
      thisForm.user_passwd.focus();
	  return (false);
   }
   else if (inValidString(thisForm.user_passwd.value))
   {
       alert('パスワードはA-Z、a-z、0-9を含む文字でなければなりません。')
       thisForm.user_passwd.focus();
       return (false);
   }
   else if( (thisForm.user_passwd.value.length < 4) || (thisForm.user_passwd.value.length > 16))
   {
        alert('パスワードは4～16文字出なければなりません。');
        thisForm.user_passwd.focus();
        return(false);
   }
   else if (!containsNumeric(thisForm.user_passwd.value))
   {
       alert('パスワードは最低１つの数字を含まなければなりません。')
       thisForm.user_passwd.focus();
       return (false);
   }
   else if(thisForm.user_id.value == thisForm.user_passwd.value)
   {
      alert('パスワードとユーザー名は同じものをご利用できません。');
      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('再入力されたパスワードは、入力されたパスワードと同じでなければなりません。');
      thisForm.user_passwd2.focus();
     return (false);
   }

  else  if (thisForm.first_name.value =='')
   {
	  alert('名を入力してください。');
	  thisForm.first_name.focus();
	  return (false);
   }
   else if (invalidName(thisForm.first_name.value))
   {
	  alert('名は A-Z、a-zを含む文字、及び余白でなければなりません。');
      thisForm.first_name.focus();
	  return (false);
   }
   else if (thisForm.last_name.value == '')
   {
	  alert('姓を入力してください。');
	  thisForm.last_name.focus();
	  return (false);
   }
   else if (invalidName(thisForm.last_name.value))
   {
	  alert('姓は A-Z、a-zを含む文字、及び余白でなければなりません。');
	  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('Ｅメールを入力してください。 ');
			thisForm.email.focus();
			return (false);
	}
	else if(!isValidEmailId(thisForm.email.value))
   {
      alert('Ｅメールアドレスが無効です。');
      thisForm.email.focus();
      return(false);
   } 

   else if(isBlank(thisForm.phone.value))
   {
	   alert('電話番号を入力してください。');
	   thisForm.phone.focus();
	   return(false);
   }
   else if(invalidPhoneNumber(thisForm.phone.value))
   {
	   alert('電話番号は 0-9 x X - + ( )でなければなりません。 ');
	   thisForm.phone.focus();
	   return(false);
   }
 
  
  
  else if (radioChecked == 0)
   {
	  
	  alert('プランをお選びください。');
	  return (false);
   }
   
  
  else if(thisForm.textverify.value == '')
  {
       alert(' 確認テストを入力してください。');
	   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('カード番号を入力してください。');
		  thisForm.cardnumber.focus();
		  return (false);
	   }
       else if (invalidNumber(thisForm.cardnumber.value) )
       {
           alert('カード番号は0～9桁でなければなりません。');
           thisForm.cardnumber.focus();
           return (false);
       }
	   else if (thisForm.cardnumber.value.length < 14 || thisForm.cardnumber.value.length > 16)
	   {
			alert("カード番号は14～16桁でなければなりません。");
			thisForm.cardnumber.focus();
			return (false);
	   }
	   else if(isBlank(thisForm.cvv.value))
	   {
		  alert('ＣＶＶ番号(カードの裏にある最後の３桁)を入力してください。');
		  thisForm.cvv.focus();
		  return (false);
	   }
	   else if(invalidNumber(thisForm.cvv.value))
	   {
		  alert(' ＣＶＶは数字0～9でなければなりません。');
		  thisForm.cvv.focus();
		  return (false);
	   }
	 else  if(isBlank(thisForm.cardtype.value) )
	   {
		  alert('カードの種類をお選びください。');
		  thisForm.cardtype.focus();
		  return (false);
	   }
	  
	   else if(isBlank(thisForm.month.value))
	   {
		  alert('クレジットカードの有効期限の月を入力してください。');
		  thisForm.month.focus();
		  return (false);
	   }
	   else if(invalidNumber(thisForm.month.value))
	   {
	 	  alert('クレジットカードの有効な月を入力してください。 ');
		  thisForm.month.focus();
		  return (false);
	   }
	   else if( (thisForm.month.value < 1) || (thisForm.month.value > 12) )
       {
          alert('クレジットカードの有効な月を入力してください。 ');
          thisForm.month.focus();
          return(false);
       }

	  else if(isBlank(thisForm.year.value))
	   {
		  alert('クレジットカードの有効な年を入力してください。');
		  thisForm.year.focus();
		  return (false);
	   }

	   else if(invalidNumber(thisForm.year.value))
	   {
		  alert('クレジットカードの有効な年を入力してください。');
		  thisForm.year.focus();
		  return (false);
	   }
	   
	   else if((thisForm.year.value) < (parseInt(currentYear1,10)) )
	   {
			alert('クレジットカードの有効な年を入力してください。');
			thisForm.year.focus();
			return(false);
	   }


	   else if( ( (thisForm.year.value) ==(parseInt(currentYear1,10)) ) && ( (thisForm.month.value) < (parseInt(currentMonth,10))  ) )
	   {
			  alert('クレジットカードの有効な日付を入力してください。');
			  thisForm.month.focus();
    		  return (false);
	   } 	
           
      else  if(isBlank(thisForm.address.value))
	   {
		  alert('有効な請求先住所を入力してください。');
		  thisForm.address.focus();
		  return (false);
	   }
	   else if(inValidAddress(thisForm.address.value))
	   {
          alert('住所は一重・二重引用符および逆斜線はご利用できません。');
		  thisForm.address.focus();
		  return (false);
	   }
	   else if(isBlank(thisForm.zip.value))
	   {
		  alert('郵便番号を入力してください。');
		  thisForm.zip.focus();
		  return (false);
	   }
	   else if(inValidZip(thisForm.zip.value))
	   {
			alert('郵便番号はA-Z、a-z、0-9、 -、 _ 、余白でなければなりません。 ') ;
			thisForm.zip.focus();
			return (false);
	   } 
	   else
		{
           return true;
		}
	} 
   else
   { 
     return true;
   }
}


/////////////////////////////////

/////////////////////////////////
//forgot password
/////////////////////////////////


function forgotValidate(thisForm)
{
if (isBlank(thisForm.user_name.value)&&(isBlank(thisForm.email.value)))
{
  alert('ユーザー名またはＥメールアドレスを入力してください。 ');
  thisForm.user_name.focus();
  return (false);
}

else if( !isBlank(thisForm.email.value) && (thisForm.email.value).indexOf('@')== -1)
{
 alert('Ｅメールアドレスが無効です。');
  thisForm.email.focus();
  return (false);
}
else
 {
  return(true);
 }
}

////////////////////////////////
/////==========

//For Edit profile process	not using////////////
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.getYear(); 
   currentMonth = currentMonth + 1;
   var currentYear1 = new String(currentYear);
  // currentYear1 = currentYear1.substring(2);

  if (agt.indexOf("msie") != -1){
	currentYear1 = currentYear1.substring(2);
	}else{
	currentYear1 = currentYear1.substring(1);
	}

  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('プランをお選びください。');
	  return (false);
   }

  else  if(isBlank(thisForm.cardnumber.value))
	   {
		  alert('カード番号を入力してください。');
		  thisForm.cardnumber.focus();
		  return (false);
	   }
    else if(thisForm.cardnumber.value.indexOf('*')== -1)
	 {
		  if (invalidNumber(trim(thisForm.cardnumber.value)) )
		   {
		   alert('カード番号は0～9桁でなければなりません。');
		  thisForm.cardnumber.focus();
					 return (false);
		  }
	 }
  if (trim(thisForm.cardnumber.value).length < 14 || trim(thisForm.cardnumber.value).length > 16)
   {
		alert("カード番号は14 - 16桁でなければなりません。");
		thisForm.cardnumber.focus();
		return (false);
   }

 if(isBlank(thisForm.cvv.value))
	  {
		  alert('ＣＶＶ番号(カードの裏にある最後の３桁)を入力してください。');
		  thisForm.cvv.focus();
		  return (false);
	   }
   else if(invalidNumber(thisForm.cvv.value))
	   {
		  alert('ＣＶＶは数字0～9でなければなりません。'); 
		  thisForm.cvv.focus();
		  return (false);
	   }

	   if(invalidNumber(thisForm.month.value))
	   {
	 	  alert('クレジットカードの有効期限の月を入力してください。');
		  thisForm.month.focus();
		  return (false);
	   }
	   else if( (thisForm.month.value < 1) || (thisForm.month.value > 12) )
       {
          alert('クレジットカードの有効な月を入力してください。 ');
          thisForm.month.focus();
          return(false);
       }

	   if(isBlank(thisForm.year.value))
	   {
		  alert('クレジットカードの有効な年を入力してください。');
		  thisForm.year.focus();
		  return (false);
	   }
   else if(invalidNumber(thisForm.year.value))
	   {
		  alert('クレジットカードの有効な年を入力してください。');
		  thisForm.year.focus();
		  return (false);
	   }
	    else if((thisForm.year.value) < (parseInt(currentYear1,10)) )
	   {
			alert('クレジットカードの有効な年を入力してください。');
			thisForm.year.focus();
			return(false);
	   }


	   else if( ( (thisForm.year.value) ==(parseInt(currentYear1,10)) ) && ( (thisForm.month.value) < (parseInt(currentMonth,10))  ) )
	   {
			  alert('クレジットカードの有効な日付を入力してください。');
			  thisForm.month.focus();
    		  return (false);
	   } 	
           
      if(isBlank(thisForm.billaddr.value))
	   {
		  alert('有効な請求先住所を入力してください。');
		  thisForm.billaddr.focus();
		  return (false);
	   }
	   else if(inValidAddress(thisForm.billaddr.value))
	   {
		  alert('住所は一重・二重引用符および逆斜線はご利用できません。 ');
		  thisForm.billaddr.focus();
		  return (false);
	   }

	 if(isBlank(thisForm.zip.value))
	   {
		  alert('郵便番号を入力してください。');
		  thisForm.zip.focus();
		  return (false);
	   }
	   else if(inValidZip(thisForm.zip.value))
	   {
			alert('郵便番号はA-Z、a-z、0-9、 -、 _ 、余白でなければなりません。 ') ;
			thisForm.zip.focus();
			return (false);
	   }
	   else if(thisForm.phone && invalidPhoneNumber(trim(thisForm.phone.value)))
		{ 
			 alert('Enter valid phone number.');
			 thisForm.phone.focus();
			 return (false);
		}
	   else
	   {
		   return true;
	   }
 }


 function IDUpgrade_unlimit(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 (agt.indexOf("msie") != -1){
	currentYear1 = currentYear1.substring(2);
	}else{
	currentYear1 = currentYear1.substring(1);
	}

   if(isBlank(thisForm.cardnumber.value))
	   {
		  alert('カード番号を入力してください。');
		  thisForm.cardnumber.focus();
		  return (false);
	   }
    else if(thisForm.cardnumber.value.indexOf('*')== -1)
	 {
		  if (invalidNumber(trim(thisForm.cardnumber.value)) )
		   {
		   alert('カード番号は0～9桁でなければなりません。');
		  thisForm.cardnumber.focus();
					 return (false);
		  }
	 }
  if (trim(thisForm.cardnumber.value).length < 14 || trim(thisForm.cardnumber.value).length > 16)
   {
		alert("カード番号は14 - 16桁でなければなりません。");
		thisForm.cardnumber.focus();
		return (false);
   }

 if(isBlank(thisForm.cvv.value))
	  {
		  alert('ＣＶＶ番号(カードの裏にある最後の３桁)を入力してください。');
		  thisForm.cvv.focus();
		  return (false);
	   }
   else if(invalidNumber(thisForm.cvv.value))
	   {
		  alert('ＣＶＶは数字0～9でなければなりません。'); 
		  thisForm.cvv.focus();
		  return (false);
	   }

	   if(invalidNumber(thisForm.month.value))
	   {
	 	  alert('クレジットカードの有効期限の月を入力してください。');
		  thisForm.month.focus();
		  return (false);
	   }
	   else if( (thisForm.month.value < 1) || (thisForm.month.value > 12) )
       {
          alert('クレジットカードの有効な月を入力してください。 ');
          thisForm.month.focus();
          return(false);
       }

	   if(isBlank(thisForm.year.value))
	   {
		  alert('クレジットカードの有効な年を入力してください。');
		  thisForm.year.focus();
		  return (false);
	   }
   else if(invalidNumber(thisForm.year.value))
	   {
		  alert('クレジットカードの有効な年を入力してください。');
		  thisForm.year.focus();
		  return (false);
	   }
	    else if((thisForm.year.value) < (parseInt(currentYear1,10)) )
	   {
			alert('クレジットカードの有効な年を入力してください。');
			thisForm.year.focus();
			return(false);
	   }


	   else if( ( (thisForm.year.value) ==(parseInt(currentYear1,10)) ) && ( (thisForm.month.value) < (parseInt(currentMonth,10))  ) )
	   {
			  alert('クレジットカードの有効な日付を入力してください。');
			  thisForm.month.focus();
    		  return (false);
	   } 	
           
      if(isBlank(thisForm.billaddr.value))
	   {
		  alert('有効な請求先住所を入力してください。');
		  thisForm.billaddr.focus();
		  return (false);
	   }
	   else if(inValidAddress(thisForm.billaddr.value))
	   {
		  alert('住所は一重・二重引用符および逆斜線はご利用できません。 ');
		  thisForm.billaddr.focus();
		  return (false);
	   }

	 if(isBlank(thisForm.zip.value))
	   {
		  alert('郵便番号を入力してください。');
		  thisForm.zip.focus();
		  return (false);
	   }
	   else if(inValidZip(thisForm.zip.value))
	   {
			alert('郵便番号はA-Z、a-z、0-9、 -、 _ 、余白でなければなりません。 ') ;
			thisForm.zip.focus();
			return (false);
	   }
	   else if(thisForm.phone && invalidPhoneNumber(trim(thisForm.phone.value)))
		{ 
			 alert('Enter valid phone number.');
			 thisForm.phone.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 (agt.indexOf("msie") != -1){
	currentYear1 = currentYear1.substring(2);
	}else{
	currentYear1 = currentYear1.substring(1);
	}


 if(isBlank(thisForm.cardnumber.value))
	   {
		  alert('カード番号を入力してください。');
		  thisForm.cardnumber.focus();
		  return (false);
	   }

	 else if(thisForm.cardnumber.value.indexOf('*')== -1)
	 {
	 if (invalidNumber(trim(thisForm.cardnumber.value)) )
       {
       alert('カード番号は0～9桁でなければなりません。');
      thisForm.cardnumber.focus();
                 return (false);
      }
	 }
    if (trim(thisForm.cardnumber.value).length < 14 || trim(thisForm.cardnumber.value).length > 16)
   {
		alert("カード番号は14～16桁でなければなりません。");
		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('カードの種類をお選びください。');
		  thisForm.cardtype.focus();
		  return (false);
	   }
	    if(isBlank(thisForm.month.value))
	   {
		  alert('クレジットカードの有効な月を入力してください。 ');
		  thisForm.month.focus();
		  return (false);
	   }
	   else if(invalidNumber(thisForm.month.value))
	   {
	 	  alert('クレジットカードの有効な月を入力してください。 ');
		  thisForm.month.focus();
		  return (false);
	   }
	   else if( (thisForm.month.value < 1) || (thisForm.month.value > 12) )
       {
          alert('クレジットカードの有効な月を入力してください。 ');
          thisForm.month.focus();
          return(false);
       }

	  if(isBlank(thisForm.year.value))
	   {
		  alert('クレジットカードの有効な年を入力してください。');
		  thisForm.year.focus();
		  return (false);
	   }

	   else if(invalidNumber(thisForm.year.value))
	   {
		  alert('クレジットカードの有効な年を入力してください。');
		  thisForm.year.focus();
		  return (false);
	   }
	   
	   else if((thisForm.year.value) < (parseInt(currentYear1,10)) )
	   {
			alert('クレジットカードの有効な日付を入力してください。');
			thisForm.year.focus();
			return(false);
	   }

     else if( ( (thisForm.year.value) ==(parseInt(currentYear1,10)) ) && ( (thisForm.month.value) < (parseInt(currentMonth,10))  ) )
	   {
			  alert('クレジットカードの有効な日付を入力してください。');
			  thisForm.month.focus();
    		  return (false);
	   } 	
           
      if(isBlank(thisForm.billingaddress.value))
	   {
		  alert(' 有効な請求先住所を入力してください。');
		  thisForm.billingaddress.focus();
		  return (false);
	   }
	   else if(inValidAddress(thisForm.billingaddress.value))
	   {
		  alert('住所は一重・二重引用符および逆斜線はご利用できません。 ');
		  thisForm.billingaddress.focus();
		  return (false);
	   }
      
 if(isBlank(thisForm.zip.value))
	{
			alert('郵便番号を入力してください。');
			thisForm.zip.focus();
			return (false);
	}
	else if(inValidZip(thisForm.zip.value))
	{
			alert('郵便番号はA-Z、a-z、0-9、 -、 _ 、余白でなければなりません。 ') ;
			thisForm.zip.focus();
			return (false);
	}
	else if(thisForm.phone && invalidPhoneNumber(trim(thisForm.phone.value)))
	{ 
		 alert('Enter valid phone number.');
	     thisForm.phone.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('有効なＥメールアドレスを入力してください。.');
      thisForm.email.focus();
      return(false);
   }
   else if(thisForm.user_id.value!='' && invalidUserName(thisForm.user_id.value))
	{
	   alert('ユーザー名は a-z、0-9、 _ (下線)でなければなりません。 ');
	   thisForm.user_id.focus();
	   return false;

	}
	else if((thisForm.invUser.value=="too") && isBlank(thisForm.user_id.value)) 
   {  
	  alert("Iドライブのアカウントを特定する為にユーザー名を入力してください。 ");
      thisForm.user_id.focus();
	  return false; 
   }
    else if((thisForm.invUser.value=="too") && (invalidUserName(thisForm.user_id.value)))
   {
	  alert('ユーザー名は a-z、0-9、 _ (下線)でなければなりません。 ');
      thisForm.user_id.focus();
	  return false;
   } 
   else if( (thisForm.phone.value!='') && (invalidSecurityPhNum(thisForm.phone.value)))
   {
	   thisForm.phone.focus();
	   alert('電話番号は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(' 技術的なトラブル/フィードバックを入力してください。');
	   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('ユーザー名またはＥメールアドレスを入力してください。 ');
      thisForm.username.focus();
      return (false);
   }

   if(thisForm.username.value.indexOf('@')!=-1)
	{
       if(!isValidEmailId(thisForm.username.value))
		{
		   alert('有効なＥメールアドレスを入力してください。');
 		   thisForm.username.focus();
	       return (false);

		}
	}
	if(thisForm.username.value.indexOf('@')==-1)
	{
		if(invalidUserName(thisForm.username.value))
		{
			alert('有効なユーザー名を入力してください。');
			thisForm.username.focus();
	        return (false);
		}

	}
	 if(isBlank(thisForm.password.value))
   {
      alert('パスワードを入力してください。. ');
      thisForm.password.focus();
      return (false);
   }
   else if (inValidString(thisForm.password.value))
   {
       alert('パスワードはA-Z、a-z、0-9を含む文字でなければなりません。')
       thisForm.password.focus();
       return (false);
   }
   else if( (thisForm.password.value.length < 4) || (thisForm.password.value.length > 16))
   {
        alert('パスワードは4～16文字でなければなりません。');
        thisForm.password.focus();
        return(false);
   }
   else   if (thisForm.reason.value =='')
	{
		thisForm.reason.focus();
		alert('Iドライブのアカウントをキャンセルされる理由をお選びください。 ');
		return (false);
	}

	else    if ( (thisForm.reason.value =='Others') && (thisForm.Others.value ==''))
	{
		thisForm.Others.focus();
		alert('コメントを入力してください。');
		return (false);
	}


   if( (thisForm.email.value!='') && (!isValidEmailId(thisForm.email.value)) )
   {
      thisForm.email.focus();
	  alert('有効なＥメールアドレスを入力してください。');
      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 invalidUserNameNew(Str)
 {
	 var alloweduser = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789_";

	 for(var count = 0; count < Str.length; count++)
	 {
		if(alloweduser.indexOf(Str.substring(count, count + 1)) == -1)
		{
			return(true);
		}
	 }
 }


 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('パスワードを入力してください。');
	  thisForm.user_passwd.focus();
      return (false);
   }
   else if (inValidString(thisForm.user_passwd.value))
   {
       alert('パスワードはA-Z、a-z、0-9を含む文字でなければなりません。')
       thisForm.user_passwd.focus();
       return (false);
   }
   else if( (thisForm.user_passwd.value.length < 4) || (thisForm.user_passwd.value.length > 16))
   {
       alert('パスワードは4～16文字でなければなりません。');
       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('再入力されたパスワードは、入力されたパスワードと同じでなければなりません。');
      thisForm.user_passwd2.focus();
      return (false);
   }
   else
   { 
      return (true);
   }
}

