function buildScroller() {
	
	var container = $(".create-slider");
	var table = $("table", container);
	var contain = $(".slidebar", container);
	var handle = $(".slider", container);
	var cell = $("td", table);
	
	var itemsWidth;
	var sliderPosition = 0;
	
	table.css('position', 'absolute');
	table.css('top', '90px');
	table.css('left', '0px')
	
	if(table.innerWidth() > container.outerWidth()) {
		
		table.css("left", 0);
		contain.css("display", "block");
		itemsWidth = table.innerWidth() - container.outerWidth();
		var step = cell.innerWidth();
		
		$(handle).slider({
	        animate: 2,
			startValue: 0,
			min: 0,
	        max: itemsWidth,
	        //handle: ".handle",
	       
			change: function(event, ui) {
				table.stop(true, true);
				table.animate({"left": ui.value * -1 + "px"});
			}
			
			
	    });
		
		$(".rew").bind("click", function() { $(handle).slider('moveTo', "-=" + step) });
		$(".ffwd").bind("click", function() { $(handle).slider('moveTo', "+=" + step) });
	} else {
		
		itemsWidth = container.outerWidth() - table.innerWidth();
		table.css("left", itemsWidth/2);
		contain.css("display", "none");
	}
}

$(function() {
	
	buildScroller();
	
	/*$(window).load(function () {
      $(".create-slider table img").reflect({height: 0.7, opacity: 0.1});
    });*/
	
	window.onresize = buildScroller;
});


