function isValidMailAddr(toCheck){
	//メールアドレスがスペース時
    if(toCheck.length == 0)
    {
        alert("メールアドレスを入力してください。");
        return false;
    }
	//メールアドレスが英数字じゃない時
    if (!isBanjiaoaa(toCheck))
    {
        alert("メールアドレスは、半角英数字で入力してください。");
        return false;
    }
	//正しいメールアドレスかどうかのチェック
    if(toCheck.length>0)
    {
	    if(!isMailAddr(toCheck))
	    {
            alert("入力したメールアドレスは正しくありません。");
            return false;
	    }
    }
    return true;
}

function isValidPassword(toCheck1,toCheck2){
	//パスワード未入力時
    if (toCheck1.length==0)
    {
            alert("パスワード を入力してください。");
            return false;
    }
	//パスワードが半角英数字かどうかのチェック
    else if (!isBanjiaoaa(toCheck1))
    {
            alert("パスワードは、半角英数字で入力してください。");
            return false;
    }
	//パスワード桁数チェック
    else if (toCheck1.length<4)
    {
            alert("パスワードは、４桁以上で入力してください。");
            return false;
    }
    
	//パスワードの確認未入力時
    if (toCheck2.length==0)
    {
            alert("パスワードの確認を入力してください。");
            return false;
    }
	//パスワードの確認が一致かどうかのチェック
    if(toCheck1!=toCheck2)
    {
            alert("入力したパスワードの確認は、パスワードと一致してません。");
            return false;
    }
	//パスワードの確認が半角英数字かどうかのチェック
    else if (!isBanjiaoaa(toCheck2))
    {
            alert("パスワードの確認は、半角英数字で入力してください。");
            return false;
    }  
	//パスワードの確認の桁数チェック
    else if (toCheck2.length<4)
    {
            alert("パスワードの確認は、４桁以上で入力してください。");
            return false;
    }       
    return true;
}

function isValidLoginPass (toCheck) {
    //パスワード未入力時
    if (trim(toCheck).length == 0)
	{
	    alert("パスワードを入力してください。");
        return false;
    }
    //パスワードが半角英数字かどうかのチェック
    else if (!isBanjiaoaa(toCheck))
    {
        alert("半角英数字で入力してください。");
        return false;
    }
    //パスワード桁数チェック
    else if (trim(toCheck).length < 4)
    {
        alert("４桁以上で入力してください。");
        return false;
    }
        return true;
}

function inValidTelNo(toCheck1,toCheck2,toCheck3){
    if ( (toCheck1.length == 0) &&
            (toCheck2.length == 0) &&
            (toCheck3.length == 0) )
    {
            alert("電話番号を入力してください。");
            return 1;
    }       
    if (toCheck1.length == 0)
    {
            alert("電話番号の市外局番を入力してください。");
            return 1;
    }       
    if (toCheck3.length == 0)
    {
            alert("電話番号の局番を入力してください。");
            return 3;
    }       
    if (toCheck1.length>0)
    {
            if (!isInt(toCheck1))
            {
                    alert("電話番号は、半角数字で入力してください。");
                    return 1; 
            }
    }
    if (toCheck2.length>0)
    {
            if (!isInt(toCheck2))
            {
                    alert("電話番号は、半角数字で入力してください。");
                    return 2; 
            }
    }
    if (toCheck3.length>0)
    {
            if (!isInt(toCheck3))
            {
                    alert("電話番号は、半角数字で入力してください。");
                    return 3; 
            }
    }
    return 0;
}

function inValidFaxNo(toCheck1,toCheck2,toCheck3){
    if (toCheck1.length>0)
    {
            if (!isInt(toCheck1))
            {
                    alert("ＦＡＸ番号は、半角数字で入力してください。");
                    return 1; 
            }
    }
    if (toCheck2.length>0)
    {
            if (!isInt(toCheck2))
            {
                    alert("ＦＡＸ番号は、半角数字で入力してください。");
                    return 2; 
            }
    }
    if (toCheck3.length>0)
    {
            if (!isInt(toCheck3))
            {
                    alert("ＦＡＸ番号は、半角数字で入力してください。");
                    return 3; 
            }
    }
    if ((toCheck1.length>0) || (toCheck2.length>0) || (toCheck3.length>0))  {   
            if ((toCheck1.length) == 0)
            {
                    alert("ＦＡＸ番号の市外局番を入力してください。");
                    return 1; 
            }
            if ((toCheck3.length) == 0)
            {
                    alert("ＦＡＸ番号の局番を入力してください。");
                    return 3; 
            }
    }
    return 0;
}

function inValidZip(toCheck1,toCheck2){
    if (toCheck1.length==0)
    {
            alert("郵便番号上３桁を入力してください。");
            return 1; 
    }
    if (toCheck1.length>0)
    {
            if (!isInt(toCheck1))
            {
                    alert("郵便番号上３桁は、半角数字で入力してください。");
                    return 1; 
            }
            if (toCheck1.length != 3)
            {
                    alert("郵便番号上３桁を入力してください。");
                    return 1; 
            }
    }   
    if (toCheck2.length==0)
    {
            alert("郵便番号下４桁を入力してください。");
            return 2; 
    }
    if (toCheck2.length>0)
    {
            if (!isInt(toCheck2))
            {
                    alert("郵便番号下４桁は、半角数字で入力してください。");
                    return 2; 
            }
            if (toCheck2.length != 4)
            {
                    alert("郵便番号下４桁を入力してください。");
                    return 2; 
            }
    }
    return 0;
}

