/*********************************************
* ÆÄÀÏ¸í: lib.javascript.js
* ±â´É: À¯¿¬ÇÑ ÀÚµ¿ Æû °Ë»ç±â
* ¸¸µçÀÌ: °ÅÄ£¸¶·ç <comfuture@maniacamp.com>
* ³¯Â¥: 2002-10-01
* == change log ==
* 2003-10-02 ¿©·¯Ä­À¸·Î ³ª´²Áø Ç×¸ñ¿¡ ´ëÇÑ °Ë»ç±â´É Ãß°¡
* 2003-10-02 ÆÐ½º¿öµåµî µÎ°³ Ç×¸ñ¿¡ ´ëÇÑ ºñ±³ ±â´É Ãß°¡
**********************************************/

/// ¿¡·¯¸Þ½ÃÁö Æ÷¸ä Á¤ÀÇ ///
var NO_BLANK = "{name+Àº´Â} ÇÊ¼ö Ç×¸ñÀÔ´Ï´Ù.";
var NOT_VALID = "{name+ÀÌ°¡} ¿Ã¹Ù¸£Áö ¾Ê½À´Ï´Ù.";
// var TOO_LONG = "{name}ÀÇ ±æÀÌ°¡ ÃÊ°úµÇ¾ú½À´Ï´Ù (ÃÖ´ë {maxbyte}¹ÙÀÌÆ®)";

/// ½ºÆ®¸µ °´Ã¼¿¡ ¸Þ¼Òµå Ãß°¡ ///
String.prototype.trim = function(str) { 
	str = this != window ? this : str; 
	return str.replace(/^\s+/g,'').replace(/\s+$/g,''); 
}

String.prototype.hasFinalConsonant = function(str) {
	str = this != window ? this : str; 
	var strTemp = str.substr(str.length-1);
	return ((strTemp.charCodeAt(0)-16)%28!=0);
}

String.prototype.bytes = function(str) {
	str = this != window ? this : str;
	var len = 0;
	for(j=0; j<str.length; j++) {
		var chr = str.charAt(j);
		len += (chr.charCodeAt() > 128) ? 2 : 1;
	}
	return len;
}

function validate(form) {
	for (i = 0; i < form.elements.length; i++ ) {
		var el = form.elements[i];
		if (el.tagName == "FIELDSET") continue;
		el.value = el.value.trim();

		var minbyte = el.getAttribute("MINBYTE");
		var maxbyte = el.getAttribute("MAXBYTE");
		var option = el.getAttribute("OPTION");
		var match = el.getAttribute("MATCH");
		var glue = el.getAttribute('GLUE');
		var minvalue = el.getAttribute('MINVALUE');
		var maxvalue = el.getAttribute('MAXVALUE');

		if (el.getAttribute("REQUIRED") != null) {
			if (el.type == "checkbox" || el.type == "radio")
			{
				var span = el.getAttribute("SPAN");
				var isChecked = 0;
				for (var j = 0; j < span; j++)
				{
					if (form.elements[i+j].checked == true)
					{
						isChecked = 1;
						break;
					}
				}
				if (!isChecked)
				{
					return doError(el,NO_BLANK);
				}
			}
			if (el.value == null || el.value == "") {
				return doError(el,NO_BLANK);
			}
		}

		if (minbyte != null) {
			if (el.value.bytes() < parseInt(minbyte)) {
				return doError(el,"{name+Àº´Â} ÃÖ¼Ò "+minbyte+"¹ÙÀÌÆ® ÀÌ»ó ÀÔ·ÂÇØ¾ß ÇÕ´Ï´Ù.");
			}
		}

		if (maxbyte != null && el.value != "") {
			var len = 0;
			if (el.value.bytes() > parseInt(maxbyte)) {
				return doError(el,"{name}ÀÇ ±æÀÌ°¡ ÃÊ°úµÇ¾ú½À´Ï´Ù (ÃÖ´ë "+maxbyte+"¹ÙÀÌÆ®)");
			}
		}

		if (match && (el.value != form.elements[match].value)) return doError(el,"{name+ÀÌ°¡} ÀÏÄ¡ÇÏÁö ¾Ê½À´Ï´Ù.");

		if (option != null && el.value != "") {
			if (el.getAttribute('SPAN') != null) {
				var _value = new Array();
				for (span=0; span<el.getAttribute('SPAN');span++ ) {
					_value[span] = form.elements[i+span].value;
				}
				var value = _value.join(glue == null ? '' : glue);
				if (!funcs[option](el,value)) return false;
			} else {
				if (!funcs[option](el)) return false;
			}
		}

		if (minvalue != null && el.value != "") {
			if (el.value < parseInt(minvalue)) {
				return doError(el, "{name}ÀÇ ÃÖ¼Ò°ªÀº "+minvalue+"ÀÌ¾î¾ß ÇÕ´Ï´Ù.");
			}
		}

		if (maxvalue != null && el.value != "") {
			if (el.value > parseInt(maxvalue)) {
				return doError(el, "{name}ÀÇ ÃÖ´ë°ªÀº "+maxvalue+"ÀÌ¾î¾ß ÇÕ´Ï´Ù.");
			}
		}
	}
	return true;
}

