//--------------------------
//	店舗一覧画面JavaScript
//--------------------------
//	一覧画面のイメージの切り替え
//--------------------------
function ChangeImage(ix,genre,shop_id,img_id,ww,hh){
	//	画像の切り替え
	document.images["imgs" + shop_id].onload = function(){
		this.width = ww;
		this.height = hh;
		this.style.display = "";
	}
	//document.images["imgs" + shop_id].width = ww;
	//document.images["imgs" + shop_id].height = hh;
	document.images["imgs" + shop_id].style.display = "none";
	document.images["imgs" + shop_id].src = "/image.php?id=" + img_id + "&scr=260x208";
	//	画像キャプションの読み込み
	var param = "type=ajax&execmode=lst&mode=list_image_caption&shop=" + shop_id + "&genre=" + genre + "&index=" + ix;
	var obj = new Ajax.Request(
			'/rpc.php',
			{
				method: 'get',
				parameters: param,
				onComplete: ExecLoadCaption
			}
			);
}
//--------------------------
//	読み込んだキャプションの描画
//--------------------------
function ExecLoadCaption(xObj){
	var xml = xObj.responseXML;
//alert("res=" + xObj.responseText);
	var opta = '';
	var optc = '';
	if(xObj.responseText){
		var root = xml.documentElement;
		for(var i=0;i<root.childNodes.length;i++){
			var elm = root.childNodes[i];
			if(elm.nodeType == 1){
				if(elm.nodeName == "caption"){
					var ix = elm.getAttribute("shop");
					$("imgmsg" + ix).innerHTML = elm.firstChild.nodeValue;
					break;
				}
			}
		}
	}
}
//--------------------------
//	プラス検索条件の表示・非表示
//--------------------------
function expand(URI,SUB,EXP){
  if(document.getElementById) {
    if(document.getElementById(SUB).style.display) {
      if(URI != 0) {
        document.getElementById(SUB).style.display = "block";
        document.getElementById(EXP).style.display = "none";
      } else {
        document.getElementById(SUB).style.display = "none";
        document.getElementById(EXP).style.display = "block";
      }
    } else {
      location.href = URI;
      return true;
    }
  } else {
    location.href = URI;
    return true;
  }
}
//--------------------------
//	プラス検索のチェック
//--------------------------
function CheckPlus(){
	var pls = document.form1.elements["plus[]"];
	var flg = false;
	if(pls){
		for(var i=0;i<pls.length;i++){
			if(pls[i].checked){
				flg = true;
				break;
			}
		}
	}
	if(!flg){
		pls[0].checked = true;
	}
}
//--------------------------
//	一覧画面クーポンの表示・非表示
//--------------------------
function ShowCouponDetail(no){
	var lk = $("s" + no + "_lk");
	var dt = $("s" + no + "_dt");
	var ca = $("s" + no + "_ca");
	lk.innerHTML = (ca.style.display ? '＜＜閉じる' : 'クリック＞＞さらに詳しく');
	dt.style.display = (dt.style.display ? "" : "none");
	ca.style.display = (ca.style.display ? "" : "none");
}
//--------------------------
//	コース画面の画像拡大
//--------------------------
function ViewLargeImage(id,scr){
	var ar = scr.split("x");
	window.open("/image.php?id=" + id,"_blank","width=" + (ar[0] * 1 + 20) + ",height=" + (ar[1] * 1 + 20));
}
//--------------------------
//	地図画像の切り替え
//--------------------------
function ChangeMap(prm){
	var dt = new Date();
	document.images["map"].src = "/map.php?p=" + prm + "&s=" + dt.getTime();
}
//--------------------------
//	最寄駅ルート画像の表示
//--------------------------
function ShowRouteMap(rt){
	var dt = new Date();
	document.images["map"].src = "/map.php?route=" + rt + "&s=" + dt.getTime();
}