/*
	グローバルナビのプルダウンを実装いたします。
*/

$(document).ready(function() {
						   
	var subNavHTML = {
		about: 
			'<div class="sub-gnav">'+
			'<dl>'+
				'<dt>日本製紙連合会のプロフィールや、活動等についての基本情報</dt>'+
				'<dd>'+
				'<ul>'+
					'<li><a href="/about/business/index.html">事業内容</a></li>'+
					'<li><a href="/about/member/index.html">会員企業</a></li>'+
					'<li><a href="/about/history/index.html">事業沿革</a></li>'+
					'<li><a href="/about/pr/index.html">広報活動</a></li>'+
					'<li><a href="/about/map/index.html">地図</a></li>'+
					'<li class="last-child"><a href="/about/issue/index.html">刊行物</a></li>'+
				'</ul>'+
				'</dd>'+
			'</dl>'+
			'</div>',
		docs:
			'<div class="sub-gnav">'+
			'<dl>'+
				'<dt>最新の活動内容や統計に関する発表資料をご覧いただけます</dt>'+
				'<dd>'+
				'<ul>'+
					'<li><a href="/docs/release/index.php">発表資料</a></li>'+
					'<li class="last-child"><a href="/docs/stats/inventory.php">統計資料</a></li>'+
				'</ul>'+
				'</dd>'+
			'</dl>'+
			'</div>',
		states:			
			'<div class="sub-gnav">'+
			'<dl>'+
				'<dt>国内外における製紙産業の動向を最新データに基づき分析</dt>'+
				'<dd>'+
				'<ul>'+
					'<li><a href="/states/brief/index.html">概要</a></li>'+
					'<li><a href="/states/paper/index.html">紙・板紙</a></li>'+
					'<li><a href="/states/pulp/index.html">パルプ</a></li>'+
					'<li><a href="/states/pulpwood/index.html">パルプ材</a></li>'+
					'<li><a href="/states/used-paper/index.html">古紙</a></li>'+
					'<li class="last-child"><a href="/states/global-view/index.html">世界の中の日本</a></li>'+
				'</ul>'+
				'</dd>'+
			'</dl>'+
			'</div>',
		env:
			'<div class="sub-gnav">'+
			'<dl>'+
				'<dt>資源循環型産業である製紙業界の、環境への取り組みをご紹介</dt>'+
				'<dd>'+
				'<ul>'+
				'<li><a href="/env/cycloid-type/overview/index.html">循環型産業について</a></li>'+
				'<li><a href="/env/proc/stance/index.html">木材調達に対する考え方</a></li>'+
				'<li><a href="/env/recycle/used-paper/index.html">紙のリサイクルに対する考え方</a></li>'+
				'<li><a href="/env/plan/brief/index.html">環境に関する自主行動計画</a></li>'+
				'<li><a href="/env/energy-saving/feature/index.html">省エネ対策</a></li>'+
				'<li class="last-child"><a href="/env/environment/equipment/index.html">環境対策</a></li>'+
				'</ul>'+
				'</dd>'+
			'</dl>'+
			'</div>',
		paperworld:
			'<div class="sub-gnav-ppw">'+
			'<dl>'+
				'<dt>紙の歴史やまめ知識、紙の製造工程など、紙に親しむコンテンツページ</dt>'+
				'<dd>'+
				'<img src="/images/banner_paperworld_b.jpg" alt="" width="411" height="205" border="0" usemap="#Map_PPPULLDOWN" />'+
				'<map name="Map_PPPULLDOWN" id="Map_PPPULLDOWN">'+
				'<area shape="rect" coords="24,11,114,44" onclick="WindowPopUp(\'/p-world/p_kind/index.html\', \'ppw\', 960, 600)" href="javascript:void(0)" />'+
				'<area shape="rect" coords="151,7,239,40" onclick="WindowPopUp(\'/p-world/p_history/index.html\', \'ppw\', 960, 600)" href="javascript:void(0)" />'+
				'<area shape="rect" coords="258,54,390,86" onclick="WindowPopUp(\'/p-world/eco/index.html\', \'ppw\', 960, 600)" href="javascript:void(0)" />'+
				'<area shape="rect" coords="20,81,128,114" onclick="WindowPopUp(\'/p-world/p_seizou/index.html\', \'ppw\', 960, 600)" href="javascript:void(0)" />'+
				'<area shape="rect" coords="176,106,264,139" onclick="WindowPopUp(\'/p-world/knowledge/index.html\', \'ppw\', 960, 600)" href="javascript:void(0)" />'+
				'<area shape="rect" coords="283,120,392,154" onclick="WindowPopUp(\'/p-world/p_make/index.html\', \'ppw\', 960, 600)" href="javascript:void(0)" />'+
				'<area shape="rect" coords="164,164,272,196" onclick="WindowPopUp(\'/p-world/weekend/index.html\', \'ppw\', 960, 600)" href="javascript:void(0)" />'+
				'</map>'+
				'</dd>'+
			'</dl>'+
			'</div>'
	}
	
	var _showSubNavigation = function(ev) {
		$(ev.currentTarget).find(".sub-gnav, .sub-gnav-ppw").show();
		$(ev.currentTarget).children("a").addClass("ro");
	}
	
	var _hideSubNavigation = function(ev) {
		$(ev.currentTarget).find(".sub-gnav, .sub-gnav-ppw").hide();
		$(ev.currentTarget).children("a").removeClass("ro");
	}

	var _initialize = function() {
		$("#gNav li").each(function() {
			
			var $this = $(this);
			var $class = $this.attr("class");
			
			if(!$this.hasClass("ro")) {
				$this.append(subNavHTML[$class]);
			
				$this.bind("mouseover", _showSubNavigation);
				$this.bind("mouseout", _hideSubNavigation);
			}
			
		});
	}
	
	_initialize();
						   
});