function josa(str,tail) {
	return (str.hasFinalConsonant()) ? tail.substring(0,1) : tail.substring(1,2);
}

function doError(el,type,action) {
	var pattern = /{([a-zA-Z0-9_]+)\+?([°¡-ÆR]{2})?}/;
	var name = (hname = el.getAttribute("HNAME")) ? hname : el.getAttribute("NAME");
	pattern.exec(type);
	var tail = (RegExp.$2) ? josa(eval(RegExp.$1),RegExp.$2) : "";
	popupModalAlert(type.replace(pattern,eval(RegExp.$1) + tail));
	if (action == "sel") {
		el.select();
	} else if (action == "del")	{
		el.value = "";
	}
	el.focus();
	return false;
}	

/// Æ¯¼ö ÆÐÅÏ °Ë»ç ÇÔ¼ö ¸ÅÇÎ ///
var funcs = new Array();
funcs['email'] = isValidEmail;
funcs['phone'] = isValidPhone;
funcs['userid'] = isValidUserid;
funcs['password'] = isValidPassword;
funcs['hangul'] = hasHangul;
funcs['number'] = isNumeric;
funcs['engonly'] = alphaOnly;
funcs['jumin'] = isValidJumin;
funcs['bizno'] = isValidBizNo;
//funcs['domain'] = isValidDomain;
funcs['url'] = isValidUrl;

/// ÆÐÅÏ °Ë»ç ÇÔ¼öµé ///
function isValidEmail(el,value) {
	var value = value ? value : el.value;
	var pattern = /^[_a-zA-Z0-9-\.]+@[\.a-zA-Z0-9-]+\.[a-zA-Z]+$/;
	return (pattern.test(value)) ? true : doError(el,NOT_VALID);
}

function isValidUserid(el) {
	var pattern = /^[a-zA-Z]{1}[a-zA-Z0-9_]{4,15}$/;
	return (pattern.test(el.value)) ? true : doError(el,"{name+Àº´Â} 5ÀÚÀÌ»ó 16ÀÚ ¹Ì¸¸ÀÌ¾î¾ß ÇÏ°í,\n ¿µ¹®,¼ýÀÚ, _(¾ð´õ¹Ù) ¹®ÀÚ¸¸ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù.");
}

/*
function isValidPassword(el) {
	var pattern = /^[a-zA-Z0-9_]{1}[a-zA-Z0-9_]{4,11}$/;
	return (pattern.test(el.value)) ? true : doError(el,"{name+Àº´Â} 5ÀÚÀÌ»ó 12ÀÚ ¹Ì¸¸ÀÌ¾î¾ß ÇÏ°í,\n ¿µ¹®,¼ýÀÚ, _(¾ð´õ¹Ù) ¹®ÀÚ¸¸ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù.");
}*/

