/**
 * HitTours site
 * Index javascript
 *
 * Noriko Shimazaki
 * 2007/12/25(Tue.)
 */
	var	document_root;
	var	pageURL;

	/**
	 * load時の処理
	 */
	function initialize() {

		// ドキュメントルートを取得（開発処置）
		document_root = getDocumentRoot();
		overseasURL = document_root + '/package/overseas/';
		domesticURL = document_root + '/package/domestic/';

		// 海外セレクトメニュー挿入
		initOverseasOptions();

		// 中央コンテンツ挿入
		insertContents();
	}

	/**
	 * 中央コンテンツ挿入
	 */
	function insertContents()	{
		// 海外コンテンツ
		var	url = overseasURL + 'toppage/contents/';
		sendGet( url, 'html' );

		// 国内コンテンツ
		var	url = domesticURL + 'toppage/contents/';
		sendGet( url, 'html' );
		return;

	}

	/**
	 * 海外セレクトメニュー初期設定
	 */
	function initOverseasOptions()	{
		var	url = overseasURL + 'toppage/initialize/';

		sendGet( url, 'html' );
		return;
	}


	/**
	 * 国内セレクトメニュー初期設定
	 */
	function initDomesticOptions()	{
		url = domesticURL + 'toppage/initialize/';

		sendGet( url, 'html' );
		return;
	}

	/**
	 * sendOverseasForm
	 */
	 function sendOverseasForm()	{
		var m_area_id = $( 'm_area_id' ).value;
		var m_country_id = $( 'm_country_id' ).value;

		if( m_area_id < 1 )	{
			alert( '地域，国を選択してください' );
			return false;
		}

		if( m_country_id < 1 )	{
			alert( '国を選択してください' );
			return false;
		}

		 $( 'frm_condition' ).submit();
	 }

	/**
	 * データを送信して結果を挿入
	 */
	// 目的地(国)
	 function changeCountryList()	{
		var id = $( 'm_area_id' ).value;

		// データ取得
		url = overseasURL + 'select/country/id/' + id + '/';

		sendGet( url, 'html' );
		return;
	 }

	// 目的地(都市)
	 function changeCityList()	{
		var id = $( 'm_country_id' ).value;

		// データ取得
		url = overseasURL + 'select/city/id/' + id + '/';

		sendGet( url, 'html' );
		return;
	 }

	/**
	 * sendDomesticForm
	 */
	 function sendDomesticForm()	{
		var dm_m_prefecture_id = $( 'dm_m_prefecture_id' ).value;

		if( dm_m_prefecture_id < 1 )	{
			alert( '目的地を選択してください' );
			return false;
		}

		 $( 'frm_condition' ).submit();
	 }

	/**
	 * load時のイベントハンドラをセットする
	 */
	Event.observe( window, 'load', initialize, false );


