//------------------------------------------------------------------------------------------------------------
// 2010/03/19 : Tab¸Þ´º ¹æ½ÄÀÇ È­¸é Ã³¸®(Tab¸Þ´º´Â °¢°¢ img·Î Ç¥ÇöÇÏ°í ÇØ´ç¸Þ´ºÀÇ È­¸éÀº DIV¿µ¿ªÀ¸·Î Ç¥±âÇÑ´Ù)
//------------------------------------------------------------------------------------------------------------
CSelectTab = function()
{
	this.arrayTabList = new Array();				// Tab¸Þ´ºÀÇ Ç×¸ñ ¸®½ºÆ®
	this.arrayOnMenuList = new Array();				// ¼±ÅÃµÇ¾úÀ»¶§ Tab ¸Þ´º¿¡ º¸¿©ÁÙ img list
	this.arrayOffMenuList = new Array();			// ¼±ÅÃµÇÁö¾Ê¾ÒÀ»¶§ Tab¸Þ´º¿¡ º¸¿©ÁÙ img list 
	this.arrayBodyList = new Array();				// ¼±ÅÃµÇ¾úÀ»¶§ º¸¿©ÁÙ DIV ¸®½ºÆ®
	this.iAddIndex = 0;								// µî·ÏµÈ Tab ¸Þ´º ¼ö
	this.iShowIndex = -1;							// ÇöÀç ¼±ÅÃµÈ Tab¸Þ´ºÀÇ Index°ª
	this.isShowOn = true;							// Timer¿¡ ÀÇÇØ È£Ãâ½Ã ´ÙÀ½ Img¸¦ Ãâ·ÂÇÒ Áö ¿©ºÎ
}
//------------------------------------------------------------------------------------------------------------
// Tab¸Þ´º Ã³¸®ÇÒ Ç×¸ñÀ» µî·ÏÇÑ´Ù
// strTabID : µî·ÏÇÒ Tab¸Þ´ºÀÇ img tagÀÇ ID
// strOnMenuImg : ¼±ÅÃ½Ã DisplayÇÒ img tagÀÇ src°ª
// strOffMenuImg : ¼±ÅÃµÇÁö ¾Ê¾ÒÀ» ¶§ DisplayÇÒ img tagÀÇ src°ª
// strBodyID : ¼±ÅÃ½Ã DisplayÇÒ div tagÀÇ id
//------------------------------------------------------------------------------------------------------------
CSelectTab.prototype.AddList = function(strTabID, strOnMenuImgPath, strOffMenuImgPath, strBodyID)
{
	this.arrayTabList[this.iAddIndex] = document.getElementById(strTabID);
	this.arrayOnMenuList[this.iAddIndex] = strOnMenuImgPath;
	this.arrayOffMenuList[this.iAddIndex] = strOffMenuImgPath;
	this.arrayBodyList[this.iAddIndex] = document.getElementById(strBodyID);

	this.iAddIndex++;
}
//------------------------------------------------------------------------------------------------------------
// Tab MenuÀÇ ¸¶¿ì½º ¼±ÅÃ½Ã TabMenu¿¡ ÇØ´çÇÏ´Â Body¸¦ DisplayÇÑ´Ù
//------------------------------------------------------------------------------------------------------------
CSelectTab.prototype.ShowIndex = function(iIndex)
{
	if(!this.isShowOn || (iIndex == this.iShowIndex)) return;
		
	if(this.iShowIndex > -1) this.arrayTabList[this.iShowIndex].src = this.arrayOffMenuList[this.iShowIndex];
	this.arrayTabList[iIndex].src = this.arrayOnMenuList[iIndex];

	if(this.iShowIndex > -1) this.arrayBodyList[this.iShowIndex].style.display = 'none';
	this.arrayBodyList[iIndex].style.display = 'block';

	this.iShowIndex = iIndex;
}
//------------------------------------------------------------------------------------------------------------
// Tab MenuÀÇ Ç×¸ñ¿¡ ÇØ´çÇÏ´Â Body¸¦ ¼øÂ÷ÀûÀ¸·Î DisplayÇÒ ¼ö ÀÖ°Ô ÇÑ´Ù
//------------------------------------------------------------------------------------------------------------
CSelectTab.prototype.ShowNext = function()
{
	iIndex = this.iShowIndex+1;
	if(iIndex == this.iAddIndex) iIndex = 0;
	this.ShowIndex(iIndex);
}
//------------------------------------------------------------------------------------------------------------
// Tab MenuÀÇ Ç×¸ñ¿¡ ÇØ´çÇÏ´Â Body¸¦ RandomÇÏ°Ô DisplayÇÒ ¼ö ÀÖ°Ô ÇÑ´Ù
//------------------------------------------------------------------------------------------------------------
CSelectTab.prototype.ShowRandom = function()
{
	var iIndex = Math.round(Math.random() * (this.iAddIndex-1));
	if(iIndex == this.iShowIndex)
	{
		iIndex++;
		if(iIndex >= this.iAddIndex) iIndex=0;
	}
	this.ShowIndex(iIndex);
}
//------------------------------------------------------------------------------------------------------------
