function cSwapContentsControl( sID )
{
	this.sControlId = sID
	this.hCurrentSibling = null

	this.sObjName = cSwapContentsControl.CS_OBJ_NAME + (cSwapContentsControl.nCount++)
	this.hObj = this.sObjName
	eval( this.hObj + '= this' )
	
	this.doSwap()
}

cSwapContentsControl.CB_AUTOINIT = true
cSwapContentsControl.CS_OBJ_NAME = 'CS_SWAP_CONTROL'
cSwapContentsControl.CN_SWAP_TIMEOUT = 2000

cSwapContentsControl.nCount = 0

cSwapContentsControl.prototype.doSwap = function()
{
	var hContainer = document.getElementById( this.sControlId )
	if( this.hCurrentSibling != null )
	{
		this.hCurrentSibling.style.display = 'none'
		this.hCurrentSibling = getNextNodeSibling( this.hCurrentSibling )
	}
	if( this.hCurrentSibling == null )
	{
		this.hCurrentSibling = getSubNodeByName( hContainer, 'div' )
	}
	this.hCurrentSibling.style.display = 'block'
	this.hSwapTimeout = setTimeout( this.hObj+'.doSwap()', cSwapContentsControl.CN_SWAP_TIMEOUT )
}

cSwapContentsControl.autoInit = function()
{
	var nI = 0
	var hCLC = null

	var aDIVS = document.getElementsByTagName( 'DIV' )
	for( nI = 0; nI < aDIVS.length; nI ++ )
	{
	 	var sIsSwapContentsControl = aDIVS[ nI ].getAttribute( 'swapcontrol' )
		if( sIsSwapContentsControl != null && sIsSwapContentsControl.length > 0 && sIsSwapContentsControl == 'true' )
		{
			hCLC = new cSwapContentsControl( aDIVS[ nI ].id )
		}
	}
}

if( cSwapContentsControl.CB_AUTOINIT )
{
	if( window.attachEvent ) 
	{
		window.attachEvent( 'onload', cSwapContentsControl.autoInit )
	}
	else if( window.addEventListener )
	{
		window.addEventListener( 'load', cSwapContentsControl.autoInit, false )
	}
} 
