	var httpObject;
	var timerId;
	var timerIdStatus;
	var timeoutSecondDefault = 10000;		// Timeout (ms)
	var timeoutSecond = timeoutSecondDefault;		// Timeout (ms)
	var timeInterval = 50;	// ms
	var urlTarget = "xml_list.php";

// タイムアウト処理
function checkTimeout()
{
	timeoutSecond -= timeInterval;
	if( timeoutSecond <= 0 )
	{
		// タイマーをストップ
		clearInterval( timerId );
		clearInterval( timerIdStatus );
		timerId = null;
		timerIdStatus = null;
		// HTTPリクエストを中断
		httpObject.abort();
		// エラーダイアログを表示
		timerIdStatus = cheltenhamText_displayTextGradually( "LabelStatus", 'ファイルの読み込みに失敗しました。', 500, 20 );

		// 検索ボタンを有効
		activateButton( true );

		return( false );
	}
}

// POSTデータ
function sendPostData( objectEvent, viewOffset, viewQuantity )
{
	// フォームの値をGET
	var valueGenre = document.getElementById( 'Genre' ).value;
	var valueGenreID = document.getElementById( 'GenreID' ).value;
	var valueCategory = document.getElementById( 'Category' ).value;
	var valueTitle = document.getElementById( 'Title' ).value;
	var valueOrderView = document.getElementById( 'OrderView' ).value;

	// 送信POSTデータ
	var postData = '';
	postData += 'OrderView=' + encodeURIComponent( valueOrderView );
	if( valueTitle != '' )
	{
		postData += '&Title=' + encodeURIComponent( valueTitle );
	}
	if( valueGenre != '' )
	{
		postData += '&Genre=' + encodeURIComponent( valueGenre );
	}
	if( valueGenreID != '' )
	{
		postData += '&GenreID=' + encodeURIComponent( valueGenreID );
	}
	if( valueCategory != '' )
	{
		postData += '&Category=' + encodeURIComponent( valueCategory );
	}

	// HTTP通信を開始
	httpPostRequest( urlTarget, postData, printResultData );
}

// サーバーへデータを送信する関数
function httpPostRequest( urlTarget, postData, functionNext )
{
	// タイマーをリセット
	timeoutSecond = timeoutSecondDefault;

	// タイマーをストップ
	if( timerId != null )
	{
		clearInterval( timerId );
	}
	if( timerIdStatus != null )
	{
		clearInterval( timerIdStatus );
	}

	// XMLHttpリクエストオブジェクト生成
	httpObject = cheltenhamXmlHttpObject_createXmlHttpRequest()
	if( !httpObject )
	{
		cheltenhamXmlHttpObject_noticeFailureCreateXmlHttpRequest();
	}

	// タイマーをセット
	timerId = setInterval( 'checkTimeout()', timeInterval );
	httpObject.open( "post", urlTarget, true );
	httpObject.setRequestHeader( "Content-Type", "application/x-www-form-urlencoded" );
	timerIdStatus = cheltenhamText_displayTextGradually( "LabelStatus", 'Now Loading .............................................................', 2000, 20 );
	httpObject.onreadystatechange = function()
	{
		if( httpObject.readyState == 4 )
		{
			// タイマーをストップ
			clearInterval( timerId );
			timerId = null;
			document.getElementById( 'LabelStatus' ).innerHTML = '　';
			if(  httpObject.status == 200 )
			{
				// 処理を実行
				functionReference = function()
				{
					// タイマーをストップ
					clearInterval( timerIdStatus );
					timerIdStatus = null;
					// 結果をリセット
					printResultList( '' );
					printResultTitle( '' );
					// XML
					var dataXml = httpObject.responseXML;
					var listItem = dataXml.getElementsByTagName( 'Item' );
					// 件数をチェック
					if( listItem.length > 0 )
					{
						// ステータスを表示
						cheltenhamText_displayTextGradually( "LabelStatus", '検索結果は' + listItem.length + '件見つかりました。', 300, 20 );
						functionReference2 = function()
						{
							functionNext( listItem );
						}
						setTimeout( functionReference2, 500 );
					}
					else
					{
						// ステータスを表示
						cheltenhamText_displayTextGradually( "LabelStatus", '検索結果が見つかりませんでした。', 300, 20 );
					}
				}
				setTimeout( functionReference, 0 );
			}
			else
			{
				// ステータスを表示
				cheltenhamText_displayTextGradually( "LabelStatus", '検索結果が見つかりませんでした。', 300, 20 );
			}
		}
	}
	httpObject.send( postData );
}

// 検索結果を表示する関数
function printResultData( listItem )
{
	var dataText = '';
	for( var i = 0 ; i < listItem.length ; i++ )
	{
		// タイトル
		var titleProduct = '';
		if( listItem[ i ].getElementsByTagName( 'Title' )[ 0 ] )
		{
			titleProduct = listItem[ i ].getElementsByTagName( 'Title' )[ 0 ].firstChild.nodeValue;
		}
		// 価格
		var priceProduct = '';
		if( listItem[ i ].getElementsByTagName( 'FormattedPrice' )[ 0 ] )
		{
			priceProduct = listItem[ i ].getElementsByTagName( 'FormattedPrice' )[ 0 ].firstChild.nodeValue;
		}
		// 詳細ページURL
		var urlProduct = '';
		if( listItem[ i ].getElementsByTagName( 'DetailPageURL' )[ 0 ] )
		{
			urlProduct = listItem[ i ].getElementsByTagName( 'DetailPageURL' )[ 0 ].firstChild.nodeValue;
		}
		// 画像
		var dataImage = listItem[ i ].getElementsByTagName( 'SmallImage' );
		var imageProduct = "./image/NoImage.gif";
		if( dataImage.length > 0 )
		{
			if( dataImage[ 0 ].getElementsByTagName( 'URL' )[ 0 ] )
			{
				imageProduct = dataImage[ 0 ].getElementsByTagName( 'URL' )[ 0 ].firstChild.nodeValue;
			}
		}
		// HTML
		dataText += '<a href = "' + urlProduct + '" target = "_blank" onmouseover = "printResultTitle(\'' + titleProduct  + '\');" onmouseout = "printResultTitle(\'\');"><img src = "' + imageProduct + '" class = "ThumbNail"></a>';
	}
	// HTML出力
	printResultList( dataText );
}

// 検索結果のリストタイトルを表示する関数
function printResultList( text )
{
	document.getElementById( 'PanelResultList' ).innerHTML = text;
}
function printResultTitle( text )
{
	document.getElementById( 'LabelResultTitle' ).innerHTML = 'タイトル：' + text;
}

// EventListener
function setListeners( e )
{
	var objectFormKeyword = document.getElementById( 'Keyword' );
	var objectFormCategory = document.getElementById( 'Category' );
	var objectFormGenre = document.getElementById( 'Genre' );
	var objectFormOrderView = document.getElementById( 'OrderView' );
	var objectFormButton = document.getElementById( 'ButtonSubmit' );
//	cheltenhamEvent_addListener( objectFormKeyword, 'keyup', sendPostData, false );
//	cheltenhamEvent_addListener( objectFormCategory, 'change', sendPostData, false );
	cheltenhamEvent_addListener( objectFormGenre, 'change', sendPostData, false );
	cheltenhamEvent_addListener( objectFormOrderView, 'change', sendPostData, false );
	cheltenhamEvent_addListener( objectFormButton, 'click', sendPostData, false );
}

// リスナー設定
cheltenhamEvent_addListener( window, 'load', setListeners, false );


