


function imageRotate() {
	// Set out next image...
	var nextImage = thisImage.next();
	// Check to see if we have reached the end of our loop...
	if (!nextImage || !nextImage.is('a')) {
		// We have reached our last image, so let's go back to the start...
		nextImage = $('.home_rotator a:first-child');	
	}
	
	
	nextImage.css({opacity: 0.0});

	thisImage.animate({opacity: 0.0}, 1000);
	nextImage.animate({opacity: 1.0}, 1000);
	
	thisImage.removeClass('thisImage');
	nextImage.addClass('thisImage');
	thisImage = nextImage;
	
	var imgID = thisImage.attr('id');
	var prev = thisImage.prev();
	//window.alert(imgID);
	
	var nextThumb = thisImage.next();
	if (!nextThumb || !nextThumb.is('a')) {
		// We have reached our last image, so let's go back to the start...
		nextThumb = $('.home_thumbs img:first-child');	
		prevThumb = $('.home_thumbs img:last-child');

		
	}
	else
	{
			prevThumb = $('img[data-id='+imgID+']');
			if (imgID == 1) {
				  $('.home_thumbs img:last-child').css('top', '0px');
			}
	 }
		prevThumb.css('top', '-70px');
		prevThumb.prev().css('top', '0px');

}

$(document).ready(function() {
	thisImage = $('.home_rotator a:first-child');
	setInterval(imageRotate, 6000);
});
