// JavaScript Document


// global navigation
$(document).ready(function() {
	
	function megaHoverOver(){
		$(this).find(".sub-nav").stop().fadeTo('fast', 1).show();
	}
	
	function megaHoverOut(){ 
	  $(this).find(".sub-nav").stop().fadeTo('fast', 0, function() {
		  $(this).hide(); 
	  });
	}

	var config = {    
		 sensitivity: 2,
		 interval: 60,
		 over: megaHoverOver,
		 timeout: 200,
		 out: megaHoverOut
	};

	$("#globalnav ul li .sub-nav").css({'opacity':'0'});
	//$("#globalnav ul li .sub-nav a").css({'opacity':'100'});
	$("#globalnav ul li").hoverIntent(config);

});


// Roll over images   class="hover"
var preLoadImg = new Object();
 
function initRollOvers(){
    $("a img.hover").each(function(){
        var imgSrc = this.src;
        var sep = imgSrc.lastIndexOf('.');
        var onSrc = imgSrc.substr(0, sep) + '_on' + imgSrc.substr(sep, 4);
        preLoadImg[imgSrc] = new Image();
        preLoadImg[imgSrc].src = onSrc;
        $(this).hover(
            function() { this.src = onSrc; },
            function() { this.src = imgSrc; }
        );
    });
}
$(function(){
    initRollOvers();
});

// Roll over images alpha  class="hover-a"
$(document).ready(function(){
$("img.hover-a").fadeTo(0,1.0);
$("img.hover-a").hover(function(){
        $(this).fadeTo(500,0.6);
    },
    function(){
        $(this).fadeTo(500,1.0);
    });
});

// jquery.appleEffect
/*
$(document).ready(function() {
	$('#content').appleEffect({
		color: '#fff',
		zIndex: 9999,
		timeout: 100,
		speed: 1000
	});
});*/


// jquery.biggerlink  class="b-link"
$(document).ready(function(){
	// Supporting target _blank
	$('a[target="_blank"]').click(function(){
		window.open(this.href);
		return false;
	});
	// Adding biggerlink
		$('.b-link').biggerlink();
		$('.b-link2').biggerlink();
});


// table  偶数行にのみクラスを指定
$(document).ready(function(){
	$(".tb01 tr:even").addClass("bg-f4f");
	$(".tb_zeb tr:even").addClass("bg-f4f");
});


// Page Scroller
callExternal = "pSc";
delayExternal= 200



// タブ index
$tablist = function( target )
{
//Default Action
target.find(".tab_content").hide(); //Hide all content
target.find("ul.tabs li:first").addClass("active").show(); //Activate first tab
target.find(".tab_content:first").show(); //Show first tab content

//On Click Event
target.find("ul.tabs li").click(function()
{
target.find("ul.tabs li").removeClass("active"); //Remove any "active" class
$(this).addClass("active"); //Add "active" class to selected tab
target.find(".tab_content").hide(); //Hide all tab content

var activeTab = $(this).find("a").attr("href"); //Find the rel attribute value to identify the active tab + content

activeTab = activeTab.replace( '#', '.' );

target.find(activeTab).fadeIn(); //Fade in the active content

return false;
});
}

$(function()
{
$tablist( $('#box1') );
$tablist( $('#box2') );
$tablist( $('#box3') );
$tablist( $('#box_k_shikaku') );
$tablist( $('#box_news') );
});


