$(function(){
	/* linkListの幅を揃える */
	var maxWidth = 0;
	var linkList = $(".linkList dt");
	linkList.each(function(){
		var width = this.offsetWidth;
		if (width > maxWidth) maxWidth = width;
	});
	linkList.css('width',maxWidth - parseInt(linkList.css("padding-left")) + 10 + 'px');
	$(".linkList dd").css("margin-left",maxWidth + "px");
	
	if( $(".linkListTwoColumn") > 0 ){
		parentBoxWidth = $(".linkListTwoColumn")[0].offsetWidth;
		thumbnailImg = $(".linkListTwoColumn .thumbnail img")[0].offsetWidth;
		$(".linkListTwoColumn .linkList").css("width",parentBoxWidth - thumbnailImg -36 + "px");
	}

	/* コンテンツトップとページトップへのリンクが隣接しているときコンテンツトップの上マージンを変更する */
	$(".page-top+.contents-top a").css("margin-top","-10px");
	if( $(".contents-top").prev() > 0 ){
		if( $($(".contents-top").prev()).find(":last") > 0 ){
			if( $($($(".contents-top").prev()).find(":last")[0]).parent() ){
				if($($($(".contents-top").prev()).find(":last")[0]).parent()[0].className =="page-top"){
					$(".contents-top a").css("margin-top","-10px");
				}
			}
		}
	}
	
	/* h4とh5が隣接しているときh5の上マージンを変更する */
	$("h4+h5").css("margin-top","0");
	
	
	/*プルダウンメニュー*/
	$.get("/js/pulldown.xml", function(data) {
		$(data).find("category").each(function() {
			var linkList = new Array();
			var submenu = $("." + $(this).attr("name")).append("<ul style='display:none'></ul>");
			$(this).children('item').each(function() {
				$(submenu).children("ul").append("<li><a href='" + $(this).attr("url") + "'>" + $(this).attr("name") + "</a></li>");
			});
			$(submenu).children("ul").children("li:last-child").children("a").css("border","none");
		});
	});
	$(function() {
		if (document.location.pathname == "/index.html" || document.location.pathname == "/"){
			$('#topNavi').droppy();
		}else{
			$('#gNavi').droppy();
		}
	});


});



