var menu_images = new Object();
/*
var dom_list = new Array(
	'menu_keisai',
	'menu_taiken',
	'menu_movi',
	'menu_futube',
	'menu_link',
	'menu_report'
);
*/
function onMenuMouseOver(e){
	var target_dom = Event.element(e);
	target_dom.src = target_dom.on.src;
}

function onMenuMouseOut(e){
	var target_dom = Event.element(e);
	target_dom.src = target_dom.off.src;
}


function getCurrentPage(){

	var reg = new RegExp("/([a-zA-Z_\-]+)/(work/|search/|)$");
	var result = reg.exec(window.location.pathname);
	//if(console) console.info(result);
	//alert(result)
	if(result){
		var current = result[1];
	/*
		if(current == 'top' && window.location.hash == "#futube"){
			return "futube";
		}
	*/
		return current;
	}
	
	return null;
}


function initMenuButton(){
	
	var dom_list = $$("#headermenu a img");
	
	var current = getCurrentPage();
	
	for(var i=0; i<dom_list.length; i++){
		
		dom_list[i].on = new Image();
		dom_list[i].on.src = "/image/on_"+[dom_list[i].id]+".jpg";
		dom_list[i].off = new Image();
		dom_list[i].off.src = "/image/btn_"+[dom_list[i].id]+".jpg";
		
		if("menu_"+current == dom_list[i].id){
			dom_list[i].src = dom_list[i].on.src;
		} else {
			Event.observe(dom_list[i], 'mouseover', onMenuMouseOver);
			Event.observe(dom_list[i], 'mouseout', onMenuMouseOut);
		}
	}
}
initMenuButton();