function InputChecker(p_form,p_elm,p_koumoku){this.mNull=false;this.mMin=0;this.mMax=0;this.mFocus=2;this.mNumType=1;this.mFltMax=0;this.mMinus=false;this.mZero=true;this.mPreZero=false;this.mTelMark=false;this.mMark=0;this.mHalfKana=false;this.mSpace=false;this.mStrByte=1;this.mHttp=false;this.mYmdType=7;this.mYmdNeed=7;this.mYearMax=2100;this.mYearMin=1753;this.mFillType=1;this.mSlash=true;this.mFormName=p_form;this.mKoumoku=p_koumoku;this.mElmName=null;this.mElmNames=null;this.mFormElement=null;this.mFormElements=null;this.mFormElmAfter=null;if(typeof p_elm=="object"){this.mElmNames=new Array();this.mFormElements=new Array();for(var i in p_elm){this.mElmNames[i]=p_elm[i];this.mFormElements[i]=document.forms[p_form].elements[p_elm[i]];}}else{this.mElmName=p_elm;this.mFormElement=document.forms[p_form].elements[p_elm];}}function defineMethod_InputChecker(){var pr=InputChecker.prototype;pr.setChkNull=function(b){this.mNull=Boolean(b);};pr.setChkMin=function(n){this.mMin=n;};pr.setChkMax=function(n){this.mMax=n;};pr.setResultTextBox=function(pName){this.mFormElmAfter=document.forms[this.mFormName].elements[pName];};pr.setChkFltMax=function(n){this.mFltMax=n;};pr.setChkNumType=function(n){this.mNumType=n;};pr.setPermitMinus=function(b){this.mMinus=Boolean(b);};pr.setPermitZero=function(b){this.mZero=Boolean(b);};pr.setDelPreZero=function(b){this.mPreZero=Boolean(b);};pr.setDelTelMark=function(b){this.mTelMark=Boolean(b);};pr.setChgMark=function(n){this.mMark=n;};pr.setChgHalfKana=function(b){this.mHalfKana=Boolean(b);};pr.setChgSpace=function(b){this.mSpace=Boolean(b);};pr.setDefStrByte=function(n){this.mStrByte=n;};pr.setChkHttp=function(b){this.mHttp=Boolean(b);};pr.setYmdType=function(){if(arguments.length==1)this.mYmdType=this.mYmdNeed=arguments[0];else{this.mYmdType=arguments[0];this.mYmdNeed=arguments[1];}};pr.setYearMax=function(n){this.mYearMax=n;};pr.setYearMin=function(n){this.mYearMin=n;};pr.setFillType=function(b){this.mFillType=b;};pr.setDivSlash=function(b){this.mSlash=b;};pr.checkNumeric=function(){with(this){return mtdChkNum(mFormElement,mKoumoku,mNull,mMin,mMax,mFltMax,mNumType,mMinus,mZero,mPreZero,mTelMark,mFormElmAfter,mFocus);}};pr.checkTel=function(){with(this){return mtdChkNum(mFormElement,mKoumoku,mNull,mMin,mMax,mFltMax,mNumType,mMinus,mZero,mPreZero,true,mFormElmAfter,mFocus);}};pr.checkString=function(){with(this){return mtdChkStr(mFormElement,mKoumoku,mNull,mMin,mMax,mMark,mHalfKana,mSpace,mStrByte,mHttp,mFormElmAfter,mFocus);}};pr.checkAlphabet=function(){with(this){return mtdChkAlpha(mFormElement,mKoumoku,mNull,mMin,mMax,mFormElmAfter,mFocus,0);}};pr.checkIdPassword=function(){with(this){return mtdChkAlpha(mFormElement,mKoumoku,mNull,mMin,mMax,mFormElmAfter,mFocus,1);}};pr.checkMailAddress=function(){with(this){return mtdChkAlpha(mFormElement,mKoumoku,mNull,mMin,mMax,mFormElmAfter,mFocus,2);}};pr.checkDate=function(){var divYmd;var formElm;var nullChk;with(this){if(mFormElement!=null){divYmd=mtdPrepareYmd(mFormElement.value);formElm=[mFormElement];}else if(mFormElements!=null){divYmd=mtdPrepareYmd2(mFormElements,mYmdType);formElm=mFormElements;}divYmd=mtdYmdNullChk(divYmd,mNull,mYmdType,mYmdNeed,mFillType);return mtdChkDate(formElm,mKoumoku,mYmdType,mYearMax,mYearMin,mSlash,divYmd,mFillType,mFormElmAfter,mFocus);}};function mtdChkNum(pFormElement,pKoumoku,pNull,pMin,pMax,pFltMax,pNumType,pMinus,pZero,pPreZero,pTelMark,pAfter,pFocus){var ret;with(this){ret=Com_Chk_Suji(pFormElement.value,pKoumoku,pNull,pMin,pMax,pFltMax,pNumType,pMinus,pZero,pPreZero,pTelMark);}return mtdSetResult(ret,[pFormElement],pAfter,pFocus);}function mtdChkStr(pFormElement,pKoumoku,pNull,pMin,pMax,pMark,pHalfKana,pSpace,pStrByte,pHttp,pAfter,pFocus){var ret;with(this){ret=Com_Chk_Moji(pFormElement.value,pKoumoku,pNull,pMin,pMax,pMark,pHalfKana,pSpace,pStrByte,pHttp);}return mtdSetResult(ret,[pFormElement],pAfter,pFocus);}function mtdChkAlpha(pFormElement,pKoumoku,pNull,pMin,pMax,pAfter,pFocus,pType){var ret=Com_Chk_Eisuji(pFormElement.value,pKoumoku,pNull,pMin,pMax,pType);return mtdSetResult(ret,[pFormElement],pAfter,pFocus);}function mtdChkDate(pFormElements,pKoumoku,pYmdType,pYearMax,pYearMin,pSlash,pDivYmd,pFill,pAfter,pFocus){var ret=Com_Chk_Seireki(pDivYmd,pKoumoku,pYmdType,pYearMax,pYearMin,pFill,pSlash);return mtdSetResult(ret,pFormElements,pAfter,pFocus);}}defineMethod_InputChecker();function mtdAlert(){var args=arguments;var pKoumoku=args[0];var pCategory=args[1];var pCd=args[2];if(args.length==4)var pStr=args[3];var msg="";var msgNr="入力して下さい";var msgNrDkn="は入力できません";var msgNrHs="入力必須項目です";switch(pCategory){case "cmn":switch(pCd){case-1:msg=msgNrHs;break;case-2:msg=pStr+"桁までで"+msgNr;break;case-3:msg=pStr+"桁以上で"+msgNr;break;case-4:msg=pStr[0]+"文字までで"+msgNr+"\n　(現在 "+pStr[1]+"文字です)";break;case-5:msg=pStr[0]+"文字以上で"+msgNr+"\n　(現在 "+pStr[1]+"文字です)";break;case-6:msg=pStr+msgNrDkn;break;case-7:msg=pStr+"文字で"+msgNr;break;case-8:msg=pStr+"桁で"+msgNr;break;}break;case "str":switch(pCd){case-1:msg="半角英数字で"+msgNr;break;case-2:msg="半角英数字およびアンダーバー、\n　ハイフンで"+msgNr;break;case-3:msg="入力が不正です\n　正しい文字を"+msgNr;break;}break;case "num":switch(pCd){case-1:msg="数値を"+msgNr;break;case-2:msg="整数を"+msgNr;break;case-3:msg="正の整数を"+msgNr;break;case-4:msg="マイナス値"+msgNrDkn;break;case-5:msg="小数点を正しく"+msgNr;break;case-6:msg="小数点以下を"+msgNr;break;case-7:msg="数字を"+msgNr;break;}break;case "ymd":switch(pCd){case-1:msg="数値を"+msgNr;break;case-2:msg="YYYY/MM もしくは YYYY.MM 形式で\n　"+msgNr;break;case-3:msg="YYYY/MM/DD もしくは YYYY.MM.DD 形式で\n　"+msgNr;break;case-10:msg="月を"+msgNr;break;case-11:msg="年を"+msgNr;break;case-12:msg="年,日を"+msgNr;break;case-13:msg="年,月を"+msgNr;break;case-14:msg="日："+msgNrHs;break;case-15:msg="日を"+msgNr;break;case-16:msg="月,日："+msgNrHs;break;case-17:msg="月,日を"+msgNr;break;case-18:msg="月："+msgNrHs;break;case-19:msg=msgNrHs;break;case-20:msg=pStr+"年より過去"+msgNrDkn;break;case-21:msg=pStr+"年より未来"+msgNrDkn;break;case-22:msg="正確な日付を"+msgNr;break;}break;}alert(pKoumoku+"：\n\n　"+msg);}function mtdSetResult(pRetObj,pFormElements,pAfter,pFocus){with(pRetObj){for(var i in pFormElements)pFormElements[i].value=val[i];if(pAfter!=null)pAfter.value=afterVal;if(!result){if(pFocus>=1)pFormElements[errPt].focus();if(pFocus==2)pFormElements[errPt].select();}return result;}}