function isValidPassword(el) {
	var pattern = /^[!-z]{1}[!-z]{4,15}$/;
	 alert(el.value);
	return (pattern.test(el.value)) ? true : doError(el,"{name+Àº´Â} 5ÀÚÀÌ»ó 16ÀÚ ¹Ì¸¸ÀÌ¾î¾ß ÇÕ´Ï´Ù.");
}

function hasHangul(el) {
	var pattern = /[°¡-ÆR]/;
	return (pattern.test(el.value)) ? true : doError(el,"{name+Àº´Â} ¹Ýµå½Ã ÇÑ±ÛÀ» Æ÷ÇÔÇØ¾ß ÇÕ´Ï´Ù.");
}

function alphaOnly(el) {
	var pattern = /^[a-zA-Z]+$/;
	return (pattern.test(el.value)) ? true : doError(el,NOT_VALID);
}

function isNumeric(el) {
	var pattern = /^[0-9]+$/;
	return (pattern.test(el.value)) ? true : doError(el,"{name+Àº´Â} ¹Ýµå½Ã ¼ýÀÚ·Î¸¸ ÀÔ·ÂÇØ¾ß ÇÕ´Ï´Ù.");
}

function isValidJumin(el,value) {
    var pattern = /^([0-9]{6})-?([0-9]{7})$/; 
	var num = value ? value : el.value;
    if (!pattern.test(num)) return doError(el,NOT_VALID); 
    num = RegExp.$1 + RegExp.$2;

	var sum = 0;
	var last = num.charCodeAt(12) - 0x30;
	var bases = "234567892345";
	for (var i=0; i<12; i++) {
		if (isNaN(num.substring(i,i+1))) return doError(el,NOT_VALID);
		sum += (num.charCodeAt(i) - 0x30) * (bases.charCodeAt(i) - 0x30);
	}
	var mod = sum % 11;
	return ((11 - mod) % 10 == last) ? true : doError(el,NOT_VALID);
}

function isValidBizNo(el, value) { 
    var pattern = /([0-9]{3})-?([0-9]{2})-?([0-9]{5})/; 
	var num = value ? value : el.value;
    if (!pattern.test(num)) return doError(el,NOT_VALID); 
    num = RegExp.$1 + RegExp.$2 + RegExp.$3;
    var cVal = 0; 
    for (var i=0; i<8; i++) { 
        var cKeyNum = parseInt(((_tmp = i % 3) == 0) ? 1 : ( _tmp  == 1 ) ? 3 : 7); 
        cVal += (parseFloat(num.substring(i,i+1)) * cKeyNum) % 10; 
    } 
    var li_temp = parseFloat(num.substring(i,i+1)) * 5 + '0'; 
    cVal += parseFloat(li_temp.substring(0,1)) + parseFloat(li_temp.substring(1,2)); 
    return (parseInt(num.substring(9,10)) == 10-(cVal % 10)%10) ? true : doError(el,NOT_VALID); 
}

function isValidPhone(el, value) {
	var pattern = /^([0]{1}[0-9]{1,2})-?([1-9]{1}[0-9]{2,3})-?([0-9]{4})$/;
	var num = value ? value : el.value;
	if (pattern.exec(num)) {
		if(RegExp.$1 == "011" || RegExp.$1 == "016" || RegExp.$1 == "017" || RegExp.$1 == "018" || RegExp.$1 == "019") {
			if (!el.getAttribute('SPAN')) el.value = RegExp.$1 + "-" + RegExp.$2 + "-" + RegExp.$3;
		}
		return true;
	} else {
		return doError(el,NOT_VALID);
	}
}

function isValidUrl(el, value) {
	var pattern = /^http\:\/\//;
	return (pattern.test(el.value)) ? true : doError(el,"{name+Àº´Â} http:// ·Î ½ÃÀÛÇØ¾ß ÇÕ´Ï´Ù.");
}



