$(function(){

	var now_href = location.href.replace(/http\:\/\/[^\/]+\//, "/");
	var now_href = now_href.replace(/\/([^/]+)\/([^/]+)\/.+$/, "/$1/$2/");

	var now_file = now_href.replace(/\/[a-z]+\//,"");

	var now_href_dir = "";
		now_href_dir = now_href.replace(/\#.*$/, "");
		now_href_dir = now_href_dir.replace(/([a-zA-Z0-9_\-]+\.[a-z]+)$/, "");
		now_href_dir = now_href_dir.replace(/^\/[a-z]+\//, "/");

	$("#pulldown > li").hover(function(){
		var src = $(" > a > img", this).attr("src");

		if(!src.match(/header_gbtn_top_on\.gif$/)){
			//remove rollover class
			$(" > a > img", this).removeClass("ro");
			//change img
			if(!src.match(/_on(\.[a-z]+)$/)){
				var src_on = src.replace(/^(.+)(\.[a-z]+)$/, "$1_on$2");
				$(" > a > img", this).attr("src", src_on);
			}
			//pulldown open
			$(" > ul", this).css({visibility:"visible", display:"none"}).fadeIn("fast");
		}
	},
	function(){
		var src = $(" > a > img", this).attr("src");
		var btn_href = $(" > a", this).attr("href");
		btn_href_rep = btn_href.replace(/\/[a-z]{2}\//,"");

		//add rollover class
		if(now_href_dir == '/' && btn_href_rep == 'index.html'){
			
		}else{
			$(" > a > img", this).addClass("ro");
			//change img
			var my_href = $(" > a", this).attr("href");
			my_href = my_href.replace(/\/[a-zA-Z0-9]+\.[a-zA-Z0-9]+$/, "/");

			if(src.match(/_on(\.[a-z]+)$/) && my_href != now_href){
				var src_off = src.replace(/^(.+)_on(\.[a-z]+)$/, "$1$2");
				$(" > a > img", this).attr("src", src_off);
			}
			//pulldown close
			$(" > ul", this).css({visibility:"hidden"}).fadeOut("fast");
		}

	});
});

