
//<![CDATA[

function initOnLoad(){
	//load();
}

//アコーディオン用CSS書き換え
$(function(){
	$('ul.list-02').css('display','none');
	$('ul.list-03').css('display','none');
});

//アコーディオン用　H3
$(function(){
	var handler = $('#accordion01 h3');
	menus = $('#accordion01 ul');
	handler.click(function(){
		var _thisMenu = $(this).next();
		if(_thisMenu.is(':visible')){
			_thisMenu.show();
		}
		else {
			menus.slideUp();
		_thisMenu.slideDown();
		}
	});
});

//アコーディオン用　地域のクリックで県表示
$(function(){
	var handler = $('#accordion01 .list-01 li');
	menus = $('#accordion01 ul');
	handler.click(function(){
		var _thisMenu = $('#accordion01 .list-02');
		if(_thisMenu.is(':visible')){
			_thisMenu.show();
		}
		else {
			menus.slideUp();
			_thisMenu.slideDown();
		}
		//alert (this.innerHTML);
	document.getElementById("h3-pref").innerHTML ="地域の選択("+this.innerHTML+")";
	});
	
});

//アコーディオン用　地域のクリックで県表示
function shoplist(){
	var handler = $('#accordion01 .list-02 li');
	menus = $('#accordion01 ul');
	//handler.click(function(){
		var _thisMenu = $('#accordion01 .list-03');
		if(_thisMenu.is(':visible')){
			_thisMenu.show();
		}
		else {
			menus.slideUp();
			_thisMenu.slideDown();
		}
	//});
};
	
function hokaido(){
	var pref;
	prf='<li onclick="GetShopMas1(0)">北海道</li>';
	document.getElementById("list-2").innerHTML =prf;
	  
}

function tohoku(){
	var pref;
	prf='<li onclick="GetShopMas1(0,this.innerHTML)">北海道</li>';
	prf+='<li onclick="GetShopMas1(1,this.innerHTML)">青森県</li>';
	prf+='<li onclick="GetShopMas1(2,this.innerHTML)">岩手県</li>';
	prf+='<li onclick="GetShopMas1(3,this.innerHTML)">秋田県</li>';
	prf+='<li onclick="GetShopMas1(4,this.innerHTML)">宮城県</li>';
	prf+='<li onclick="GetShopMas1(5,this.innerHTML)">山形県</li>';
	prf+='<li onclick="GetShopMas1(6,this.innerHTML)">福島県</li>';
	document.getElementById("list-2").innerHTML =prf;  
}

function kanto(){
	var pref;
	prf='<li onclick="GetShopMas1(0,this.innerHTML)">茨城県</li>';
	prf+='<li onclick="GetShopMas1(1,this.innerHTML)">群馬県</li>';
	prf+='<li onclick="GetShopMas1(2,this.innerHTML)">栃木県</li>';
	prf+='<li onclick="GetShopMas1(3,this.innerHTML)">埼玉県</li>';
	prf+='<li onclick="GetShopMas1(4,this.innerHTML)">千葉県</li>';
	prf+='<li onclick="GetShopMas1(5,this.innerHTML)">東京都</li>';
	prf+='<li onclick="GetShopMas1(6,this.innerHTML)">神奈川県</li>';
	document.getElementById("list-2").innerHTML =prf;  
}

function chubu(){
	prf='<li onclick="GetShopMas1(0,this.innerHTML)">山梨県</li>';
	prf+='<li onclick="GetShopMas1(1,this.innerHTML)">長野県</li>';
	prf+='<li onclick="GetShopMas1(2,this.innerHTML)">新潟県　準備中</li>';
	prf+='<li onclick="GetShopMas1(3,this.innerHTML)">富山県　準備中</li>';
	prf+='<li onclick="GetShopMas1(4,this.innerHTML)">石川県　準備中</li>';
	prf+='<li onclick="GetShopMas1(5,this.innerHTML)">福井県　準備中</li>';
	prf+='<li onclick="GetShopMas1(6,this.innerHTML)">静岡県　準備中</li>';
	prf+='<li onclick="GetShopMas1(7,this.innerHTML)">愛知県　準備中</li>';
	prf+='<li onclick="GetShopMas1(8,this.innerHTML)">岐阜県　準備中</li>';
	document.getElementById("list-2").innerHTML =prf;  
}