/*----------------------------------------------------------+
|
| ÀÌÇÏ nvrstop <nvrstop@corelanguage.com> Ãß°¡ 
|
+----------------------------------------------------------*/
function setFormElement(form, arr)
{
	for (var i = 0; i < form.elements.length; i++)
	{
		var el = form.elements[i];
		if (el.type == "select-one")
		{
			for (var j = 0; j < el.options.length; j++)
			{
				if (arr[el.name] == el.options[j].value)
				{
					el.options[j].selected = true;
				}
			}
		}
		else if (el.type == "radio" || el.type == "checkbox")
		{
			if (arr[el.name] == el.value)
			{
				el.checked = true;
			}
		}
	}
}

function setFormCheckbox(form, arr)
{
	for (var i = 0; i < form.elements.length; i++)
	{
		var el = form.elements[i];
		for (var j = 0; j < arr.length; j++)
		{
			if (arr[j] == el.value)
			{
				el.checked = true;
				break;
			}
			else 
			{
				el.checked = false;
			}
		}
	}
}




function isAlien(a)
{
	return isObject(a) && typeof	a.constructor != 'function';
}
function isArray(a) 
{
	return isObject(a) && a.constructor == Array;
}
function isBoolean(a)
{
	return typeof a == 'boolean';
}
function isEmpty(o)
{
	var i, v;
	if (isObject(o)) 
	{
		for (i in o) 
		{
			v = o[i];
			if (isUndefined(v) && isFunction(v))
			{
				return false;
			}
		}
	}
	return true;
}
function isFunction(a) 
{
	return typeof a == 'function';
}
function isNull(a)
{
	return typeof a == 'object' && !a;
}
function isNumber(a)
{
	return typeof a == 'number' && isFinite(a);
}
function isObject(a) 
{
	return (typeof a ==	'object' && a) || isFunction(a);
}
function isString(a)
{
	return typeof a == 'string';
}
function isUndefined(a)
{
	return typeof a == 'undefined';
}

/*
isAlien(a)
Internet Explorer holds references to objects which are not JavaScript objects, and which produce errors if they are treated as JavaScript objects. This is a problem because typeof identifies them as JavaScript objects. The isAlien() function will return true if a is one of those alien objects.

isArray(a)
isArray() returns true if a is an array, meaning that it was produced by the Array constructor or by using the [ ] array literal notation.

isBoolean(a) 
isBoolean(a) returns true if a is one of the boolean values, true or false.

isEmpty(a) 
isEmpty(a) returns true if a is an object or array or function containing no enumerable members.

isFunction(a)
isFunction(a) returns true if a is a function. Beware that some native functions in IE were made to look like objects instead of functions. This function does not detect that.

isNull(a)
isNull(a) returns true if a is the null value.

isNumber(a)
isNumber(a) returns true if a is a finite number. It returns false if a is NaN or Infinite. It also returns false if a is a string that could be converted to a number.

isObject(a) 
isObject(a) returns true if a is an object, and array, or a function. It returns false if a is a string, a number, a boolean, or null, or undefined. 

isString(a) 
isString(a) returns true if a is a string.

isUndefined(a) 
isUndefined(a) returns true if a is the undefined value. You can get the undefined value from an uninitialized variable or from a missing member of an object. 
*/




/* ±âÅ¸ °£´ÜÇÑ ÀÚ¹Ù½ºÅ©¸³Æ®µé */

// »ç¿ëÀÚ Á¤ÀÇ ¾Ù·¯Æ®
function popupModalAlert(strMessage)
{
	if (navigator.appName == "Microsoft Internet Explorer")
	{
		strMessage = strMessage.replace("\n", "<br>\n");
		var strUrl = "?strMode=public/public.alert.popup&strMessage=" + strMessage;
		var intWidth= 350;
		var intHeight = 190;
		var isResizable = 1;
		var isScrollbars = 0;
		var modalwindow = showModalDialog(strUrl, "modalwindow", "dialogHeight:"+intHeight+"px; dialogWidth:"+intWidth+"px;resizable:"+isResizable+"; status:0; scroll:"+isScrollbars+"; center:1; ");
	}
	else
	{
		window.alert(strMessage);
	}
}