function isNickName(toCheck){
    if (toCheck.length>0)
    {
            if (isJiaMing(toCheck))
            {
                    alert("ニックネームは、全角で入力してください。");
                    return false;
            }
    }
    return true;
}

function isYearsOld(toCheck,varString){
    if (toCheck.length==0)
    {
            alert("生年を入力してください。");
           return false; 
    }
//生年が数字かどうかのチェック
    else if (toCheck.length>0)
    {
            if (!isInt(toCheck))
            {
                    alert("生年は半角数字で入力してください。");
                    return false; 
            }
            else if (!isBanjiaoaa(toCheck))
            {
                    alert("生年は半角数字で入力してください。");
                    return false;
            } 
    }
//有効な生年かどうかのチェック
    if ((toCheck < varString - 99) || (toCheck > 0 + varString))
    {
            alert("正しい生年を入力してください。");
            return false;
    }
    return true;
}

function isNameKanji(toCheck1,toCheck2){
//氏名（漢字）姓入力チェック
    if (toCheck1.length==0)
    {
            alert("氏名(漢字)の姓を入力してください。");
            return 1; 
    }
//氏名（漢字）姓が全角かどうかのチェック
    if (toCheck1.length>0)
    {
            if (isJiaMing(toCheck1))
            {
				    alert("氏名（漢字）の姓は、全角で入力してください。");
                    return 1;
            }
    }
//氏名（漢字）名入力チェック
    if (toCheck2.length==0)
    {
            alert("氏名(漢字)の名を入力してください。");
            return 2; 
    }
//氏名（漢字）名が全角かどうかのチェック
    if (toCheck2.length>0)
    {
            if (isJiaMing(toCheck2))
            {
				    alert("氏名（漢字）の名は、全角で入力してください。");
                    return 2;
            }
    }
    return 0;
}

function isNameKatakana(toCheck1,toCheck2){
//氏名（フリガナ）姓入力チェック
    if (toCheck1.length==0)
    {
            alert("氏名(フリガナ)の姓を入力してください。");
            return 1; 
    }       
//氏名（フリガナ）姓が全角カタカナかどうかのチェック
    if (toCheck1.length>0)
    {
            if (isqjJiaMing(toCheck1))
            {
				    alert("氏名（フリガナ）の姓は、全角カタカナで入力してください。");
                    return 1;
            }
    }
//氏名（フリガナ）名入力チェック
    if (toCheck2.length==0)
    {
            alert("氏名(フリガナ)の名を入力してください。");
            return 2; 
    }
//氏名（フリガナ）名が全角かどうかのチェック
    if (toCheck2.length>0)
    {
            if (isqjJiaMing(toCheck2))
            {
					alert("氏名（フリガナ）の名は、全角カタカナで入力してください。");
                    return 2;
            }
    }
    return 0;
}

function isSiku(toCheck){
    if (toCheck.length==0)
    {
            alert("市区町村を入力してください。");
            return false; 
    }
    if (toCheck.length>0)
    {
            if (isJiaMing(toCheck))
            {
				    alert("市区町村は、全角で入力してください。");
                    return false;
            }
   }
   return true;
}	

function isBanti(toCheck){
    if (toCheck.length==0)
    {
            alert("番地を入力してください。");
            return false; 
    }
    if (toCheck.length>0)
    {
            if (isJiaMing(toCheck))
            {
                    alert("番地は、全角で入力してください。");
                    return false;
            }
    }
    return true;
}	

function isApart(toCheck){
    if (toCheck.length>0)
    {
            if (isJiaMing(toCheck))
            {
                    alert("アパート／マンションは、全角で入力してください。");
                    return false;
            }
    }
    return true;
}	

function isPhoto(toCheck){
    if (toCheck.length>0){
        var   strType1 = toCheck.substring(toCheck.length-4,toCheck.length);
        if ( strType1.toUpperCase() != ".JPG" && strType1.toUpperCase() != ".GIF" && strType1.toUpperCase() != ".PNG"){
        	alert("写真に.jpg,.gif,.pngファイルを指定してください。");
            return false;
        }        
    }
    return true;
}

function isPhotDupli (toCheck1,toCheck2,toCheck3) {
	var fileError = 0;
    // ファイル名称部分の位置を取得する
    var intFile1 = toCheck1.lastIndexOf(String.fromCharCode(92));
    var intFile2 = toCheck2.lastIndexOf(String.fromCharCode(92));
    var intFile3 = toCheck3.lastIndexOf(String.fromCharCode(92));

    // ファイル名称を取得
    var inFileName1 = toCheck1.substring((intFile1+1),toCheck1.length);
    var inFileName2 = toCheck2.substring((intFile1+1),toCheck2.length);
    var inFileName3 = toCheck3.substring((intFile1+1),toCheck3.length);

    // 画像1と画像2のファイル名が同じか？
	if (toCheck1.length != 0 && toCheck2.length != 0) {
    	if (inFileName1 == inFileName2) { 
				fileError= -1;
		}
	}
    // 画像2と画像3のファイル名が同じか？
	if (toCheck2.length != 0 && toCheck3.length != 0) {
	    if (inFileName2 == inFileName3) { 
			fileError= -1;
		}
	}
    // 画像1と画像3のファイル名が同じか？
	if (toCheck1.length != 0 && toCheck3.length != 0) {
    	if (inFileName1 == inFileName3) { 
			fileError= -1;
		}
	}
	// ファイル名重複時
	if ( fileError == -1 ) { 
		alert("ファイル名が重複しています。");
		return false;
	} else {
		return true;
	}
}

