function fnc_sleep(time){
	setTimeout(doShopSearch, time);
}

function doShopSearch() {
    document.form1.category_id.value = document.search_form.category_id.value;
    document.form1.genre_id.value = document.search_form.genre_id.value;
    document.form1.keyword.value = document.search_form.keyword.value;
    document.form1.LATITUDE.value = document.search_dmy_form.LATITUDE.value;
    document.form1.LONGITUDE.value = document.search_dmy_form.LONGITUDE.value;
    document.form1.ZOOM.value = document.search_dmy_form.ZOOM.value;
    document.form1.bounds.value = document.search_dmy_form.bounds.value;
    
	document.getElementById('category_id_back').value = document.search_form.category_id.value;
	document.getElementById('genre_id_back').value = document.search_form.genre_id.selectedIndex;
	document.getElementById('keyword_back').value = document.search_form.keyword.value;
	document.getElementById('area_id_back').value = '';
	document.getElementById('railway_id_back').value = '';
	document.getElementById('station_id_back').value = '';
	if (document.getElementById('area_id') != null) {
		document.getElementById('area_id_back').value = document.getElementById('area_id').value;
	}
	if (document.getElementById('railway_id') != null) {
		document.getElementById('railway_id_back').value = document.getElementById('railway_id').selectedIndex;
	}
	if (document.getElementById('station_id') != null) {
		document.getElementById('station_id_back').value = document.getElementById('station_id').selectedIndex;
	}
	
    url = "shop_search.php";
    var myAjax = new Ajax.Request(
        url,
        {
            method: 'post',
            asynchronous: false,
            parameters: Form.serialize('form1'),
            onComplete: showResponse
        });
    
}
function shopSearch(start, max)
{
    nowLoadingFlag = true;
    visibleLoadingImage();

    if (start != '') {
        document.form1.S.value = start;
    }
    if (max != '') {
        document.form1.M.value = max;
    }

	fnc_sleep(100);

}

function showResponse(xmlhttp)
{
    var result = eval("(" + xmlhttp.responseText + ")");

    if (result.sts != "0") {
        location.href = "/error.php";
    } else {

        document.getElementById('contents').innerHTML = result.contents;
        document.getElementById('shs').innerHTML = result.page_navi;

        document.getElementById('contents_back').value = xmlhttp.responseText;

        map_disp();
        set_marker(result.map_data);
		rom();

    }
    nowLoadingFlag = false;
}

function shopSearch2(menu)
{
    document.form1.menu_no.value = menu;
    shopSearch();
}

