function musicPlay(_id)
{
	PLAYERFRAME.PLAYERHIDDEN.location.href = "/portal/common/player_get_music.asp?aid=" + _id;
}

// =====================================================================
// ----- 1. ÇÃ·¡½¬ °ü·Ã ½ÃÀÛ -------------------------------------------

// ÇÃ·¡½¬ - Åõ¸í
function swf_trans(src,w,h)	// (ÀÌ¸§, ³ÐÀÌ, ³ôÀÌ)
{
	html = '';
	html += '<object type="application/x-shockwave-flash" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" id="param" width="'+w+'" height="'+h+'">';
	html += '<param name="movie" value="'+src+'">';
	html += '<param name="quality" value="high">';
	html += '<param name="bgcolor" value="#ffffff">';
	html += '<param name="wmode" value="transparent">';
	html += '<param name="menu" value="false">';
	html += '<param name="swliveconnect" value="true">';
	html += '<embed src="'+src+'" quality=high bgcolor="#ffffff" menu="false" width="'+w+'" height="'+h+'" swliveconnect="true" id="param" allowScriptAccess="sameDomain" name="param" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"><\/embed>';

	html += '<\/object>';
	document.write(html);
}
function swf_zone(src,w,h)	// (ÀÌ¸§, ³ÐÀÌ, ³ôÀÌ)
{
	html = '';
	html += '<object type="application/x-shockwave-flash" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" id="param" width="'+w+'%" height="'+h+'">';
	html += '<param name="movie" value="'+src+'">';
	html += '<param name="quality" value="high">';
	html += '<param name="bgcolor" value="#ffffff">';
	html += '<param name="wmode" value="transparent">';
	html += '<param name="menu" value="false">';
	html += '<param name="swliveconnect" value="true">';
	html += '<embed src="'+src+'" quality=high bgcolor="#ffffff" menu="false" width="'+w+'%" height="'+h+'" swliveconnect="true" id="param" allowScriptAccess="sameDomain" name="param" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"><\/embed>';

	html += '<\/object>';
	document.write(html);
}

// ÇÃ·¡½¬ - ¸ÞÀÎ
function swf_main(src,w,h)	// (ÀÌ¸§, ³ÐÀÌ, ³ôÀÌ)
{
	html = '';
	html += '<object type="application/x-shockwave-flash" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" id="param" width="'+w+'%" height="'+h+'%">';
	html += '<param name="movie" value="'+src+'">';
	html += '<param name="quality" value="high">';
	html += '<param name="bgcolor" value="#ffffff">';
	html += '<param name="wmode" value="transparent">';
	html += '<param name="menu" value="false">';
	html += '<param name="swliveconnect" value="true">';
	html += '<embed src="'+src+'" quality=high bgcolor="#ffffff" menu="false" width="'+w+'%" height="'+h+'" swliveconnect="true" id="param" allowScriptAccess="sameDomain" name="param" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"><\/embed>';

	html += '<\/object>';
	document.write(html);
}
// ----- 1. ÇÃ·¡½¬ °ü·Ã ³¡ ---------------------------------------------
// =====================================================================


var contextPath = "/portal/";

