/*--------------------------------------------------------------------------*
 *
 *  Search Map(Top page) JavaScript Library beta2
 *
 *  jQuery required.
 *
 *  Oct 23st, 2010 Written by Megumi Kawano
 *  http://www.rhythmtype.com/
 *
 *--------------------------------------------------------------------------*/

$(document).ready(function(){
	// 地図上のアクティブ要素の追加
	$("#area-list").before('<img src="./../common/images/top/img_map_hokkaido_on.gif" width="37" height="29" alt="" id="image-hokkaido" class="map">');
	$("#area-list").before('<img src="./../common/images/top/img_map_tohoku_on.gif" width="26" height="38" alt="" id="image-tohoku" class="map">');
	$("#area-list").before('<img src="./../common/images/top/img_map_kanto_on.gif" width="35" height="38" alt="" id="image-kanto" class="map">');
	$("#area-list").before('<img src="./../common/images/top/img_map_hokuriku_on.gif" width="19" height="10" alt="" id="image-hokuriku" class="map">');
	$("#area-list").before('<img src="./../common/images/top/img_map_tokai_on.gif" width="32" height="28" alt="" id="image-tokai" class="map">');
	$("#area-list").before('<img src="./../common/images/top/img_map_kansai_on.gif" width="30" height="28" alt="" id="image-kansai" class="map">');
	$("#area-list").before('<img src="./../common/images/top/img_map_shikoku_on.gif" width="29" height="30" alt="" id="image-shikoku" class="map">');
	$("#area-list").before('<img src="./../common/images/top/img_map_kyushu_on.gif" width="36" height="39" alt="" id="image-kyushu" class="map">');
	$("#area-list").before('<img src="./../common/images/top/img_map_kaigai_on.gif" width="5" height="5" alt="" id="image-kaigai" class="map">');
	// プルダウンポジション連想配列
	var obj;
	obj = new Array();
	obj["hokkaido"] = new Object(); obj["hokkaido"].top = "17px"; obj["hokkaido"].left = "0px";
	obj["tohoku"] = new Object(); obj["tohoku"].top = "17px"; obj["tohoku"].left = "-33px";
	obj["kanto"] = new Object(); obj["kanto"].top = "29px"; obj["kanto"].left = "-23px";
	obj["hokuriku"] = new Object(); obj["hokuriku"].top = "-32px"; obj["hokuriku"].left = "0px";
	obj["tokai"] = new Object(); obj["tokai"].top = "0px"; obj["tokai"].left = "30px";
	obj["kansai"] = new Object(); obj["kansai"].top = "-16px"; obj["kansai"].left = "30px";
	obj["shikoku"] = new Object(); obj["shikoku"].top = "-32px"; obj["shikoku"].left = "0px";
	obj["kyushu"] = new Object(); obj["kyushu"].top = "17px"; obj["kyushu"].left = "-8px";
	obj["kaigai"] = new Object(); obj["kaigai"].top = "0px"; obj["kyushu"].left = "0px";
	// マウスアクション
	var cid;
	$("#area-list li.area").hover(
		function() {
			cid = $(this).attr("id");
			if (cid != "") {
				var t = "#image-" + cid;
				$(t).css("display", "block");
				$(this).css("z-index", "101");
				$(this).find("ul").css("top", obj[cid].top);
				$(this).find("ul").css("left", obj[cid].left);
			}
		},
		function() {
			var id = $(this).attr("id");
			if (id != "" && cid != "") {
				var t = "#image-" + cid;
				$(t).css("display", "none");
				$(this).css("z-index", "100");
				$(this).find("ul").css("top", "-999em");
				$(this).find("ul").css("left", "0px");
			}
		}
	);
});

