$(document).ready(function(){

	$("#navi a img").hover(
		function(){
			this.src = this.src.replace('off','on');
		},
		function(){
			this.src = this.src.replace('on','off');
		}
	);
	$("#navi a img").click(
		function(){
			this.src = this.src.replace('on','off');
		}
	);


	$("#hosp-navi a").click(
		function(){
			$("#hosp-navi a"). each(function(){
				$( "#" + $(this).attr("id").replace("n","b") ).fadeOut("slow");
			});
			$( "#" + $(this).attr("id").replace("n","b") ).fadeIn("slow");
		}
	);


	$("#navi-top a img").hover(
		function(){
/*			$("#navi-top a img"). each(function(){
				this.src = this.src.replace('on','off');
			});
*/
			this.src = this.src.replace('off','on');
			if( $(this).attr("id") != "init" ) $("#init").attr("src", $("#init").attr("src").replace('on','off') );
		},
		function(){
			this.src = this.src.replace('on','off');
			$("#init").attr("src", $("#init").attr("src").replace('off','on') );
		}
	);

	$("#faci-navi a").click(
		function(){
			$("#faci-navi a"). each(function(){
				$( "#" + $(this).attr("id").replace("n","b") ).fadeOut("slow");
			});
			$( "#" + $(this).attr("id").replace("n","b") ).fadeIn("slow");
		}
	);


	$("#facility #next").click(
		function(){
			
			pos = new Array();
			$("#faci-navi a"). each(function(){
				pos.push( new Array( $(this).attr('id'), $( "#" + $(this).attr("id").replace("n","b") ).css('display') ) );
			});
		
			for( i=0; i<pos.length; i++ ) {
				if( pos[i][1] == 'block' ) {
					$( "#" + pos[i][0].replace("n","b") ).fadeOut("slow");
					pos[i][1] = 'none';
					n = i+1;
					if( n >= pos.length ) n=0;
					$( "#" + pos[n][0].replace("n","b") ).fadeIn("slow");
					pos[n][1] = 'block';
					return;
				}
			}
		}
	);

	$("#epi-navi").change(
		function() {
			document.location = this.options[this.selectedIndex].value;
		}
	);


	$("#information .photo :first-child").each(function(){
		$(this).css('display','block');
	});
	$("#information .photo img").each(function(){
		$(this).attr('title','次へ');
	});
	$("#information .photo div").click(
		function(){
			$(this).fadeOut('slow');
			$(this).parent().find(':first').fadeIn('slow');
		}
	);
	$("#information .photo img").click(
		function(){
			$(this).fadeOut('slow');
			$(this).next().fadeIn('slow');
		}
	);


	$(".BT-HOVER").hover(
		function(){
			this.src = this.src.replace('off','on');
		},
		function(){
			this.src = this.src.replace('on','off');
		}
	);
	$(".BT-HOVER").click(
		function(){
			this.src = this.src.replace('on','off');
		}
	);
	$(".BT-NEW").click(
		function(){
			window.open(this.href); return false;
		}
	);
	$(".BT-BACK").click(
		function(){
			history.back(); return false;
		}
	);
	$(".BT-TOP").click(
		function(){
			$("html,body").animate({ scrollTop: 0 }, 500); return false;
		}
	);

});

jQuery.preloadImages = function()
{
	for(var i = 0; i<arguments.length; i++)
	{
		jQuery("<img>").attr("src", arguments[i]);
	}
};
 