// ÄÁÆß ¸ð´ÞÃ¢ ÆË¾÷ ÇÔ¼ö
function popupModalConfirmWindow(strMessage, strRedirectUrl)
{
	var strUrl = "?strMode=public/public.confirm.popup&strMessage=" + strMessage;
	var intWidth= 350;
	var intHeight = 190;
	var isResizable = 1;
	var isScrollbars = 0;
	var modalwindow = showModalDialog(strUrl, "modalwindow", "dialogHeight:"+intHeight+"px; dialogWidth:"+intWidth+"px;resizable:"+isResizable+"; status:0; scroll:"+isScrollbars+"; center:1; ");
	if (isObject(modalwindow))
	{
		if (modalwindow.result == 1)
		{
			location.href = (strRedirectUrl.charAt(0) == "?" ? "" : "?") + strRedirectUrl;
		}
	}
}




// ¼³¹®Á¶»ç Ã¼Å©¿©ºÎ È®ÀÎ ÇÔ¼ö
function checkSurvey(isAnswered)
{
	if (isAnswered)
	{
		popupModalAlert("ÀÌ¹Ì ¼³¹®Á¶»ç¿¡ Âü¿©ÇÏ¿´½À´Ï´Ù.");
		return false;
	}

	var num = document.all['saKey'].length
	var cnt = 0;
	for (var i = 0; i < num; i++)
	{
		if (document.all['saKey'][i].checked == true)
		{
			return true;
		}
	}
	popupModalAlert("´äº¯À» Ã¼Å©ÇØ ÁÖ¼¼¿ä.");
	return false;
}




// ¿£ÅÍÆ¼ »ý¼º => strTableId ¿¡ __ »ç¿ë ±ÝÁö
function createEntity(strTableId)
{
	var objTable = document.getElementById(strTableId);
	var intTableRowNum = objTable.rows.length;
	var objTr = objTable.insertRow(intTableRowNum);
	objTr.id = strTableId + "__" + intTableRowNum;
	for (var i = 0; i < objTable.rows(parseInt(objTr.rowIndex) - 1).cells.length; i++)
	{
		var objTd = objTable.rows(objTr.rowIndex).insertCell(objTr.cells.length);
		strTmp = objTable.rows(0).cells(i).innerHTML;
		var j = 0;
		while (strTmp.match(/\[0\]/))
		{
			strTmp = strTmp.replace("\[0\]", "\[" + intTableRowNum + "\]");
			if (j++ > 10) break;
		}
		objTd.innerHTML = strTmp.replace("destroyEntity\('" + strTableId + "'\)", "destroyEntity\('" + strTableId + "__" + intTableRowNum + "'\)");
	}
}
// ¿£ÅÍÆ¼ ÆÄ±« 
function destroyEntity(idx)
{
	var arrIdx = idx.split("__");
	var objTable = document.getElementById(arrIdx[0]);
	if (objTable.rows.length > 1)
	{
		for (var i = 0; i < objTable.rows.length; i++)
		{
			if (objTable.rows(i).getAttribute('id') == idx)
			{
				objTable.deleteRow(i);
				break;
			}
		}
	}
	else
	{
		// window.alert("´õÀÌ»ó »èÁ¦ÇÒ ¼ö ¾ø½À´Ï´Ù.");
	}
}





// Ä«Å×°í¸® Æ®¸®±¸Á¶ ÄÁÆ®·Ñ ÇÔ¼ö
function controlTree(ename)
{
	var srcElement = window.event.srcElement;
	var entity = eval("document.all." + ename);
	if (isObject(entity))
	{
		if (entity.style.display == "none")
		{
			srcElement.src = "_src/img/icon/icon_folder_open.gif";
			entity.style.display = "";
		}
		else
		{
			srcElement.src = "_src/img/icon/icon_folder_close.gif";
			entity.style.display = "none";
		}
	}
}

