function goLoginPage() {
	document.CLGNFRM.submit();
}

function nav_main(url) {
	if (url == undefined) {
		url = "http://www.xxx.com/";
	}
	location.href = url;
}

function buy(Lcate, Mcate) {
	nav_main("/pages/attend/application.asp?lCate="+Lcate+"&Mcate="+Mcate);
}

function nav_open(url) {
	if (url != undefined) {
		if (url != "") {
			window.open(url,"","");
		}
	}
}

function sound(file_name, width, height) {
    document.write('<OBJECT id="mPlayer" style="LEFT: 0px; TOP: 0px" width="'+width+'" height="'+height+'" classid="clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95">');
	document.write('<PARAM NAME="AutoSize" VALUE="0">');
	document.write('<PARAM NAME="AutoStart" VALUE="1">');
	document.write('<PARAM NAME="Volume" VALUE="-100">');
	document.write('<PARAM NAME="Filename" value="'+file_name+'">');
	document.write('<PARAM NAME="CanSeek" VALUE="1">');
	document.write('<PARAM NAME="CanSeekToMarkers" VALUE="1">');
	document.write('<PARAM NAME="ShowPositionControls" VALUE="0">');
	document.write('<PARAM NAME="ShowCaptioning" VALUE="0">');
	document.write('</OBJECT>');
}

function goOpenUrl(url,size,scroll) {
	if (url == undefined) { url = "http://www.xxx.co.kr/"; }
	if (scroll == undefined) { scroll = "0"; }
	if (size != undefined) {
		var splitS = size.split(",");
		var ws = splitS[0];
		var hs = splitS[1];
		if (scroll == "0") {
			window.open(url,"","width="+ws+",height="+hs);
		} else {
			window.open(url,"","width="+ws+",height="+hs+",scrollbars=1");
		}
	} else {
		window.open(url,"","");
	}
}

//ÄíÅ° °¡Á®¿À±â
function 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 ""; 

} 
/***************************************************************************************************/
var ASCII_WIDTH_TABLE = new Array(
	0,6,6,6,6,6,6,6,6,0,0,0,0,0,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
	6,6,6,6,0,4,4,6,6,10,0,4,5,5,6,6,4,6,4,6,6,6,6,6,6,6,6,6,6,
	6,4,4,0,6,8,6,12,8,8,9,8,8,7,9,8,3,6,8,7,11,9,9,8,9,8,8,8,8,
	8,10,8,8,8,6,11,6,6,6,4,7,7,7,7,7,3,7,7,3,3,6,3,11,7,7,7,7,4,
	7,3,7,6,10,7,7,7,6,6,6,9,6,10,10,10,10,10,10,10,10,10,10,10,10,
	10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,4,5,
	6,6,7,6,3,6,6,9,5,6,7,0,9,6,4,10,4,4,4,7,7,3,3,4,5,6,6,6,6,7,9,9,
	9,9,9,9,11,8,7,7,7,7,4,4,4,4,9,9,9,9,9,9,9,10,9,9,9,9,9,8,7,6,5,5,
	5,5,5,5,8,5,5,5,5,5,3,3,3,3,6,6,6,6,6,6,6,10,6,6,6,6,6,7,7,7);
var KOREAN_WIDTH = 12;

function get_bytes(str) {
	str = "" + str;
	var n;
	var len = str.length;
	var bytes = 0;
	for (var i = 0 ; i < len ; i++) {
		n = str.charCodeAt(i);
		bytes += (n < 0 || n > 127) ? 2 : 1;
	}
	return bytes;
}

function LEFT(str, len)	{
	len = isNaN(len) ? 1 : +len;
	return C_STR(str).substring(0, len);
}

function RIGHT(str, len) {
	len = isNaN(len) ? 1 : +len;
	return C_STR(str).substring(C_STR(str).length - len);
}

function MID(str, index, len) {
	index = isNaN(index) ? 0 : +index;
	if (!isNaN(len))
		return C_STR(str).substring(index, index + len);
	else
		return C_STR(str).substring(index);
}

function LTRIM(str)	{
	while (C_STR(str).charAt(0) == ' ')
	{
		str = MID(str, 1);
	}
	return str;
}

function RTRIM(str)	{
	while (C_STR(str).charAt(C_STR(str).length - 1) == ' ')
		str = LEFT(str, C_STR(str).length - 1);
	return str;
}

