var fadeSpeed = 3000;
var intervalSpeed = 7000;

$(document).ready(function() {
	setInterval( "mainphotoSwitch()", intervalSpeed );
});

function mainphotoSwitch( id ) {
	
	var active = $('#big_img img.current');
	if ( active.length == 0 ) active = $('#big_img img:last');
	if ( id != null ) var next = $('#big_img img#b_' + id);
	else var next = active.next().length ? active.next() : $('#big_img img:first');
	//alert('next');
	if($('#big_img img').length > 1) {
		$('#big_img img').each(function(){
			if( $(this).attr('id') != active.attr('id') ) $(this).css({opacity:0});
		});
		active.addClass('last-active');
		next.addClass('current').animate({opacity:1}, fadeSpeed);
		active.removeClass('current last-active').animate({opacity:0}, fadeSpeed);
	}
	var prev_id = active.attr("id").replace("b_", "");
	var new_id = next.attr("id").replace("b_", "");
}
