﻿//store object to hold values
icomefromthenet.ImageStore = new Ext.data.JsonStore({
    url: 'Services/ImageData.ashx',
    root: 'images',
    fields: ['id', 'categoryType'],
    autoLoad: true,
    listeners: {
        load: function(store, records, options) {
            store.clearFilter();
            var count = 24;
            //filter for inital load
            store.filterBy(function(record, id) {
                var value = record.get("id");
                var keep = false;
                var column_count = 8;
                //var keep = Math.round((records.length / column_count));
                //a trim function
                if (count > 0 && Math.random() > 0.3) {
                    keep = true;
                    --count;
                }
                return keep;
            }, this)
        }
    }

});

icomefromthenet.imageurl = "Services/ReturnImg.ashx?id={id}&ThumbIT=true&maintainAspect=false&thumbHi=80&thumbWi=100"


// Dataview X Template
icomefromthenet.dviewXTemplate = new Ext.XTemplate(
   '<tpl for=".">',
        '<div class="thumb-wrap" id="{id}">',
        '<div class="thumb"><img src="' + icomefromthenet.imageurl + '" title="{id}" /></div>',
       '</div></tpl>',
    '<div class="x-clear"></div>'
);
 
 