// ¾ÆÀÌÇÁ·¡ÀÓ
function iframe_autoresize(arg) {
    arg.height = eval(arg.name+".document.body.scrollHeight");
}

// °øÁö ÆË¾÷Ã¢À» ¶ç¿î´Ù.
function popUpWindow(htmlvalue,names, width, Height, top, left, scrollbar,resizable) {
	if(top == "") top='0';
	if(left == "") left='0';
	if(scrollbar == "") scrollbar='no';
	if(resizable == "") resizable='no';
	window.open (htmlvalue, names, "scrollbars="+ scrollbar+", resizable="+ resizable+", width=" + width + ", height=" + Height + ",top=" + top + ",left=" + left + ", toolbar=no, location=no, directories=no, status=no, copyhistory=no, menubar=no");
}



// Post ¹æ½ÄÀ¸·Î »çÀÌÆ®¸¦ ÀÌµ¿ ½ÃÄÑÁØ´Ù.
function goURLPost(gURL,message) {

	if(message != "") {
		if(confirm(message)) {
			postFormAction(gURL);
			return;
		} else {
			return;
		}
	}
	postFormAction(gURL);
}

// Get ¹æ½ÄÀÇ URL À» ºÐ¼®ÇÏ¿© Post ¹æ½ÄÀÇ Form À¸·Î Àü¼ÛÇÑ´Ù.
function postFormAction(gURL) {
	tempgURL_array = gURL.split("?");	// »çÀÌÆ® URL °ú ÆÄ¶ó¸ÞÅ¸º¯¼ö¸¦ ºÐ¸®ÇÑ´Ù.
	tmpURL = tempgURL_array[0];		// »çÀÌÆ® URL
	tmpPara = tempgURL_array[1];	// ÆÄ¶ó¸ÞÅ¸º¯¼ö
	writeform = "<meta http-equiv='Content-Type' content='text/html; charset=euc-kr'>";
	writeform = writeform + "<form name='autopost_form' action='"+tmpURL+"' method='post'>\n";
	if(tmpPara != "" && tmpPara != null) {
		tmpPara_array = tmpPara.split("&");	// ÆÄ¶ó¸ÞÅ¸º¯¼ö ¹è¿­
		for(i=0;tmpPara_array.length > i;i++) {
			para = tmpPara_array[i];
			para_array = para.split("=");	// ÆÄ¶ó¸ÞÅ¸ÀÇ ÀÌ¸§°ú °ªÀ» ³ª´«´Ù.
			writeform = writeform + "<input type='hidden' name='"+para_array[0]+"' value='"+para_array[1]+"'>\n";
		}
	}
	writeform = writeform + "</form>\n";
	writeform = writeform + "<script>document.autopost_form.submit();</script>\n";

	document.write(writeform);
}


/*
ÀÌ¹ÌÁö¸¦ ÆË¾÷À¸·Î ¶Ù¿ì°í Ã¢º¸´Ù ÀÌ¹ÌÁö°¡ Å¬°æ¿ì µå·¡±×ÇÏ¿© º¸±â°¡ °¡´ÉÇÏ´Ù.
imgpath : ÀÌ¹ÌÁö °æ·Î
wintitle : ÀÌ¹ÌÁö ÆË¾÷Ã¢ÀÇ Å¸ÀÌÆ² ÀÌ¸§
*/
function popupImageView(imgpath,wintitle) {
	// ÀÌ¹ÌÁö Á¤º¸¸¦ °¡Á®¿À±âÀ§ÇÑ ÀÌ¹ÌÁö°´Ã¼ »ý¼º
	var imageobj = new Image();
	imageobj.src = imgpath;

	img_width = imageobj.width;
	img_height = imageobj.height;


	winhtml = "<html>";
	winhtml += "<head>";
	winhtml += "<title>" + wintitle + "</title>";
	winhtml += "<script>";
	winhtml += "function winResize(){";
	winhtml += "	var bodyobj=document.body;";
	winhtml += "	var imageobj = document.images[0];";
	winhtml += "	img_width = imageobj.width;";
	winhtml += "	img_height = imageobj.height;";
	winhtml += "	rewidth=img_width-bodyobj.clientWidth;";
	winhtml += "	reheight=img_height-bodyobj.clientHeight-15;";
	winhtml += "	window.resizeBy(rewidth,reheight);";
	winhtml += "}";
	winhtml += "\n";
	winhtml += "var sx=0;";
	winhtml += "var sy=0;";
	winhtml += "document.onmousedown = dset;";
	winhtml += "function dset() {";
	winhtml += "	sx = event.x;";
	winhtml += "	sy = event.y;";
	winhtml += "}";
	winhtml += "\n";
	winhtml += "function imgmove() {";
	winhtml += "	dx = event.x;";
	winhtml += "	dy = event.y;";
	winhtml += "	mx =  sx - dx;";
	winhtml += "	my =  sy - dy;";
	winhtml += "	sx =  dx;";
	winhtml += "	sy =  dy;";
	winhtml += "	window.scrollBy(mx,my);";
	winhtml += "}";
	winhtml += "</"+"script>";
	winhtml += "</head>";
	winhtml += "<body style='margin:0' Onload='winResize()'>";
	winhtml += "<a style='cursor:move' Ondrag='imgmove();'><img src='" + imgpath + "' border=0 OnClick='window.close();'></a></body></html>";

	winobj = window.open("about:blank","","scrollbars=yes,status=yes,resizable=yes,width="+img_width+",height="+img_height+"");
	winobj.document.open("text/html", "replace");
	winobj.document.write(winhtml);
	winobj.document.close();
}


