$(document).ready(function(){

//画像ONOFF

$("a img").hover(function(){
$(this).attr("src", $(this).attr("src").replace("_off", "_on"));
}, function(){
if (!$(this).hasClass("currentPage")) {
$(this).attr("src", $(this).attr("src").replace("_on", "_off"));
}
});


//ページ遷移時フェードイン

//$(function(){
//$("#topMainArea, #bodyTxt_inner, #mainArea h2 img").css({display:"none"});
//読み込み時にフェードイン
//$("#topMainArea, #bodyTxt_inner, #mainArea h2 img").fadeIn(600);

//aタグクリック時にフェードアウト実行
//$("#gnavi a").click(function(){
//var url = $(this).attr("href");
//$("#bodyTxt_inner").animate({"opacity":0},300,function(){
//location.href = url;
//});
//return false;
//});
//});


//ブロック要素ごとクリック

$(".blockLink").click(function(){
if(!$(this).find("a").attr("rel")) {
	window.location.href = $(this).find("a").attr('href');
	return false;
}
});


$(".blockLink").hover(function(){
	if(window.navigator.userAgent.toLowerCase().indexOf('msie') != -1) {
		$(this).contents().css({"opacity":"0.5"});
	} else {
		$(this).contents().css({"filter":"alpha(style=0; opacity=50)","opacity":"0.5","-moz-opacity":"0.5"});
	}
},
function(){
	if(window.navigator.userAgent.toLowerCase().indexOf('msie') != -1) {
		$(this).contents().css({"opacity":"1"});
	} else {
		$(this).contents().css({"filter":"alpha(style=0; opacity=100)","opacity":"1","-moz-opacity":"1"});
	}
});

$(".blockLink").css("cursor","pointer");



//スムーススクロール

$(function(){
// #で始まるアンカーをクリックした場合に処理
$("a[href^=#]").click(function() {
  // スクロールの速度
  var speed = 400;// ミリ秒
  // アンカーの値取得
  var href= $(this).attr("href");
  // 移動先を取得
  var target = $(href == "#" || href == "" ? 'html' : href);
  // 移動先を数値で取得
  var position = target.offset().top;
  // スムーススクロール
  $($.browser.safari ? 'body' : 'html').animate({scrollTop:position}, speed, 'swing');
  return false;
});
});


//開閉式メニュー


//$(".worksBox").each(function(){
//$(".slideBox").hide();
//$(".slideLink").click(function(){
// if(!$(this).hasClass("selected")){
// $(".slideLink.selected").removeClass("selected").next().slideToggle("slow");
// $(this).addClass("selected").next().slideToggle("slow");
//    }
//  });
// });



$(".slideBox").css("display","none");

$(".slideLink").click(function(){
 $(this).next().slideToggle("slow");
});

$(".slideLink").css("cursor","pointer");


$(".slideLink").hover(function(){
$(this).contents().css({"filter":"alpha(style=0; opacity=50)","opacity":"0.5","-moz-opacity":"0.5"});},
function(){$(this).contents().css({"filter":"alpha(style=0; opacity=100)","opacity":"1","-moz-opacity":"1"});
});


//しましまテーブル

$(function(){
$("#business tbody:odd").addClass("odd");
});


// コンテンツクリエイション事業ページの処理
var spls = location.href.split('#');
var spll = spls[0].split('/');
if((spll[spll.length-1]=='creation.html' || spll[spll.length-1]=='provider.html') && spls.length > 1) {
	var divs = $("section.worksBox#" + spls[1] + "_b>div");
	if(divs.length >= 2) {
		$(divs[1]).slideToggle(0, function(){
			// スクロールの速度
			var speed = 400;// ミリ秒
			var position = $(this).parent().offset().top;
			// スムーススクロール
			$($.browser.safari ? 'body' : 'html').animate({scrollTop:position}, speed, 'swing');
		});
	}
}

});
