/* Data Table Slider */

$('div.table-container div.table').css({'width': 460})

if ($("div.table table").width()>460) {

	$("table.hide").width($("table.table-style-1 td.fixed").width());
	$("table.hide").width($("table.table-style-1 th.fixed").width());
	$("div.scrollbar").width(460 - $(".colhide").width());
	$("div.bar").width($("div.scrollbar").width() - 40); 
	
	// equals heights of table header (re-work this if time)
	$("table.table-style-1 th").height(40)
	$("table.table-style-1 th.fixed").height("auto")
	$(".colhide td:first").height(40)

 	$('div.table').removeClass("without-js").addClass("with-js");

	$("div.table-container").css('overflow','hidden') // ie only needs this
	$("div.table").css('overflow','hidden') //
  	$('div.scrollbar').show(); //
	$('.colhide').show();

	// browser specific presentation
	if ($.browser.msie || $.browser.safari) { 
	$('.colhide').css('marginTop', 0);
	$(".colhide td:first").css("border", "none")	
	}	

 $('div.table').each(function () {
    var table = $('table', this);
    var productWidth = table.innerWidth() - $(this).outerWidth();

    var slider = $('.bar', this).slider({ 
      handle: '.handle',
      min: 0, 
      max: productWidth, 
      slide: function (ev, ui) {
	
        table.css('left', '-' + ui.value + 'px');

      }, 
      stop: function (ev, ui) {

        table.animate({ 'left' : '-' + ui.value + 'px' }, 460, 'linear');

      }
    });
  });
} 

else 

{
	$('div.table-container div.table table').css({'width': 460})
	$('.colhide').hide();
}