jQuery(document).ready(function($) {
      $('a[rel*=facebox]').facebox({
        loading_image : 'loading.gif',
        close_image   : 'closelabel.gif'
      }) 
    })

$(document).ready(function(){
//マウスオーバー時
function megaHoverOver(){
   	 $(this).find(".sub").stop().fadeTo('slow', 1).show(); 
    (function($) {
        jQuery.fn.calcSubWidth = function() {
            rowWidth = 0;
            $(this).find("ul").each(function() { 
                rowWidth  = $(this).width(); 
            });
        };
    })(jQuery); 

    if ( $(this).find(".row").length > 0 ) {

        var biggestRow = 0;	

        $(this).find(".row").each(function() {
            $(this).calcSubWidth();
            //Find biggest row
            if(rowWidth > biggestRow) {
                biggestRow = rowWidth;
            }
        });

        $(this).find(".sub").css({'width' :biggestRow});
        $(this).find(".row:last").css({'margin':'0'});

    } else { 

        $(this).calcSubWidth(); 
        $(this).find(".sub").css({'width' : rowWidth});

    }
}
//On Hover Out
function megaHoverOut(){
  $(this).find(".sub").stop().fadeTo('fast', 0, function() {
      $(this).hide();  //after fading, hide it
  });
}

var config = {
     sensitivity: 1,
     interval: 100,
     over: megaHoverOver,
     timeout: 100, 
     out: megaHoverOut 
};

$("ul#topnav li .sub").css({'opacity':'0'}); 
$("ul#topnav li").hoverIntent(config); 

});

$(function(){
	$("#mytabset").semantictabs({
		panel:'panel',　//パネルのクラス名 
		head:'h3', //タブの要素名
		active:':first' //最初にアクティブにするタブ
	});
});
