/**
 * HitTours site
 * Domestic_Result javascript
 *
 * Noriko Shimazaki
 * 2007/12/23(Sun.)
 */
	var	document_root;
	var	pageURL;
	var	selectURL;

	/**
	 * load時の処理
	 */
	function initialize() {
		// ドキュメントルートを取得（開発処置）
		document_root = getDocumentRoot();
		pageURL = document_root + '/package/domestic/tour/';
		selectURL = document_root + '/package/domestic/select/';

		if ( Element.empty( 'add' ) )	{
			Element.hide( 'insert_add_conditions' );
		} else	{
			Element.hide( 'btn_add_open' );
		}


		/**
		 * Eventハンドラ追加
		 */
		// Clickイベント
		Event.observe( $( 'btn_search' ), 'click', function(){ formSend();  }, false );

		// Changeイベント
		Event.observe( $( 'dm_m_prefecture_id' ), 'change', function(){ changeDetailList();  }, false );

		// 画像の入れ替え
		new Image().src = document_root + '/images/button/toursearch2r.gif';
		pageEffect = new PageEffect();
		pageEffect.imageRollOver( $( 'btn_search' ), document_root + '/images/button/toursearch2r.gif', document_root + '/images/button/toursearch2.gif' );
	}

	/**
	 * FromSend
	 */
	function formSend()	{
		var dm_m_prefecture_id = $( 'dm_m_prefecture_id' ).value;

		if( dm_m_prefecture_id < 1 )	{
			alert( '目的地を選択してください' );
			return false;
		}

		if ( Element.visible( 'insert_add_conditions' ) == true )	{
			$( 'add_open' ).value = 1;
		} else	{
			$( 'add_open' ).value = '';
		}

		$( 'frm_condition' ).submit();
	}

	/**
	 * データを送信して結果を挿入
	 */

	// ホテル
	 function changeDetailList()	{
		var id = $( 'dm_m_prefecture_id' ).value;

		// データ取得
		url = selectURL + 'detail/id/' + id + '/';
		sendGet( url, 'html' );
		return;
	 }

	/**
	 * 追加条件表示･非表示
	 */
	function addOpen()	{
		Element.show( 'insert_add_conditions' );
		Element.hide( 'btn_add_open' );
	}

	function addClose()	{
		Element.hide( 'insert_add_conditions' );
		Element.show( 'btn_add_open' );
	}

	/**
	 * load時のイベントハンドラをセットする
	 */
	Event.observe( window, 'load', initialize, false );

