$(document).ready(function() {
	var $firstImageNode = $(".image:first");
	var $firstImage = $firstImageNode.children("img:first");	
	var $firstComment = $firstImage.next("div");
	$firstImage.mouseenter(function() { $firstComment.css({ 'display': 'block' }); }).mouseleave(function() { $firstComment.css({ 'display': 'none' }); });
	setTimeout(function() { $ChangeImage($firstImageNode, $firstImageNode); }, 1500);
});

function $ChangeImage($firstImageNode, $currentImageNode) {
	var $nextImageNode = $currentImageNode.next(".image");
	if ($nextImageNode.length == 0) $nextImageNode = $firstImageNode;
	var $currentImage = $currentImageNode.children("img:first");
	var $currentComment = $currentImage.next("div");
	var $nextImage = $nextImageNode.children("img:first");
	var $nextComment = $nextImage.next("div");
	$nextImage.mouseenter(function() { $nextComment.css({ 'display': 'block' }); }).mouseleave(function() { $nextComment.css({ 'display': 'none' }); });
	$currentComment.css({ 'display': 'none' });
	$nextComment.css({ 'opacity': '0.0' });
	$nextImage.css({ 'display': 'block', 'opacity': '0.0' });
    $currentImage.animate({ 'opacity': '0.0' }, 2500);
    $nextImage.animate({ 'opacity': '1.0' }, 2500);
	$nextComment.animate({ 'opacity': '1.0' }, 2500);
	setTimeout(function() { $currentImage.css({ 'display': 'none' }); }, 2500);
    setTimeout(function() { $ChangeImage($firstImageNode, $nextImageNode); }, 4000);
}