function isPhotDupliVar (toCheck) {
    var intCnt;
    var fileError = true;
    arrFileName1 = new Array(toCheck.length);
    for (i = 0; i < toCheck.length; i++) {
         intCnt = toCheck[i].lastIndexOf(String.fromCharCode(92));
         arrFileName1[i] = toCheck[i].substring((intCnt+1),toCheck[i].length);
    }
    for (i = 0; i < arrFileName1.length; i++) {
        for (j = i + 1; j < arrFileName1.length; j++) {
            if (arrFileName1[j].length > 0) {
                if (arrFileName1[i] == arrFileName1[j]) {
                    fileError = false;
                    //alert(arrFileName1[j]);
                }
            }
        }
    }
    if (fileError==false){alert("ファイル名が重複しています。");}
    return fileError;
}

function isKaisya(toCheck){
     if (toCheck.length==0)
     {
        alert("所属リフォーム会社名を入力してください。");
        return false;
     }
     if (isJiaMing(toCheck))
     {
         alert("所属リフォーム会社名は、全角で入力してください。");
         return false;
     }
     return true;
}

function isPR(toCheck){
	
    if ( toCheck.length == 0 ) {
         alert("本人PRを入力してください。");
         return 1;
    }
    else if (check_space(toCheck) == toCheck.length ){
         alert("本人PRに「スペース」のみは使用できません。");
         return 2;
    }
    else if (check_long(toCheck) > 400 ){
    	
         alert("本人PRは200文字以下で指定してください。");
         return 3;              
    }
    return 0;                     
}

function check_long(var_str)
  {
   var char_num = 0;
   for ( var i = 0; i < var_str.length; i++ ){  
        if ( var_str.charCodeAt(i) > 127 ) 
            {char_num = char_num + 2;
            }
        else
            {char_num++;
            }
    }        
    return  char_num;  
}

function check_space(var_str)
  {
   var char_num = 0;
   for ( var i = 0; i < var_str.length ; i++ ) {
       var oneChar = var_str.charAt(i);
       if  ( oneChar == " " ||  oneChar == "　")
             char_num++;
    }
    return  char_num;  
}

function isKntikuIC2(toCheck1,toCheck2){
  //1級建築士資格登録番号、IC資格登録番号入力チェック
    if  (toCheck1.length == 0)
    {
        if  (toCheck2.length == 0)
        {
            alert("1級建築士資格登録番号あるいはIC資格登録番号を入力してください。");
            return 1;   
        }
    }
    if (toCheck1.length>0)
    {
        if (!isInt(toCheck1))
        {
            alert("1級建築士資格登録番号を半角数値で入力してください。");
            return 1;
        }
        if (toCheck1.length > 6)
        {
            alert("1級建築士資格登録番号を6桁以内で入力してください。");
            return 1;
        }
   }
   if (toCheck2.length > 0) 
   {
        if (toCheck2.length != 7) 
        {
            alert("IC資格登録番号を7桁で入力してください。");
            return 2;
        }

        if (!isInt(toCheck2.substr(0,6)))
        {
            alert("IC資格登録番号を上6桁を半角数値で入力してください。");
            return 2;
        }

        if (!ismailbanjiaoeng2(toCheck2.substr(6,1)))
        {
            alert("IC資格登録番号 下1桁を半角英字 a又はA、b又はBで入力してください。");
            return 2;
        }
        
   }
   return 0;
}

function ismailbanjiaoeng2(toCheck){   
   var strset = "abAB";
   if (toCheck.length==0) return false;
   if (strset.indexOf(toCheck.charAt(0))==-1){
          return false;  
   }       
   return true;   
}

function isKntikuIC(toCheck1,toCheck2){
  //1級建築士資格登録番号、IC資格登録番号入力チェック
    if  (toCheck1.length == 0)
    {
        if  (toCheck2.length == 0)
        {
            alert("1級建築士資格登録番号あるいはIC資格登録番号を入力してください。");
            return 1;   
        }
    }
    if (toCheck1.length>0)
    {
        if (!isInt(toCheck1))
        {
            alert("1級建築士資格登録番号を 正しく入力してください。");
            return 1;
        }
        if (toCheck1.length > 6)
        {
            alert("1級建築士資格登録番号を 正しく入力してください。");
            return 1;
        }
   }
   if (toCheck2.length > 0) 
   {
        if (!isInt(toCheck2.substr(0,6)))
        {
            alert("IC資格登録番号を 正しく入力してください。");
            return 2;
        }
        if (!ismailbanjiaoeng(toCheck2.substr(6,1)))
        {
            alert("IC資格登録番号を 正しく入力してください。");
            return 2;
        }
        
        if (toCheck2.length != 7) 
        {
            alert("IC資格登録番号を 正しく入力してください。");
            return 2;
        }
   }
   return 0;
}

function isValidStrLong(toCheck,lenInt){
   var char_num = 0;
   for ( var i = 0; i < toCheck.length; i++ ){  
        if ( toCheck.charCodeAt(i) > 127 ) 
            {char_num = char_num + 2;
            }
        else
            {char_num++;
            }
    }
    if (char_num > lenInt){
    	return false;
    }
    return true;
}

