
String.implement({
	ellipsise: function(toLength, where, ellipsis) { // Where is one of ['front','middle','end'] -- default is 'end'
		if (toLength < 1) return this;
		ellipsis = ellipsis || '\u2026';
		if (this.length < toLength) return this;
		switch (where) {
			case 'front':
				return ellipsis + this.substr(this.length - toLength);
				break;
			case 'middle':
				return this.substr(0, toLength / 2) + ellipsis + this.substr(this.length - toLength / 2)
				break;
			case 'end':
			default:
				return this.substr(0, toLength) + ellipsis;
				break;
		}
	}
});
	window.addEvents({
		'domready': function()
		{

			var div,tpl;
			var jsonRequest = new Request.JSON
			(
				{
					url: "../feed/index.php?both=20&giftonly",
					onSuccess: function(responseJSON, responseText)
					{
					},
					onComplete: function(response)
					{ document.getElementById('SlideItMoo_items').innerHTML = '';
						response.each(function(obj) {
							var s = obj.title;
							var s = s.ellipsise(11);
							var t = '<div class="csl-item-inner"><a href="http://www.borrowme.com/item/detail.php?id=' + obj.id + '" class="thumb"><img src="http://www.borrowme.com/images/item/?id=' + obj.id + '&c=0" alt="' + obj.title + '" title="' + obj.title + '" border="0" /></a><a href="http://www.borrowme.com/item/detail.php?id=' + obj.id + '" class="title">' + s + '</a><span class="location">' + obj.city + '</span></div>';
							div = new Element('div', {
								'class': 'SlideItMoo_element',
								'html': t
							});
							$('SlideItMoo_items').appendChild(div);
						});
						new SlideItMoo({
							overallContainer: 'SlideItMoo_outer',
							elementScrolled: 'SlideItMoo_inner',
							thumbsContainer: 'SlideItMoo_items',		
							itemsVisible:6,
							elemsSlide:3,
							duration:0,
							itemsSelector: '.SlideItMoo_element',
							itemWidth: 151,
							showControls:1});
					}
				}
			).get();




		}
	});