function menuLink(idx, isLogin)
{
	var url = "";
	var param = "";

	if (isLogin)
	{
		url = contextPath + "common/login.asp";
	}
	else
	{
		switch (idx)
		{
			case 1 : // MAIN
				url = contextPath;
				break;

			// ABOUT STOMPMUSIC
			case 10 : // MAIN
				url = contextPath + "company/company_01.asp";
				param = "&infoKind=1";
				break;
			case 11 : // MORE FOR THE LIFE
				url = contextPath + "company/company_01.asp";
				param = "&infoKind=1";
				break;
			case 12 : // HISTORY
				url = contextPath + "company/company_02.asp";
				param = "&infoKind=2";
				break;
			case 13 : // ÆÄÆ®³Ê½±
				url = contextPath + "company/company_03.asp";
				param = "&infoKind=3";
				break;
			case 14 : // ¹ÂÁ÷ ºñÁö´Ï½º
				url = contextPath + "company/company_04.asp";
				param = "&infoKind=4";
				break;
			case 15 : // AUDITION
				url = contextPath + "company/company_05.asp";
				param = "&infoKind=6";
				break;

			// ARTIST
			case 20 : // MAIN
				url = contextPath + "artist/artist_01.asp";
				break;
			case 21 : // ±¹³»¾ÆÆ¼½ºÆ®
				url = contextPath + "artist/artist_01.asp";
				break;
			case 22 : // ±¹¿Ü¾ÆÆ¼½ºÆ®
				url = contextPath + "artist/artist_02.asp";
				break;

			// ALBUM
			case 30 : // MAIN
				url = contextPath + "album/album.asp";
				break;
			case 31 : // STEADY SELLER
				url = contextPath + "album/album_01.asp";
				param = "&c=1";
				break;
			case 32 : // YIRUMA
				url = contextPath + "album/album_01.asp";
				param = "&c=2";
				break;
			case 33 : // CROSSOVER
				url = contextPath + "album/album_01.asp";
				param = "&c=3";
				break;
			case 34 : // CLASSIC
				url = contextPath + "album/album_01.asp";
				param = "&c=4";
				break;
			case 35 : // JAZZ
				url = contextPath + "album/album_01.asp";
				param = "&c=5";
				break;
			case 36 : // ¿ùµå¹ÂÁ÷
				url = contextPath + "album/album_01.asp";
				param = "&c=6";
				break;
			case 37 : // ETC
				url = contextPath + "album/album_01.asp";
				param = "&c=7";
				break;

			// CONCERT
			case 40 : // MAIN
				url = contextPath + "concert/concert_01.asp";
				break;
			case 41 : // CONCERT
				url = contextPath + "concert/concert_01.asp";
				break;

			// STOMP NEWS LETTER
			case 50 : // MAIN
				url = contextPath + "letter/letter_01.asp";
				break;
			case 51 : // °øÁö»çÇ×
				url = contextPath + "letter/letter_01.asp";
				break;
			case 52 : // ¸®ºä
				url = contextPath + "letter/letter_02.asp";
				break;
			case 53 : // ÀÌº¥Æ®
				url = contextPath + "letter/letter_03.asp";
				break;
			case 54 : // PRESS KIT
				url = contextPath + "letter/letter_04.asp";
				break;
			case 55 : // ½ºÄÉÁÙÇ¥
				url = contextPath + "letter/letter_05.asp";
				break;
			case 56 : // ½ºÅèÇÁ ¸â¹ö °¡ÀÔ¾È³»
				url = contextPath + "letter/letter_06.asp";
				break;

			// STOMP ZONE
			case 60 : // MAIN
				url = contextPath + "zone/zone.asp";
				break;
			case 611 : // ¸ÖÆ¼¹Ìµð¾î - ON-STAGE
				url = contextPath + "zone/zone_01_1.asp";
				break;
			case 612 : // ¸ÖÆ¼¹Ìµð¾î - BACK-STAGE
				url = contextPath + "zone/zone_01_2.asp";
				break;
			case 613 : // ¸ÖÆ¼¹Ìµð¾î - PHOTO ZONE
				url = contextPath + "zone/zone_01_3.asp";
				break;
			case 621 : // FREE STAGE - AUDITION UCC
				url = contextPath + "zone/zone_02_1.asp";
				break;
			case 622 : // FREE STAGE - PHOTO ZONE
				url = contextPath + "zone/zone_02_2.asp";
				break;
			case 63 : // STOMP MAGAZINE
				url = contextPath + "zone/zone_03.asp";
				break;
			case 64 : // STOMP VIP LOUNGE
				url = contextPath + "zone/zone_04.asp";
				break;
			case 651 : // MEMBER LOUNGE - ÀÌº¥Æ®
				url = contextPath + "zone/zone_05_1.asp";
				break;
			case 652 : // MEMBER LOUNGE - Q&A
				url = contextPath + "zone/zone_05_2.asp";
				break;
			case 653 : // MEMBER LOUNGE - °ø¿¬/À½¹Ý °¨»óÆò
				url = contextPath + "zone/zone_05_3.asp";
				break;
			case 654 : // MEMBER LOUNGE - Stomp °ø¿¬¼Ò½Ä
				url = contextPath + "zone/zone_05_4.asp";
				break;
			case 655 : // MEMBER LOUNGE - ¿ì¼öÈ¸¿ø °¡ÀÔ¾È³»
				url = contextPath + "zone/zone_05_5.asp";
				break;

			// SHOPPING
			case 70 : // MAIN
				url = contextPath + "shopping/shopping.asp";
				break;
			case 71 : // HOT ITEM
				url = contextPath + "shopping/shopping_01.asp";
				break;
			case 72 : // ¾Ù¹ü
				url = contextPath + "shopping/shopping_02.asp";
				break;
			case 73 : // °ø¿¬
				url = contextPath + "shopping/shopping_03.asp";
				break;
			case 74 : // ¸ÓÃµ»óÇ°
				url = contextPath + "shopping/shopping_04.asp";
				break;
			case 75 : // ETC
				url = contextPath + "shopping/shopping_05.asp";
				break;

			// MEMBER
			case 80 : // MAIN
				url = contextPath + "common/login.asp";
				break;
			case 81 : // ·Î±×ÀÎ
				url = contextPath + "common/login.asp";
				break;
			case 811 : // ·Î±×¾Æ¿ô
				url = contextPath + "common/logout.asp";
				break;
			case 82 : // È¸¿ø°¡ÀÔ
				url = contextPath + "common/join.asp";
				break;
			case 83 : // ID/PW Ã£±â
				url = contextPath + "common/idpw.asp";
				break;
			case 84 : // °³ÀÎÁ¤º¸º¸È£Á¤Ã¥/ÀÌ¿ë¾à°ü
				url = contextPath + "common/use.asp";
				break;
			case 85 : // CS CENTER
				url = contextPath + "zone/zone_05_2.html";
				break;
			case 86 : // »çÀÌÆ®¸Ê
				url = contextPath + "common/sitemap.asp";
				break;

			// MYPAGE
			case 90 : // MAIN
				url = contextPath + "mypage/mypage_01.asp";
				break;
			case 91 : // MY Æ÷ÀÎÆ®
				url = contextPath + "mypage/mypage_01.asp";
				break;
			case 92 : // MY ¾Ù¹ü/À½¾Ç
				url = contextPath + "mypage/mypage_02.asp";
				break;
			case 93 : // MY ¼îÇÎ
				url = contextPath + "mypage/mypage_03.asp";
				break;
			case 94 : // MY ¾ÆÆ¼½ºÆ®
				url = contextPath + "mypage/mypage_04.asp";
				break;
			case 95 : // MY ÄÜ¼­Æ®
				url = contextPath + "mypage/mypage_05.asp";
				break;
			case 96 : // MY °Ô½Ã±Û
				url = contextPath + "mypage/mypage_06.asp";
				break;
			case 97 : // MY °³ÀÎÁ¤º¸ ¼öÁ¤
				url = contextPath + "mypage/mypage_07.asp";
				break;

			default :
				alert("Àß¸øµÈ ¸Þ´º IndexÀÔ´Ï´Ù.");
				return;
		}
	}

	location.href = url + "?idx=" + idx + param;
}