function isBanjiaoaa(toCheck){      
   for(i=0;i<toCheck.length;i++){       
       if (toCheck.charCodeAt(i)>255 || toCheck.charCodeAt(i) <0  ) {
          return false;      
       }        
   }    
   return true;   
}

function isMailAddr(emailStr){   
	var emailPat   = /^(.+)@(.+)$/;
	var userPat    = /^[a-zA-Z0-9\._-]+$/;
	var domainPat  = /^[a-zA-Z0-9\.-]+$/;
	var invalid0   = /^(.+)\.(.+)\.(.+)$/;
	var invalid1   = /^\.(.+)/;
	var invalid2   = /(.+)\.$/;
	var invalid3   = /\.\./;
	var eMailArray = emailStr.match(emailPat);

	if (eMailArray == null) {
	return false;
	}

	var user      = eMailArray[1];
	var dom       = eMailArray[2];

	if (user.match(userPat) == null || user.match(invalid1) != null
	     || user.length < 1         || user.match(invalid3) != null) {
	return false;
	}
	if (dom.match(domainPat) == null || dom.indexOf('.') == -1
	     || dom.length < 4		     || dom.match(invalid1) != null
	                                 || dom.match(invalid2) != null
	                                 || dom.match(invalid3) != null) {
	return false;
	}
	return true;
}

function ismailbanjiaoeng(toCheck){   
   var strset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
   if (toCheck.length==0) return false;
   if (strset.indexOf(toCheck.charAt(0))==-1){
          return false;  
   }       
   return true;   
}

function isRighFileName(toCheck){   
   var strset = "0123456789._";
   strset =strset + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ;
   strset =strset + "abcdefghijklmnopqrstuvwxyz" ;      
   if (toCheck.length==0) return false;
   for(i=0;i<toCheck.length;i++){       
       if (strset.indexOf(toCheck.charAt(i))==-1){
          return false;            
       }        
   }    
   return true;   
}

function isHtmlfileName(toCheck){   
   var strset = "0123456789_";
   strset =strset + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ;
   strset =strset + "abcdefghijklmnopqrstuvwxyz" ;      
   if (toCheck.length==0) return false;
   for(i=0;i<toCheck.length;i++){       
       if (strset.indexOf(toCheck.charAt(i))==-1){
          return false;      
       }        
   }    
   return true;   
}

function isValidNDID(toCheck){   
   var Numset = "0123456789._";
   var Usset= "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ;
   if (toCheck.length==0) return false;
   if (Usset.indexOf(toCheck.charAt(0))==-1) return false;      
   for(i=1;i<toCheck.length;i++){       
       if (Numset.indexOf(toCheck.charAt(i))==-1){
          return false;      
       }        
   }    
   return true;   
}

function isAtoZOrNum(toCheck){
   var strset = "0123456789";
   strset =strset + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ;
   strset =strset + "abcdefghijklmnopqrstuvwxyz" ;
   strset +=" .,<>?/:;'\\\"[{]}!@#$%^&*()_+-=|";

   if (toCheck.length==0) { return false;}

   for(i=0;i<toCheck.length;i++){
	if (strset.indexOf(toCheck.charAt(i))==-1){
          return false;
	}
   }
   return true;
}

function isJiaMing_backup(str) {
   var i=0;
   for (i=0;i<str.length;i++){      
      if ( ( str.charCodeAt(i) >= -79  && str.charCodeAt(i) <= -36 )||
      (  str.charCodeAt(i) >=65393 && str.charCodeAt(i) <= 65436   ) ) {
        continue;
      } else {
      return false;
      }
   }
   return true;
}

function isJiaMing(toCheck) {
   var strset ="ｱｲｳｴｵ";
   strset +="ｶｷｸｹｺ";
   strset +="ｻｼｽｾｿ";
   strset +="ﾀﾁﾂﾃﾄ";
   strset +="ﾅﾆﾇﾈﾉ";
   strset +="ﾊﾋﾌﾍﾎ";
   strset +="ﾏﾐﾑﾒﾓ";
   strset +="ﾗﾘﾙﾚﾛ";
   strset +="ﾔﾕﾖｦﾝ";
   strset +="ﾜﾞﾟｬｭｮｯ";
   strset +="ｧｨｪｫ";
   strset +="0123456789";
   strset +="abcdefghijklmnopqrstuvwxyz"; 
   strset +="ABCDEFGHIJKLMNOPQRSTUVWXYZ"; 
   strset +=" .,<>?/:;'\"[{]}!@#$%^&*~()_+-=|ｰ";
    if (toCheck.length==0) return true;
   for(i=0;i<toCheck.length;i++){ 
       if (strset.indexOf(toCheck.charAt(i))!=-1){
          return true;      
       }        
   }    
   return false;     
}

function isqjJiaMing(toCheck) {
   var strset ="アイウエオァィゥェォカキクケコサシスセソタチツテトッナニヌネノハヒフヘホマミムメモラリルレロヤユヨンワャュョ";
   strset +="ガギグゲゴザジズゼゾダヂヅデドバビブベボパビプペポ";

    if (toCheck.length==0) return true;
   for(i=0;i<toCheck.length;i++){       
       if (strset.indexOf(toCheck.charAt(i))==-1){
          return true;
       }
   }
   return false;
}

