$(function(){




	/*連続でファイルダウンロード一覧があった場合、スペースを短くする*/
	var pageLinkFlg = false;
    $("#contents > *").each(function(idx){
		if( $(this).hasClass('pageLink') ) {
			// 前回のクラスが「pageLink」だったら
			if(pageLinkFlg) {
				$(this).addClass("top10");
			}
			pageLinkFlg = true;
		}
		else {
			pageLinkFlg = false;
		}
    });

	/*pで囲まれていないテキストがあったら囲む*/
	$("div.wyswyg").filter(function(){
		if( $($(this).find("p")).size() > 0 ) {
			return false;
		}
		if( $($(this).find("ul")).size() > 0 ) {
			return false;
		}
		if( $($(this).find("table")).size() > 0 ) {
			return false;
		}
		if( $($(this).find("div")).size() > 0 ) {
			return false;
		}
		
		return true;
	}).wrapInner("<p />");


	$("table.wyswyg tr").each(function(idx){
		$(this).find("td > *").each(function(idx2){
			if(idx2 == 0) {
				var tag = this.tagName;
				
				
				
				if(    tag.match(/^p$/i) || tag.match(/^ul$/i) || tag.match(/^div$/i) || tag.match(/^table$/i)   ) {
					$(this).addClass("top0");
				}
				return false;
			}
	    });
    });


	/*画像2列並びの場合、下キャプションの横幅を決める*/
    $(".col2Box").each(function(idx){
    	var imgLWidth = $(this).find(".L img").width();
    	var imgRWidth = $(this).find(".R img").width();
    	
    	$(this).find(".L p").css("width", imgLWidth);
    	$(this).find(".R p").css("width", imgRWidth);
    	
    });



	/*wysiwygにh2があったときクラスをセット*/
	$("#contents .wyswyg h2").addClass("type1").wrapInner('<span class="bg" />');

	/*wysiwygにh3があったときクラスをセット*/
	$("#contents .wyswyg h3").addClass("type1").wrapInner('<span class="bg" />');






});







