//	È­¸é Áß¾Ó¿¡ ·¹ÀÌ¾îÃ¢ : 
function pLayer(select,mode,width,height) {
	if (select == "popup")	{ //»ó´ã¹®ÀÇ
		DivObj = DivPop.style;
	} else if (select == "popup2") {
		DivObj = DivPop2.style;
	} else if (select == "popup3") {
		DivObj = DivPop3.style;
	} else if (select == "popup4") {
		DivObj = DivPop4.style;
	} else if (select == "popup5") {
		DivObj = DivPop5.style;
	} else if (select == "popup6") {
		DivObj = DivPop6.style;
	} else if (select == "popup7") {
		DivObj = DivPop7.style;
	} else if (select == "popup8") {
		DivObj = DivPop8.style;
	} else if (select == "popup9") {
		DivObj = DivPop9.style;
	} else if (select == "popup10") {
		DivObj = DivPop10.style;
	} 

	var win_width = width;
	var win_height = height;
	var win_left = window.screen.width/2 - win_width/2;
	var win_top = window.screen.height/2 - win_height/2;

	if (mode == "view") {
		DivObj.left = win_left;
		DivObj.top = win_top;
		DivObj.visibility = "visible";
	}else {
		DivObj.visibility = "hidden";
		DivObj.left = 0;
		DivObj.top = 0;
	}
}

//var stmnLEFT = 837; // ½ºÅ©·Ñ¸Þ´ºÀÇ ÁÂÃø À§Ä¡. ÇÊ¿ä ¾øÀ» °æ¿ì »èÁ¦
var stmnGAP1 = 5; // ÆäÀÌÁö Çì´õºÎºÐÀÇ ¿©¹é (ÀÌº¸´Ù À§·Î´Â ¿Ã¶ó°¡Áö ¾ÊÀ½)
var stmnGAP2 = 50; // ½ºÅ©·Ñ½Ã ºê¶ó¿ìÀú »ó´Ü°ú ¾à°£ ¶ç¿ò. ÇÊ¿ä¾øÀ¸¸é 0À¸·Î ¼¼ÆÃ
var stmnBASE = 30; // ½ºÅ©·Ñ¸Þ´º ÃÊ±â ½ÃÀÛÀ§Ä¡ (¾Æ¹«·¸°Ô³ª ÇØµµ »ó°üÀº ¾øÁö¸¸ stmnGAP1°ú ¾à°£ Â÷ÀÌ¸¦ ÁÖ´Â°Ô º¸±â ÁÁÀ½)
var stmnActivateSpeed = 200; // ¿òÁ÷ÀÓÀ» °¨ÁöÇÏ´Â ¼Óµµ (¼ýÀÚ°¡ Å¬¼ö·Ï ´Ê°Ô ¾Ë¾ÆÂ÷¸²)
var stmnScrollSpeed = 10; // ½ºÅ©·ÑµÇ´Â ¼Óµµ (Å¬¼ö·Ï ´Ê°Ô ¿òÁ÷ÀÓ)
var stmnTimer;

// ÄíÅ° ÀÐ±â
function ReadCookie(name) {
	var label = name + "=";
	var labelLen = label.length;
	var cLen = document.cookie.length;
	var i = 0;
	while (i < cLen) {
		var j = i + labelLen;
		if (document.cookie.substring(i, j) == label) {
			var cEnd = document.cookie.indexOf(";", j);
			if (cEnd == -1) cEnd = document.cookie.length;
			return unescape(document.cookie.substring(j, cEnd));
		}
		i++;
	}
	return "";
}

// ÄíÅ° ÀúÀå
function SaveCookie(name, value, expire) {
	var eDate = new Date();
	eDate.setDate(eDate.getDate() + expire);
	document.cookie = name + "=" + value + "; expires=" +  eDate.toGMTString()+ "; path=/";
}

/***** Å¬¸¯ÆË¾÷ ·¹ÀÌ¾î *****/