function isqjJiaMing2(toCheck) {
   var strset ="アイウエオァィゥェォカキクケコサシスセソタチツテトッナニヌネノハヒフヘホマミムメモラリルレロヤユヨンワャュョ";
   strset +="ガギグゲゴザジズゼゾダヂヅデドバビブベボパビプペポ　";

    if (toCheck.length==0) return true;
   for(i=0;i<toCheck.length;i++){       
       if (strset.indexOf(toCheck.charAt(i))==-1){
          return true;
       }
   }
   return false;
}

function getStrLength(str){
   var i=0;
   var len=0;   
   for (i=0;i<str.length;i++){      
      if (  !( str.charCodeAt(i) >= -79  && str.charCodeAt(i) <= -36 )   &&  !(  str.charCodeAt(i) >=65393 && str.charCodeAt(i) <= 65436   )  && (   str.charCodeAt(i) >255   || str.charCodeAt(i) <0 ) ) {
        len = len + 2; 
      }
      else{
        len = len + 1;
      }
   }
   return len;
 }   

function getStrLength1(str){
   var i=0;
   var len=0;   
   for (i=0;i<str.length;i++){      
      if (  !( str.charCodeAt(i) >= -79  && str.charCodeAt(i) <= -36 )   &&  !(  str.charCodeAt(i) >=65393 && str.charCodeAt(i) <= 65436   )  && (   str.charCodeAt(i) >255   || str.charCodeAt(i) <0 ) ) {
        len = len + 2; 
      }
      else{
if (( str.charCodeAt(i) == 13 && str.charCodeAt(i+1) != 10 ) || ( str.charCodeAt(i-1) != 13 && str.charCodeAt(i) == 10 )) {
        len = len + 1;}
      }
   }
   return len;
 }   

function isRightDate(DatetoCheck){ 
  
  if (DatetoCheck.length != 10 ){        
    return false;
  }  
  if (DatetoCheck.indexOf("/")!=4 || DatetoCheck.lastIndexOf("/")!=7 ){
    return false;
  }
  var vyear = DatetoCheck.substr(0,4);
  var vmonth = DatetoCheck.substr(5,2);
  var vdate = DatetoCheck.substr(8,2);  
  if ( isNaN(vyear) || isNaN(parseInt(vyear)) || (!isInt(vyear)) || (vyear<1900) || (vyear>3000) || vmonth>12 || vmonth==0 ) {
     return false;
     
  }
  if (isNaN(vmonth) || isNaN(parseInt(vmonth)) || (!isInt(vmonth)) ){
     return false;
     
  }
  if (isNaN(vdate) || isNaN(parseInt(vdate)) || (!isInt(vdate))){
     return false;
     
  }  
  
  var a  = new Date(vyear,vmonth,vdate);  
  if ( isNaN(a.getFullYear()) || isNaN(a.getMonth()) || isNaN(a.getDate())  ){    
    return  false;
  } 
  
  var year="";
  var month;
  var day;
  var myDate;
  var b = new Date(DatetoCheck);    

  year = new String(b.getFullYear());    
  
  month = b.getMonth() +1 ;
  if (month<10){
    month = "0" + month;
  } 
  day =  b.getDate();
  if (day<10){
    day = "0" + day;
  }    
  myDate = year+"/"+month+"/" + day;    
  
  if (myDate!=DatetoCheck ) { 
  return false;
  }  
  
  return true;  
}

function isInt(toCheck){
   var strset = "0123456789";       
   if (toCheck.length==0) return false;
   for(i=0;i<toCheck.length;i++){       
       if (strset.indexOf(toCheck.charAt(i))==-1){
          return false;      
       }        
   }    
   return true;   
}

function isIntPlus(toCheck){
   var strset = "0123456789";       
   if (toCheck.length==0) return false;
   for(i=0;i<toCheck.length;i++){       
       if (strset.indexOf(toCheck.charAt(i))==-1){
           if (toCheck !="-"){
               return false;
           }
       }        
   }    
   return true;   
}

function isNumeric(toCheck){  
  if (isNaN(toCheck) || isNaN(parseFloat(toCheck)) ){
     return false;
  }
  return true;
}

function myDate(DatetoCheck){
  if (!isRightDate(DatetoCheck)){
    return "";
  }
  var vyear = DatetoCheck.substr(0,4);  
  var vmonth = DatetoCheck.substr(5,2);
  var vdate = DatetoCheck.substr(8,2);  
  var dateobj  = new Date(vyear,vmonth-1,vdate);
  var resultstr =  dateobj.getFullYear() + "/"  +((dateobj.getMonth())>=9?(dateobj.getMonth()+1):"0"+(dateobj.getMonth()+1) )+  "/" + (dateobj.getDate()>=10? dateobj.getDate():"0"+dateobj.getDate());
  return resultstr;     
} 

function trim(str) 
{
    var beginPos,endPos;
    
    for(i=0;i<str.length;i++) 
    {
    if(str.charAt(i) != " ")
        {
        beginPos=i;
        break;
        }
    }
    for(i = str.length; i>0; i--) 
    {
        if(str.charAt(i-1) != " ") 
        {
            endPos=i;
            break;
        }
    }
    if(beginPos <= endPos) 
    {
        return str.substring(beginPos, endPos);
    } 
    else 
    {
        return "";
    }
}

