var timer;

function mouseIn (elementid)
{
	//alert('mousein('+elementid+')');
	var id = elementid.substring (7, 8);
		
	if ($('.slideshow_left a.active').length == 0 || id != $('.slideshow_left a.active').parent().attr('id').substring (7, 8))
	{
		//alert('change active from '+$('.slideshow_left a.active').parent().attr('id')+' to '+elementid);
		active_element = $('.slideshow_left a.active');
		$('.slideshow_left a').stop();
		$('#'+elementid).children('a').addClass('active');
		$(active_element).animate (
			{
				paddingLeft: '50px',
				backgroundPosition: '5px 50%'
			},
			250, 'swing', function(){
				$(this).removeClass('active');
				$('#slideshow'+id).addClass ('active');
			}
		);
		$('.slideshow_pic.active').fadeOut ('slow');
		$('#slideshow'+id).fadeIn ('slow');
	}


	$('#'+elementid).children('a').stop();
	$('#'+elementid).children('a').animate (
		{
			paddingLeft: '70px',
			backgroundPosition: '25px 50%'
		},
		250
	);
}

function mouseOut (elementid)
{
	/*
	$('#'+elementid).children('a').stop();
	$('#'+elementid).children('a').animate (
		{
			paddingLeft: '50px',
			backgroundPosition: '5px 50%'
		},
		250
	);
	*/
}

$(document).ready (function ()
{	
	$('.slideshow_left a').css('paddingLeft', '50px');
	$('.slideshow_left a').css('backgroundPosition', '5px 50%');
	$('.slideshow_left a.active').css('paddingLeft', '70px');
	$('.slideshow_left a.active').css('backgroundPosition', '25px 50%');
	
	$('#content .slideshow_left .element').mouseover (function ()
	{
		timer = setTimeout ('mouseIn (\''+$(this).attr ('id')+'\')', 100);
	});
	$('#content .slideshow_left .element').mouseout (function ()
	{
		window.clearTimeout (timer);
		mouseOut ($(this).attr ('id'));
	});
	
	mouseIn('trigger1');
});