// ½ºÅ©·Ñ ¸Þ´ºÀÇ À§Ä¡ °»½Å
function RefreshStaticMenu(select) {
	if (select == "popup")	{
		DivObj = DivPop.style;
	} else if (select == "popup2") {
		DivObj = DivPop2.style;
	} else if (select == "popup3") {
		DivObj = DivPop3.style;
	} else if (select == "popup4") {
		DivObj = DivPop4.style;
	} else if (select == "popup5") {
		DivObj = DivPop5.style;
	} else if (select == "popup6") {
		DivObj = DivPop6.style;
	} else if (select == "popup7") {
		DivObj = DivPop7.style;
	} else if (select == "popup8") {
		DivObj = DivPop8.style;
	} else if (select == "popup9") {
		DivObj = DivPop9.style;
	} else if (select == "popup10") {
		DivObj = DivPop10.style;
	} 

	var stmnStartPoint, stmnEndPoint, stmnRefreshTimer;
		stmnStartPoint = parseInt(DivObj.top, 10);
		stmnEndPoint = document.body.scrollTop + stmnGAP2;

	if (stmnEndPoint < stmnGAP1) stmnEndPoint = stmnGAP1;
		stmnRefreshTimer = stmnActivateSpeed;

	if ( stmnStartPoint != stmnEndPoint ) {
		stmnScrollAmount = Math.ceil( Math.abs( stmnEndPoint - stmnStartPoint ) / 15 );
		DivObj.top = parseInt(DivObj.top, 10) + ( ( stmnEndPoint<stmnStartPoint ) ? -stmnScrollAmount : stmnScrollAmount );
		stmnRefreshTimer = stmnScrollSpeed;
	}
	stmnTimer = setTimeout ("RefreshStaticMenu();", stmnRefreshTimer);
}

// ¸Þ´º ON/OFF ÇÏ±â
function ToggleAnimate(select) {
	if (select == "popup")	{
		DivObj = DivPop.style;
	} else if (select == "popup2") {
		DivObj = DivPop2.style;
	} else if (select == "popup3") {
		DivObj = DivPop3.style;
	} else if (select == "popup4") {
		DivObj = DivPop4.style;
	} else if (select == "popup5") {
		DivObj = DivPop5.style;
	} else if (select == "popup6") {
		DivObj = DivPop6.style;
	} else if (select == "popup7") {
		DivObj = DivPop7.style;
	} else if (select == "popup8") {
		DivObj = DivPop8.style;
	} else if (select == "popup9") {
		DivObj = DivPop9.style;
	} else if (select == "popup10") {
		DivObj = DivPop10.style;
	} 

	if (document.all.Animate.checked) { // ÀÌµ¿ÇÏ±â ¹öÆ°ÀÌ Ã¼Å©µÇ¾ú´Ù¸é
		RefreshStaticMenu(select); // ¸Þ´ºÀ§Ä¡¸¦ ´Ù½Ã Á¶Á¤
		SaveCookie("Animate", "true", 300); // ÀÌµ¿ÀÌ ON »óÅÂ¶ó°í ÄíÅ°¸¦ ¼³Á¤
	}
	else { // ¾Æ´Ï¶ó¸é... (ÀÌµ¿ÇÏ±â ¹öÆ°ÀÌ Ã¼Å©µÇ¾î ÀÖÁö ¾ÊÀ¸¸é)
		clearTimeout(stmnTimer); // ÀÌµ¿¿ë Å¸ÀÌ¸Ó ÇØÁ¦
		DivObj.top = stmnGAP1; // ¸Þ´ºÀÇ À§Ä¡¸¦ »ó´ÜÀ¸·Î ¿Å±ä´Ù.
		SaveCookie("Animate", "false", 300); // ÀÌµ¿»óÅÂ°¡ "OFF" ÀÓ
	}
}

// ¸Þ´º ÃÊ±âÈ­
function InitializeStaticMenu(select) {
	if (select == "popup")	{
		DivObj = DivPop.style;
	} else if (select == "popup2") {
		DivObj = DivPop2.style;
	} else if (select == "popup3") {
		DivObj = DivPop3.style;
	} else if (select == "popup4") {
		DivObj = DivPop4.style;
	} else if (select == "popup5") {
		DivObj = DivPop5.style;
	} else if (select == "popup6") {
		DivObj = DivPop6.style;
	} else if (select == "popup7") {
		DivObj = DivPop7.style;
	} else if (select == "popup8") {
		DivObj = DivPop8.style;
	} else if (select == "popup9") {
		DivObj = DivPop9.style;
	} else if (select == "popup10") {
		DivObj = DivPop10.style;
	} 

	if (ReadCookie("Animate") == "false") { // ÀÌµ¿»óÅÂ°¡ off »óÅÂ¶ó¸é
		document.all.Animate.checked = false; // Ã¼Å©Ç¥½Ã¸¦ Áö¿ì°í
		DivObj.top = document.body.scrollTop + stmnGAP1; // ¸Ç À§¿¡ µé·¯ ºÙ´Â´Ù.
	}
	else { // ÀÌµ¿ on »óÅÂ¶ó¸é
		document.all.Animate.checked = true; // Ã¼Å©Ç¥½Ã¸¦ ÇÏ°í
		DivObj.top = document.body.scrollTop + stmnBASE; // ±âº»À§Ä¡·Î ÀÌµ¿ÇÑ´Ù.
		RefreshStaticMenu(); // ½ºÅ©¸³Æ® °¡µ¿
	}
	//DivPop.style.left = stmnLEFT; // ¸Þ´º ¿ÞÂÊ À§Ä¡ ÃÊ±âÈ­. ÇÊ¿ä¾øÀ» °æ¿ì »èÁ¦
}