function isValidTel(toCheck){
   var strset = "0123456789-";       
   if (toCheck.length==0) return false;
   for(i=0;i<toCheck.length;i++){       
       if (strset.indexOf(toCheck.charAt(i))==-1){
          return false;      
       }        
   }    
   return true;   
}

function isValidNum(toCheck){
   var strset = "0123456789.";       
   if (toCheck.length==0) return false;
   for(i=0;i<toCheck.length;i++){       
       if (strset.indexOf(toCheck.charAt(i))==-1){
          return false;      
       }        
   }    
   return true;   
}

function isValidURL(toCheck){
   var strset = "0123456789.+-/_?~*";       
   var strset = "0123456789";
   strset =strset + "ABCDEFGHIJKLMNOPQRSTUVWXYZ" ;
   strset =strset + "abcdefghijklmnopqrstuvwxyz" ;      
   if (toCheck.length==0) return false;
   for(i=0;i<toCheck.length;i++){       
       if (strset.indexOf(toCheck.charAt(i))==-1){
          return false;      
       }        
   }    
   return true;   
}

function openNewBrowser(url1, filename,from_cd)
{
    var aUrl = url1 + filename;
    var newWindow = window;

    if ((newWindow == window) || win.closed) 
    {
        newWindow = open("aUrl","a","toolbar=no,location=no,directories=no,menubar=no,status=no,scrollbars=yes,resizable=yes,width=660,height=500");
        newWindow.location = aUrl;

	if (from_cd == 1) {
		newContent  = "<HTML><HEAD><TITLE>HomeClip - 掲示板画像</TITLE>\n";
	}

	if (from_cd == 2) {
		newContent  = "<HTML><HEAD><TITLE>HomeClip - 専門家相談室画像</TITLE>\n";
	}


        newContent += "<IMG SRC="+aUrl+">";
        newContent += "</BODY></HTML>";
        newWindow.document.write(newContent);
	newWindow.document.close(); // close layout stream

    }
    
    newWindow.focus();
}

function getCookieVal (offset) 
{
  var endstr = document.cookie.indexOf (";", offset);
  //alert("offset + endstr: " + offset + "/ " + endstr);

  if (endstr == -1)
    endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
}

function GetCookie (name) 
{
  var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  //alert("clen" + clen);
  var i = 0;
  while (i < clen) {
    var j = i + alen;
       if (document.cookie.substring(i, j) == arg)
     return getCookieVal (j);
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) break; 
  }
  return null;
}

function SetCookie (name, value) 
{
  var argv = SetCookie.arguments;
  var argc = SetCookie.arguments.length;
  var expires = (argc > 2) ? argv[2] : null;
  var path = (argc > 3) ? argv[3] : null;
  var domain = (argc > 4) ? argv[4] : null;
  var secure = (argc > 5) ? argv[5] : false;

  document.cookie = name + "=" + escape (value) +
    ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
    ((path == null) ? "" : ("; path=" + path)) +
    ((domain == null) ? "" : ("; domain=" + domain)) +
    ((secure == true) ? "; secure" : "");
}

function DeleteCookie (name) {
  var exp = new Date();
  exp.setTime (exp.getTime() - 1);  // This cookie is history
  var cval = GetCookie (name);
  if (cval != null)
    document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();
}