function kinki(){
	prf='<li onclick="GetShopMas1(0,this.innerHTML)">三重県　準備中</li>';
	prf+='<li onclick="GetShopMas1(1,this.innerHTML)">滋賀県　準備中</li>';
	prf+='<li onclick="GetShopMas1(2,this.innerHTML)">京都府　準備中</li>';
	prf+='<li onclick="GetShopMas1(3,this.innerHTML)">大阪府　準備中</li>';
	prf+='<li onclick="GetShopMas1(4,this.innerHTML)">兵庫県　準備中</li>';
	prf+='<li onclick="GetShopMas1(5,this.innerHTML)">奈良県　準備中</li>';
	prf+='<li onclick="GetShopMas1(6,this.innerHTML)">和歌山県　準備中</li>';
	document.getElementById("list-2").innerHTML =prf;  
}

function shikoku(){
	prf='<li onclick="GetShopMas1(0,this.innerHTML)">鳥取　準備中</li>';
	prf+='<li onclick="GetShopMas1(1,this.innerHTML)">島根県　準備中</li>';
	prf+='<li onclick="GetShopMas1(2,this.innerHTML)">岡山県　準備中</li>';
	prf+='<li onclick="GetShopMas1(3,this.innerHTML)">広島県　準備中</li>';
	prf+='<li onclick="GetShopMas1(4,this.innerHTML)">山口県　準備中</li>';
	prf+='<li onclick="GetShopMas1(5,this.innerHTML)">徳島県　準備中</li>';
	prf+='<li onclick="GetShopMas1(6,this.innerHTML)">香川県　準備中</li>';
	prf+='<li onclick="GetShopMas1(7,this.innerHTML)">愛媛県　準備中</li>';
	prf+='<li onclick="GetShopMas1(8,this.innerHTML)">高知県　準備中</li>';
	document.getElementById("list-2").innerHTML =prf;  
}

function kyusyu(){
	prf='<li onclick="GetShopMas1(0,this.innerHTML)">福岡県　準備中</li>';
	prf+='<li onclick="GetShopMas1(1,this.innerHTML)">佐賀県　準備中</li>';
	prf+='<li onclick="GetShopMas1(2,this.innerHTML)">長崎県　準備中</li>';
	prf+='<li onclick="GetShopMas1(3,this.innerHTML)">熊本県　準備中</li>';
	prf+='<li onclick="GetShopMas1(4,this.innerHTML)">大分県　準備中</li>';
	prf+='<li onclick="GetShopMas1(5,this.innerHTML)">宮崎県　準備中</li>';
	prf+='<li onclick="GetShopMas1(6,this.innerHTML)">鹿児島県　準備中</li>';
	prf+='<li onclick="GetShopMas1(7,this.innerHTML)">沖縄県　準備中</li>';
	document.getElementById("list-2").innerHTML =prf;  
}

function GetShopMas1(n,arg2){
	document.getElementById("h3-shop").innerHTML ="お店の選択("+arg2+"のお店)";
	//alert (n);
	xhrObj1 = getXhrObj();
	var pref = document.getElementById("list-2").childNodes.item(n).innerHTML;
	//alert (pref);
	xhrObj1.open("get", "sel_shopmaster.php?pref="+pref);
	xhrObj1.setRequestHeader("If-Modified-Since", "01 Jan 2000 00:00:00 GMT");
	xhrObj1.send(null);
	xhrObj1.onreadystatechange = RespShopMas1;
}

