/* 初期値 */
var activeObj;

/*-----サブメニュー------*/
function subnl(obj){
	var txt ="";
	var strh = String(obj.getAttribute('href'));
		if( strh.indexOf('#') != -1 ){
		}else if( strh.indexOf('/information/') != -1 ){
			txt += '<dl>';
			txt += '<dd><a href="/information/info_list.php?ctg=trial"><p id="info01">おためし隊</p></a></dd>';
			/*txt += '<dd><a href="/information/info_list.php?ctg=training"><p id="info02">愛犬のトレーニング教室</p></a></dd>';*/
			txt += '<dd><a href="/information/info_list.php?ctg=event"><p id="info03">イベント</p></a></dd>';
			txt += '<dd><a href="/information/info_list.php?ctg=goods"><p id="info04">商品情報</p></a></dd>';
			txt += '<dd><a href="/information/info_list.php?ctg=news_www"><p id="info05">TOPICS</p></a></dd>';
			txt += '<dd><a href="/information/info_list.php?ctg=press"><p id="info06">ニュース</p></a></dd>';
			txt += '<dd><a href="/information/important.php"><p id="info07">大切なお知らせ</p></a></dd>';
			txt += '<dd><a href="/information/info_list.php?ctg=press_www"><p id="info08">プレスリリース</p></a></dd>';
			txt += '</dl>';
		}else if( strh.indexOf('/faq/') != -1){
			txt += '<dl>';
			txt += '<dd><a href="/faq/food.php"><p id="faq01">食品に関するＱ＆Ａ</p></a></dd>';
			txt += '<dd><a href="/faq/goods.php"><p id="faq02">用品に関するＱ＆Ａ</p></a></dd>';
			txt += '<dd><a href="/faq/health.php"><p id="faq03">健康に関するＱ＆Ａ</p></a></dd>';
			txt += '</dl>';
		}else if( strh.indexOf('http://plaza.petio.com/') != -1){
			txt += '<dl>';
			txt += '<dd><a href="http://www.addmate.com/" target="_blank"><p id="community01">ADD.MATE</p></a></dd>';
			txt += '<dd><a href="http://www.petio.com/products/zuttone/index.html" target="_blank"><p id="community02">zuttone</p></a></dd>';
			txt += '<dd><a href="http://plaza.petio.com/" target="_blank"><p id="community03">ペティオ・プラザ</p></a></dd>';
			txt += '<dd><a href="http://www.petiomagazine.com/" target="_blank"><p id="community04">ペティオ・マガジン</p></a></dd>';
			txt += '<dd><a href="http://www.petioteire.com/" target="_blank"><p id="community05">お手入れ</p></a></dd>';
			txt += '</dl>';			
		}else if( strh.indexOf('/aboutpetio/') != -1){
			txt += '<dl>';
			txt += '<dd><a href="/aboutpetio/index.php"><p id="about01">ブランドステートメントシステム</p></a></dd>';
			txt += '<dd><a href="/aboutpetio/promotion.php"><p id="about02">プロモーション活動</p></a></dd>';
			txt += '<dd><a href="/aboutpetio/csr.php"><p id="about04">CSRへの取り組み</p></a></dd>';
			txt += '<dd><a href="/aboutpetio/company.php"><p id="about05">企業情報</p></a></dd>';
			txt += '<dd><a href="/information/info_list.php?ctg=press"><p id="about06">ニュース</p></a></dd>';
			txt += '<dd><a href="/aboutpetio/recruit.php"><p id="about07">採用情報</p></a></dd>';			
			txt += '</dl>';
			
			
		/*	
		}else if( strh.indexOf('/english/') != -1){
			txt += '<dl>';
			txt += '<dd><a href="/english/index.php"><p id="about01">Statement system</p></a></dd>';
			txt += '<dd><a href="/english/promotion.php"><p id="about02">Promotion activity</p></a></dd>';
			txt += '<dd><a href="/english/concept.php"><p id="about03">CSR activity</p></a></dd>';
			txt += '<dd><a href="/english/csr.php"><p id="about04">Company infomation</p></a></dd>';		
			txt += '</dl>';
		*/	
			
		}



	return txt;
}


function headnaviinit(){
	if (!document.getElementsByTagName){ return; }
	var anchors = document.getElementsByTagName('a');

	for (var i=0; i<anchors.length; i++){
		var anchor = anchors[i];
		
		var idAttribute = String(anchor.getAttribute('id'));

		if ( idAttribute.toLowerCase().match('exp') ){
			anchor.onmouseover = function () {pull(this);}
			anchor.onmouseout = function () {pullDel(this);}
		}
	}
	
	//メニューレイヤー作成
	var divNode = document.createElement("div");
	divNode.id = 'subnavi';
	divNode.style.display = 'none';
	document.body.appendChild(divNode);	
	
	var obj = getObj("subnavi");
	obj.onmouseover = function(){
		this.style.display = "block";
		activeObj.style.backgroundPosition ="0px -35px";
	}
	obj.onmouseout = function(){
		this.style.display = "none";
		activeObj.style.backgroundPosition ="0px 0px";
	}
}


/*-----サブメニュー表示------*/
function pull(obj){
	activeObj = obj;
	if( subnl(obj) != ""){
		var pos = layerPos(obj);
		var obj2 = getObj("subnavi");
		obj2.style.left = pos.left + "px";
		obj2.style.top = (pos.top + obj.offsetHeight)+ "px";
		obj2.innerHTML = subnl(obj);
		obj2.style.position = "absolute";
		obj2.style.display = "block";
	}
	activeObj.style.backgroundPosition ="0px -35px";
}

/*-----サブメニュー非表示------*/
function pullDel(obj){
	var obj2 = getObj("subnavi");
	obj2.style.display = "none";
	activeObj.style.backgroundPosition ="0px 0px";
}


/*-----オンロード------*/
if(window.opera){
	window.onload = headnaviinit;
}else if(window.addEventListener){
	window.addEventListener('load', headnaviinit, true);
}else if(window.attachEvent){
	window.attachEvent('onload', headnaviinit);
}