// ツリーメニュー

function displayTown(TownMenu) {
	tMenu = document.getElementById(TownMenu).style;
	if(tMenu.display == 'none') {
		tMenu.display = "block";
	} else {
		tMenu.display = "none";
	}
}

function categoryCheck(chk_category,time) {
	this.chk_category = chk_category;
	var kind_list = document.getElementById("rank_icon");
	var loader_image = "<img src='/images/ajax-icon/indicator_technorati.gif' alt='now loading' />";
	var list = "ﾗﾝｷﾝｸﾞを読み込み中" + loader_image + "<br clear='all' />";
	kind_list.innerHTML = list;

	new Ajax.Request("/function/rank_category_sch.php", {method:"get",
					parameters:"category_data=" + chk_category + "&time_data=" + time,
					onComplete:category_sch});
}

function citySelect(city) {
	this.chk_city = city;
}

function category_sch(httpObj) {
	var t=new Array();//optionの項目(text)
	var v=new Array();//optionのvalue
	var rank_view=new Array();
	var photo_size=new Array();
	var service_view=new Array();
	var shop_name=new Array();
	text = unescape(httpObj.responseText);
	pic_list = text.split("######");
	service = pic_list[5].split("#####");
	kind_name = service[5].split("####");
	last_rank = kind_name[5].split("###");
	shop_code = last_rank[5].split("##");
	shop_name = shop_code[5].split("#");
	if(shop_name[0] != "") {
		for(j=0;j<shop_name.length;j++) {
			t[j]=shop_name[j];v[j]=shop_name[j];
		}
	}

	for(i=0;i<t.length;i++) {
		if(t[i] != "") {
			if(last_rank[i] == 0) {
			}
			if(last_rank[i]==0) {
				rank_view[i] = "<span style='color:red;'>　　新着！</span>";
			} else {
				if(i>last_rank[i]) {
					rank_view[i] = "　<span style='color:darkred; font-weight:bold;font-size:13px;'>↓</span>前回"+last_rank[i]+"位";
				} else if(i==last_rank[i]) {
					rank_view[i] = "　<span style='color:darkred; font-weight:bold;font-size:13px;'>→</span>前回"+last_rank[i]+"位";
				} else if(i<last_rank[i]) {
					rank_view[i] = "　<span style='color:darkred; font-weight:bold;font-size:13px;'>↑</span>前回"+last_rank[i]+"位";
				}
			}
			if(pic_list[i] == "width") {
				photo_size[i] = "<img src='images/photo_shop_thumb/"+shop_code[i]+"photo_top.jpg' width='120'><br clear='all'>"+shop_name[i];
			} else if(pic_list[i] == "height") {
				photo_size[i] = "<img src='images/photo_shop_thumb/"+shop_code[i]+"photo_top.jpg' height='90'><br clear='all'>"+shop_name[i];
			} else {
				photo_size[i] = shop_name[i];
			}
			if(service[i] == "no") {
				service_view[i] = "";
			} else {
				service_view[i] = "<span style='color:#FF0000;font-weight:bold;'>ｸｰﾎﾟﾝ</span>："+service[i];
			}
			i_purace = i+1;
			document.getElementById('rank_all_'+i).innerHTML="<hr style='border:1px dashed silver;'><strong style='font-size:20px;'>"+i_purace+"</strong>位"+rank_view[i]+"<br /><a href='shop_info.php?ShopCode="+shop_code[i]+"'>"+photo_size[i]+"</a><br />【"+kind_name[i]+"】<br />"+service_view[i]+"<br />";
		} else if(t[i] == "") {
			continue;
		}
	}
	var kind_list = document.getElementById("rank_icon");
	list = '';
	kind_list.innerHTML = list;
}

