function goLoginPage() {
//	document.CLGNFRM.PURL.value = document.location;
	document.CLGNFRM.submit();
}


function gatherAlert(){
	alert('Á¾ÇÕ¹Ý ÆÇ¸Å°¡ Áß´Ü µÇ¾ú½À´Ï´Ù. °¨»çÇÕ´Ï´Ù.');
}

function gatherAlert1(){
	alert('´Ü°ú¹Ý ÆÇ¸Å°¡ Áß´Ü µÇ¾ú½À´Ï´Ù. °¨»çÇÕ´Ï´Ù.');
}

function openWin(dir,inputname,form1,file_seq){
	goOpenUrl("/pages/common/upload.asp?dir="+dir+"&inputName="+inputname+"&file_seq="+file_seq+"&openerform="+form1,"480,300");
}

function setfname(fname, inputname, form_name){
	frmtarget = eval("document."+form_name+"." + inputname);
	frmtarget.value = fname;
}

function goLocationUrl(url) {
	if (url == undefined) {
		url = "http://www.et-house.com/";
	}
	location.href = url;
}
function download(d_file){
	var nUrl = "http://file.et-house.com/ne_common/download.asp?contets_file="+d_file;
	window.open(nUrl,'filedownload','width=1,height=1,left=10000,top=10000');
}

function goOpenUrl(url,size,scroll) {
	if (url == undefined) { url = "http://www.et-house.com/"; }
	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 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 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 auth_regist() {
 //   if (parseInt(getCookie("USERIDX")) > 0) {
		goOpenUrl("/pages/myteens/popup_input_book_authcode.asp","416,338");
//	} else {
//		alert('·Î±×ÀÎ ÈÄ ÀÌ¿ë°¡´ÉÇÕ´Ï´Ù.');
//	}
}

//ÄíÅ° °¡Á®¿À±â
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 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 showImgWin(imgSrc) {
	var	objImg	=	new Image();

	objImg.src	=	imgSrc;

	w		=	objImg.width;
	h		=	objImg.height;
	swidth	=	screen.width;
	sheight	=	screen.height;
	mwidth	=	iwidth	=	w;
	mheight	=	iheight	=	h;

	if(iwidth >= swidth)
		mwidth	=	swidth - 16;

	if(iheight >= sheight)
		mheight	=	sheight - 60;

	showImg		=	window.open('/pages/album/pop_img_view.asp?imgPath=' + objImg.src + '&mw=' + mwidth + '&mh=' + mheight, '', 'width=' + mwidth + ',height=' + mheight + ',scrollbars=0,status=0,resizable=0');
}

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;
}


//et-house °Ë»ö
function chk_blank_ethouse() {
	if (document.frm_ethouse_search.isUse.value == "0") {
		document.frm_ethouse_search.isUse.value = "1";
		document.frm_ethouse_search.Query.value = "";
	}
}

function searchAct_ethouse(pForm) {
	if (pForm.isUse.value == "0" || pForm.Query.value == "") {
		alert('°Ë»ö¾î¸¦ ÀÔ·ÂÇÏ¼¼¿ä');
		pForm.Query.focus();
		return false;
	}
	return true;
}
/***************************************************************************************************/

