droplinemenu.buildmenu("globalnavi-main");

$(function(){

	// ブロック要素の高さを揃える
	$('.navilistcell').flatHeights();
	$('.fixheight').flatHeights();
	$('.bnr3cells > ol > .mediacell').flatHeights();

    var sets = [], temp = [];
    $('.bnr2cells > ol > .mediacell').each(function(i) {
        temp.push(this);
        if (i % 2 == 1) {
            sets.push(temp);
            temp = [];
        }
    });
    if (temp.length) sets.push(temp);

    $.each(sets, function() {
        $(this).flatHeights();
    });


	// 改行有りのインライン要素の右側にアイコンを表示
	$('.mediacell > p > a, .loadarticle > dl > dd > a').inlineBgFix();


	// ブロック要素の幅を揃える
	var max = 0; 
	$('.address dl dt').each(function(){ 
		if ($(this).width() > max) 
		max = $(this).width(); 
	}); 
	$('.address dl dt').width(max); 


	// スライドウィジット
	$('#worksthumb > .clearfix > .slidepanel > .imgborder_g').innerfade({
		animationtype: 'fade',
		speed: 1500,
		timeout: 7000,
		type: 'sequence',
		containerheight: '1em'
	});


	if(navigator.userAgent.indexOf("Mac") != -1) {

		var BaseUrl = location.protocol + "//" + location.host + "/";

		var addlink = function(file){
			file = BaseUrl + file;
			var csslink = document.createElement("link");
			csslink.setAttribute("type","text/css");
			csslink.setAttribute("rel","stylesheet");
			csslink.setAttribute("href",file);
			return csslink;
		};

		var jquery_link = addlink("/style/mac.css");
		$("head").append(jquery_link);
	}

	$("h1").click(function(){
		window.location = "http://www.warp-jp.net/";
		return false;
	});

	// アコーディオンメニュー
	$('#accordion').accordion({
		active: true,
		header: '.head',
		alwaysOpen: false,
		autoheight: false
	});


});


// 改行有りのインライン要素の右側にアイコンを表示オプション（IE6/7）
$.fn.extend({
	inlineBgFix: function() {
		if ($.browser.msie && $.browser.version < 8.0) {
			$(this)
			.addClass('inline-bg-fix')
			.append('<span>&nbsp;</span>');
		}
	}
});



