//------------------------------------------------------------------------------------------------------------
// 2010/03/16  µî·ÏµÈ ¹è³Ê ÀÌ¹ÌÁö ¸®½ºÆ®¸¦ ÁöÁ¤ÇÑ <TD>¶Ç´Â <img>¿µ¿ª¿¡ ·£´ýÇÏ°Ô DisplayÇÑ´Ù
//------------------------------------------------------------------------------------------------------------
// »ý¼ºÀÚ strDestID : DisplayÇÒ <TD>ÅÂ±×ÀÇ ID°ª
//------------------------------------------------------------------------------------------------------------
CRotateBanner = function(strDestID)
{
	this.strDestID = document.getElementById(strDestID);	// ÀÌ¹ÌÁö¸¦ DisplayÇÒ  td Obj¸¦ ±¸ÇÑ´Ù
	this.arrayImgList = new Array();						// º¸¿©ÁÙ Img ¸®½ºÆ®
	this.arrayLinkList = new Array();						// Link ¸®½ºÆ®
	this.iAddIndex = 0;										// µî·ÏµÈ Img ¼ö
	this.iShowIndex = -1;									// ÇöÀç º¸¿©Áö°í ÀÖ´Â ImgÀÇ Index
	this.isShowOn = true;									// Timer¿¡ ÀÇÇØ È£Ãâ½Ã ´ÙÀ½ Img¸¦ Ãâ·ÂÇÒ Áö ¿©ºÎ
	this.isBlendTrans = true;								// Img BlendTrans ¹æ½ÄÀ¸·Î Show(<td> backgroundImage ¿¡¼­¸¸ »ç¿ë)
	this.iDestType = 0;										// DestIDÀÇ Obj Type 0:<td> 1:<img>

	//-- Browser, OS Á¤º¸ ¾Ë±â
	var appName = navigator.appName;
	var version = navigator.appVersion;
/*
	this.ns = ( appName == "Netscape" );
	this.ns4 = this.ns && version.indexOf("4.")!=-1;
	this.ns5 = this.ns && version.indexOf("5.")==0;
	this.ns6 = ( this.ns5 || (this.ns && version.indexOf("6.")!=-1) );
*/
	this.isIE = ( appName == "Microsoft Internet Explorer" );
/*
	this.ie4 = this.ie && version.indexOf("MSIE 4.")!=-1;
	this.ie5 = this.ie && version.indexOf("MSIE 5.")!=-1;
	this.ie6 = this.ie && version.indexOf("MSIE 6.")!=-1;
	this.ie7 = this.ie && version.indexOf("MSIE 7.")!=-1;
*/
	var userAgent = navigator.userAgent.toLowerCase()
	this.isWinows = ( userAgent.indexOf( "windows" ) != -1 )
/*
	this.mac = ( userAgent.indexOf( "mac" ) != -1 )
	this.linux = ( userAgent.indexOf( "linux" ) != -1 )
*/
}
//------------------------------------------------------------------------------------------------------------
// DisplayÇÒ ÀÌ¹ÌÁö¿Í Å¬¸¯½Ã ¸µÅ©ÇÒ Á¤º¸¸¦ µî·ÏÇÑ´Ù
//------------------------------------------------------------------------------------------------------------
CRotateBanner.prototype.AddList = function(strImgPath, strLinkInfo)
{
	this.arrayImgList[this.iAddIndex] = strImgPath;
	this.arrayLinkList[this.iAddIndex] = strLinkInfo;
	this.iAddIndex++;
}
//------------------------------------------------------------------------------------------------------------
// µî·ÏµÈ  ÀÌ¹ÌÁö¿¡¼­ ÇØ´ç IndexÀÌ¹ÌÁö¸¦ DisplayÇÑ´Ù
//------------------------------------------------------------------------------------------------------------
CRotateBanner.prototype.ShowIndex = function(iIndex)
{
	if(!this.isShowOn) return;
	switch(this.iDestType)
	{
		case 1:
			this.strDestID.src = this.arrayImgList[iIndex];
			break;
		default:
			if( this.isIE && this.isWinows && this.isBlendTrans)
			{ 	// Window IE·Î Á¢¼ÓÇßÀ»¶§¿¡´Â blendTrans¹æ½ÄÀ¸·Î DisplayÇÑ´Ù
				this.strDestID.filters.blendTrans.apply();
				this.strDestID.style.backgroundImage="url(" + this.arrayImgList[iIndex] + ")";
				this.strDestID.filters.blendTrans.play();
			}
			else
			{
				this.strDestID.style.backgroundImage="url(" + this.arrayImgList[iIndex] + ")";
			}
	}
	this.iShowIndex = iIndex;
}
//------------------------------------------------------------------------------------------------------------
// µî·ÏµÈ  ÀÌ¹ÌÁö¸¦ ·£´ýÇÏ°Ô DisplayÇÑ´Ù
//------------------------------------------------------------------------------------------------------------
CRotateBanner.prototype.ShowRandom = function()
{
	var iIndex = Math.round(Math.random() * (this.iAddIndex-1));
	if(iIndex == this.iShowIndex)
	{
		iIndex++;
		if(iIndex >= this.iAddIndex) iIndex=0;
	}

	// ¸ÇÃ³À½ È£ÃâµÉ ¶§´Â isBlendTrans¸¦ »ç¿ëÇÏÁö ¾Ê´Â´Ù
	var isBlendTransOld;
	var isBlendTransChanged = (this.iShowIndex == -1);
	if(isBlendTransChanged)
	{
		isBlendTransOld = this.isBlendTrans;
		this.isBlendTrans = false;
	}
	this.ShowIndex(iIndex);
	if(isBlendTransChanged) this.isBlendTrans = isBlendTransOld;
}
//------------------------------------------------------------------------------------------------------------
// µî·ÏµÈ  ÀÌ¹ÌÁö¸¦ ¼øÂ÷ÀûÀ¸·Î DisplayÇÑ´Ù
//------------------------------------------------------------------------------------------------------------
CRotateBanner.prototype.ShowNext = function()
{
	var iIndex = this.iShowIndex+1;
	if(iIndex >= this.iAddIndex) iIndex = 0;
	this.ShowIndex(iIndex);
}
//------------------------------------------------------------------------------------------------------------
// µî·ÏµÈ  ÀÌ¹ÌÁö¸¦ Å¬¸¯½Ã ÇØ´ç URLÀ» ½ÇÇà½ÃÅ²´Ù
//------------------------------------------------------------------------------------------------------------
CRotateBanner.prototype.GoURL = function()
{
	// Calendar ¸¸ ÀÓ½Ã·Î ÆË¾÷À¸·Î ¶ç¿ï ¼ö ÀÖµµ·Ï ¼öÁ¤ÇÔ(2011-06-22) ºÒÇÊ¿ä½Ã »èÁ¦¿ä¸Á
	if(this.arrayLinkList[this.iShowIndex] == 'Calendar')
	{
		PopupWinOpen2('/gallery/calendar2011/calendar.php',1000,700);
		return;
	}
	location.href = this.arrayLinkList[this.iShowIndex];
}
//------------------------------------------------------------------------------------------------------------
