/**
 * search.js
 * 検索用JavaScript
 */

/**
 * トップ画面から僧侶検索画面へ遷移
 * 遷移時に、検索条件のサービスIDを引き継ぐ
 * 但し、サービスIDを引き継ぐのは「ペットセレモニー」のみ
 */
function goPriestSearch(form_id, service_id, service_id_value) {
	var form = document.getElementById(form_id);
	var service = document.getElementById(service_id);

	service.value = service_id_value;
	form.submit();

	return false;
}

/**
 * 都道府県設定
 * 僧侶検索画面で
 * 地図から都道府県を設定する
 */
function setPref(select_id, pref_name) {
	var select = document.getElementById(select_id);
	var option;
	var i;

	for (i = 0; i < select.options.length; i++) {
		if (select.options[i].value == pref_name) {
			option = select.options[i];
			break;
		}
	}

	option.selected = true;
}

/**
 * 絞込み検索実行
 * 未使用関数
 * @return
function submitSearchOpt() {
	var form = document.getElementById("search_priest_form");
	var select_service = document.getElementById("service_opt");
	var select_price = document.getElementById("price_opt");
	var service = document.getElementById("service");
	var price = document.getElementById("price");

	// 値の設定
	service.value = select_service.options[select_service.selectedIndex].value;
	price.value = select_price.options[select_price.selectedIndex].value;

	// フォームのsubmit
	form.submit();
	return true;
}
 */

/**
 * ページング処理：前ページ
 *
 * @return
 */
function pagingPrev(form_id) {
	var paging = document.getElementById("paging");

	// 値の設定
	paging.value = "prev";

	// フォームサブミット
	submitForm(form_id);
}
/**
 * ページング処理：次ページ
 *
 * @return
 */
function pagingNext(form_id) {
	var paging = document.getElementById("paging");

	// 値の設定
	paging.value = "next";

	// フォームサブミット
	submitForm(form_id);
}

/**
 * 僧侶情報ページ遷移
 * @param userid
 * @return
 */
function showPriestInfo(userid) {
	var form = document.getElementById("priest_info_form");
	var user_id = document.getElementById("user_id");

	// 値の設定
	user_id.value = userid;

	// actionの設定
	var action = form.action;
	action = action + "?id=" + userid;
	form.action = action;

	// フォームサブミット
	form.submit();
}

