$(document).ready(function() {

	/* menu slider */
	$("#museum, #gallery, #hall, #cafe").hover(function () {
		$( '#' + $(this).attr('id') + '_up' ).queue([]).fadeTo("slow", 0);
	}, function() {
		$( '#' + $(this).attr('id') + '_up' ).queue([]).fadeTo("slow", 1.0);
    });
  	
  	/* modal window for artist page */
 
	$('.modal').click(function() {
		
		$('html').css({overflow:'hidden'});
		
		if(document.getElementById("MDL_overlay") === null) {
			
			$('body').append('<div id="MDL_overlay"></div>');
			if($.browser.msie && $.browser.version < 7) {
				
				$('body','html').css({height: '100%', width: '100%'});
				$('#MDL_overlay').css('position','absolute');
				$('#MDL_overlay').css('top',$(document).scrollTop());
			
			}
	
		}
		
		if(document.getElementById("MDL_window") === null) {
			
			$('body').append(
				'<div id="MDL_window">' +
					'<h2>モーダルウィンドウBOX</h2>' +
					'<p>簡易的な説明テキストなど表示する場合などに。</p>' +
					'<p>BOX外をクリック、もしくは「閉じる」ボタンをクリックで枠を閉じる。</p>' +
					'<div class="md_btn">' +
						'<a href="javascript:void(0);" id="md_close">閉じる</a>' +
					'</div>' +
				'</div>'
			);
			
			if($.browser.msie && $.browser.version < 7) {
				
				$('#MDL_window').css('position','absolute');
				$('#MDL_window').css('top',($(document).scrollTop() + $(window).height()/2) + "px");
		
			}
		}
		
		$('#MDL_overlay').show();
		$('#MDL_window').fadeIn('slow');
		$('#MDL_overlay,#md_close').click(function () {
			MDL_eliminate();
		});

		return false;
	
	});

	function MDL_eliminate() {

		$('html').css({overflow:''});
		$('#MDL_overlay').fadeOut('fast');
		$('#MDL_window').fadeOut('fast');
		if($.browser.msie && $.browser.version < 7) {
			$("body","html").css({height: "auto", width: "auto"});
		};

		setTimeout(function() {
		
			$('#MDL_overlay').remove();
			$('#MDL_window').remove();
		
		}, 500);

	}


  	
});


