/**
 * linkerbalk aanpassen aan hoogte
 */
function resizeLeftWrapper()
{
	//linker balk herschalen
	var rightWrapperSize = $('right_wrapper').getSize();
	var scrollTopSize = $('scroll_top').getSize();
	var scrollBottomSize = $('scroll_bottom').getSize();
	var contentSize = $('left_content').getScrollSize();
	var wrapperSize = $('left_wrapper').getSize();

	$('left_wrapper').setStyle('height', rightWrapperSize.y + 'px');
	$('left_content').setStyles({
		'height': rightWrapperSize.y - scrollTopSize.y - scrollBottomSize.y + 'px',
		'width': (contentSize.y > (rightWrapperSize.y - scrollTopSize.y - scrollBottomSize.y)) ? wrapperSize.x + 17 : wrapperSize.x + 'px',
		'padding-top': scrollTopSize.y + 'px',
		'padding-bottom': scrollBottomSize.y + 'px'
	});

	//scroll_down div opnieuw positioneren
	$('scroll_bottom').setStyle('top', rightWrapperSize.y - scrollBottomSize.y + 'px');
}

var direction = 'up';
var scrollInterval = 10;
var scrollSteps = 2;
window.addEvent('domready', function() {

	//muispositie
	$('right_wrapper').addEvent('mousemove', function(e){
		tempX = e.page.x;
		tempY = e.page.y;
	});

	//omhoog scrollen
	$$('.scroll_up').each(function(el){
		el.addEvent('mouseover', function() {
			direction = 'up';
			periodical = scrollLefColumn.periodical(scrollInterval);
		});
		el.addEvent('mouseout', function() {
			$clear(periodical);
		});
	});

	//omlaag scrollen
	$$('.scroll_down').each(function(el){
		el.addEvent('mouseover', function() {
			direction = 'down';
			periodical = scrollLefColumn.periodical(scrollInterval);
		});
		el.addEvent('mouseout', function() {
			$clear(periodical);
		});
	});

	//mouseovers product frontpage
	$$('.product_image').each(function(el){
		var idParts = el.id.split('_');
		var productId = idParts[1];
		el.addEvent('mouseover', function(){
			$('product_hover_title_' + productId).setStyle('display', 'block');
			$('product_hover_title_' + productId).setStyle('z-index', 999);

			if(typeof(DD_belatedPNG) != 'undefined')
				DD_belatedPNG.fix('#product_hover_title_' + productId);

		}).addEvent('mouseout', function(){
			$('product_hover_title_' + productId).setStyle('display', 'none');

			if(typeof(DD_belatedPNG) != 'undefined')
				DD_belatedPNG.fix('#product_hover_title_' + productId);

		});
	});
});

/**
 * linker kolom scrollen
 */
function scrollLefColumn()
{
	var scroll = $('left_content').getScroll();

	if (direction == 'up')
		$('left_content').scrollTo(0, scroll.y - scrollSteps);
	else
		$('left_content').scrollTo(0, scroll.y + scrollSteps);
}