// Ä«Å×°í¸® Æ®¸®±¸Á¶¿¡¼­ ÇöÀç Ä«Å×°í¸®ÀÇ Á¶»ó Ä«Å×°í¸®¸¦ ¸ðµÎ ¿ÀÇÂÇØÁÖ´Â ÇÔ¼ö
function setTreeIcon(strCategoryCode, intCategoryNodeLength)
{
	if (strCategoryCode.length == 0) return;
	if (intCategoryNodeLength == "") intCategoryNodeLength = 2;
	var tmp;
	var intCategoryCodeLength = strCategoryCode.length;
	var objCategory;
	var objIcon;
	for (var i = 0; i <= intCategoryCodeLength; i += intCategoryNodeLength)
	{
		strCode = strCategoryCode.substr(0, i) + strRepeat("0", intCategoryCodeLength - i);
		var objCategory = eval("document.all.category" + strCode);
		var objIcon = eval("document.all.icon" + strCode);
		if (isObject(objCategory))
		{
			objCategory.style.display = "";
			objIcon.src = "_src/img/icon/icon_folder_open.gif";
		}
	}
}

// Ä«Å×°í¸® ¼±ÅÃ ÇÔ¼ö
function popupSelectCategoryWindow(strCategoryTable, strParentCategoryCode, strCategoryCode)
{
	strCategoryCode = eval("document.all." + strCategoryCode);
	strCategoryPath = document.all.strCategoryPath;
	var url = "?strMode=category/category.select.popup&strCategoryTable=" + strCategoryTable + "&strParentCategoryCode=" + strParentCategoryCode + "&strCategoryCode=" + strCategoryCode.value;
	var ret = popupModalWindow(url, 400, 400, 1, 1, 1);
	if (ret)
	{
		strCategoryCode.value = ret.strCategoryCode;
		strCategoryPath.value = ret.strCategoryPath;
	}
}

// Ä«Å×°í¸® ´ÙÁß ¼±ÅÃ ÇÔ¼ö
function popupMultiSelectCategoryWindow(strCategoryTable, strParentCategoryCode, arrCategoryCode, arrCategoryPath, form)
{
	var form = eval(form);
	var url = "?strMode=category/category.select.popup&strCategoryTable=" + strCategoryTable + "&strParentCategoryCode=" + strParentCategoryCode;
	var ret = popupModalWindow(url, 400, 400, 1, 1, 1);
	var flag = 0;
	if (ret)
	{
		for (var i = 0 ; i < form.elements.length; i++)
		{
			if (form.elements[i].name == arrCategoryCode)
			{
				form.elements[i].value = ret.strCategoryCode;
				flag++;
			}
			if (form.elements[i].name == arrCategoryPath)
			{
				form.elements[i].value = ret.strCategoryPath;
				flag++;
			}
			if (flag == 2) break;
		}
	}
}


// ¹®ÀÚ¿­ ¹Ýº¹ÇÏ¿© ¸®ÅÏ
function strRepeat(str, num)
{
	var buffer = "";
	for (var i = 0; i < num; i++)
	{
		buffer = buffer + str;
	}
	return buffer;
}

// ÆË¾÷ ÇÔ¼ö
function popupWindow(strUrl, intWidth, intHeight, isScrollbars, isResizable,isCenter)
{
	oNow = new Date();
	var strNow = oNow.getHours() + oNow.getMinutes() + oNow.getSeconds(); 

	var intLeft = 0;
	var intTop = 0;
	if (isCenter == 1)
	{
		intLeft = (window.screen.width/2) - (intWidth/2 + 10);
		intTop = (window.screen.height/2) - (intHeight/2 + 50);
	}
	window.open(strUrl, "popup_"+strNow, "status=no, width="+intWidth+",height="+intHeight+",resizable="+isResizable+",left="+intLeft+",top="+intTop+";,screenX="+intLeft+",screenY="+intTop+",scrollbars="+isScrollbars);
}

