
$(document).ready(function(){
	// configurator scroll
	$.each( $(".vendor"), function() {
		var vid = $(this).attr('id').replace('vendor','');
		if( vid != vid_ ) {
			$("#vendor" + vid_).scrollTop(0);			
		}
		var div = $("#vendor" + vid);
		var ul = $("#vendor-move" + vid);
		var lastLi = ul.find('p:last-child');
		var divHeight = div.height();
		var ulPadding = 15;
		var ulHeight = lastLi[0].offsetTop + lastLi.outerHeight() + ulPadding;
		if( divHeight > ulHeight ) { // non scroll
			$("#scroll" + vid).css('display','none');
		}
	});
	var vid_ = -1;
	$(".vendor").mousemove( function(e) {
		var vid = $(this).attr('id').replace('vendor','');
		if( vid != vid_ ) {
			$("#vendor" + vid_).scrollTop(0);	
			$("#scroll" + vid_).css('top','0px');
			$("#scroll" + vid_ + " img").css('top', '0px');
		}
		var div = $("#vendor" + vid);
		var ul = $("#vendor-move" + vid);
		var lastLi = ul.find('p:last-child');
		var divHeight = div.height();
		var ulPadding = 15;
		var ulHeight = lastLi[0].offsetTop + lastLi.outerHeight() + ulPadding;
		var top = (e.pageY - div.offset().top) * (ulHeight-divHeight) / divHeight;
		$("#scroll" + vid).css('top',(0+top)+'px');
		$("#scroll" + vid + " img").css('top', (150/(ulHeight-divHeight)*top)+'px');
		div.scrollTop(top);
		vid_ = vid;
	});					   
						   
						   });

//==========================