function makeNewWindow(sCont, sImgName, nImgX, nImgY)
{
    if(sCont.length ==0 && sImgName.length ==0)
        return;
    
    var sType, sKata, sContent;
    var n = 0;
    
    while(sCont.length != 0)
    {
        var nPos = sCont.indexOf("^^")
        
        if(nPos != -1)
        {
            if(n == 0)
                sType = sCont.substring(0, nPos);
            else 
                sKata = sCont.substring(0, nPos);
            sCont = sCont.substring(nPos+2, sCont.length);
            n++;
        }
        else
        {
            sContent = sCont;
            sCont = ""
        }
    }
    

    var sImgUrl  = "/mame/img/"                  //適当なパス名が修正必要
    var sImg     = sImgUrl + sImgName           //"P123.JPG"
    var sImgGif  = sImgUrl + "h1w1.gif"
    
    var sWinX, sWinY, sTab;

        sTab = nImgX;

       	sWinX = parseInt(nImgX) + 60;		//横幅
       	sWinY = parseInt(nImgY) + 210;		//縦幅
        
    var attr = "";
    var isNN;
    
    //NNに対応
    if (navigator.appName.charAt(0) == "N")
        isNN = true;
    else
        isNN = false;

    var newWindow = window;

    if((newWindow == window) || newWindow.closed)
    {
       var winsize ='toolbar=no,location=no,directories=no,menubar=no,status=no,scrollbars=yes,resizable=yes,width='+sWinX+',height='+sWinY;
       newWindow = open("","a",winsize);
       newWindow.resizeTo(sWinX, sWinY);
       newWindow.focus();
    }

    if (newWindow != null) 
    {
        // assemble content for new window
        
        var newContent;
        
        newContent = "<HTML>";
        newContent += "<HEAD>";
        newContent += "<title>HomeClip - 住まいの用語検索画像</title>\n";
        newContent += "<META http-equiv=";
        newContent += '"';
        newContent += "Content-Type";
        newContent += '"';
        newContent += " content=";
        newContent += '"';
        newContent += "text/html; charset=shift_jis";
        newContent += '"';
        newContent += ">\n";
        newContent += "</HEAD>\n";
        newContent += "<LINK rel=";
        newContent += '"';
        newContent += "stylesheet";
        newContent += '"';
        newContent += " href=";
        newContent += '"';
        newContent += "/img/style_common.css";
        newContent += '"';
        newContent += ">\n";
        
        newContent += "<body bgcolor=";
        newContent += '"';
        newContent += "#FFFFFF";
        newContent += '"';
        newContent += " link=";
        newContent += '"';
        newContent += "#FF6600";
        newContent += '"';
        newContent += " vlink=";
        newContent += '"';
        newContent += "#0066CC";
        newContent += '"';
        newContent += " alink=";
        newContent += '"';
        newContent += "#FFFF00";
        newContent += '"';
        newContent += ">\n";

        newContent += "<TABLE width=";
        newContent += '"';
        newContent += sTab   //"400";
        newContent += '"';
        newContent += " border=";
        newContent += '"';
        newContent += "0";
        newContent += '"';
        newContent += " cellspacing=";
        newContent += '"';
        newContent += "0";
        newContent += '"';
        newContent += " cellpadding=";
        newContent += '"';
        newContent += "5";
        newContent += '"';
        newContent += ">\n";

        newContent += "<TR bgcolor=";
        newContent += '"';
        newContent += "#CC0000";
        newContent += '"';
        newContent += " align =";
        newContent += '"';
        newContent += "center";
        newContent += '"';
        newContent += ">\n";

        newContent += "<TD>";
        newContent += "<FONT face=";
        newContent += '"';
        newContent += "ＭＳ Ｐゴシック, Osaka";
        newContent += '"';
        newContent += " class=";
        newContent += '"';
        newContent += "shiro14b";
        newContent += '"';
        newContent += ">" + sType;       //住宅金融公庫
        newContent += "<BR></FONT>";

        //<FONT face="ＭＳ Ｐゴシック, Osaka" class="shiro10r">じゅうたくきんゆうこうこ</FONT>;
        newContent += "<FONT face=";
        newContent += '"';
        newContent += "ＭＳ Ｐゴシック, Osaka";
        newContent += '"';
        newContent += " class=";
        newContent += '"';
        newContent += "shiro10r";
        newContent += '"';
        newContent += ">" + sKata;    //じゅうたくきんゆうこうこ;
        newContent += "</FONT>";
        newContent += "</TD>\n";

        newContent += "</TR>\n";

        newContent += "<TR><TD><FONT face=";
        newContent += '"';
        newContent += "ＭＳ Ｐゴシック, Osaka";
        newContent += '"';
        newContent += " class=";
        newContent += '"';
        newContent += "kuro12r";
        newContent += '"';
        newContent += ">" + sContent;
        newContent += "</FONT></TD></TR>";
        newContent += "<TR align=";
        newContent += '"';
        newContent += "center";
        newContent += '"';
        newContent += "><TD><IMG src=";
        newContent += '"';
        newContent += sImg;
        newContent += '"';
        newContent += " width=";
        newContent += '"' + nImgX;
        newContent += '"';
        newContent += " height=";
        newContent += '"' + nImgY;
        newContent += '"';
        newContent += "></TD></TR>";
        
        newContent += "<TR><TD>　</TD></TR>";
        newContent += "<TR bgcolor=";
        newContent += '"';
        newContent += "#CC0000";
        newContent += '"';
        newContent += ">";
        newContent += "<TD><IMG src=";
        newContent += '"';
        newContent += sImgGif;
        newContent += '"';
        newContent += " width=";
        newContent += '"';
        newContent += "1";
        newContent += '"';
        newContent += " height = ";
        newContent += '"';
        newContent += "1";
        newContent += '"';
        newContent += "></TD></TR>";
                
        newContent += "</TABLE>";


        newContent += "</BODY></HTML>";
        
        //alert(newContent);
        
        // write HTML to new window document;
        newWindow.document.write(newContent);
        newWindow.document.close(); // close layout stream
    }
}

function Mame_Key_Change(toChange) 
{
    var numSource ="0123456789";
    var numObject ="０１２３４５６７８９";
    var strAlfa1S ="abcdefghijklmnopqrstuvwxyz"; 
    var strAlfa2S ="ABCDEFGHIJKLMNOPQRSTUVWXYZ"; 
    var strAlfa3S ="ａｂｃｄｅｆｇｈｉｊｋｌｍｎｏｐｑｒｓｔｕｖｗｘｙｚ"; 
    var strAlfaOb ="ＡＢＣＤＥＦＧＨＩＪＫＬＭＮＯＰＱＲＳＴＵＶＷＸＹＺ"; 
    var strForAll = numSource + strAlfa1S + strAlfa2S + strAlfa3S;

    var strResult ="";
    if (toChange.length==0) return strResult;
    
    for(i=0;i<toChange.length;i++)
    {       
        if (strForAll.indexOf(toChange.charAt(i))==-1)
        {
           strResult += toChange.charAt(i);      
        } 
        else 
        {
           if (numSource.indexOf(toChange.charAt(i))!=-1){
               strResult += numObject.charAt(numSource.indexOf(toChange.charAt(i)));      
           } 
           if (strAlfa1S.indexOf(toChange.charAt(i))!=-1){
               strResult += strAlfaOb.charAt(strAlfa1S.indexOf(toChange.charAt(i)));      
           } 
           if (strAlfa2S.indexOf(toChange.charAt(i))!=-1){
               strResult += strAlfaOb.charAt(strAlfa2S.indexOf(toChange.charAt(i)));      
           } 
           if (strAlfa3S.indexOf(toChange.charAt(i))!=-1){
               strResult += strAlfaOb.charAt(strAlfa3S.indexOf(toChange.charAt(i)));      
           } 
        }
    }    
    // alert("strResult === " + strResult);
    return strResult;   
}

