<!--
$(function(){

	//親カレント追加
	var childurlC = "clinic_";
	var childurlT = "treat_";
	var childurlU = "useful_";
	
	if(0 <= location.href.search(childurlC)){
	$("#Clinic").addClass("current");
	}

	if(0 <= location.href.search(childurlT)){
	$("#Treat").addClass("current");
	}
	
	if(0 <= location.href.search(childurlU)){
	$("#Useful").addClass("current");
	}
	
	//ローカルナビ用 親カレント追加
	var childurlTI = "treat_imp_";
	var childurlTH = "treat_head_";
	var childurlUC = "treat_cloumn";
	
	if(0 <= location.href.search(childurlTI)){
	$("#TreatImp").addClass("current");
	}

	if(0 <= location.href.search(childurlTH)){
	$("#TreatHead").addClass("current");
	}
	

	//ナビのHover
	$("#nav").children("li").each(function()
	{
		var _current =($(this).children("a").attr("class"));
		var cur = _current.match("current");
		
		if(cur == "current"){
			$(this).children("a").css("opacity","1");
		}
		else{
				$(this).children("a").css("opacity","0");
				$(this).children("a").hover(
				function () {
					$(this).stop().animate({opacity: 1},500);},
				function () {
					$(this).stop().animate({opacity: 0},500);}
			);
		}
	});
	
	//サブナビのHover
	$("#subnav").children("li").each(function()
	{
		var _subcurrent =($(this).children("a").attr("class"));
		var subcur = _subcurrent.match("current");
		
		if(subcur == "current"){
			$(this).children("a").css("opacity","1");
		}
		else{
				$(this).children("a").css("opacity","0");
				$(this).children("a").hover(
				function () {
					$(this).stop().animate({opacity: 1},500);},
				function () {
					$(this).stop().animate({opacity: 0},500);}
			);
		}
	});
	
	
	//ローカルナビ用
	var img_ca = new Object();
	
	$("#LocalNavigation").children("ul").children("li").children("a").children("img").each(function(i) {
		
		var crch = ($(this).parents("a").attr("class"));
		var crchcur = crch.match("current");
		var crchpar = crch.match("parentsLink");
		
		var navimgsrc = this.src;
		var navdot = this.src.lastIndexOf('.');
		var navimgsrc_on = this.src.substr(0, navdot) + '_on' + this.src.substr(navdot, 4);
		
		img_ca[this.src] = new Image();
		img_ca[this.src].src = navimgsrc_on;
		
		var crcheck = this.src.match("_cr");
		if( crcheck != "_cr" ){
			var navimgsrc_cr = this.src.substr(0, navdot) + '_cr' + this.src.substr(navdot, 4);
		}
		else{var navimgsrc_cr = this.src;}

		if(crchcur != "current" && crchpar != "parentsLink"){
			$(this).hover(
			  function() { this.src = navimgsrc_on; },
			  function() { this.src = navimgsrc; });
			}
		else{this.src = navimgsrc_cr;}
		});
	
	
	//インプラントナビ用
	var img_impca = new Object();
	
	$("#ImplantLNavi").children("li").children("a").children("img").each(function(i) {
		
		var impcrch = ($(this).parents("a").attr("class"));
		var impcrchcur = impcrch.match("current");
		var impcrchpar = impcrch.match("parentsLink");
		
		var impnavimgsrc = this.src;
		var impnavdot = this.src.lastIndexOf('.');
		var impnavimgsrc_on = this.src.substr(0, impnavdot) + '_on' + this.src.substr(impnavdot, 4);
		img_impca[this.src] = new Image();
		img_impca[this.src].src = impnavimgsrc_on;
		
		if(impcrchcur != "current" && impcrchpar != "parentsLink"){
			$(this).hover(
			  function() { this.src = impnavimgsrc_on; },
			  function() { this.src = impnavimgsrc; });
			}
		});


	//頭痛ナビ用
	var img_headca = new Object();
	
	$("#HeadLNavi").children("li").children("a").children("img").each(function(i) {
		
		var headcrch = ($(this).parents("a").attr("class"));
		var headcrchcur = headcrch.match("current");
		var headcrchpar = headcrch.match("parentsLink");
		
		var headnavimgsrc = this.src;
		var headnavdot = this.src.lastIndexOf('.');
		var headnavimgsrc_on = this.src.substr(0, headnavdot) + '_on' + this.src.substr(headnavdot, 4);
		img_headca[this.src] = new Image();
		img_headca[this.src].src = headnavimgsrc_on;
		
		if(headcrchcur != "current" && headcrchpar != "parentsLink"){
			$(this).hover(
			  function() { this.src = headnavimgsrc_on; },
			  function() { this.src = headnavimgsrc; });
			}
		});

	//用語集ナビ用
	var img_wordca = new Object();
	
	$("#YougoMenu").children("li").children("a").children("img").each(function(i) {
		
		var wordcrch = ($(this).parents("a").attr("class"));
		var wordcrchcur = wordcrch.match("current");
		var wordcrchpar = wordcrch.match("parentsLink");
		
		var wordnavimgsrc = this.src;
		var wordnavdot = this.src.lastIndexOf('.');
		var wordnavimgsrc_on = this.src.substr(0, wordnavdot) + '_on' + this.src.substr(wordnavdot, 4);
		img_wordca[this.src] = new Image();
		img_wordca[this.src].src = wordnavimgsrc_on;
		
		if(wordcrchcur != "current" && wordcrchpar != "parentsLink"){
			$(this).hover(
			  function() { this.src = wordnavimgsrc_on; },
			  function() { this.src = wordnavimgsrc; });
			}
		});


	//イメージロールオーバー
	var image_cache = new Object();
	$("img.linkImg").each(function(i) {
	var imgsrc = this.src;
	var dot = this.src.lastIndexOf('.');
	var imgsrc_on = this.src.substr(0, dot) + '_on' + this.src.substr(dot, 4);
	image_cache[this.src] = new Image();
	image_cache[this.src].src = imgsrc_on;
	$(this).css("opacity","1");
	$(this).hover(
	  function() { this.src = imgsrc_on; $(this).stop().animate({opacity: 0.8},300); },
	  function() { this.src = imgsrc; $(this).stop().animate({opacity: 1},300); });
	});
  	
	//角丸ボックス用
	$(".kadomarubox").before("<div class='kadomaruTop'></div>");
	$(".kadomarubox").after("<div class='kadomaruBtm'></div>");
	
	//TOPページ求人ボックス用
	$("#TopRecruit").after("<img src='img/top/recruit_btm.gif' />");
			
	//設備紹介追加用
	$("#EquipGallery h4").before("<span><img src='img/clinic/roupe.gif' /></span>");

	//患者さんの声ボックス用
	$(".VoiceBox").before("<div class='VoiceBoxTop'></div>");
	$(".VoiceBox").after("<div class='VoiceBoxBtm'></div>");

	//用語集ボックス用
	$(".wordbox h4").before("<span class='WordPin'></span>");
	
	//コラムボックス用
	$(".columbox").before("<div class='columboxTop'></div>");
	$(".columbox").after("<div class='columboxBtm'></div>");
	
});


//別ウィンドウ用
function externalLinks() {
	if (!document.getElementsByTagName) return;
	var anchors = document.getElementsByTagName("a");
	for (var i=0; i<anchors.length; i++) {
	var anchor = anchors[i];
	if (anchor.getAttribute("href") &&
	anchor.getAttribute("rel") == "external")
	anchor.target = "_blank";
	}
}
window.onload=externalLinks;
// -->