// ÀÚ½ÅÀº ´ÝÈ÷°í ÀÚ½ÅÀ» ¿­Àº ÆäÀÌÁö´Â ÀÌµ¿½ÃÅ²´Ù.
function win_Close_openerGo(gourl) {
	opener.window.location=gourl;
	window.close();
}

// »õÃ¢À» ¶ç¿ì°í ÀÚ½ÅÀº ´ÝÈù´Ù.
function win_newopen_Close(gourl) {
	window.open (gourl, "_blank");
	window.close();
}


//»õÃ¢¶ç¿ì±â
function open_window(url, target, w, h, s) {
    if(s) s = 'yes';
    else s = 'no';
    var its = window.open(url,target,'width='+w+',height='+h+',top=0,left=0,scrollbars='+s);
    its.focus();
}

//»õÃ¢¶ç¿ì±â 2
function newWindow(htmlvalue) {
	window.open (htmlvalue, "_blank");
}

// »çÀÌÆ®¸¦ ÀÌµ¿ ½ÃÄÑÁØ´Ù.
function goURL(gURL,message) {

	if(message != "") {
		if(confirm(message)) {
			location.href=gURL;
			return;
		} else {
			return;
		}
	}

	document.location=gURL;
}

// »çÀÌÆ®¸¦ ÀÌµ¿ ½ÃÄÑÁØ´Ù.
function goURL_One(gURL,message,tobj) {

	if(message != "") {
		if(confirm(message)) {
			tobj.disabled = true;
			location.href=gURL;
			return;
		} else {
			return;
		}
	}

	document.location=gURL;
}

/**
 * ºê¶ó¿ìÀúÀÇ ¹öÀüÀ» Ã¼Å©ÇÕ´Ï´Ù.
 */
function GetBrowser()
{
	var tempDocument = window.document;

	if (tempDocument.all && tempDocument.getElementById) // ÀÎÅÍ³Ý ÀÍ½ºÇÃ·Î·¯ 5.x
	{
		return 1;
	}
	else if (tempDocument.all && !tempDocument.getElementById) // ÀÎÅÍ³Ý ÀÍ½ºÇÃ·Î·¯ 4.x
	{
		return 2;
	}
	else if (tempDocument.getElementById && !tempDocument.all) // ³Ý½ºÄÉÀÌÇÁ 6
	{
		return 3;
	}
	else if (tempDocument.layers) // ³Ý½ºÄÉÀÌÇÁ 4.x
	{
		return 4;
	}
}

/**
 * ÆË¾÷Ã¢À» ¿øÇÏ´Â À§Ä¡¿¡ »ý¼ºÇÕ´Ï´Ù.
 */
function OpenWindow(url, name, width, height, align, valign, option)
{
    var x,y;
	var window_option = "width="+width+",height="+height;

	if (option!=null) window_option+=","+option;
    if (align==null) align="center";
    if (valign==null) valign="center";

    if (align=="left") x=0;
    else if (align=="right") x=(screen.width-width);
    else if (align=="center") x=(screen.width-width)/2

    if (valign=="top") y=0;
    else if (valign=="bottom") y=(screen.height-height);
    else if (valign=="center") y=(screen.height-height)/2

    window_option+=",left="+x+",top="+y;

    var win = window.open(url,name,window_option);

	focus();
    win.focus();
	return win;
}

/**
 * À©µµ¿ì°¡ ¿­·ÁÀÖ´ÂÁö Ã¼Å©ÇÕ´Ï´Ù.
 */
function isAliveWindow(win)
{
	if (!win.closed) return true;
	else return false;
}

/**
 * »ç¿îµå¸¦ µéÀ»¼ö ÀÖ´ÂÁö È¯°æÀÎÁö Ã¼Å©ÇÕ´Ï´Ù. (IEÀü¿ë)
 */
function EnableSound()
{
  document.write("<OBJECT ID='Player64' CLASSID='CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95' STYLE='display:none'></OBJECT>");
  return Player64.IsSoundCardEnabled();
}

/**
 * ¸®¾óÇÃ·¹ÀÌ¾î(RealPlayer) ¼³Ä¡ ¿©ºÎ Ã¼Å©ÇÕ´Ï´Ù.
 */
