//========================================================================================================================//
// 茨城パシフィックカントリー倶楽部　ホームページ用JAVA SCRIPT                                                            //
// 製作：日本スプリード                                                                                                   //
//========================================================================================================================//

// 交通アクセス詳細地図表示 //
function windowOpenMap(){
	window.open("images/map_detail.gif","アクセス地図","width=580,height=550,toolbar=no,location=no,directries=no,status=no,menubar=yes,scrollbars=yes,resizable=yes")
}

// コース写真表示 //
function windowOpenCourse(num){
	window.open("images/pic_course"+num+".jpg",num+"番ホール","width=385,height=285,toolbar=no,location=no,directries=no,status=no,menubar=no,scrollbars=no,resizable=no")
}

// シニア・レディースコンペ予定表ポップアップ表示 //
function windowOpenSenior(){
	window.open("page_reserve_senior.htm","予定表","width=300,height=500,toolbar=no,location=no,directries=no,status=no,menubar=yes,scrollbars=yes,resizable=yes")
}

// シニア・レディースコンペ予定表自動作成 //
function createCalender() {

  var nDate  = new Date();
  var nCompe = new Date();
  var nFLG   = new Boolean;

  var wDate01 = new Date('2012/01/12');
  var wDate02 = new Date('2012/02/09');
  var wDate03 = new Date('2012/03/08');
  var wDate04 = new Date('2012/04/12');
  var wDate05 = new Date('2012/05/10');
  var wDate06 = new Date('2012/06/07');
  var wDate07 = new Date('2012/07/12');
  var wDate08 = new Date('2012/08/09');
  var wDate09 = new Date('2012/09/06');
  var wDate10 = new Date('2012/10/11');
  var wDate11 = new Date('2012/11/08');
  var wDate12 = new Date('2012/12/06');

  var wColor01 = "FFFFFF";
  var wColor02 = "FFFFFF";
  var wColor03 = "FFFFFF";
  var wColor04 = "FFFFFF";
  var wColor05 = "FFFFFF";
  var wColor06 = "FFFFFF";
  var wColor07 = "FFFFFF";
  var wColor08 = "FFFFFF";
  var wColor09 = "FFFFFF";
  var wColor10 = "FFFFFF";
  var wColor11 = "FFFFFF";
  var wColor12 = "FFFFFF";

  nFLG = false;

  // １月 //
  if((nDate - wDate01) / (1000 * 60 * 60 * 24) <= -6){
    if(nFLG == false){
      nFLG = true;
      wColor01 = "FFCC00";
      nCompe = wDate01;
    }
  }
  else{
    wColor01 = "CCCCCC";
  }

  // ２月 //
  if((nDate - wDate02) / (1000 * 60 * 60 * 24) <= -6){
    if(nFLG == false){
      nFLG = true;
      wColor02 = "FFCC00";
      nCompe = wDate02;
    }
  }
  else{
    wColor02 = "CCCCCC";
  }

  // ３月 //
  if((nDate - wDate03) / (1000 * 60 * 60 * 24) <= -6){
    if(nFLG == false){
      nFLG = true;
      wColor03 = "FFCC00";
      nCompe = wDate03;
    }
  }
  else{
    wColor03 = "CCCCCC";
  }

  // ４月 //
  if((nDate - wDate04) / (1000 * 60 * 60 * 24) <= -6){
    if(nFLG == false){
      nFLG = true;
      wColor04 = "FFCC00";
      nCompe = wDate04;
    }
  }
  else{
    wColor04 = "CCCCCC";
  }

  // ５月 //
  if((nDate - wDate05) / (1000 * 60 * 60 * 24) <= -6){
    if(nFLG == false){
      nFLG = true;
      wColor05 = "FFCC00";
      nCompe = wDate05;
    }
  }
  else{
    wColor05 = "CCCCCC";
  }

  // ６月 //
  if((nDate - wDate06) / (1000 * 60 * 60 * 24) <= -6){
    if(nFLG == false){
      nFLG = true;
      wColor06 = "FFCC00";
      nCompe = wDate06;
    }
  }
  else{
    wColor06 = "CCCCCC";
  }

  // ７月 //
  if((nDate - wDate07) / (1000 * 60 * 60 * 24) <= -6){
    if(nFLG == false){
      nFLG = true;
      wColor07 = "FFCC00";
      nCompe = wDate07;
    }
  }
  else{
    wColor07 = "CCCCCC";
  }

  // ８月 //
  if((nDate - wDate08) / (1000 * 60 * 60 * 24) <= -6){
    if(nFLG == false){
      nFLG = true;
      wColor08 = "FFCC00";
      nCompe = wDate08;
    }
  }
  else{
    wColor08 = "CCCCCC";
  }

  // ９月 //
  if((nDate - wDate09) / (1000 * 60 * 60 * 24) <= -6){
    if(nFLG == false){
      nFLG = true;
      wColor09 = "FFCC00";
      nCompe = wDate09;
    }
  }
  else{
      wColor09 = "CCCCCC";
  }

  // １０月 //
  if((nDate - wDate10) / (1000 * 60 * 60 * 24) <= -6){
    if(nFLG == false){
      nFLG = true;
      wColor10 = "FFCC00";
      nCompe = wDate10;
    }
  }
  else{
    wColor10 = "CCCCCC";
  }

  // １１月 //
  if((nDate - wDate11) / (1000 * 60 * 60 * 24) <= -6){
    if(nFLG == false){
      nFLG = true;
      wColor11 = "FFCC00";
      nCompe = wDate11;
    }
  }
  else{
    wColor11 = "CCCCCC";
  }

  // １２月 //
  if((nDate - wDate12) / (1000 * 60 * 60 * 24) <= -6){
    if(nFLG == false){
      nFLG = true;
      wColor12 = "FFCC00";
      nCompe = wDate12;
    }
  }
  else{
    wColor12 = "CCCCCC";
  }

  document.write("<BR>");
  document.write("■開催予定日■<BR>");
  document.write("<TABLE BORDER='0' CELLSPACING='1' CELLPADDING='2' STYLE='BACKGROUND:#000000;FONT-WEIGHT:BOLD;TEXT-ALIGN:CENTER'>");
  document.write("<TR>");
  document.write("<TD STYLE='FONT-WEIGHT:BOLD;TEXT-ALIGN:CENTER;BACKGROUND:#0066FF;COLOR:#FFFFFF;WIDTH:60px'>月度</TD>");
  document.write("<TD STYLE='FONT-WEIGHT:BOLD;TEXT-ALIGN:CENTER;BACKGROUND:#0066FF;COLOR:#FFFFFF;WIDTH:100px'>開催日</TD>");
  document.write("</TR>");
  document.write("<TR>");
  document.write("<TD STYLE='BACKGROUND:#" + wColor01 + "'>" + (wDate01.getMonth() + 1) + "月</TD>");
  document.write("<TD STYLE='BACKGROUND:#" + wColor01 + "'>" + (wDate01.getMonth() + 1) + "月" + wDate01.getDate() + "日</TD>");
  document.write("</TR>");
  document.write("<TR>");
  document.write("<TD STYLE='BACKGROUND:#" + wColor02 + "'>" + (wDate02.getMonth() + 1) + "月</TD>");
  document.write("<TD STYLE='BACKGROUND:#" + wColor02 + "'>" + (wDate02.getMonth() + 1) + "月" + wDate02.getDate() + "日</TD>");
  document.write("</TR>");
  document.write("<TR>");
  document.write("<TD STYLE='BACKGROUND:#" + wColor03 + "'>" + (wDate03.getMonth() + 1) + "月</TD>");
  document.write("<TD STYLE='BACKGROUND:#" + wColor03 + "'>" + (wDate03.getMonth() + 1) + "月" + wDate03.getDate() + "日</TD>");
  document.write("</TR>");
  document.write("<TR>");
  document.write("<TD STYLE='BACKGROUND:#" + wColor04 + "'>" + (wDate04.getMonth() + 1) + "月</TD>");
  document.write("<TD STYLE='BACKGROUND:#" + wColor04 + "'>" + (wDate04.getMonth() + 1) + "月" + wDate04.getDate() + "日</TD>");
  document.write("</TR>");
  document.write("<TR>");
  document.write("<TD STYLE='BACKGROUND:#" + wColor05 + "'>" + (wDate05.getMonth() + 1) + "月</TD>");
  document.write("<TD STYLE='BACKGROUND:#" + wColor05 + "'>" + (wDate05.getMonth() + 1) + "月" + wDate05.getDate() + "日</TD>");
  document.write("</TR>");
  document.write("<TR>");
  document.write("<TD STYLE='BACKGROUND:#" + wColor06 + "'>" + (wDate06.getMonth() + 1) + "月</TD>");
  document.write("<TD STYLE='BACKGROUND:#" + wColor06 + "'>" + (wDate06.getMonth() + 1) + "月" + wDate06.getDate() + "日</TD>");
  document.write("</TR>");
  document.write("<TR>");
  document.write("<TD STYLE='BACKGROUND:#" + wColor07 + "'>" + (wDate07.getMonth() + 1) + "月</TD>");
  document.write("<TD STYLE='BACKGROUND:#" + wColor07 + "'>" + (wDate07.getMonth() + 1) + "月" + wDate07.getDate() + "日</TD>");
  document.write("</TR>");
  document.write("<TR>");
  document.write("<TD STYLE='BACKGROUND:#" + wColor08 + "'>" + (wDate08.getMonth() + 1) + "月</TD>");
  document.write("<TD STYLE='BACKGROUND:#" + wColor08 + "'>" + (wDate08.getMonth() + 1) + "月" + wDate08.getDate() + "日</TD>");
  document.write("</TR>");
  document.write("<TR>");
  document.write("<TD STYLE='BACKGROUND:#" + wColor09 + "'>" + (wDate09.getMonth() + 1) + "月</TD>");
  document.write("<TD STYLE='BACKGROUND:#" + wColor09 + "'>" + (wDate09.getMonth() + 1) + "月" + wDate09.getDate() + "日</TD>");
  document.write("</TR>");
  document.write("<TR>");
  document.write("<TD STYLE='BACKGROUND:#" + wColor10 + "'>" + (wDate10.getMonth() + 1) + "月</TD>");
  document.write("<TD STYLE='BACKGROUND:#" + wColor10 + "'>" + (wDate10.getMonth() + 1) + "月" + wDate10.getDate() + "日</TD>");
  document.write("</TR>");
  document.write("<TR>");
  document.write("<TD STYLE='BACKGROUND:#" + wColor11 + "'>" + (wDate11.getMonth() + 1) + "月</TD>");
  document.write("<TD STYLE='BACKGROUND:#" + wColor11 + "'>" + (wDate11.getMonth() + 1) + "月" + wDate11.getDate() + "日</TD>");
  document.write("</TR>");
  document.write("<TR>");
  document.write("<TD STYLE='BACKGROUND:#" + wColor12 + "'>" + (wDate12.getMonth() + 1) + "月</TD>");
  document.write("<TD STYLE='BACKGROUND:#" + wColor12 + "'>" + (wDate12.getMonth() + 1) + "月" + wDate12.getDate() + "日</TD>");
  document.write("</TR>");
  document.write("</TABLE>");
  document.write("<BR>");

  document.write("<TABLE BORDER='0' CELLSPACING='1' CELLPADDING='10' STYLE='BACKGROUND:#000099;WIDTH:170px'>");
  document.write("<TR>");
  document.write("<TD STYLE='FONT-WEIGHT:BOLD;TEXT-ALIGN:CENTER;BACKGROUND:#FFFFFF'>");
  document.write("次回開催日は<BR>");
  document.write((nCompe.getMonth() + 1) + "月" + nCompe.getDate() + "日です。");
  document.write("</TD>");
  document.write("</TR>");
  document.write("</TABLE>");
  document.write("<BR>");

}

// メール予約入力チェック //
function checkData(){

	// 変数宣言 //
	var errFLG    = "OK"
	var chk_name  = document.forms['form_reserve'].elements[1].value;
	var chk_phone = document.forms['form_reserve'].elements[4].value;

	if(document.layers){
		alert("申し訳ありませんが、Netscape Navigator では正常動作いたしません。");
		errFLG = "NG";
	}
	if(!document.all && document.getElementById){
		alert("申し訳ありませんが、Netscape Navigator では正常動作いたしません。");
		errFLG = "NG";
	}

	if(errFLG == "OK"){
		if(chk_name == ""){
			alert("名前を入力してください。");
			errFLG = "NG";
			document.forms['form_reserve'].elements[1].focus();
		}
	}
	if(errFLG == "OK"){
		if(chk_phone == ""){
			alert("電話番号を入力してください。");
			errFLG = "NG";
			document.forms['form_reserve'].elements[2].focus();
		}
	}
	if(errFLG == "OK"){
		document.form_reserve.submit();
		document.form_reserve.reset();
		setTimeout("window.open('page_finish.htm','ご予約有難う御座いました','width=400,height=400,toolbar=no,location=no,directries=no,status=yes,menubar=no,scrollbar=no,resizable=no')",1500);
	}
}