var    _intValue   = '0123456789';
function isNumber(value)
{
	var isInts = true;
	for(i=0;i<value.length;i++)
	{
		if(_intValue.indexOf(value.substring(i,i+1))<0)
		{
			isInts = false;
			break;
		}
	}

	return isInts;
}

function NumberFormat(obj)
{
	obj.value = obj.value.replaceAll(",", "");

	obj.value = NumberFormating(obj.value);
}

function NumberFormating(values)
{
	var str="";
	var hi;
	var int = values;

	if (int >= 1000)
	{
		while (int >= 1000)
		{
			hi = Math.floor(int/1000);
			lostr = "000" + int%1000;
			len = lostr.length;
			lostr = lostr.substring(len-3,len);
			if (!str)
			{
				str = lostr;
			}
			else
			{
				str = lostr + "," + str;
			}
			int = Math.floor(int/1000);
		}
		str = hi + "," + str;

		return str;
	}
	else
	{
		return (int == "")?0:int;
	}
}

function UnNumberFormat(obj)
{
	obj.value = obj.value.replaceAll(",", "");
	obj.select();
}

// ##########################################################################
// ##
// ## Html Editor °ü·Ã
// ##
// ##########################################################################

_editor_url = "/lib/htmlarea/";

var win_ie_ver = parseFloat(navigator.appVersion.split("MSIE")[1]);

