function control_in(control, text){ if (text == control.value) control.value = ''; }
function control_out(control, text){ if ('' == control.value) control.value = text; }

function works_next()
{
	elem = $('.works-item.open');
	
	if (elem.next('.works-item').length > 0)
	{		
		elem.next('.works-item').addClass('open').fadeIn('slow');
	}
	else
	{
		$('.works-item:first').addClass('open').fadeIn('slow');
	}
	
	elem.removeClass('open').fadeOut();
	
	setTimeout("works_next();", 2000);
}

$(document).ready(function()
{
	$('.content-gallery-prev').click(function()
	{
	
		elem = $('.content-gallery-inner img.open');
		
		if (elem.prev('img').length > 0)
		{
			elem.prev('img').addClass('open').fadeIn('slow');
			elem.removeClass('open').fadeOut();
		}
		else
		{
			$('.content-gallery-inner img:last').addClass('open').fadeIn('slow');
			elem.removeClass('open').fadeOut();		
		}
	});

	$('.content-gallery-next').click(function()
	{
		elem = $('.content-gallery-inner img.open');
		
		if (elem.next('img').length > 0)
		{
			elem.next('img').addClass('open').fadeIn();
			elem.removeClass('open').fadeOut();
		}
		else
		{
			$('.content-gallery-inner img:first').addClass('open').fadeIn();
			elem.removeClass('open').fadeOut();		
		}
	});
	
	setTimeout("works_next();", 2000);
	
	
});
