var GB_ANIMATION = true;

$(document).ready(function(){

  //Scrolling
  //this one is important, many browsers don't reset scroll on refreshes
  $.scrollTo( 0 );//reset the screen to (0,0)
  $("a.scroll-down").click(function(){
  	var hotelId = $(this).parent().get(0).id.split("-")[1];
  	$('#yad_no0-' + hotelId).attr("checked","checked");
  	var gb_txt = '';
  	var gb_cnt = 'hotel-' + hotelId + '.html';
		setTimeout(function() {
			hideIbox();
      $.scrollTo( $('#reserveTitle'), 500);
      }, 2000);
    return false;
	});
  $("a.scroll-up").click(function(){
    $.scrollTo( $('#top'), 500);
    return false;
	});

  var today = new Date();

  // Defaultの出発日と到着日を設定
  var defDepDate = new Date(today.getFullYear(), today.getMonth(), today.getDate() + 10); // 訪問日の10日後
  var defArrDate = new Date(today.getFullYear(), today.getMonth(), today.getDate() + 12); // 訪問日の12日後
  document.jaltp.dep_boardMonth.options.selectedIndex = defDepDate.getMonth();
  document.jaltp.dep_boardDay.options.selectedIndex   = defDepDate.getDate() - 1;
  document.jaltp.arr_boardMonth.value = defArrDate.getMonth() + 1;
  document.jaltp.arr_boardDay.value   = defArrDate.getDate();

  // 出発日と宿泊onchange用機能
  function setArrDates() {
    var days    = Number(document.jaltp.period.options[document.jaltp.period.options.selectedIndex].value) + 1;
    var depMon  = Number(document.jaltp.dep_boardMonth.options[document.jaltp.dep_boardMonth.options.selectedIndex].value);
    var depDay  = Number(document.jaltp.dep_boardDay.options[document.jaltp.dep_boardDay.options.selectedIndex].value);
    var depDate = new Date(today.getFullYear(), depMon - 1, depDay + days);
    document.jaltp.arr_boardMonth.value = depDate.getMonth() + 1;
    document.jaltp.arr_boardDay.value   = depDate.getDate();
  }
  document.jaltp.period.onchange         = setArrDates;
  document.jaltp.dep_boardMonth.onchange = setArrDates;
  document.jaltp.dep_boardDay.onchange   = setArrDates;

  // 出発空港と到着空港onchange用
  function setAirports() {
  	document.jaltp.arr_arrivalAirport.value = document.jaltp.dep_boardAirport.options[document.jaltp.dep_boardAirport.options.selectedIndex].value;
  	document.jaltp.arr_boardAirport.value   = document.jaltp.dep_arrivalAirport.options[document.jaltp.dep_arrivalAirport.options.selectedIndex].value;
  }
  document.jaltp.dep_boardAirport.onchange   = setAirports;
  document.jaltp.dep_arrivalAirport.onchange = setAirports;
});