if (navigator.userAgent.indexOf('Mac')        >= 0) { win_ie_ver = 0; }
if (navigator.userAgent.indexOf('Windows CE') >= 0) { win_ie_ver = 0; }
if (navigator.userAgent.indexOf('Opera')      >= 0) { win_ie_ver = 0; }
if (win_ie_ver >= 5.5)
{
	document.write('<scr' + 'ipt src="' +_editor_url+ 'editor.js"');
	document.write(' language="JavaScript"></scr' + 'ipt>');
}
else
{
	document.write('<scr'+'ipt>function editor_generate() { return false; }</scr'+'ipt>');
}

function LoadHtmlEditor(formName)
{
	LoadHtmlEditor (formName, "300px");
}

function LoadHtmlEditor(formName, _height)
{
	var config = new Object();    // create new config object

	if (!_height)
	{
		_height = "400";
	}

	config.width = "100%";
	config.height = _height;
	config.bodyStyle = 'background-color: white; font-family: "±¼¸²"; font-size: 9pt; color:555555;';
	config.debug = 0;

	// NOTE:  You can remove any of these blocks and use the default config!

	config.toolbar = [
		['fontname'],
		['fontsize'],
	//    ['fontstyle'],
		['bold','italic','underline','separator'],
		['strikethrough','subscript','superscript','separator'],
		['linebreak'],
		['justifyleft','justifycenter','justifyright','separator'],
		['OrderedList','UnOrderedList','Outdent','Indent','separator'],
		['forecolor','backcolor','separator'],
		['HorizontalRule','Createlink','InsertImage','InsertTable','htmlmode','popupeditor'],
	//    ['about','help','popupeditor'],
	];

	config.fontnames = {
		"±¼¸²":            "±¼¸²",
		"±¼¸²Ã¼":          "±¼¸²Ã¼",
		"µ¸¿ò":            "µ¸¿ò",
		"µ¸¿òÃ¼":          "µ¸¿òÃ¼",
		"¹ÙÅÁ":            "¹ÙÅÁ",
		"¹ÙÅÁÃ¼":          "¹ÙÅÁÃ¼",
		"±Ã¼­":            "±Ã¼­",
		"±Ã¼­Ã¼":          "±Ã¼­Ã¼",
		"Arial":           "arial, helvetica, sans-serif",
		"Courier New":     "courier new, courier, mono",
		"Georgia":         "Georgia, Times New Roman, Times, Serif",
		"Tahoma":          "Tahoma, Arial, Helvetica, sans-serif",
		"Times New Roman": "times new roman, times, serif",
		"Verdana":         "Verdana, Arial, Helvetica, sans-serif",
		"impact":          "impact",
		"WingDings":       "WingDings"
	};

	config.fontsizes = {
		"1 (8 pt)":  "1",
		"2 (10 pt)": "2",
		"3 (12 pt)": "3",
		"4 (14 pt)": "4",
		"5 (18 pt)": "5",
		"6 (24 pt)": "6",
		"7 (36 pt)": "7"
	  };

	//config.stylesheet = "http://www.domain.com/sample.css";

	config.fontstyles = [   // make sure classNames are defined in the page the content is being display as well in or they won't work!
	  { name: "headline",     className: "headline",  classStyle: "font-family: arial black, arial; font-size: 28px; letter-spacing: -2px;" },
	  { name: "arial red",    className: "headline2", classStyle: "font-family: arial black, arial; font-size: 12px; letter-spacing: -2px; color:red" },
	  { name: "verdana blue", className: "headline4", classStyle: "font-family: verdana; font-size: 18px; letter-spacing: -2px; color:blue" }

	// leave classStyle blank if it's defined in config.stylesheet (above), like this:
	//  { name: "verdana blue", className: "headline4", classStyle: "" }
	];

	editor_generate(formName, config);
}


