$(function() {
	$('.menu').mouseover(function() {
		if($(this).hasClass('_hover')) return;
		$(this).attr('src', $(this).attr('src').replace(/\.png/, '_hover.png'));	
	}).mouseout(function() {
		if($(this).hasClass('_hover')) return;
		$(this).attr('src', $(this).attr('src').replace(/_hover/, ''));	
	});

	$('.column1, .column2').next().slider({
		orientation: "vertical",
		min: 0,
		max: 100,
		value: 100,
		slide: function( event, ui ) {
			var heightDiff 	= $(this).prev().children('.content').height() - $(this).prev().height();
			var top			= (100 - ui.value) * heightDiff / 100;

			$(this).prev().children('.content').css('top', -top);
		}
	});

	$('.column1, .column2').mousewheel(function(e, delta) {
		e.preventDefault();

		var heightDiff 	= $(this).children('.content').height() - $(this).height();
		var top 		= parseInt($(this).children('.content').css('top'))+delta*20;

		if (top < -heightDiff) top = -heightDiff;
		if (top > 0 ) top = 0;

		$(this).children('.content').css('top', top);

		var scroll = 100 + (top * 100 / heightDiff);		
		$(this).next().slider('value', scroll);
	});

	if ($('.column1').children('.content').height() < $('.column1').height()) $('.column1').next().slider('destroy');
	if ($('.column2').children('.content').height() < $('.column2').height()) $('.column2').next().slider('destroy');
});