function TRIM(str) {
	str = LTRIM(str);
	str = RTRIM(str);
	return str;
}

function C_STR(str)	{
	return (typeof(str) == "undefined" ? "" : "" + str);
}

function CSTR(o){return (""+o);}
function CINT(o){return parseInt(o);}

function GetChrWidth(chr) {
	var n = CSTR(chr).charCodeAt(0);
	return ( (n >= 0 && n < 256) ? ASCII_WIDTH_TABLE[n] : KOREAN_WIDTH );
}

function GetStrWidth(str) {
	var w = 0;
	str = CSTR(str);
	for (var i = 0 ; i < str.length ; i++)
		w += GetChrWidth(str.charAt(i));
	return w;
}

// Á¦¸ñ ±ÛÀÚ¼ö Â©¶óÁÜ
function MakeStrEllipsis(str, width) {
	str = CSTR(str);
	width = CINT(width);
	var w = 0;
	var addedStr = "..";
	var addedWidth = GetStrWidth(addedStr);
	if (GetStrWidth(str) <= width) return str;
	for (var i = 0 ; i < str.length ; i++)
	{
		w += GetChrWidth(str.charAt(i));
		if (w + addedWidth > width) {--i;break;}
	}
	return LEFT(str, i+1)+addedStr;
}

function runObj(string)
{
	if(string != undefined) {
		document.write(string);
	}
}

function runObj_tframe(string, tframe)
{
	if(tframe == null)
	{
		if(string != undefined) {
			document.write(string);
		}
	}
	else
	{
		if(string != undefined) {
			tframe.document.write(string);
		}
	}
}

function runObj_innerHTML(string, tobj)
{
	if(string != undefined) {
		tobj.innerHTML = string;
	}
}

function auto_fit_size(w_width, w_height)
{
/*
	var Dwidth = null;
	var Dheight = null;

	if(w_width == null ||  w_width == '')
		Dwidth = parseInt(document.body.scrollWidth);
	else
		Dwidth = parseInt(w_width);

	if(w_height == null ||  w_height == '')
		Dheight = parseInt(document.body.scrollHeight);
	else
		Dheight = parseInt(w_height);

	var divEl = document.createElement("div");
	divEl.style.position = "absolute";
	divEl.style.left = "0px";
	divEl.style.top = "0px";
	divEl.style.width = "100%";
	divEl.style.height = "100%";

	document.body.appendChild(divEl);

	window.resizeBy(Dwidth-divEl.offsetWidth, Dheight-divEl.offsetHeight);

	document.body.removeChild(divEl);
*/
	var thisX = parseInt(document.body.scrollWidth);
	var thisY = parseInt(document.body.scrollHeight);
	var maxThisX = screen.width - 50;
	var maxThisY = screen.height - 50;
	var marginY = 0;

	if (navigator.userAgent.indexOf("MSIE 8") > 0) marginY = 72;        // IE 8.x
	else if(navigator.userAgent.indexOf("MSIE 7") > 0) marginY = 75;    // IE 7.x
	else if(navigator.userAgent.indexOf("MSIE 6") > 0) marginY = 45;    // IE 6.x
	else if(navigator.userAgent.indexOf("Firefox") > 0) marginY = 50;   // FF
	else if(navigator.userAgent.indexOf("Opera") > 0) marginY = 30;     // Opera
	else if(navigator.userAgent.indexOf("Netscape") > 0) marginY = -2;  // Netscape

	if (thisX > maxThisX) {
		window.document.body.scroll = "yes";
		thisX = maxThisX;
	}
	if (thisY > maxThisY - marginY) {
		window.document.body.scroll = "yes";
		thisX += 19;
		thisY = maxThisY - marginY;
	}
	window.resizeTo(thisX+10, thisY+marginY);
}

/***************************************************************************************************/
/*                             »ó´Ü¸Þ´º °ü·Ã Àü¿ªº¯¼­.										       */
/***************************************************************************************************/
/***************************************************************************************************/
/*                             ¿ä±â ¾Æ·¡¿¡¼­ ºÎÅÍ.. °³ÀÎ ÇÔ¼ö¸¦ Ãß°¡ÇÏ¼¼¿ä.                        */
/***************************************************************************************************/

//#ºñÁÖ¾ó½ºÅ©¸³Æ® ±è¿ìÁ¤ Ãß°¡
/*ActiveX ÇÃ·¡½¬*/
// id: flash id
// url: source url
// w: source width
// h: source height
// t: wmode (none/transparent/opaque)

