var g_rolloverImage=new Array();
var URL = String(document.location);
var i = 0;

window.onload = function(){
	if($('pickup-body')){
			adjustPickup();
	}
	
	//画像ロールオーバー
	$$('img.rollover').each(function (node){
			var src=node.src;
			var pos=(src.lastIndexOf('.'));
			if(1<pos){
				var over=src.substr(0,pos)+'_on'+src.substr(pos);
				node.onmouseover=function(){
					this.src=over;
				}
				node.onmouseout=function(){
					this.src=src;
				}
			}
	});
	
	
	/*左ナビゲーション表示初期化*/
	$$('li.active ul').each(function (node){
			node.style.display = 'none';
			if(URL.indexOf('/strategy/') != -1){
				$('strategy').style.display = '';
			}else if(URL.indexOf('/meeting/') != -1){
				$('recruit').style.display = '';
			}else if(URL.indexOf('/career/') != -1){
				$('career').style.display = '';
			}else if(URL.indexOf('/cs/') != -1){
				$('cs').style.display = '';
			}else if(URL.indexOf('/effort/') != -1){
				$('effort').style.display = '';
			}/*else if(URL.indexOf('/personnel/') != -1){
				$('personnel').style.display = '';
			}*/
	});
	/*左ナビゲーション表示・非表示切り替え*/
	$$('li.active').each(function (node){
			node.no = i;
			i ++;
			node.childNodes[0].onclick=function(){
				if(node.no==0){
					var target = $('recruit');
					Element.toggle(target);
					arrowRotation(node,target);
				}else if(node.no==1){
					var target = $('career');
					Element.toggle(target);
					arrowRotation(node,target);
				}else	 if(node.no==2){
					var target = $('strategy');
					Element.toggle(target);
					arrowRotation(node,target);
				}else if(node.no==3){
					var target = $('cs');
					Element.toggle(target);
					arrowRotation(node,target);
				}else if(node.no==4){
					var target = $('effort');
					Element.toggle(target);
					arrowRotation(node,target);
				}/*else if(node.no==6){
					var target = $('personnel');
					Element.toggle(target);
					arrowRotation(node,target);
				}*/
			}
	});
}

//メニューの↓を回転
function arrowRotation(path,target){
	if(target.style.display != ''){
		path.style.background = "url('/img/common/parts/icon/icon_arrow_gray.gif') 14px 8px no-repeat";
	}else{
		path.style.background = "url('/img/common/parts/icon/icon_arrow_gray_bottom.gif') 12px 8px no-repeat";
	}
}

	//ピックアップの要素高さを調整
function adjustPickup(){
	var pickup = new Array();
	var num = 0;
	$$('div#pickup-body p').each(function (node){
			pickup.push(node.offsetHeight);
			node.id = 'pickup0'+num;
			num ++;
	});
	var maxHeights=pickup[0];　
	for (j=1; j<pickup.length; j++) {
		maxHeights=Math.max(pickup[j],maxHeights);
	}
	if(maxHeights > 180){
		var addHeight = maxHeights + 10;
		for(j=0; j<3; j++){
			var node = document.getElementById('pickup0'+j);
			if(typeof document.body.style.maxHeight != "undefined") {
				node.style.minHeight =addHeight + 'px';
			}else {
				node.style.height =addHeight + 'px';
			}
		}
	}
}