// ============================================================
// オーバーレイヤーの表示
// 
// %update / 09.10.28
// 
// %use / jquery1.2.6
// ============================================================

// ------------------------------------------------------------
// ▼
// ------------------------------------------------------------
var ChCloseupUnitFlg = 0;
var ChCloseupModalFlg = 0;
var ChCloseupTimer = null;
var ChCloseupInterval = 1;

var IndOverLayFlg = 0;
var IndOverTimer = null;
var IndOverInterval = 0.2;

// ------------------------------------------------------------
// ▼
// ------------------------------------------------------------
// prototype.js と jquery の共存
if(! $jQ) { var $jQ = jQuery.noConflict(); }

$jQ(document).ready( function() {
	// ------------------
	// 【リゾートTOP　オーバーレイヤーの表示】
	// ------------------
	$jQ('.indMenuLabelUnit a').hover(	
    function() {
      clearTimeout(IndOverTimer);
      var myId = $jQ(this).parent().parent().get(0).id;
      IndOverTimer = setTimeout("showIndOverlay('" + myId + "')", IndOverInterval * 1000);
      return false;
  	},
    function() {
      clearTimeout(IndOverTimer);
      return false;
  	}
  );  // mouseover()
	$jQ('.indOverlayUnit').hover(	
    function() { IndOverLayFlg = 1; }, // mouseover()
    function() { IndOverLayFlg = 0; } // mouseout()
  );  // hover()
  $jQ(document).click( function() {
    if (IndOverLayFlg){ return; }
		$jQ('#IndOverlay01').addClass('hide');
		$jQ('#IndOverlay02').addClass('hide');
    $jQ('#IndlbOversea a').removeClass('current');
    $jQ('#IndlbDomestic a').removeClass('current');
    //return false;
  } );  // click()
  $jQ(".IndOverlayClose a").click(	function() {
		$jQ('#IndOverlay01').addClass('hide');
		$jQ('#IndOverlay02').addClass('hide');
    $jQ('#IndlbOversea a').removeClass('current');
    $jQ('#IndlbDomestic a').removeClass('current');
    return false;
  } );  // click()
  
  
  

	// ------------------
	// 【チャペル＞クローズアップ　オーバーレイヤーの表示】
	// ------------------
	$jQ('#ChCloseupPicArea .trigger').mouseover( function() {  // mouseover
    //全て非表示
    clearTimeout(ChCloseupTimer);
		$jQ('#ChCloseupPicArea .chCloseupPartUnit').addClass('hide');
    
    //カレント
    var myId = $jQ(this).get(0).id.replace(/Trigger$/, "");
    $jQ('#' + myId).removeClass('hide');
    return false;
	} );  // mouseover()
  
	$jQ('#ChCloseupPicArea .chCloseupPartUnit').hover( 
    function(){  // mouseover
      //フラグ更新
      ChCloseupUnitFlg = 1;
	  },
    function(){  // mouseout
      //フラグ判定
      if (!ChCloseupUnitFlg){ return; }
      
      //遅延処理
      clearTimeout(ChCloseupTimer);
      ChCloseupTimer = setTimeout("hideCloseupUnit()", ChCloseupInterval * 1000);
      return false;
	  }
  );  // hover()
  
	// ------------------
	// 【チャペル＞クローズアップ　写真レイヤーの表示】
	// ------------------
	$jQ('#ChCloseupPicArea .ChCloseupPartBtnZoom a').click( function() {
    var myId = $jQ(this).parent().get(0).id.replace(/Part(.+?)BtnZoom$/, 'Zoom$1');
		$jQ('#' + myId).removeClass('hide');
    
    $jQ('#ChCloseupModal').height($jQ(document).height());
    $jQ('#ChCloseupModal').width($jQ(window).width());
    $jQ('#ChCloseupModal').removeClass('hide');
		return false;
	} );  // click()
  
  $jQ('#ChCloseupModal .chCloseupZoomUnit').hover( 
    function() {
      ChCloseupModalFlg = 1;
    }, // mouseover();
    function() {
      ChCloseupModalFlg = 0;
    } // mouseout();
   ); // hover();
	$jQ('#ChCloseupModal .ChCloseupPartBtnClose a').click( function() {
    $jQ('#ChCloseupPicArea .chCloseupZoomUnit').addClass('hide');
    $jQ('#ChCloseupModal').addClass('hide');
		return false;
	} );  // click()
	$jQ('#ChCloseupModal').click( function() {
    if (ChCloseupModalFlg){ return; }
    $jQ('#ChCloseupPicArea .chCloseupZoomUnit').addClass('hide');
    $jQ('#ChCloseupModal').addClass('hide');
		return false;
	} );  // click()

	// ------------------
	// モーダルウィンドウリサイズ
	// ------------------
  $jQ(window).resize( function(){
    $jQ('#ChCloseupModal').height($jQ(document).height());
    $jQ('#ChCloseupModal').width($jQ(window).width());
    return false;
  });

} );  // ready()

// ------------------------------------------------------------
// ▼トップページ　遅延対応
// ------------------------------------------------------------
function showIndOverlay(vstrLocation){
  
  if (vstrLocation == "IndlbOversea"){
		$jQ('#IndOverlay01').removeClass('hide');
		$jQ('#IndOverlay02').addClass('hide');
    $jQ('#IndlbOversea a').addClass('current');
    $jQ('#IndlbDomestic a').removeClass('current');
	}else{
		$jQ('#IndOverlay01').addClass('hide');
		$jQ('#IndOverlay02').removeClass('hide');
    $jQ('#IndlbOversea a').removeClass('current');
    $jQ('#IndlbDomestic a').addClass('current');
  }
  
  clearTimeout(IndOverTimer);

  return false;
}

// ------------------------------------------------------------
// ▼クローズアップ　遅延対応
// ------------------------------------------------------------
function hideCloseupUnit(){
  //全て非表示
	$jQ('#ChCloseupPicArea .chCloseupPartUnit').addClass('hide');

  //フラグ更新
  ChCloseupUnitFlg = 0;

  return false;
}