// ¸ð´ÞÇü ÆË¾÷ ÇÔ¼ö
function popupModalWindow(strUrl, intWidth, intHeight, isScrollbars, isResizable,isCenter)
{
	var intLeft = 0;
	var intTop = 0;
	if (isCenter == 1)
	{
		intLeft = (window.screen.width/2) - (intWidth/2 + 10);
		intTop = (window.screen.height/2) - (intHeight/2 + 50);
	}
	var ret = showModalDialog(strUrl, "modalwindow", "dialogHeight:"+intHeight+"px; dialogWidth:"+intWidth+"px; dialogTop:"+intTop+"px; dialogLeft:"+intLeft+"px; help:Yes; resizable:"+isResizable+"; status:0; scroll:"+isScrollbars+"; center:"+isCenter+"; ");
	return ret;
}

// ÀÌ¹ÌÁö º¸±â ÇÔ¼ö
function popupModalImageWindow(strImagePath, isWatermark)
{
	var intHeight = 10;
	var intWidth = 10;
	var intTop = 0;
	var intLeft = 0;
	var isResizable = 1;
	var isScrollbars = 1;
	var isCenter = 0;
	if (isWatermark == 1)
	{
		var strUrl = "?strMode=public/public.image.watermark.popup&strImagePath=" + strImagePath;
	}
	else
	{
		var strUrl = "?strMode=public/public.image.popup&strImagePath=" + strImagePath;
	}
	var ret = showModalDialog(strUrl, "modalwindow", "dialogHeight:"+intHeight+"px; dialogWidth:"+intWidth+"px; dialogTop:"+intTop+"px; dialogLeft:"+intLeft+"px; help:Yes; resizable:"+isResizable+"; status:0; scroll:"+isScrollbars+"; center:"+isCenter+"; ");
	return ret;
}


// À¯ÀÏÇÑ ÄÃ·³°ªÀÎÁö Ã¼Å©ÇÏ´Â ÆË¾÷Ã¢ ¶ç¿ì´Â ÇÔ¼ö
function isUnique(strTable, strColumn)
{
	var objColumn = eval("document.all."+strColumn);
	var strHname = objColumn.hname;
	var strValue = objColumn.value;
	var strUrl = "?strMode=public/public.isUnique.popup&strTable="+strTable+"&strColumn="+strColumn+"&strValue="+strValue+"&strHname="+strHname;
	var intHeight = 150;
	var intWidth= 350;
	var isResizable = 1;
	var isScrollbars = 0;
	var isCenter = 1;
	if (isCenter == 1)
	{
		intLeft = (window.screen.width/2) - (intWidth/2 + 10);
		intTop = (window.screen.height/2) - (intHeight/2 + 50);
	}
	var ret = showModalDialog(strUrl, "modalwindow", "dialogHeight:"+intHeight+"px; dialogWidth:"+intWidth+"px; dialogTop:"+intTop+"px; dialogLeft:"+intLeft+"px; help:Yes; resizable:"+isResizable+"; status:0; scroll:"+isScrollbars+"; center:"+isCenter+"; ");
	while (1)
	{
		if (isObject(ret))
		{
			if (ret.isResearch == 1)
			{
				strUrl = "?strMode=public/public.isUnique.popup&strTable="+strTable+"&strColumn="+strColumn+"&strValue="+ret.strValue+"&strHname="+strHname;
				ret = showModalDialog(strUrl, "modalwindow", "dialogHeight:"+intHeight+"px; dialogWidth:"+intWidth+"px; dialogTop:"+intTop+"px; dialogLeft:"+intLeft+"px; help:Yes; resizable:"+isResizable+"; status:0; scroll:"+isScrollbars+"; center:"+isCenter+"; ");
			}
			else
			{
				objColumn.value = ret.strValue;
				return;
			}
		}
		else
		{
			return;
		}
	}
}

