// =====================================================================
// ----- 1. ÇÃ·¡½¬ °ü·Ã ½ÃÀÛ -------------------------------------------

// ÇÃ·¡½¬ - Åõ¸í
function swf_trans(src,w,h, name)	// (ÀÌ¸§, ³ÐÀÌ, ³ôÀÌ)
{
	if (!name)
	{
		name = "param";
	}

	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="'+name+'" 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="'+name+'" allowScriptAccess="sameDomain" name="'+name+'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"><\/embed>';

	html += '<\/object>';
	document.write(html);
}

// ÇÃ·¡½¬ - ¸ÞÀÎ
function swf_main(src,w,h, name)	// (ÀÌ¸§, ³ÐÀÌ, ³ôÀÌ)
{
	if (!name)
	{
		name = "param";
	}

	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="'+name+'" 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="'+name+'" allowScriptAccess="sameDomain" name="'+name+'" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"><\/embed>';

	html += '<\/object>';
	document.write(html);
}
// ----- 1. ÇÃ·¡½¬ °ü·Ã ³¡ ---------------------------------------------
// =====================================================================


var contextPath = "/yiruma/";

function page_link(idx) {
	menuLink(parseInt(idx));
}

function menuLink(idx)
{
	var url = "";

	switch (idx)
	{
		case 1 : //BIO
			url = contextPath + "bio.asp";
			break;
		case 2 : //NOTICE
			url = contextPath + "notice.asp";
			break;
		case 3 : //SCHEDULE
			url = contextPath + "schedule.asp";
			break;
		case 4 : //REVIEWS
			url = contextPath + "reviews.asp";
			break;
		case 5 : //DISCOGRAPHY
			url = contextPath + "discography.asp";
			break;
		case 6 : //GALLERY
			url = contextPath + "gallery.asp";
			break;
		case 7 : //VIDEO
			url = contextPath + "video.asp";
			break;
		case 8 : //LIVE STAGE
			url = contextPath + "live.asp";
			break;
		case 9 : //FAN LETTER
			url = contextPath + "fan.asp";
			break;
		case 10 : //LINK
			url = contextPath + "link.asp";
			break;
		case 11 : //CONTACT US
			url = contextPath + "contact.asp";
			break;
		case 12 : //LETTER FROM YH
			url = contextPath + "letter.asp";
			break;
		case 13 : //MOBILE
			url = contextPath + "mobile.asp";
			break;
		case 14 : //Á¤º¸¼öÁ¤
			url = contextPath + "edit.asp";
			break;

		default :
			alert(idx + "´Â Àß¸øµÈ ¸Þ´º IndexÀÔ´Ï´Ù.");
			return;
	}

	location.href = url + "?idx=" + idx;
}

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;
}




// ##########################################################################
// ##
// ## 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)
{
	var config = new Object();    // create new config object

	config.width = "100%";
	config.height = "300px";
	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) {}
}

//autoCheck´Â flash¿¡¼­´Â °ªÀ» ³Ñ±âÁö ¾Ê´Â´Ù. Áï, false°ª°ú µ¿ÀÏÇÔ.
//ÆäÀÌÁö»ó¿¡¼­ È£Ãâ½Ã true¸¦ ³Ñ°Ü flash¿¡¼­ È£ÃâÀÌ µÇ¾ú´ÂÁö ÆäÀÌÁö»ó¿¡¼­ È£ÃâµÇ¾ú´ÂÁö¸¦ ÆÇ´ÜÇÔ.
function soundControl2(_playIdx, autoCheck)
{
	try
	{
		var obj = parent.etcFrame.document.all.param;
			obj.playIdx = _playIdx;


		//isOn ÇÁ·ÎÆÛÆ¼´Â ÀÓ½Ã·Î Á¤ÇÑ ÇÁ·ÎÆÛÆ¼ÀÓ.
		if (parent.etcFrame.document.all.param.isOn)
		{
			//flash¿¡¼­ È£ÃâµÇ¾úÀ» °æ¿ì¿¡´Â ¹«Á¶°Ç play
			if (!autoCheck)
			{
				//flash¿¡¼­ È£ÃâµÇ¾úÀ» °æ¿ì¿¡¸¸ isOn ÇÁ·ÎÆÛÆ¼°ªÀ» 'ON'À¸·Î ¼³Á¤ÇÔ
				obj.isOn = "ON";
				obj.GotoFrame(_playIdx + 10);
			}
			//isOn ÇÁ·ÎÆÛÆ¼ °ªÀÌ 'OFF'°¡ ¾Æ´Ò°æ¿ì¿¡¸¸ play
			//Áï, flash¿¡¼­ OFF ÇÏ¿´À» °æ¿ì ÆäÀÌÁö»ó¿¡¼­ ON È£ÃâµÇ¾îµµ play ÇÏÁö ¾ÊÀ½.
			else if (obj.isOn != "OFF")
			{
				obj.GotoFrame(_playIdx + 10);
			}
		}
		//isOn ÇÁ·ÎÆÛÆ¼°¡ Á¤ÀÇ µÇÁö ¾ÊÀ¸¸é ÃÊ±âÈ­ÇÔ
		else
		{
			obj.isOn = "ON";
			obj.GotoFrame(_playIdx + 10);
		}
	}
	catch (e) {}
}

function soundControl3(_playIdx)
{
	try
	{
		parent.etcFrame.document.all.param.playIdx = _playIdx;

		var obj = parent.initFrame.document.all.soundSwf;

		obj.GotoFrame(_playIdx + 10);
	}
	catch (e) {}
}

function onLoadCheck()
{
	var len = document.body.getElementsByTagName("object").length;

	soundControl((len < 4), 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.trim = function()
{
	return this.replace(/^(\s+)|(\s+)$/g,"");
}