//autoCheck´Â flash¿¡¼­´Â °ªÀ» ³Ñ±âÁö ¾Ê´Â´Ù. Áï, false°ª°ú µ¿ÀÏÇÔ.
//ÆäÀÌÁö»ó¿¡¼­ È£Ãâ½Ã true¸¦ ³Ñ°Ü flash¿¡¼­ È£ÃâÀÌ µÇ¾ú´ÂÁö ÆäÀÌÁö»ó¿¡¼­ È£ÃâµÇ¾ú´ÂÁö¸¦ ÆÇ´ÜÇÔ.
function soundControl(isPlay, autoCheck)
{
	try
	{
		var obj = parent.etcFrame.document.all.param;

		if (isPlay)
		{
			//isOn ÇÁ·ÎÆÛÆ¼´Â ÀÓ½Ã·Î Á¤ÇÑ ÇÁ·ÎÆÛÆ¼ÀÓ.
			if (parent.etcFrame.document.all.param.isOn)
			{
				//flash¿¡¼­ È£ÃâµÇ¾úÀ» °æ¿ì¿¡´Â ¹«Á¶°Ç play
				if (!autoCheck)
				{
					//flash¿¡¼­ È£ÃâµÇ¾úÀ» °æ¿ì¿¡¸¸ isOn ÇÁ·ÎÆÛÆ¼°ªÀ» 'ON'À¸·Î ¼³Á¤ÇÔ
					obj.isOn = "ON";
					obj.GotoFrame(1);
				}
				//isOn ÇÁ·ÎÆÛÆ¼ °ªÀÌ 'OFF'°¡ ¾Æ´Ò°æ¿ì¿¡¸¸ play
				//Áï, flash¿¡¼­ OFF ÇÏ¿´À» °æ¿ì ÆäÀÌÁö»ó¿¡¼­ ON È£ÃâµÇ¾îµµ play ÇÏÁö ¾ÊÀ½.
				else if (obj.isOn != "OFF")
				{
					obj.GotoFrame(1);
				}
			}
			//isOn ÇÁ·ÎÆÛÆ¼°¡ Á¤ÀÇ µÇÁö ¾ÊÀ¸¸é ÃÊ±âÈ­ÇÔ
			else
			{
				obj.isOn = "ON";
				obj.GotoFrame(1);
			}
		}
		else
		{
			//flash¿¡¼­ È£ÃâµÇ¾úÀ» °æ¿ì¿¡¸¸ isOn ÇÁ·ÎÆÛÆ¼°ªÀ» 'OFF'·Î ¼³Á¤ÇÔ
			if (!autoCheck)
			{
				obj.isOn = "OFF";
			}

			obj.GotoFrame(3);
		}
	}
	catch (e) {}
}

function onLoadCheck()
{
	var len = document.body.getElementsByTagName("object").length;

	soundControl((len < 3), true);
}

window.onload = onLoadCheck;

function na_getCookie( name )
{
	var nameOfCookie = name + "=";
	var x = 0;
	while ( x <= document.cookie.length )
	{
		var y = (x+nameOfCookie.length);
		if ( document.cookie.substring( x, y ) == nameOfCookie )
		{
			if ( (endOfCookie=document.cookie.indexOf( ";", y )) == -1 )
				endOfCookie = document.cookie.length;

			return unescape( document.cookie.substring( y, endOfCookie ) );
		}

		x = document.cookie.indexOf( " ", x ) + 1;

		if ( x == 0 )
			break;
	}
	return "";
}