function Flash(id,url,w,h,bg,t){
document.write("\
<object classid='clsid:d27cdb6e-ae6d-11cf-96b8-444553540000' codebase='http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0' width="+w+" height="+h+" id="+id+">\
<param name='movie' value="+url+" />\
<param name='wmode' value="+t+" />\
<param name='bgcolor' value="+bg+" />\
<param name='allowScriptAccess' value='always' />\
<param name='quality' value='high' />\
<param name='menu' value='false' />\
<embed src="+url+" width="+w+" height="+h+" name="+id+" bgcolor="+bg+" wmode="+t+" allowScriptAccess='always' quality='high' type='application/x-shockwave-flash' pluginspage='http://www.macromedia.com/go/getflashplayer' />\
</object>\
");
}


/*ActiveX µ¿¿µ»ó<script>Movie('url','178','133','0');</script*/
function Movie(url,width,height,controls){
document.write("\
<object width='"+width+"' height='"+height+"' id='Player' classid='clsid:22D6f312-B0F6-11D0-94AB-0080C74C7E95' codebase='http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701' standby='Loading Microsoft Windows Media Player components...' type='application/x-oleobject' VIEWASTEXT>\
<param name='AutoRestart' value='true'>\
<param name='AutoRewind' value='false'>\
<param name='ShowAudioControls' value='true'>\
<param name='ShowControls' value='"+controls+"'>\
<param name='PlayCount' value='1'>\
<param name='EnableContextMenu' value='0'>\
<param name='BufferTime' value='3'>\
<param name='ClickToPlay' value='false'>\
<param name='AnimationAtStart' value='false'>\
<param name='FileName' value='"+url+"'>\
<param name='Volume' value='0'>\
</object>\
");
}

function fncAct(nextUrl) {
	document.addInfoForm.action = nextUrl;
	document.addInfoForm.submit();
}

function actLogin() {
	var pForm = document.loginForm;
	if(pForm.userid.value == "") {
		alert("¾ÆÀÌµð¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");
		pForm.userid.focus();
		return;
	}
	if(pForm.passwd.value == "") {
		alert("ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇÏ¼¼¿ä.");
		pForm.passwd.focus();
		return;
	}

	pForm.submit();
}

function formatnumber(num)
{
	num	=	num.toString();
	var strLen	=	num.length;
	var retVal	=	"";

	for(var i = 0; i < strLen; i++)
	{
		if(((strLen - i) % 3 == 0) && i > 0)
			retVal	=	retVal + "," + num.substring(i, i + 1);
		else
			retVal	+=	num.substring(i, i + 1);
	}

	return retVal;
}

function fncCMAct(nextUrl) {
	document.glLoginForm.action = nextUrl;
	document.glLoginForm.submit();
}

function goBlog(userid, pageType, viewSid) {
	var f = document.BlogForm;
	var HelloBlog = window.open("about:blank","HelloBlog","width=935, height=630");

	f.UserID.value = userid;
	f.viewSid.value = viewSid;

	f.target = "HelloBlog";
	f.action = "/pages/community/blog_"+ pageType +".asp";
	f.submit();
}

function videoStart(teacher, sseq, joinName, joinerID, peopleCnt)
{
	var teacherId = sseq;
	var url = "http://www.hello-et.com/accuzone/videoStart.asp?Teacher=" + teacher + "&JoinerID=" + joinerID + "&JoinerName=" + joinName + "&StudentID=" + teacherId + "&peopleCnt=" + peopleCnt;
	window.open(url, "", "width=100, height=100");
}
function fullScreenOpen(whatIsIt) {
	var widthValue = screen.availWidth - 11;
	var heightValue = screen.availHeight - 50;
	var  propertyValue;
	propertyValue = "width="+ widthValue +",height="+ heightValue +", toolbar=no,top=0,left=0,resizable=yes,scrollbars=no,status=no";
window.open(whatIsIt,'hellocourse',propertyValue);
}

// png ÆÄÀÏ Åõ¸í Ã³¸® 
function setPng24(obj) {
    obj.width=obj.height=1;
    obj.className=obj.className.replace(/\bpng24\b/i,'');
    obj.style.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='"+ obj.src +"',sizingMethod='image');"
    obj.src='';
    return '';
}