$(document).ready(function(){
	
	// bodyのclass名で判別してグローバルナビの画像をカレント表示に
	var bodyClass = $("body").attr("class");
	if(0 < $(".nav_bottom img[src*="+bodyClass+"_off]").length){
	$(".nav_bottom img[src*="+bodyClass+"_off]").addClass("current").attr("src",$(".nav_bottom img[src*="+bodyClass+"_off]").attr("src").replace("_off.", "_on."));
	}
	
	 // ロールオーバー
	$(".ro").hover(
	/*マウスオーバー時　1.5秒かけて30％に*/
		function(){$(this).fadeTo(100, 0.5);return false;},
	/*マウスアウト時　100％に*/
		function(){$(this).fadeTo(50, 1);return false;}
	  );
	 
	$("img[src*='_on']").addClass("current");

	$("img,input").mouseover(function(){
		if ($(this).attr("src")){
			$(this).attr("src",$(this).attr("src").replace("_off.", "_on."));
		}
	});

	$("img[class!='current'],input").mouseout(function(){
			if ($(this).attr("src")){
				$(this).attr("src",$(this).attr("src").replace("_on.", "_off."));
			}
	});
	
	 // なめらかスクロール
	(function($) {
	  $.__smoothScroll = function(name, duration, delay) {
		if (!name) return false;
		if (!delay) delay = 0;
		var target = $('a[name="'+name+'"], [id="'+name+'"]');
		if (target.length == 0) return false;
		
		setTimeout(function (obj, t) {return function () { 
		  $($.browser.safari ? 'body' : 'html').animate({scrollTop: obj.offset().top}, t, 'swing');
		} }(target, duration), delay);
		return true;
	  }
		
	  $.fn.Smoothie = function(settings) {
		settings = jQuery.extend({duration: 1000, delay: 0}, settings);
		var anchorLink = this;
		anchorLink.click(function() {
		  var anchor;
		  if (this.hash.match(RegExp("^#(.+)$"))) anchor = RegExp.$1;
		  var ret = $.__smoothScroll(anchor, settings.duration);
		  return ret ? false : true;
		});
	  };

	  $.Smoothie = function(settings) {
		settings = jQuery.extend({duration: 1000, delay: 0}, settings);
		
		var anchor = location.hash;
		if (anchor) {
			anchor = anchor.replace(/^#/, "");
			anchor = $.browser.fx ? anchor : decodeURIComponent(anchor);
		} else {
		  anchor = null;
		}

		$.__smoothScroll(anchor, settings.duration, settings.delay);

		$('a[href^=#]'+'a[rel!=tab]').Smoothie(settings);
		return true;
	  };
	})(jQuery);
	
		$(document).ready(function(){
		  $.Smoothie();
	});
		
	 // 新規ウィンドウ	
	$("a.external").click(function(){
		window.open(this.href,"_blank");
		return false;
	});
		

});
