var homeSliderIndex = 0;
function homeslider(imagesWithContent, images)
{
	$('#imageslider_image1').css({
		'margin-left' : -950,
		'background-image' : 'url("' + imagesWithContent[homeSliderIndex]['image'] + '")'
	}).html(imagesWithContent[homeSliderIndex]['content'])
	.animate({
		'margin-left' : 0
	}, 500, function() {
		$('#imageslider_image2').css({
			'margin-top' : -344 * 2,
			'background-image' : 'url("' + images[homeSliderIndex] + '")'
		})
		.show()
		.delay(4000)
		.animate({
			'margin-top' : -344
		}, 500, function() {
			$('#imageslider_image1').css({
				'margin-left' : -950,
			});
			
			$(this).delay(4000).fadeOut(500, function() {
				homeSliderIndex = (homeSliderIndex + 1) % images.length;
				homeslider(imagesWithContent, images);
			});
		});
	});
}