/***** ÀÚµ¿ÆË¾÷ ·¹ÀÌ¾î *****/

// ½ºÅ©·Ñ ¸Þ´ºÀÇ À§Ä¡ °»½Å
function RefreshStaticMenu2() {
	var stmnStartPoint, stmnEndPoint, stmnRefreshTimer;
		stmnStartPoint = parseInt(EventPop.style.top, 10);
		stmnEndPoint = document.body.scrollTop + stmnGAP2;

	if (stmnEndPoint < stmnGAP1) stmnEndPoint = stmnGAP1;
		stmnRefreshTimer = stmnActivateSpeed;

	if ( stmnStartPoint != stmnEndPoint ) {
		stmnScrollAmount = Math.ceil( Math.abs( stmnEndPoint - stmnStartPoint ) / 15 );
		EventPop.style.top = parseInt(EventPop.style.top, 10) + ( ( stmnEndPoint<stmnStartPoint ) ? -stmnScrollAmount : stmnScrollAmount );
		stmnRefreshTimer = stmnScrollSpeed;
	}
	stmnTimer = setTimeout ("RefreshStaticMenu2();", stmnRefreshTimer);
}

// ¸Þ´º ON/OFF ÇÏ±â
function ToggleAnimate2() {
	if (document.all.Animate2.checked) { // ÀÌµ¿ÇÏ±â ¹öÆ°ÀÌ Ã¼Å©µÇ¾ú´Ù¸é
		RefreshStaticMenu2(); // ¸Þ´ºÀ§Ä¡¸¦ ´Ù½Ã Á¶Á¤
		SaveCookie("Animate2", "true", 300); // ÀÌµ¿ÀÌ ON »óÅÂ¶ó°í ÄíÅ°¸¦ ¼³Á¤
	}
	else { // ¾Æ´Ï¶ó¸é... (ÀÌµ¿ÇÏ±â ¹öÆ°ÀÌ Ã¼Å©µÇ¾î ÀÖÁö ¾ÊÀ¸¸é)
		clearTimeout(stmnTimer); // ÀÌµ¿¿ë Å¸ÀÌ¸Ó ÇØÁ¦
		EventPop.style.top = stmnGAP1; // ¸Þ´ºÀÇ À§Ä¡¸¦ »ó´ÜÀ¸·Î ¿Å±ä´Ù.
		SaveCookie("Animate2", "false", 300); // ÀÌµ¿»óÅÂ°¡ "OFF" ÀÓ
	}
}

// ¸Þ´º ÃÊ±âÈ­
function InitializeStaticMenu2() {
	if (ReadCookie("Animate2") == "false") { // ÀÌµ¿»óÅÂ°¡ off »óÅÂ¶ó¸é
		document.all.Animate2.checked = false; // Ã¼Å©Ç¥½Ã¸¦ Áö¿ì°í
		EventPop.style.top = document.body.scrollTop + stmnGAP1; // ¸Ç À§¿¡ µé·¯ ºÙ´Â´Ù.
	}
	else { // ÀÌµ¿ on »óÅÂ¶ó¸é
		document.all.Animate2.checked = true; // Ã¼Å©Ç¥½Ã¸¦ ÇÏ°í
		EventPop.style.top = document.body.scrollTop + stmnBASE; // ±âº»À§Ä¡·Î ÀÌµ¿ÇÑ´Ù.
		RefreshStaticMenu2(); // ½ºÅ©¸³Æ® °¡µ¿
	}
	//EventPop.style.left = stmnLEFT; // ¸Þ´º ¿ÞÂÊ À§Ä¡ ÃÊ±âÈ­. ÇÊ¿ä¾øÀ» °æ¿ì »èÁ¦
}

