var myCatalogStore = new Ext.data.ArrayStore({
	fields: ['Id', 'register_serial', 'register_dtm', 'post', 'tell', 'catalogname', 'maker_id', 'maker', 'item_id', 'items', 'release_serial', 'release_dtm', 'collectionpoint', 'exp', 'target', 'url', 'dc','dc2', 'image', 'cover', 'onoff', 'limit'],
	sortInfo: {
	    field: 'release_serial',
	    direction: 'DESC' //  または 'ASC' (ローカルなソートのため、大文字小文字の違いを識別する)
	},
	idIndex: 0 // それぞれのレコードのidは最初の要素です。
});
//var myCatalogData = myData;
myCatalogStore.loadData(myData);

function jumpCatalog(_Id){
	location.href = "./intnavi/catalog/search_result.html?Id="+_Id+"&page=0";
}

var catalog_count=0;
function countPage(_onoff, _limit){
	catalog_count++;
	if(catalog_count>5){
		return false;
	}else{
		if(_limit){
			//alert(_limit)
			var today = new Date();
			//▼同日OKにする
			today.setHours(0);
			today.setMinutes(0);
			today.setSeconds(0);
			today.setMilliseconds(0);
			var limit_array = _limit.split("\/");
			var limitday = new Date(limit_array[0],(limit_array[1]-1),limit_array[2]);
			//alert(today.getTime()+":"+limitday.getTime())
			if(today.getTime()>limitday.getTime()){
				//alert("期限切れ");
				_onoff = "onoff";
			}
		}
		if(!_onoff){
			tmpBoolean = true;
		}else{
			tmpBoolean = false;
		}
		return tmpBoolean;
	}
}

//▼一覧テンプレート
var catalog_template = new Ext.XTemplate(
	'<table style="margin:0px 0px 0px 10px;"><tr>',
	'<tpl for="items">',
	'	<tpl for="data">',
	'		<tpl if="Id<9999">',
	'		<tpl if="countPage(onoff,limit)">',
//	'			<tpl if="myPaging.checkIndex(State)">',
//	'				<h3 class="header">{State}</h3>',
//	'			</tpl>',
	'			<td align="left" valign="center" width="123" style="padding:0px 3px 10px 0px; line-height:105%;">',
	'				<ul>',
	'					<li style="height:110px; width:123px; padding-top:10px;">',
	'					<a style="text-decoration: none; color:black;" href="javascript:jumpCatalog({Id});">',
	'					<img class="image-resize" src="./intnavi/images/catalog/{cover}" alt="{catalogname}" width="100" height="100">',
	'					</a>',
	'					</li>',
	'					<li style="font-size:11px; letter-spacing:0.5px; height:70px;">',
	'					<a style="text-decoration:none; color:black;" href="javascript:jumpCatalog({Id});"><span style="color:red;">{release_dtm}発刊</span><br>【{maker}】<br>{catalogname}</a>',
	'					</li>',
//	'					<li>{myPaging.trcount}</li>',
	'				</ul>',
	'			</td>',
//	'			<tpl if="myPaging.checkTr()">',
//	'				</tr><tr>',
//	'			</tpl>',
	'		</tpl>',
	'		</tpl>',
	'	</tpl>',
	'</tpl>',
	'</tr></table>'
);