function na_setCookie( name, value, expiredays )
{
	var todayDate = new Date();
	todayDate.setDate( todayDate.getDate() + expiredays );

	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString() + ";"
}

String.prototype.replaceAll = function(oldStr, newStr) {
	var rStr = oldStr;

	rStr = rStr.replace(/\\/g, "\\\\");
	rStr = rStr.replace(/\^/g, "\\^");
	rStr = rStr.replace(/\$/g, "\\$");
	rStr = rStr.replace(/\*/g, "\\*");
	rStr = rStr.replace(/\+/g, "\\+");
	rStr = rStr.replace(/\?/g, "\\?");
	rStr = rStr.replace(/\./g, "\\.");
	rStr = rStr.replace(/\(/g, "\\(");
	rStr = rStr.replace(/\)/g, "\\)");
	rStr = rStr.replace(/\|/g, "\\|");
	rStr = rStr.replace(/\,/g, "\\,");
	rStr = rStr.replace(/\{/g, "\\{");
	rStr = rStr.replace(/\}/g, "\\}");
	rStr = rStr.replace(/\[/g, "\\[");
	rStr = rStr.replace(/\]/g, "\\]");
	rStr = rStr.replace(/\-/g, "\\-");

  	var re = new RegExp(rStr, "g");
    return this.replace(re, newStr);
}

String.prototype.trim = function()
{
	return this.replace(/^(\s+)|(\s+)$/g,"");
}

function bigImg(src)
{
	var w = 100;
	var h = 100;

	window.open("/lib/bigImg.asp?value=" + escape(src), "bigImg", "width=" + w + ",height=" + h + ",toolbar=no,location=no,menubar=no,scrollbars=no,resizable=no,status=no" );
}

function isNumber(obj) {
	obj.value = obj.value.trim();

	if(isNaN(obj.value)) {
		alert("¼ýÀÚ·Î¸¸ ÀÔ·ÂÇÏ½Ã±â ¹Ù¶ø´Ï´Ù.");
		obj.select();
		return false;
	}
	return true;
}

function NumberFormat(obj)
{
	obj.value = NumberFormating(obj.value);
}

function NumberFormating(values)
{
	var str="";
	var hi;
	var int = values;

	if (int >= 1000)
	{
		while (int >= 1000)
		{
			hi = Math.floor(int/1000);
			lostr = "000" + int%1000;
			len = lostr.length;
			lostr = lostr.substring(len-3,len);
			if (!str)
			{
				str = lostr;
			}
			else
			{
				str = lostr + "," + str;
			}
			int = Math.floor(int/1000);
		}
		str = hi + "," + str;

		return str;
	}
	else
	{
		return (int == "")?0:int;
	}
}

function searchCheck(_searchKind) {
	top.searchFrame.document.form1.searchKind.value = _searchKind;
}
function setSearchText(_searchText) {
	top.searchFrame.document.form1.searchText.value = _searchText;
}
function initSearch() {
	try
	{
		top.searchFrame.document.form1.searchKind.value = "1";
		top.searchFrame.document.form1.searchText.value = "";
	}
	catch (Exception)
	{
	}
}
function portalSearch(_searchText, isKeyChk) {
	if (isKeyChk && event.keyCode == 13)
	{
		setSearchText(_searchText);
	} else if (isKeyChk) {
		return;
	}

	with (top.searchFrame.document.form1) {
		if (searchText.value == "")
		{
			alert("°Ë»ö¾î¸¦ ÀÔ·ÂÇÏ½Ã±â ¹Ù¶ø´Ï´Ù.");
			return;
		}

		target = "initFrame";
		method = "post";
		action = "/portal/common/search_" + searchKind.value + ".asp?idx=999";
		submit();
	}
}

function vodMute(isMute) {
	if (isMute) {
		top.etcFrame.musicPlay();
	} else {
		top.etcFrame.musicPause();
	}
}

function fileDown(value) {
	with (document.form1) {
		target = "_self";
		method = "post";
		action = "/lib/download.asp?downfilename=" + value;
		submit();
	}
}
