function slideSwitch() {
	var $active = $('#SLIDESHOW div.active');
	if ( $active.length == 0 ) $active = $('#SLIDESHOW div:last');
	var $next =  $active.next().length ? $active.next() : $('#SLIDESHOW div:first');
	$active.addClass('last-active');
	$next.css({opacity: 0.0})
		.addClass('active')
		.animate({opacity: 1.0}, 800, function() {
			$active.removeClass('active last-active');
		});
}
$(function() {
	var slide = setInterval( "slideSwitch()", 3000 );
	$('a.chgImage').mouseover(function(){
		clearInterval(slide);
		var match = $(this).attr("href").match(/\/recipe\/(\d+)\.html/);
		var recipe_id = RegExp.$1;
		var $active = $('#SLIDESHOW div.active');
		if ( $active.length == 0 ) $active = $('#SLIDESHOW div:last');
		$active.addClass('last-active');
		var $next = $('#SLIDESHOW div#osusume_image'+recipe_id)
		$next.css({opacity: 0.0})
			.addClass('active')
			.animate({opacity: 1.0}, 800, function() {
				if($active != $next){
					$active.removeClass('active last-active');
				}
			});
	});
	$('a.chgImage').mouseout(function(){
		slide = setInterval( "slideSwitch()", 3000 );
	});
});

