Ext.ns("app");

app.ProductScroller = Ext.extend(app.Scroller,
	{
		id: "product-scroller",
		
		controllerId: "producten",
		
		//private
		initComponent:  function()
			{
				var fields =
				[
					"id",
					"title",
					"price",
					"image",
					"description",
					"manufacturerName"
				];
				
				this.mainStore = new Ext.data.JsonStore(
					{
						root: "items",
						url: this.url,
						remoteSort: true,
						fields: fields,
						baseParams: this.baseParams
					}
				);
				
				this.viewStore = new Ext.data.JsonStore(
					{
						root: "items",
						fields: fields							
					}
				);
				
				this.dv = new app.ProductDataView(
					{
						id: this.id + "-view",
						store: this.viewStore,
						height: this.height,	//Important for animation
						width: this.width		//Important for animation						
					}
				);
				
				app.ProductScroller.superclass.initComponent.call(this);
			},
		
		onItemClick: function(dv, index, el, e)
			{
				var r = this.viewStore.getAt(index);
				window.location = "/" + this.controllerId + "/" + r.data.id + "/" + r.data.urlTitle + ".html";	
			}
	}
);
