$(document).ready(function(){
 $(".scroll-wrap").css({'width':$(".choice-products").width()+'px'});
 $(".topContent").width(Math.floor($(".scroll-wrap").width()/2.95));
 //$(".topContent").eq(0).width(370);
 //$(".topContent").eq(2).width(370);
 //$(".topContent").eq(1).width($(".scroll-wrap").width()-2*370-7);
 if($(".scroll-pane").width()>$(".scroll-wrap").width()){
		var minX=0;
		var offset=0;
		var dragWidth = 0;
		var per = 0;
		var per2 = 0;
		$(".scroll-pane").parent().append(jQuery('<div></div>').attr({'className':'scrollbar'})
			.append(jQuery('<div></div>').attr({'className':'scrollleft'})
				.append(jQuery('<a></a>').attr({'className':'jScrollArrowleft'}).html('Scroll left'),
				jQuery('<div></div>').attr({'className':'jScrollPaneDrag'})
				.append(jQuery('<div></div>').attr({'className':'dragLeft'}),
				jQuery('<div></div>').attr({'className':'dragRight'})),
				jQuery('<div></div>').attr({'className':'scrollright'})
					.append(jQuery('<a></a>').attr({'className':'jScrollArrowright'}).html('Scroll right'))
				)
			)
		);
		if ($.browser.msie && $.browser.version == 6) {
			$(".scrollbar").css({'position':'relative','top':'4'});
		}
		dragWidth = Math.ceil($('.scrollbar').width() * ($('.scroll-wrap').width() / $('.scroll-pane').width()))-$(".jScrollArrowright").width()-33;
		$(".jScrollPaneDrag").width(dragWidth);
		var maxX = $('.scrollbar').width()-dragWidth-$(".jScrollArrowleft").width()-$(".jScrollArrowright").width()-1;
		updateScroll = function(e) {
			if(offset==0) offset = e.pageX - $(".jScrollPaneDrag").offset()['left'];
			newLeft = e.pageX - $(".scrollbar").offset().left-offset-$(".jScrollArrowright").width();
			newLeft = newLeft > maxX ? maxX : (newLeft < minX ? minX : newLeft);
			$(".jScrollPaneDrag").css({'left':newLeft});
			per = 1/(maxX-minX);
			per2 = per * ($('.scroll-wrap').width() - $('.scroll-pane').width())-0.1;
			$(".scroll-pane").css({'left':Math.ceil(newLeft*per2)+'px'});
		}
		$(".jScrollPaneDrag").bind('mousedown',function(){jQuery('html').bind('mouseup',function(){offset=0;jQuery('html').unbind('mousemove', updateScroll);}).bind('mousemove', updateScroll);});
		
	}
 	
 document.getElementById('wuussaaaaap').onselectstart = function () { return false; }
 
 $(window).resize(function(){
		$(".scroll-wrap").css({'width':$(".choice-products").width()+'px'});
		$(".topContent").width(Math.floor($(".scroll-wrap").width()/2.95));
		// $(".topContent").eq(0).width(370);
		// $(".topContent").eq(2).width(370);
		// $(".topContent").eq(1).width($(".scroll-wrap").width()-2*370-7);
		dragWidth = Math.ceil($('.scrollbar').width() * ($('.scroll-wrap').width() / $('.scroll-pane').width()))-$(".jScrollArrowright").width()-33;
		$(".jScrollPaneDrag").width(dragWidth);
 });
});



