
// this array consists of the id attributes of the divs we wish to alternate between
var divs_to_fade = new Array( 'Image1', 'Image2', 'Image3', 'Image4', 'Image5', 'Image6' );

// the starting index in the above array.  It should be set to the value of the div which doesn't have the CSS Display property set to "none"
var i = 0;

// the number of milliseconds between swaps.  Default is five seconds.
var wait = 7000;

// the function that performs the fade
function swapFade() {
	Effect.Fade(divs_to_fade[i], { duration:3, from:1.0, to:0.0 });
	i++;
	if (i == 6) i = 0;
	Effect.Appear(divs_to_fade[i], { duration:3, from:0.0, to:1.0 });
}

// the onload event handler that starts the fading.
function startPage() {
	setInterval('swapFade()',wait);
}


/* ------------------------------------ */

var current = "ProductPhoto0";

function CrossfadePhoto( id )
{
	// 非表示
	$$( "div.ProductPhoto" ).each(
			function( ele )
			{
				if( ele.id == current )
				{
					new Effect.Appear( ele, { from:1, to:0, duration:0.5 } );
					return;
				}
			}
		);

	current = id;

	// 表示
	new Effect.Appear( $( id ), { from:0, to:1, duration:0.5 } );
}



function ChangeProductPhoto( path, filename, comment )
{
	var element_photo	= $( "ProductPhoto" );
	var element_comment	= $( "ProductComment" );

//	エフェクトが終わったタイミングで画像を切り替える
//	new Effect.Appear( element_photo, { from:1, to:0, duration:0.5 } );
//	new Effect.Appear( element_comment, { from:1, to:0, duration:0.5 } );

	new Effect.Appear( element_photo, { from:0, to:1, duration:0.5 } );
	new Effect.Appear( element_comment, { from:0, to:1, duration:0.5 } );

	element_photo.src = path + filename;
	SetInnerText( element_comment, comment );
}


function SetInnerText( element, text )
{
	if( ! IsIE() )
		element.textContent = text;
	else
		element.firstChild.nodeValue = text;
}


