﻿// BannerObject
//
// Copyright (c) 2008 Bryan Jensen.  All Rights Reserved.
// Use of this code without author consent is strictly prohibited.
// 
function BannerObject() 
{
	this.Count = 0;
	this.CurrentBanner = 0;
	this.Links = new Array();
	this.Images = new Array();
	this.Descriptions = new Array();
	this.Durations = new Array();
	this.AddBanner = function(lnk, img, desc, dur)
	{
		this.Count++;
		this.Links[this.Count] = lnk;
		this.Images[this.Count] = img;
		this.Descriptions[this.Count] = desc;
		this.Durations[this.Count] = dur;
		if (this.CurrentBanner == 0)
		{
			this.CurrentBanner = 1;
			this.CreateBanner();
		}
	}
	this.GetLink = function()
	{
		return this.Links[this.CurrentBanner];
	}
	this.GetImage = function()
	{
		return "images\\banners\\" + this.Images[this.CurrentBanner];
	}
	this.GetDescription = function()
	{
		return this.Descriptions[this.CurrentBanner];
	}
	this.GetDuration = function()
	{
		return this.Durations[this.CurrentBanner] * 1000;
	}
	this.NextBanner = function()
	{
		this.CurrentBanner++;
		if (this.CurrentBanner > this.Count) this.CurrentBanner = 1;
		this.CreateBanner();
	}
	this.CreateBanner = function()
	{
		if (this.Count > 0)
		{
			$("div#nfteBanner").html("<a href=\"" + this.GetLink() + "\" onmouseover=\"window.status='" + this.GetDescription() + "';return true;\" onmouseout=\"window.status=''; return true;\"><img alt=\"" + this.GetDescription() + "\" src=\"" + this.GetImage() + "\" border=\"0\" height=\"60\" width=\"468\"></a>").fadeIn("slow");
			setTimeout("Banners.NextBanner()",this.GetDuration());
		}
	}			
}