var contentImagePosition = 0;

$(window).resize(function() {
	setOffset();
});

$(document).ready(function()
{
	$("#slider").easySlider(
			{
				controlsShow: false,	
				vertical: false,
				speed: 1500,
				auto: true,
				pause: 5000,
				continuous: true
			});
	

	setOffset();
	$('.naviLink').bind('click', function()
			{
				DoSliderAnimation(this.id);
			});	
});

function setOffset()
{
	$('#content_image').stop();
	
	if(contentImagePosition == 0)
	{
		$('#content_image').offset({top: $('#content_1').offset().top});
		$('#content_image').offset({left: $('#content_1').offset().left});
	}
	else
	{
		$('#content_image').offset({top: $('#content_2').offset().top});
		$('#content_image').offset({left: $('#content_2').offset().left});
	}
}

function DoSliderAnimation(id)
{
	$('#content_image').stop();
	if(contentImagePosition == 0)
	{
		$('#content_image').offset({left: $('#content_1').offset().left});
		var newLeft = $('#content_2').offset().left + 'px';
		$('#content_1').html($('#' + id + 'Div').html());
		$('#content_1')[0].className = $('#' + id + 'Div')[0].className.split(' ')[0];
	}
	else
	{
		$('#content_image').offset({left: $('#content_2').offset().left});
		var newLeft = $('#content_1').offset().left + 'px';
		$('#content_2').html($('#' + id + 'Div').html());
		$('#content_2')[0].className = $('#' + id+ 'Div')[0].className.split(' ')[0];
	}

	contentImagePosition = 1 - contentImagePosition;
	
	$('#content_image').animate(
	{
		left: newLeft
	}, 1000);
}

function getClassName(obj) 
{
	return obj.className;
}