function EnableRealPlayer()
{
	var nRealMode=0;
	var nRealPlayer5=0;
	var nRealPlayer4=0;
	var nRealPlayerG2=0;

	if (window.document.all) // IE
	{
		document.write('<SCRIPT LANGUAGE=VBScript\> \n');
		document.write('on error resume next \n');
		document.write('nRealPlayerG2 = (NOT IsNull(CreateObject("rmocx.RealPlayer G2 Control")))\n');
		document.write('nRealPlayer5 = (NOT IsNull(CreateObject("RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)")))\n');
		document.write('nRealPlayer4 = (NOT IsNull(CreateObject("RealVideo.RealVideo(tm) ActiveX Control (32-bit)")))\n');
		document.write('</SCRIPT\> \n');
	}
	else // NS
	{
		var numPlugins = navigator.plugins.length;
		for (var i = 0; i < numPlugins; i++)
		{
			plugin = navigator.plugins[i];
			if (plugin.name.substring(0,10)=="RealPlayer")
			{
				nRealMode=1;
			}
		}
	}

	if (nRealMode || nRealPlayerG2 || nRealPlayer5 || nRealPlayer4)
		return true;
	else
		return false;
}

/**
 * ÆäÀÌÁö ÀÌµ¿À» ÇÕ´Ï´Ù.
 * @param		delay		ÆäÀÌÁö ÀÌµ¿ Áö¿¬ ½Ã°£ (milliseconds)
 */
function MovePage(str,delay)
{
	if (delay==null)
		window.location.href=str;
	else
		window.setInterval("window.location.href='"+str+"'",delay);
}

/**
 * ÇöÀç È÷½ºÅä¸® ¿£Æ®¸®¿¡ ÆäÀÌÁö¸¦ ÀÐ¾îµéÀÔ´Ï´Ù. (µÚ·Î°¡±â ¹öÆ° ºñÈ°¼ºÈ­)
 */
function ReplacePage(str,delay)
{
	if (delay==null)
		window.location.replace(str);
	else
		window.setInterval("window.location.replace('"+str+"')",delay);
}

/**
 * ÇöÀç ÆäÀÌÁö »õ·Î °íÄ§
 */
function ReloadPage(delay)
{
if (delay==null)
		window.location.reload();
	else
		window.setInterval("window.location.reload()",delay);
}

/**
 * ¹®ÀÚ¿­À» Å¬¸³º¸µå¿¡ º¹»çÇÕ´Ï´Ù. (IEÀü¿ë)
 */
function CopyToClip(str)
{
	if (window.document.all) // IEÀÏ¶§
		window.clipboardData.setData('Text',str);
}

/**
 * ºê¶ó¿ìÀúÀÇ ½ÃÀÛÆäÀÌÁö º¯°æÃ¢À» ¶ç¿ó´Ï´Ù. (IEÀü¿ë)
 */
function SetHomePage(url)
{
	window.document.write("<SPAN ID='objHomePage' STYLE='behavior:url(#default#homepage); display:none;' >s</SPAN>");
	window.document.all.objHomePage.setHomePage(url);
}

/**
 * ºê¶ó¿ìÀúÀÇ Áñ°ÜÃ£±â Ãß°¡Ã¢À» ¶ç¿ó´Ï´Ù. (IEÀü¿ë)
 */
function AddFavorite(url, homename)
{
	window.external.AddFavorite(url, homename);
}

/**
 * ¸ð´ÏÅÍ ÇØ»óµµ¸¦ ±¸ÇÕ´Ï´Ù.
 */
function GetWindowResolution()
{
	if (window.screen)
	{
		var returnArray = new Array(2);
		returnArray[0] = window.screen.width;
		returnArray[1] = window.screen.height;
		return returnArray;
	}
	else return false;
}

/**
 * »ç¿ëÀÚÀÇ »ö»ó ¼³Á¤À» ±¸ÇÕ´Ï´Ù.
 * @return		»ö»óºñÆ®¼ö¸¦ ¹ÝÈ¯ÇÕ´Ï´Ù. ( 8ºñÆ® : 256»ö, 16ºñÆ® : ÇÏÀÌÄÃ·¯ , 24ºñÆ® : Æ®·çÄÃ·¯ )
 */
function GetWindowColor()
{
	if (window.screen)
	{
		return screen.colorDepth;
	}
}

/**
 * ºê¶ó¿ìÀúÀÇ Á¦¸ñÇ¥½ÃÁÙÀ» ¼³Á¤ÇÕ´Ï´Ù.
 */
function SetWindowTitle(str)
{
	document.title = str;
}

/**
 * ºê¶ó¿ìÀúÀÇ Á¦¸ñÇ¥½ÃÁÙÀÇ ¹®ÀÚ¿­À» ¹ÝÈ¯ÇÕ´Ï´Ù.
 */
function GetWindowTitle()
{
	return document.title;
}

/**
 * ºê¶ó¿ìÀúÀÇ »óÅÂÇ¥½ÃÁÙÀ» ¼³Á¤ÇÕ´Ï´Ù.
 */
function SetStatusTitle(str)
{
	window.status = str;
}

/**
 * ºê¶ó¿ìÀúÀÇ »óÅÂÇ¥½ÃÁÙÀÇ ¹®ÀÚ¿­À» ¹ÝÈ¯ÇÕ´Ï´Ù.
 */
function GetStatusTitle()
{
	return window.status;
}