//レスポンス表示用
function RespShopMas1(){
	var recs, rec;
	if(xhrObj1.readyState == 4){
	//alert ("4");
		if(xhrObj1.status == 200){
			//alert ("200");
			var recs = xhrObj1.responseText.split("<r>");
			//alert (recs);			
			var view = "";
			for(var i = 0; i < recs.length - 1; i++){
				rec = recs[i].split("<i>");
				var spid = rec[0];
				var spnm = rec[1];
				var spad = rec[2];
				var spgeo = rec[3];
				var sptel = rec[4];
				var spurl = rec[5];
				var sphp = rec[6];
				var sphold = rec[7];
				var spopen = rec[8];
				var spacc1 = rec[9];
				var spacc2 = rec[10];
				var sppark = rec[11];
				var splen=rec[1].length;
				var maxlen = 15;
				if(splen > maxlen){
					var spnm2=rec[1].substring(0,maxlen)+"...";
				}else{
					var spnm2=rec[1];
				}
				view += "<li onclick=Gload('"+spnm+"','"+spad+"','"+spgeo+"','"+sptel+"','"+spurl+"','"+sphp+"','"+sphold+"','"+spopen+"','"+spacc1+"','"+spacc2+"','"+sppark+"')>"+spnm2;+"</li>";
			}
			//alert (view);
			document.getElementById("list-3").innerHTML = view;
		}
	}
	//0.1秒後にshoplist()を実行　1秒は、1000
	var timer; 
	timer = setTimeout("shoplist()",10); 
}

//Google Maps Program1
function Gload(str1,str2,str3,str4,str5,str6,str7,str8,str9,str10,str11) {

    if (GBrowserIsCompatible()) {
        //東京銀座三越の住所
        if (str2 == null) {
        	address = "銀座三越";
        	str1 = "銀座三越";
        	str2 = "東京都中央区銀座4-6-16";
        	str3 = "銀座三越";
        	str4 = "03-3562-1111";
        	str5 = "http://ginza.mitsukoshi.co.jp/";
        	str6 = "http://img.simpleapi.net/small/http://ginza.mitsukoshi.co.jp/";
        	str7 = "　";
        	str8 = "午前10時～午後8時";
        	str9 = "　";
        	str10 = "・東京メトロ銀座線・丸ノ内線・日比谷線→銀座駅直結　・東京メトロ有楽町線→銀座1丁目駅9番出口 徒歩約5分　・都営浅草線→東銀座駅 銀座駅方面地下通路経由 徒歩約3分";
        	str11 = "　";

        }else{
	        //地図が不正確な場合は、緯度経度で検索
	        if(str3 == ""){
	        	address = str2;
	        }else{
	        	address = str3;
	        }
        }
        //GClientGeocoder生成
        var clientGeocoder = new GClientGeocoder();
        //getLatLng呼び出し
        clientGeocoder.getLatLng(address, shoMap);
    }
    document.getElementById("shopnm").innerHTML =str1;
	document.getElementById("shopadress").innerHTML =str2;
	document.getElementById("shoptel").innerHTML =str4;
	document.getElementById("shopurl").innerHTML ="<a href='"+str5+"' target='_blank'><img src='"+str6+"' /></a><br /><a href='"+str5+"' target='_blank'>ホームページへ</a>";
	document.getElementById("shophold").innerHTML =str7;
	document.getElementById("shopopen").innerHTML =str8;
	document.getElementById("shopacc2").innerHTML =str10;
	document.getElementById("shopacc1").innerHTML =str9;
	document.getElementById("shoppark").innerHTML =str11;
}
//Google Maps Program2
function shoMap(point) {
        //GMap2生成
        var map = new GMap2(document.getElementById("map"));
        map.setCenter(point, 16);
        map.addControl(new GLargeMapControl());
        map.addControl(new GOverviewMapControl());

        //マーカー
        var marker = new GMarker(point)
        map.addOverlay(marker);
}
//]]>
