if( typeof( imageCarousels )=='undefined' )
{
	imageCarousels = new Object();
}

function newImageCarousel( id, nm,width )
{
	if( nm > 1 )
	{
		imageCarousels[ id ]= Array( nm, 1,width );
		document.write( '<table width="'+width+'" class="carousel_nav"><tr><td class="carousel_previous"><a href="#" onclick="imageCarouselPrev(\''+id+'\');return false;">&lt;</a></td><td><span class="carousel_numbers"><span class="gap"> </span>');
		for( var i=1;i<=nm;i++)
		{
			document.write( '<a id="'+id+'_carousel_number_'+i+'" href="#" '+(i==1?' class="carousel_number_current"':'')+' onclick="imageCarouselChange( \''+id+'\','+ i+' );return false;">'+i+'</a><span class="gap"> </span>');
		}
		document.write( '</span></td><td class="carousel_next"><a href="#" onclick="imageCarouselNext(\''+id+'\');return false;">&gt;</a></td><tr></table>');
	}
}

function imageCarouselChange( id, nm )
{
	if( imageCarousels[ id ][ 1 ] != nm && document.getElementById )
	{
		var ele1 = document.getElementById(id+'_'+nm);
		var ele2 = document.getElementById(id+'_'+imageCarousels[ id ][ 1 ]);
		var ele3 = document.getElementById(id+'_carousel_number_'+nm);
		var ele4 = document.getElementById(id+'_carousel_number_'+imageCarousels[ id ][ 1 ]);
		ele3.className='carousel_number_current';
		ele4.className='';
		ele1.style.display='';
		ele2.style.display='none';
		imageCarousels[ id ][ 1 ]=nm;
	}
}
function imageCarouselPrev( id )
{
	if( imageCarousels[ id ][ 1 ] > 1 )
	{
		imageCarouselChange( id, imageCarousels[ id ][ 1 ]-1 );
	}
}
function imageCarouselNext( id )
{
	if( imageCarousels[ id ][ 1 ] < imageCarousels[ id ][ 0 ] )
	{
		imageCarouselChange( id, imageCarousels[ id ][ 1 ]+1 );
	}
}