fcolor='#ffee77';
tcolor='#ffffff';

/* フォームカラークリア */
function chkInit(fOBJ) {
   fOBJ.style.backgroundColor=tcolor;
}

/* 必須チェック */
function chkBlank(fOBJ) {
   if(!fOBJ.value){
      fOBJ.style.backgroundColor=fcolor;
      return false;
   }else{
      return true;
   }
}

/* 数値チェック(.含む) */
function chkNumber(fOBJ) {
   if(fOBJ.value.match(/[^0-9.]+/)){
      fOBJ.style.backgroundColor=fcolor;
      return false;
   }else{
      return true;
   }
}

/* 半角英数字チェック */
function chkHalfSize(fOBJ) {
   if(fOBJ.value.match(/[^!-~]+/)){
      fOBJ.style.backgroundColor=fcolor;
      return false;
   }else{
      return true;
   }
}

/* 全角英数字チェック */
function chkFullSize(fOBJ) {
   if(fOBJ.value.match(/[!-~]+/)){
      fOBJ.style.backgroundColor=fcolor;
      return false;
   }else{
      return true;
   }
}

/* Emailチェック */
function chkEmail(fOBJ) {
   if(!fOBJ.value){
      fOBJ.style.backgroundColor=tcolor;
      return true;
   }
   if(!fOBJ.value.match(/^\w.*@.+\..+\w$/)){
      fOBJ.style.backgroundColor=fcolor;
      return false;
   }else{
      return true;
   }
}

// 日付チェック

function chkDate(y,m,d){
    var di = new Date(y.value,m.value-1,d.value);
if(di.getFullYear() == y.value && di.getMonth() == m.value-1 && di.getDate() == d.value){
      y.style.backgroundColor=tcolor;
      m.style.backgroundColor=tcolor;
      d.style.backgroundColor=tcolor;
return true;
}
if(y.value == '9999'){
      y.style.backgroundColor=tcolor;
      m.style.backgroundColor=tcolor;
      d.style.backgroundColor=tcolor;
return true;

}

      y.style.backgroundColor=fcolor;
      m.style.backgroundColor=fcolor;
      d.style.backgroundColor=fcolor;
      return false;

}

function isValidDate(y,m,d, message){
   if( y=='' && m=='' && d=='' ){
      return true;
   }
   var di = new Date(y,m-1,d);
   if(di.getFullYear() == y && di.getMonth() == m-1 && di.getDate() == d){
      return true;
   }
   alert(message+'の日付が間違っています。');
   return false;
};

