function Roller(imgID, data, button)
{
	var This = this;
	this.index = 0;
	this.eventList = data;
	this.imgID = imgID;
	this.len = this.eventList.length-1;
	this.timer;
	this.delay;
	this.button = button;

	this.goLink = function()
	{
		if (this.eventList[This.index][1] == "" || this.eventList[This.index][1] == "#")
			return;
		location.href = this.eventList[This.index][1];
	}

	this.chnageImage = function()
	{
		var imgObj = document.getElementById(this.imgID);

		if (this.eventList[This.index][1] == "" || this.eventList[This.index][1] == "#")
		{
			imgObj.onclick = "";
			imgObj.style.cursor = "";
		}
		else
		{
			imgObj.onclick = function() { This.goLink(); }
			imgObj.style.cursor = "hand";
		}

		imgObj.src = this.eventList[This.index][0];
		if (BrowserDetect.browser == "Explorer")		// Internet Explorer
		{
			imgObj.style.filter = "blendTrans(duration=4)";
			imgObj.style.filter = "blendTrans(duration=crossFadeDuration)";
			imgObj.style.visibility="visible";
			imgObj.filters.blendTrans.stop();
			imgObj.filters.blendTrans.Apply();
			imgObj.filters.blendTrans.Play();
		}
		else	// Other
		{
		}
		if (this.button == true)
		{
			this.changeButton();
		}
	}

	this.changeButton = function()
	{
		if (this.eventList.length)
		{
			for (var i=0; i < This.len; i++)
			{
				var no = i+1;
				var btnObj = document.getElementById("event_"+no);
				var img;
				if (This.index == i)
				{
					img = "/images/common/bn_no_" + no + "2.gif";
					btnObj.src = img;
				}
				else
				{
					img = "/images/common/bn_no_" + no + "1.gif";
					if (btnObj.src != img)
					{
						btnObj.src = img;
					}
				}
			}
		}
	}

	this.chnageIndex = function(no)	{ This.index = no; this.chnageImage(); }
	this.rollFunc = function()		{ this.chnageImage(); }
	this.rolling = function()		{ This.index = (This.index + 1) % This.len; This.rollFunc(); }

	this.start = function(time)
	{
		this.chnageImage();
		this.delay = time*1000;
		if (this.eventList.length > 1)
		{
			This.index = -1;
			This.rolling();
			this.timer = setInterval(This.rolling, this.delay);
		}
	}
}

