
//jQuery--smooth scroll
$(function() {
$('a').click(function() {
var jumpTo = $(this).attr('href');
if(jumpTo == '#header') {
$(document.body).ScrollTo(1000, 'easein'); return false;
}
else if(jumpTo.charAt(0) == '#') {
$(jumpTo).ScrollTo(1000, 'easein'); return false;
}
});
});


//jQuery--lightbox
$(function() {
$('a[@rel*=lightbox]').lightBox(); //a[@rel*=lightbox]、a.lightboxなど
});


//stripe table
$(document).ready(function(){
	$(".stripe tr").mouseover(function(){
		$(this).addClass("over");
	}).mouseout(function(){
		$(this).removeClass("over");
	});
$(".stripe tr:even").addClass("even");
});



//rollover fade
$(function(){
$(".fade").load(function(){
	$(this).fadeTo(300, 1.0);
});
$(".fade").hover(
function(){
	$(this).fadeTo(300, 0.5);
},
function(){
	$(this).fadeTo(300, 1.0);
}
);
});


//jQuery RollOvers
$(document).ready(function(){
  function rollover_img(selector, suffix){
    $(selector).each(function(i){
      var default_img = $(this).attr("src"); //画像要素の初期src属性値
      if (!default_img.match((suffix))) { //src属性値に接尾語がついていた場合は動作させない
        var point = default_img.lastIndexOf(".") //src属性値の拡張子の.（ドット）の位置
        var mouseover_img = default_img.slice(0, point) + suffix + default_img.slice(point); //接尾語を加えてマウスオーバー用のsrc属性値文字列を作成
        var preload_img = new Image();
        preload_img.src = mouseover_img;  //マウスオーバー用画像を読み込み
        $(this).hover(
          function(){
            $(this).attr("src", mouseover_img);
          },
          function(){
            $(this).attr("src", default_img);
          }
        )
      }
    })
  }

  rollover_img("img[@ref=over]", "_over");  //画像のセレクタと接尾語を引数にして関数を呼び出す
});