// ¿ìÆí¹øÈ£ °Ë»öÃ¢À» ¶ç¿ì´Â ÇÔ¼ö
function searchZipcode(strZipcode1, strZipcode2, strAddress)
{
	var objZipcode1 = eval("document.all."+strZipcode1);
	var objZipcode2 = eval("document.all."+strZipcode2);
	var objAddress = eval("document.all."+strAddress);
	var strUrl = "?strMode=public/public.search.zipcode.popup";
	var intHeight = 200;
	var intWidth= 400;
	var isResizable = 1;
	var isScrollbars = 0;
	var isCenter = 1;
	if (isCenter == 1)
	{
		intLeft = (window.screen.width/2) - (intWidth/2 + 10);
		intTop = (window.screen.height/2) - (intHeight/2 + 50);
	}
	var ret = showModalDialog(strUrl, "modalwindow", "dialogHeight:"+intHeight+"px; dialogWidth:"+intWidth+"px; dialogTop:"+intTop+"px; dialogLeft:"+intLeft+"px; help:Yes; resizable:"+isResizable+"; status:0; scroll:"+isScrollbars+"; center:"+isCenter+"; ");
	while (1)
	{
		if (isObject(ret))
		{
			if (ret.isAct == 0)
			{
				strUrl = "?strMode=public/public.search.zipcode.popup";
				isScrollbars = 0;
			}
			else if (ret.isAct == 1)
			{
				strUrl = "?strMode=public/public.search.zipcode.result.popup&strKeyword="+ret.strKeyword;
				isScrollbars = 1;
			}
			else if (ret.isAct == 2)
			{
				objZipcode1.value = ret.strZipcode1;
				objZipcode2.value = ret.strZipcode2;
				objAddress.value = ret.strAddress;
				return;
			}
			ret = showModalDialog(strUrl, "modalwindow", "dialogHeight:"+intHeight+"px; dialogWidth:"+intWidth+"px; dialogTop:"+intTop+"px; dialogLeft:"+intLeft+"px; help:Yes; resizable:"+isResizable+"; status:0; scroll:"+isScrollbars+"; center:"+isCenter+"; ");
		}
		else
		{
			return;
		}
	}
}

function isDeleteAppend(strSubMode, intAppendKey)
{
	var intHeight = 150;
	var intWidth = 250;
	var isResizable = 1;
	var isScrollbars = 0;
	var isCenter = 1;
	var strUrl = "?strMode=board/board.append.delete.popup&strSubMode="+strSubMode+"&intAppendKey="+intAppendKey;
	var ret = showModalDialog(strUrl, "modalwindow", "dialogHeight:"+intHeight+"px; dialogWidth:"+intWidth+"px; help:Yes; resizable:"+isResizable+"; status:0; scroll:"+isScrollbars+"; center:"+isCenter+"; ");
	if (isObject(ret))
	{
		if (ret.isReturnPassword > 0)
		{
			document.write("<form name='deleteAppendForm' method='post' action='?strMode=board/board.append.delete.act&strSubMode="+strSubMode+"&intAppendKey="+intAppendKey+"'><input type='hidden' name='strPassword'></form>");
			deleteAppendForm.strPassword.value = ret.strPassword;
			deleteAppendForm.submit();
		}
	}
	return;
}

function isDeleteBoard(strUrl)
{
	var intHeight = 150;
	var intWidth = 250;
	var isResizable = 1;
	var isScrollbars = 0;
	var isCenter = 1;
	var strUrl = "?strMode=board/board.delete.popup&strUrl=" + strUrl;
	var ret = showModalDialog(strUrl, "modalwindow", "dialogHeight:"+intHeight+"px; dialogWidth:"+intWidth+"px; help:Yes; resizable:"+isResizable+"; status:0; scroll:"+isScrollbars+"; center:"+isCenter+"; ");
	if (isObject(ret))
	{
		if (ret.isReturnPassword > 0)
		{
			document.write("<form name='deleteBoardForm' method='post' action='?strMode=board/board.delete.act&strSubMode="+strSubMode+"&intBoardKey="+intBoardKey+"'><input type='hidden' name='strPassword'></form>");
			deleteBoardForm.strPassword.value = ret.strPassword;
			deleteBoardForm.submit();
		}
	}
	return;
}


