/*
	_Banner.js : Sistema de Banners

	Autor: WebHotel
*/

// --------------------------------------------------------
// Clase CBanner
function CBanner( sFile, nTime )
{
	this.m_File  = sFile;
	this.m_nTime = nTime;
} // --- End of Class



// --------------------------------------------------------
// Clase CSysBanner
function CSysBanner( sID, sPath )
{
	this.m_aBanners   = new Array();
	this.m_nCurBanner = 0;
	this.m_sID        = sID;
	this.m_sPath      = sPath;

	this.AddBanner = _AddBanner;
	this.Start     = _Start;
	this.Load      = _Load;
	
// ------------------------------------
// _AddBanner : Aņade un nuevo banner
function _AddBanner( sFile, nTime )
{
	try
	{
		this.m_aBanners[this.m_aBanners.length] = new CBanner( sFile, nTime );
	}
	catch(e) {}
}	


// ------------------------------------
// _Start : Comienza el sistema de banners
function _Start()
{
	try
	{
		window.setTimeout( "__SysBanner.Load()", this.m_aBanners[this.m_nCurBanner].m_nTime );
	}
	catch(e) {}
}

// ------------------------------------
// _Load : Carga un nuevo banner
function _Load()
{
	try
	{
		this.m_nCurBanner += 1;
		
		if ( this.m_nCurBanner >= this.m_aBanners.length )
			this.m_nCurBanner = 0;
			
		var oBanner = this.m_aBanners[this.m_nCurBanner]
		var sFile   = this.m_sPath + oBanner.m_File;
		var oEle    = document.getElementById( this.m_sID );
		
		oEle.loadMovie(0, sFile);

		window.setTimeout( "__SysBanner.Load()", this.m_aBanners[this.m_nCurBanner].m_nTime );
	}
	catch(e) {}
}

} // --- End Of Class


