/******************************************************************************/
/*     Date   Javascript              Last Modified 2004/05/25          */
/*     対象ブラウザ： Internet Exproler 5.01+                                 */
/*                    NetScape Navigator 4.7X+                                */
/*     notice      :  WindowsOS Only!!                                        */
/******************************************************************************/
/*----------------------------------------------------------------------------*/
/*   機　能：日付チェック                                                     */
/*   引　数：形式区分(0=yyyymm,1=yyyymmdd）、日付文字列                       */
/*           エラーメッセージを出力するか否か(true:する、false:しない)、      */
/*           エラーメッセージに出力する項目名                                 */
/*   返り値：1=lengthエラー、2=年エラー、3=月エラー、4=日エラー、9=正常       */
/*----------------------------------------------------------------------------*/
function chkDateDiff(ID,Date,msgOut,itemName){
var i;
var sringYear;
var sringMonth;
var sringDay;
var year;
var month;
var day;
var uruu;
var DD;
  //-- ID Check --//
  switch (ID){
    case 0:
      if( Date.length != 6 ){
        if  (msgOut == true){
          dateItemErrorMsgOut(itemName);
        }
        return "1";
      }
      sringYear = Date.substring( 0, 4 );
      sringMonth = Date.substring( 4, 6 );
      sringDay = "01";
      break;
    case 1:
      if( Date.length != 8 ){
        if  (msgOut == true){
          dateItemErrorMsgOut(itemName);
        }
        return "1";
      }
      sringYear = Date.substring( 0, 4 );
      sringMonth = Date.substring( 4, 6 );
      sringDay = Date.substring( 6, 8 );
      break;
    default:
      if  (msgOut == true){
        dateItemErrorMsgOut(itemName);
      }
      return "1";
      break;
  }
  //-- Number Check --//
  for( i=0 ; i<sringYear.length ; i++ ){
    if ((sringYear.substring( i, i+1 ) < "0") || (sringYear.substring( i, i+1 ) > "9")){
      if  (msgOut == true){
        dateItemErrorMsgOut(itemName);
      }
      return "2";
    }
  }
  for( i=0 ; i<sringMonth.length ; i++ ){
    if ((sringMonth.substring( i, i+1 ) < "0") || (sringMonth.substring( i, i+1 ) > "9")){
      if  (msgOut == true){
        dateItemErrorMsgOut(itemName);
      }
      return "3";
    }
  }
  for( i=0 ; i<sringDay.length ; i++ ){
    if ((sringDay.substring( i, i+1 ) < "0") || (sringDay.substring( i, i+1 ) > "9")){
      if  (msgOut == true){
        dateItemErrorMsgOut(itemName);
      }
      return "4";
    }
  }
  year = eval( sringYear );
  month = eval( sringMonth );
  if(ID=1){
    day = eval( sringDay );
  }
  //-- year Check --//
  if( year < 2000 ){
    if  (msgOut == true){
      dateItemErrorMsgOut(itemName);
    }
    return "2";
  }
  if( year % 4 ){
    uruu = false;
  }else{
    if( year % 100 ){
      uruu = true;
    }else{
      if( year % 400 ){
        uruu = false;
      }else{
        uruu = true;
      }
    }
  }
  //-- month Check --//
  if( month < 1 || month > 12 ){
    if  (msgOut == true){
      dateItemErrorMsgOut(itemName);
    }
    return "3";
  }
  if(ID=1){
    //-- day Check --//
    if( month == 2 ){
      if( uruu == true ){
        DD = 29;
      }else{
        DD = 28;
      }
    }else if(month == 4 || month == 6 || month == 9 || month == 11 ){
      DD = 30;
    }else{
      DD = 31;
    }
    if ( day < 1 || day > 31 ){
      if  (msgOut == true){
        dateItemErrorMsgOut(itemName);
      }
      return "4";
    }
    if ( day > DD ){
      if  (msgOut == true){
        dateItemErrorMsgOut(itemName);
      }
      return "4";
    }
  }
  return "9";
}
/*----------------------------------------------------------------------------*/
/*   機　能：日付チェック                                                     */
/*   引　数：形式区分(0=yymmdd,1=yyyymmdd,2=yy-mm-dd,3=yy-mm,4==yyyy-mm-dd）、*/
/*           日付文字列、                                                     */
/*           エラーメッセージを出力するか否か(true:する、false:しない)、      */
/*           エラーメッセージに出力する項目名                                 */
/*   返り値：False=エラー、True=正常                                          */
/*----------------------------------------------------------------------------*/
function chkDate(ID,Date,msgOut,itemName){
var i;
var nonEditDate = "";
var mPos = 2;
var dPos = 4;
var year;
var month;
var day;
var uruu;
var DD;
  //-- ID Check --//
  switch (ID){
    case 0:
      if( Date.length != 6 ){
        if  (msgOut == true){
          dateItemErrorMsgOut(itemName);
        }
        return false;
      }
      break;
    case 1:
      if( Date.length != 8 ){
        if  (msgOut == true){
          dateItemErrorMsgOut(itemName);
        }
        return false;
      }
      mPos = 4;
      dPos = 6;
      break;
    case 2:
      for ( i = 0; i < Date.length; i++ ) {
        if ( Date.charAt(i) != "-" ){
            nonEditDate = nonEditDate + Date.charAt(i);
        }
      }
      Date = nonEditDate;
      if( Date.length != 6 ){
        if  (msgOut == true){
          dateItemErrorMsgOut(itemName);
        }
        return false;
      }
      break;
    case 3:
      for ( i = 0; i < Date.length; i++ ) {
        if ( Date.charAt(i) != "-" ){
            nonEditDate = nonEditDate + Date.charAt(i);
        }
      }
      Date = nonEditDate;
      if( Date.length != 4 ){
        if  (msgOut == true){
          dateItemErrorMsgOut(itemName);
        }
        return false;
      }
      break;
    case 4:
      for ( i = 0; i < Date.length; i++ ) {
        if ( Date.charAt(i) != "-" ){
            nonEditDate = nonEditDate + Date.charAt(i);
        }
      }
      Date = nonEditDate;
      if( Date.length != 8 ){
        if  (msgOut == true){
          dateItemErrorMsgOut(itemName);
        }
        return false;
      }
      mPos = 4;
      dPos = 6;
      break;
    default:
      if  (msgOut == true){
        dateItemErrorMsgOut(itemName);
      }
      return false;
      break;
  }
  //-- Number Check --//
  for( i=0 ; i<Date.length ; i++ ){
    if ((Date.substring( i, i+1 ) < "0") || (Date.substring( i, i+1 ) > "9")){
      if  (msgOut == true){
        dateItemErrorMsgOut(itemName);
      }
      return false;
    }
  }
  year = eval( Date.substring( 0, mPos ) );
  month = eval( Date.substring( mPos, dPos ) );
  if(ID!=3){
    day = eval( Date.substring( dPos, Date.length ) );
  }
  //-- year Check --//
  if( ID == 1 && year < 1970 ){
    if  (msgOut == true){
      dateItemErrorMsgOut(itemName);
    }
    return false;
  }
  if( year % 4 ){
    uruu = false;
  }else{
    if( year % 100 ){
      uruu = true;
    }else{
      if( year % 400 ){
        uruu = false;
      }else{
        uruu = true;
      }
    }
  }
  //-- month Check --//
  if( month < 1 || month > 12 ){
    if  (msgOut == true){
      dateItemErrorMsgOut(itemName);
    }
    return false;
  }
  if( month == 2 ){
    if( uruu == true ){
      DD = 29;
    }else{
      DD = 28;
    }
  }else if(month == 4 || month == 6 || month == 9 || month == 11 ){
    DD = 30;
  }else{
    DD = 31;
  }
  //-- day Check --//
  if ((ID!=3) && ( day < 1 || day > 31 )){
    if  (msgOut == true){
      dateItemErrorMsgOut(itemName);
    }
    return false;
  }
  if ((ID!=3) && (day > DD) ){
    if  (msgOut == true){
      dateItemErrorMsgOut(itemName);
    }
    return false;
  }
  return true;
}
/*----------------------------------------------------------------------------*/
/*   機　能：日付エラーメッセージ出力                                         */
/*   引　数：エラーメッセージに出力する項目名                                 */
/*   返り値：なし                                                             */
/*----------------------------------------------------------------------------*/
function dateItemErrorMsgOut(itemName){
  window.alert("E512\n\n"+itemName+"の入力内容に誤りがあります。\n"+itemName+"には実在日を入力して下さい。");
}
/*----------------------------------------------------------------------------*/
/*   機　能：日付項目から"/"を除外する                                        */
/*   引　数：日付項目                                                         */
/*   返り値：なし                                                             */
/*   備　考：日付項目のonfocusイベント等で使用                                */
/*----------------------------------------------------------------------------*/
function dateOnFocus(dateItem){
var i;
var nonEditDate ="";
  for ( i = 0; i < dateItem.value.length; i++ ) {
    if ( dateItem.value.charAt(i) != "/" ){
      nonEditDate = nonEditDate + dateItem.value.charAt(i);
    }
  }
  dateItem.value = nonEditDate;
  dateItem.select();
}
/*----------------------------------------------------------------------------*/
/*   機　能：日付項目を"yy/mm/dd"の形式で編集する                             */
/*   引　数：日付項目                                                         */
/*   返り値：なし                                                             */
/*   備　考：日付項目のonblurイベントで使用                                   */
/*----------------------------------------------------------------------------*/
function dateOnBlur(dateItem){
var nonEditDate = "";
var i;
var sepCount = 0;
var sepPoint = new Array();
var year,month,day;
  /*  "/"の数をカウント&位置を退避  */
  for ( i = 0; i < dateItem.value.length; i++ ) {
    if ( dateItem.value.charAt(i) == "/" ){
      sepPoint[sepCount]=i;
      sepCount++;
    }
  }
  /*  "/"の数が3以上の場合は処理を抜ける  */
  if (sepCount > 2){
    return;
  }
  /*  "/"の数がゼロかつ入力長が8の場合は先頭の2バイトを切り捨てる  7/23 追加 */
  if ((sepCount == 0)&&(dateItem.value.length == 8)){
    dateItem.value  = dateItem.value.substring(2,dateItem.value.length);
  }
  /*  "/"の数がゼロかつ入力長が4の場合はyy/mm形式で編集する  */
  if ((sepCount == 0)&&(dateItem.value.length == 4)){
    dateOnBlur2(dateItem);
    return;
  }
  /*  "/"の数がゼロかつ入力長が6以外の場合は処理を抜ける  */
  if ((sepCount == 0)&&(dateItem.value.length != 6)){
    return;
  }
  /*  "/"の数が1かつ入力長が7以外の場合は処理を抜ける  */
  if ((sepCount == 1)&&(dateItem.value.length != 7)){
    return;
  }
  /*  "0"の補完&"/"編集  */
  if (sepCount == 2){
    year = dateItem.value.substring(0,sepPoint[0]);
    month = dateItem.value.substring(sepPoint[0]+1,sepPoint[1]);
    day = dateItem.value.substring(sepPoint[1]+1,dateItem.value.length);
    if (year.length == 1){
      year = "0"+ year;
    }
    if (month.length == 1){
      month = "0"+ month;
    }
    if (day.length == 1){
      day = "0"+ day;
    }
    nonEditDate = year + month + day;
  }else{
    if (sepCount == 1){
      nonEditDate = dateItem.value.substring(0,sepPoint[0])+dateItem.value.substring(sepPoint[0]+1,dateItem.value.length);
    }else{
      nonEditDate = dateItem.value;
    }
  }
  dateItem.value="";
  for ( i = 0; i < nonEditDate.length; i++ ) {
    if ((i == 2)||(i == 4)){
      dateItem.value = dateItem.value + "/" + nonEditDate.charAt(i);
    }else{
      dateItem.value = dateItem.value + nonEditDate.charAt(i);
    }
  }
}
/*----------------------------------------------------------------------------*/
/*   機　能：日付項目を"yy/mm"の形式で編集する                                */
/*   引　数：日付項目                                                         */
/*   返り値：なし                                                             */
/*   備　考：日付項目のonblurイベントで使用                                   */
/*----------------------------------------------------------------------------*/
function dateOnBlur2(dateItem){
var nonEditDate = "";
var i;
var sepCount = 0;
var sepPoint = 0;
var year,month;
  /*  "/"の数をカウント&位置を退避  */
  for ( i = 0; i < dateItem.value.length; i++ ) {
    if ( dateItem.value.charAt(i) == "/" ){
      sepPoint=i;
      sepCount++;
    }
  }
  /*  "/"の数が2以上の場合は処理を抜ける  */
  if (sepCount > 1){
    return;
  }
  /*  "/"の数がゼロかつ入力長が4以外の場合は処理を抜ける  */
  if ((sepCount == 0)&&(dateItem.value.length != 4)){
    return;
  }
  /*  "0"の補完&"/"編集  */
  if (sepCount == 1){
    year = dateItem.value.substring(0,sepPoint);
    month = dateItem.value.substring(sepPoint+1,dateItem.value.length);
    if (year.length == 1){
      year = "0"+ year;
    }
    if (month.length == 1){
      month = "0"+ month;
    }
    nonEditDate = year + month;
  }else{
    if (sepCount == 1){
      nonEditDate = dateItem.value.substring(0,sepPoint)+dateItem.value.substring(sepPoint+1,dateItem.value.length);
    }else{
      nonEditDate = dateItem.value;
    }
  }
  dateItem.value="";
  for ( i = 0; i < nonEditDate.length; i++ ) {
    if (i == 2){
      dateItem.value = dateItem.value + "/" + nonEditDate.charAt(i);
    }else{
      dateItem.value = dateItem.value + nonEditDate.charAt(i);
    }
  }
}
/*----------------------------------------------------------------------------*/
/*   機　能：日付項目を"yyyy/mm/dd"の形式で編集する                           */
/*   引　数：日付項目                                                         */
/*   返り値：なし                                                             */
/*   備　考：日付項目のonblurイベントで使用                                   */
/*----------------------------------------------------------------------------*/
function dateOnBlur3(dateItem){
var nonEditDate = "";
var i;
var sepCount = 0;
var sepPoint = new Array();
var year,month,day;
  /*  "/"の数をカウント&位置を退避  */
  for ( i = 0; i < dateItem.value.length; i++ ) {
    if ( dateItem.value.charAt(i) == "/" ){
      sepPoint[sepCount]=i;
      sepCount++;
    }
  }
  /*  "/"の数が3以上の場合は処理を抜ける  */
  if (sepCount > 2){
    return;
  }
  /*  入力長が10以上の場合は処理を抜ける  */
  if (dateItem.value.length > 10){
    return;
  }
  /*  "/"の数がゼロかつ入力長が8以外の場合は処理を抜ける  */
  if ((sepCount == 0)&&(dateItem.value.length != 8)){
      if (dateItem.value.length != 6){
        return;
      }
  }
  /*  "/"の数が1かつ入力長が9以外の場合は処理を抜ける  */
  if ((sepCount == 1)&&(dateItem.value.length != 9)){
    return;
  }
  /*  "0"の補完&"/"編集  */
  if (sepCount == 2){
    year = dateItem.value.substring(0,sepPoint[0]);
    month = dateItem.value.substring(sepPoint[0]+1,sepPoint[1]);
    day = dateItem.value.substring(sepPoint[1]+1,dateItem.value.length);
    if (year.length == 1){
      year = "0"+ year;
    }
    if (year.length == 2){
      year = "0"+ year;
    }
    if (year.length == 3){
      year = "2"+ year;
    }
    if (month.length == 1){
      month = "0"+ month;
    }
    if (day.length == 1){
      day = "0"+ day;
    }
    nonEditDate = year + month + day;
  }else{
    if (sepCount == 1){
      nonEditDate = dateItem.value.substring(0,sepPoint[0])+dateItem.value.substring(sepPoint[0]+1,dateItem.value.length);
    }else{
      if (dateItem.value.length == 6){
          dateItem.value = "20" + dateItem.value;
      }
      nonEditDate = dateItem.value;
    }
  }
  dateItem.value="";
  for ( i = 0; i < nonEditDate.length; i++ ) {
    if ((i == 4)||(i == 6)){
      dateItem.value = dateItem.value + "/" + nonEditDate.charAt(i);
    }else{
      dateItem.value = dateItem.value + nonEditDate.charAt(i);
    }
  }
}
/*----------------------------------------------------------------------------*/
/*   機　能：日付項目を"yyyy/mm"の形式で編集する                                */
/*   引　数：日付項目                                                         */
/*   返り値：なし                                                             */
/*   備　考：日付項目のonblurイベントで使用                                   */
/*----------------------------------------------------------------------------*/
function dateOnBlur4(dateItem){
var nonEditDate = "";
var i;
var sepCount = 0;
var sepPoint = 0;
var year,month;
  /*  "/"の数をカウント&位置を退避  */
  for ( i = 0; i < dateItem.value.length; i++ ) {
    if ( dateItem.value.charAt(i) == "/" ){
      sepPoint=i;
      sepCount++;
    }
  }
  /*  "/"の数が2以上の場合は処理を抜ける  */
  if (sepCount > 1){
    return;
  }
  /*  "/"の数がゼロかつ入力長が4以外又入力長が4以外はの場合は処理を抜ける  */
  if ((sepCount == 0)&&(dateItem.value.length != 4)){
      if (dateItem.value.length != 6){
        return;
      }
  }
  /*  "0"の補完&"/"編集  */
  if (sepCount == 1){
    year = dateItem.value.substring(0,sepPoint);
    month = dateItem.value.substring(sepPoint+1,dateItem.value.length);
    if (year.length == 1){
      year = "0"+ year;
    }
    if (month.length == 1){
      month = "0"+ month;
    }
    nonEditDate = year + month;
  }else{
    if (sepCount == 1){
      nonEditDate = dateItem.value.substring(0,sepPoint)+dateItem.value.substring(sepPoint+1,dateItem.value.length);
    }else{
      if (dateItem.value.length == 4){
          dateItem.value = "20" + dateItem.value;
      }
      nonEditDate = dateItem.value;
    }
  }
  dateItem.value="";
  for ( i = 0; i < nonEditDate.length; i++ ) {
    if ((i == 4)||(i == 6)){
      dateItem.value = dateItem.value + "/" + nonEditDate.charAt(i);
    }else{
      dateItem.value = dateItem.value + nonEditDate.charAt(i);
    }
  }
}
/*----------------------------------------------------------------------------*/
/*   機　能：日付の大小比較                                                   */
/*   引　数：形式区分(0=yymmdd,1=yyyymmdd,2=yy/mm/dd,3=yy/mm,4=yyyy/mm/dd）   */
/*           比較区分(0=日付文字列1,2の大小比較、                             */
/*                    1=日付文字列1と現在日の大小比較）                       */
/*           日付文字列1、                                                    */
/*           日付文字列2、                                                    */
/*   返り値：0=日付文字列1と日付文字列2は等しい                               */
/*           1=日付文字列1が大                                                */
/*           2=日付文字列2が大                                                */
/*          -1=引数エラー                                                     */
/*          -2=その他のエラー                                                 */
/*   備　考：日付文字列1,2は同一形式である事                                  */
/*           日付文字列は日付として妥当である事                               */
/*----------------------------------------------------------------------------*/
function compareDate(fId,cId,Date1,Date2){
var i;
var nonEditDate = "";
  /* 引数チェック */
  if ((cId != 0)&&(cId != 1)){
    return -1;
  }
  switch (fId){
    case 0:
      if (Date1.length != 6 ){
        return -1;
      }
      if (cId==0){
        if (Date2.length != 6){
            return -1;
        }
        Date2 = "20"+Date2;
      }
      Date1 = "20"+Date1;
      break;
    case 1:
      if (Date1.length != 8 ){
        return -1;
      }
      if (cId==0){
        if (Date2.length != 8){
          return -1;
        }
      }
      break;
    case 2:
      for (i = 0; i < Date1.length; i++) {
        if ( Date1.charAt(i) != "/" ){
          nonEditDate = nonEditDate + Date1.charAt(i);
        }
      }
      Date1 = nonEditDate;
      nonEditDate=""
      for (i = 0; i < Date2.length; i++) {
        if ( Date2.charAt(i) != "/" ){
          nonEditDate = nonEditDate + Date2.charAt(i);
        }
      }
      Date2 = nonEditDate;
      if (Date1.length != 6 ){
        return -1;
      }
      if (cId==0){
        if (Date2.length != 6){
          return -1;
        }
        Date2 = "20"+Date2;
      }
      Date1 = "20"+Date1;
      break;
    case 3:
      for (i = 0; i < Date1.length; i++) {
        if ( Date1.charAt(i) != "/" ){
          nonEditDate = nonEditDate + Date1.charAt(i);
        }
      }
      Date1 = nonEditDate;
      nonEditDate=""
      for (i = 0; i < Date2.length; i++) {
        if ( Date2.charAt(i) != "/" ){
          nonEditDate = nonEditDate + Date2.charAt(i);
        }
      }
      Date2 = nonEditDate;
      if (Date1.length != 4 ){
        return -1;
      }
      if (cId==0){
        if (Date2.length != 4){
          return -1;
        }
        Date2 = "20"+Date2;
      }
      Date1 = "20"+Date1;
      break;
    case 4:
      for (i = 0; i < Date1.length; i++) {
        if ( Date1.charAt(i) != "/" ){
          nonEditDate = nonEditDate + Date1.charAt(i);
        }
      }
      Date1 = nonEditDate;
      nonEditDate=""
      for (i = 0; i < Date2.length; i++) {
        if ( Date2.charAt(i) != "/" ){
          nonEditDate = nonEditDate + Date2.charAt(i);
        }
      }
      Date2 = nonEditDate;
      if (Date1.length != 8 ){
        return -1;
      }
      if (cId==0){
        if (Date2.length != 8){
          return -1;
        }
      }
      break;
    default:
      return -1;
      break;
  }
  if (fId!=3){
    if (cId==0){
        var wDate1 = Date1.substring(0,4) + Date1.substring(4,6) + Date1.substring(6,8);
        var wDate2 = Date2.substring(0,4) + Date2.substring(4,6) + Date2.substring(6,8);
      }else{
        var wDate1 = Date1.substring(0,4) + Date1.substring(4,6) + Date1.substring(6,8);
        var cDate = new Date();
        var cYear = String(cDate.getFullYear());
        var cMonth = String(cDate.getMonth() + 1);
        if (cMonth.length < 2){
          cMonth = "0" + cMonth;
        }
        var cDate = String(cDate.getDate());
        if (cDate.length < 2){
          cDate = "0" + cDate;
        }
        var wDate2 = cYear + cMonth + cDate;
    }
  }else{
      if (cId==0){
        var wDate1 = Date1.substring(0,4) + Date1.substring(4,6);
        var wDate2 = Date2.substring(0,4) + Date2.substring(4,6);
      }else{
        var wDate1 = Date1.substring(0,4) + Date1.substring(4,6);
        var cDate = new Date();
        var cYear = String(cDate.getFullYear());
        var cMonth = String(cDate.getMonth() + 1);
        if (cMonth.length < 2){
          cMonth = "0" + cMonth;
        }
        var wDate2 = cYear + cMonth;
    }
  }
  /* 大小比較 */
  if (wDate1 == wDate2){
      return 0;
  }
  if (wDate1 > wDate2){
      return 1;
  }
  if (wDate1 < wDate2){
      return 2;
  }
}
/*----------------------------------------------------------------------------*/
/*   機　能：基準日からＸ日前またはＸ日後の日付を求める                       */
/*   引　数：基準日(date型）、                                                */
/*           加減算する日数(String型、内容は数値）、                          */
/*           加減算区分（"+":基準日に加減算する日数を加算、                   */
/*                       "-":基準日から加減算する日数を減算）                 */
/*           曜日区分(""は返り値にw（曜日）を返さない、１はw（曜日）を返す。  */
/*   返り値：yy/mm/dd/w 形式の文字列型                                        */
/*   備　考：加減算する日数が数値として認識できない場合、                     */
/*           加減算区分が"+","-"以外の場合は、返り値に引数の基準日を          */
/*           そのまま返す。                                                   */
/*----------------------------------------------------------------------------*/
function getSearchDays(baseDate,addDays,cmpInd,weekInd){
var cmpDate = new Date();
var resYY;
var resMM;
var resDD;
var resDate;

    /* 加減算する日数が数値でない場合はリターン */
    if (isNaN(addDays)){
        return baseDate;
    }

    /* 加減算区分が"+"、"-"以外はリターン */
    if ((cmpInd != "+") && (cmpInd != "-")){
        return baseDate;
    }

    /* 基準日に日数を加減算 */
    if (cmpInd == "+"){
        cmpDate.setTime(eval(baseDate)  + (eval(addDays) * (24*60*60*1000)));
    }else{
        cmpDate.setTime(eval(baseDate)  - (eval(addDays) * (24*60*60*1000)));
    }

    /* yy/mm/dd形式にフォーマット */
    resYY = cmpDate.getYear().toString();
    if ((getBrowser() == "IE4")||(getBrowser() == "IE5")||(getBrowser() == "IE6")){
        resYY = resYY.substring(2,4);
    }else{
        resYY = resYY.substring(1,3);
    }
    resMM = cmpDate.getMonth() + 1;
    resMM = resMM.toString();
    if (resMM.length < 2){
        resMM = "0" + resMM;
    }
    resDD = cmpDate.getDate().toString();
    if (resDD.length < 2){
        resDD = "0" + resDD;
    }
    if (weekInd != "1"){
      resDate = resYY + "/" + resMM + "/" + resDD;
    }else{
      resDate = resYY + "/" + resMM + "/" + resDD + "/" + cmpDate.getDay();
    }
    return resDate;
}
/*----------------------------------------------------------------------------*/
/*   機　能：曜日を表す数値から曜日（日本語１文字）を求める                   */
/*   引　数：曜日を表す数値                                                   */
/*   返り値：曜日を表す日本語１文字                                           */
/*   備　考：                                                                 */
/*----------------------------------------------------------------------------*/
function getWeek(week){
  switch (week){
    case 0:
      return "日";
      break;
    case 1:
      return "月";
      break;
    case 2:
      return "火";
      break;
    case 3:
      return "水";
      break;
    case 4:
      return "木";
      break;
    case 5:
      return "金";
      break;
    case 6:
      return "土";
      break;
    default:
      return "";
      break;
  }
}

