/************************************************
  
    SiteName: 株式会社セラバリューズ
	Author  : shift-click
	Update  : 09.10.31

************************************************/


/*
---------------------------------------------------
NOTE:
- jQuery必須
USAGE:
- swapしたいimg要素にクラス名"swap"をつける
- ロールオーバ画像のファイル名の末尾に"_on"をつける
---------------------------------------------------
*/
//Plug-in
jQuery.fn.swap = function(settings){
	settings = jQuery.extend({postfix:"_on"},settings);
	return this.each(function(){
		var img_off = $(this).attr("src");
		if (!img_off.match((settings.postfix))) {
			var pnt = img_off.lastIndexOf(".");
			var img_on = img_off.slice(0, pnt) + settings.postfix + img_off.slice(pnt);
			var img_preload = new Image();
			img_preload.src = img_on;
			$(this).hover(function(){$(this).attr("src", img_on)},function(){ $(this).attr("src", img_off)});
		};
	});
};

//Execution
$(function(){
	$('img.swap').swap();
});

//globalnavi dropdownmenu
$(document).ready(function(){
	$("#globalNavi li").hoverClass ("sfHover");
	$("#nav ul li").hoverClass ("sfHover");
	$("#nav ul li li").hoverClass ("sfHover");
});

$.fn.hoverClass = function(c) {
	return this.each(function(){
		$(this).hover(
			function() { $(this).addClass(c);},
			function() { $(this).removeClass(c);}
		);
	});
};


/*
---------------------------------------------------
NOTE:
- jQuery必須
USAGE:
- footer部分などのリンク横区切りの縦線をIE6でも対応させる
---------------------------------------------------
*/
$(document).ready(function() {   
    $('#headlink li:first-child').addClass('firstChild');
    $('#globalNavi li ul li:first-child').addClass('firstChild');
	$('#topicPath li:first-child').addClass('firstChild');
    $('#footer ul li:first-child').addClass('firstChild');
});


/*
---------------------------------------------------
NOTE:
- jQuery必須
USAGE:
- classにblankと指定すると別ウインドウで開く
---------------------------------------------------
*/
$(function(){
    $('.blank').click(function(){
        window.open(this.href, '_blank');
        return false;
    });
});