function Mame_In_Check(strT1) 
{
    var iT0 = 0;
    var iT1 = 0;
    var strT0 = "";
    //var strT1 = document.new_reg_form.searchtext.value;

    if ( strT1.length == 0 ) 
    {
        alert("検索キーワードを入力してください。");
        //document.new_reg_form.searchtext.focus();
        return false;
    }    

    if ( strT1.indexOf("<") >= 0 || strT1.indexOf(">") >= 0 || 
         strT1.indexOf("\"") >= 0|| strT1.indexOf("=") >= 0) 
    {
        alert("検索キーワードにタグ等「< , >, \", =」の特殊文字は使用できません。");
        //document.new_reg_form.searchtext.focus();
        //document.new_reg_form.searchtext.value = "";
        return false;
    }

    for ( var jj = 0; jj < strT1.length; jj++ )
    {  
        //get the input string length
        if ( strT1.charCodeAt(jj) > 127 ) 
            iT0 = iT0 + 2;
        else
            iT0++;
    }        
    if ( iT0 > 50 ) 
    {
        alert("検索キーワードは50文字以下で入力してください。");
        //document.new_reg_form.searchtext.value = "";
        //document.new_reg_form.searchtext.focus();
        return  false;
    } 
    else 
    {
        for ( var i = 0; i < strT1.length ; i++ ) 
        {
             var oneChar = strT1.charAt(i);
             if  ( oneChar == " " ||  oneChar == "　")
                 iT1++;
        }
        if  ( iT1 == strT1.length )
        {
             alert("検索キーワードに「スペース」のみは使用できません。");
             //document.new_reg_form.searchtext.value = "";
             //document.new_reg_form.searchtext.focus();
             return false;
        }
    }
}

function rnd_pwd()
{  
    today = new Date();    
    var xx = today.getTime();
    xx = Math.abs((17 * xx - 1) % 1024);    
    xx = 10000000000 * xx / 1024;
    var yy = ("" + xx);
    if (yy.length <= 10)
    {
        var zz = "0000000000";
        yy = zz.substring(0, 10 - yy.length) + yy;
    }
    return yy;
}
//漢字入力文字チェック
function Kanji_Keta_Check(txt,max)
{  

	if (txt.length > max)
	{
	 return true;
	}
}

function db_quo(strVal)
{
	var rtn;
	rtn = strVal.search("\"");
	
	if (rtn != -1) {
		alert("\" は入力できません。");
	}
	
	//return なし：-1、あり：-1以外
	return rtn;
}

function is_hankaku(strVal)
{
	var rtn;
	arr = ini_han_kana()
	for (i in arr){
		rtn = strVal.search(arr[i]);
		if (rtn!=-1){
			break;
		}
	}
	//return なし：-1、あり：-1以外
	return rtn;
}

function ini_han_kana()
{
	//半角カタカナの配列を作成
	arr_tmp1 = new Array("ｧ","ｨ","ｩ","ｪ","ｫ","ｬ","ｭ","ｮ","ｯ","ｰ");
	arr_tmp2 = new Array("ｱ","ｲ","ｳ","ｴ","ｵ","ｶ","ｷ","ｸ","ｹ","ｺ");
	arr_tmp3 = new Array("ｻ","ｼ","ｽ","ｾ","ｿ","ﾀ","ﾁ","ﾂ","ﾃ","ﾄ");
	arr_tmp4 = new Array("ﾅ","ﾆ","ﾇ","ﾈ","ﾉ","ﾊ","ﾋ","ﾌ","ﾍ","ﾎ");
	arr_tmp5 = new Array("ﾏ","ﾐ","ﾑ","ﾒ","ﾓ","ﾔ","ﾕ","ﾖ");
	arr_tmp6 = new Array("ﾗ","ﾘ","ﾙ","ﾚ","ﾛ","ﾜ","ｦ","ﾝ","ﾞ","ﾟ");
	arr_tmp7 = new Array("｡","｢","｣","､","･");

	arr = arr_tmp1.concat(arr_tmp2,arr_tmp3,arr_tmp4,arr_tmp5,arr_tmp6,arr_tmp7);
	return arr;
}

// --------------------------------------------------------------------
// ラジオボタンが選択されているか？
// @auther - 2004/06/01 Kishimoto Yuu
// @param radio - radioオブジェクト
// --------------------------------------------------------------------
function isRadioChecked(radio){
  if(typeof(radio) == 'undefined'){
    return false;
  }
  var i;
  if (radio.length) {
    for (i = 0; i < radio.length; i++) {
      if (radio[i].checked) {
        return true;
      }
    }
  } else {
    if (radio.checked) {
        return true;
    }
  }
  return false;
}

// --------------------------------------------------------------------
// SELECT〜OPTION が選択されているか？
// @auther - 2004/06/01 Kishimoto Yuu
// @param select - selectオブジェクト
// --------------------------------------------------------------------
function isOptionSelected(select){
  if(typeof(select) == 'undefined'){
    return false;
  }
  var i;
  if (select.selectedIndex >= 0) {
    return true;
  }
  return false;
}

