<!--
//==================================================================================================
//¡áProgram Name		: °øÅë ÀÚ¹Ù½ºÅ©¸³Æ® ÇÔ¼ö ¸ðÀ½
//¡áFile	 Name		: /JsFile/Common/common_js.js
//¡áDescription		: °øÅë ÀÚ¹Ù½ºÅ©¸³Æ® ÇÔ¼ö ¸ðÀ½
//¡áEtc					: 
//==================================================================================================
//¡ØHistory
//==================================================================================================
//Number		Date				Author		Version			Description
//==================================================================================================
//	1			2008-07-16			ÀÌ½ÂÈÆ		1.0
//==================================================================================================

//--------------------------------------------------------------------------------------------------
// FormÃ¼Å©¸¦ À§ÇÑ ÇÔ¼ö
//--------------------------------------------------------------------------------------------------
String.prototype.IsId = function() {
	if (this.search(/[^A-Za-z0-9_-__-]/) == -1)
		return true;
	else 
		return false;
}

String.prototype.IsId2 = function() {
	if (this.search(/[^A-Za-z0-9_-__-_.]/) == -1)
		return true;
	else 
		return false;
}

String.prototype.IsPasswd = function() {
	if (this.search(/[^a-z0-9]/)== -1){
		return true;
	}else{
		return false;
	}
}

String.prototype.IsTel = function() {
	if (this.search(/[^0-9_-]/) == -1)
		return true;
	else 
		return false;
}

String.prototype.IsMoney = function() {
	if (this.search(/[^0-9_,]/) == -1)
		return true;
	else 
		return false;
}

String.prototype.IsAlpha = function() {
	if (this.search(/[^A-Za-z]/) == -1)
		return true;
	else
		return false;
}

//psh 2010-01-06 °ø¹éµµ »ç¿ëÇÒ ¼ö ÀÖ´Â ¿µ¹®ÀÚ
String.prototype.EmpAlpha = function() {
   if (this.search(/[^A-Z a-z]/) == -1)
		return true;
   else
		return false;
}
String.prototype.IsNumber = function() {
	if (this.search(/[^0-9]/) == -1)
		return true;
	else
		return false;
}

String.prototype.IsJumin = function() {
	var jumin= this
	if (jumin.length  != 13) 
		return false;
	tval=jumin.charAt(0)*2 + jumin.charAt(1)*3 + jumin.charAt(2)*4
	+ jumin.charAt(3)*5 + jumin.charAt(4)*6 + jumin.charAt(5)*7
	+ jumin.charAt(6)*8+ jumin.charAt(7)*9 + jumin.charAt(8)*2
	+ jumin.charAt(9)*3 + jumin.charAt(10)*4 + jumin.charAt(11)*5;

	tval2=11- (tval % 11);
	tval2=tval2 % 10;
	
	if (jumin.charAt(12)==tval2 &&  (jumin.charAt(6)=="1" ||jumin.charAt(6)=="2")) {
		return true;
	}
	else{
		return false ;
	}
}

String.prototype.IsEmail = function() {
	if (this.search(/(.+)@.+\..+/) == -1)
		return false;
	else {
		for(var i=0; i < this.length;i++)
			if (this.charCodeAt(i) > 256)
				return false;
		return true;
	}
}

String.prototype.IsDate = function() {
	if (this.search(/\d{4}\.\d{2}\.\d{2}/) == -1)
		return false;
	else {
		return true;
	}
}

String.prototype.StrLen = function() {
	var temp;
	var set = 0;
	var mycount = 0;

	for( k = 0 ; k < this.length ; k++ ){
		temp = this.charAt(k);

		if( escape(temp).length > 4 ) {
			mycount += 2
		}
		else mycount++;
	}

	return mycount;
}

String.prototype.LTrim = function() {
	var i, j = 0;
	var objstr

	for ( i = 0; i < this.length ; i++){
		if (this.charAt(i) == ' ' ){
			j = j + 1;
		}
		else{
			break;
		}
	}
	return this.substr(j, this.length - j+1)  
}

String.prototype.RTrim = function() {
	var i, j = 0;

	for ( i = this.length - 1; i >= 0 ; i--){
		if (this.charAt(i) == ' ' ){
			j = j + 1
		}
		else{
			break;
		}
	}
	return 	this.substr(0, this.length - j);
}

String.prototype.Trim = function() {
	return this.replace(/\s/g, "");
}

//--------------------------------------------------------------------------------------------------
// Form ÀÔ·Â°ª Ã¼Å©
// formField		form°³Ã¼
// checkName	
// message		alert¸Þ¼¼Áö
// maxlength		ÃÖ´ëÀÔ·Â byte
// minlength		ÃÖ¼ÒÀÔ·Â byte
//--------------------------------------------------------------------------------------------------
function checkform(formField, checkName, message, maxlength, minlength) {	

	//°¢ ÇÊµåº° ÀÔ·Â°ª Ã¼Å©
	//ÁÖ¹Îµî·Ï½Ã ¹Ýµå½Ã °ªÀ¸·Î ³Ñ±ä´Ù.
	//ÇÊ¼öÀÔ·Â check
	//±ÛÀÚ¼ö check
	//field À¯È¿¼º check
		
	formValue = formField.value.LTrim().RTrim();

	if(checkName != 'jumin'){
		if (formField == null ) {
			return false;
		}
	
		if (formValue == '' && minlength > 0){
			alert(message + " ÇÊ¼öÀÔ·Â Ç×¸ñÀÔ´Ï´Ù.");
			_cmdfocus(formField);
			return false;
		}

		if (formValue.StrLen() < minlength) {
			alert(message + " ÃÖ¼Ò" + minlength + "ÀÚ(ÇÑ±Û" + minlength/2 + " ÀÚ)ÀÌ»ó ÀÔ·ÂÇÏ¼¼¿ä.");
			_cmdfocus(formField);
			return false;
		}

		if (formValue.StrLen() > maxlength) {
			alert(message + " ÃÖ´ë" + maxlength + "ÀÚ(ÇÑ±Û" + maxlength/2 + " ÀÚ)±îÁö ÀÔ·Â °¡´ÉÇÕ´Ï´Ù.");
			_cmdfocus(formField);
			return false;
		}
	}		

	switch(checkName) {
		case "" :
			return true;
		//psh 2010-01-06 ¿µ¹®ÀÚ¿¡ ºó°ø°£µµ Æ÷ÇÔÇÏ°í ÀÖÀ½
		case "empAlpha" :
			if (formValue.EmpAlpha()){
				return true;
			} else {
				alert(message + " ¿µ¹®ÀÚ¸¸ ÀÔ·Â °¡´É ÇÕ´Ï´Ù.");
				_cmdfocus(formField);
				return false;
			}
		case "alpha" :
			if (formValue.IsAlpha()) {
				return true;
			} else {
				alert(message + " ¿µ¹®ÀÚ¸¸ ÀÔ·Â °¡´É ÇÕ´Ï´Ù.");
				_cmdfocus(formField);
				return false;
			}
			break;
		case "number" :

			if (formValue.IsNumber()) {
				return true;
			} else {
				alert(message + " ¼ýÀÚ¸¸ ÀÔ·Â °¡´É ÇÕ´Ï´Ù.");
				_cmdfocus(formField);		
				return false;
			}
			break;
		case "id" :
			if (formValue.IsId()) {
				return true;
			} else {
				alert(message + " ¿µ¹®ÀÚ¿Í ¼ýÀÚ¸¸ ÀÔ·Â °¡´É ÇÕ´Ï´Ù.");
				_cmdfocus(formField);		
				return false;
			}
			break;

		case "id2" :
			if (formValue.IsId2()) {
				return true;
			} else {
				alert(message + " ¿µ¹®ÀÚ¿Í ¼ýÀÚ¸¸ ÀÔ·Â °¡´É ÇÕ´Ï´Ù.");
				_cmdfocus(formField);		
				return false;
			}
			break;

		case "tel" :
			if (formValue.IsTel()) {
				return true;
			} else {
				alert(message + " ¼ýÀÚ¿Í - ¸¸ ÀÔ·Â °¡´ÉÇÕ´Ï´Ù.");
				_cmdfocus(formField);		
				return false;
			}
			break;
		case "email" :
			if (formValue.IsEmail()) {
				return true;
			} else {
				alert("ÀÌ¸ÞÀÏ Çü½ÄÀÌ Æ²¸³´Ï´Ù. ´Ù½Ã ÀÔ·ÂÇØ ÁÖ¼¼¿ä(Çü½Ä: admin@localhost.com)");
				_cmdfocus(formField);		
				return false;
			}
			break;
		case "date" :
			if (formValue.IsDate()) {
				return true;
			} else {
				alert(message + " ³¯Â¥ Çü½ÄÀÌ Æ²¸³´Ï´Ù. ´Ù½Ã ÀÔ·ÂÇØ ÁÖ¼¼¿ä(Çü½Ä: 1999.09.09)");
				_cmdfocus(formField);		
				return false;
			}
			break;
		case "jumin" :
			if(formValue.StrLen() != 13){
				alert("ÁÖ¹Îµî·Ï¹øÈ£¸¦ Á¤È®È÷ ÀÔ·ÂÇØÁÖ¼¼¿ä");
				return false
			}

			if (formValue.IsJumin()) {
				return true;
			} else {
				alert("ÁÖ¹Îµî·Ï¹øÈ£¸¦ Á¤È®È÷ ÀÔ·ÂÇØÁÖ¼¼¿ä");
				return false;
			}
			break;
	}
}

//--------------------------------------------------------------------------------------------------
// Form focus
//--------------------------------------------------------------------------------------------------
function _cmdfocus(formobj){
	formobj.select();
	formobj.focus();
}

//--------------------------------------------------------------------------------------------------
// °Ë»ö¾î¿¡¼­ ÀÔ·ÂÇÏÁö ¸»¾Æ¾ß ÇÒ ¹®ÀÚ Ã¼Å©
//--------------------------------------------------------------------------------------------------
function isSearchText(val) {		
	var valid = true;
	var cmp = "!#$%^&*|'<>-;";
	
	for (var i=0; i<val.length; i++) {
		if (cmp.indexOf(val.charAt(i)) > 0) {
			valid = false;
			break;
		}
	}		
	return valid;
}

//--------------------------------------------------------------------------------------------------
//ÀÌ¹ÌÁö°¡ Å¬½Ã ÀÌ¹ÌÁö »çÀÌÁî ÁÙÀÌ±â
//--------------------------------------------------------------------------------------------------
function imgResize(which, max_width){
	var width = eval("document."+which+".width");
	var height = eval("document."+which+".height");
	var temp = 0;

	if ( width > max_width ) {  
	   height = height/(width / max_width);
	   eval("document."+which+".width = max_width");
	   eval("document."+which+".height = height");
	}
}

//--------------------------------------------------------------------------------------------------
// ¼ýÀÚ¸¸ ÀÔ·Â°¡´É
//ex) ÀÔ·Â¹æ¹ý (´Ü Comm_Js.js°¡ Include µÇ¾îÀÖ¾î¾ß ÇÑ´Ù.
//onkeyPress="javascript:numberKeyPress();" style="ime-mode; disabled" 
//--------------------------------------------------------------------------------------------------
function numberKeyPress(){
	
	//alert(event.keyCode);
	if ((event.keyCode<48) || (event.keyCode>57)){ 
		event.returnValue=false;
		return;
	}
	event.returnValue=true;
}

//¼ýÀÚÀÔ·Â½Ã ±Ý¾×¿¡ ¸ÂÃç¼­ ,¸¦ ¸®ÅÏÇÏ´Â ÇÔ¼ö
function formatComma(tx) {
  var oldv = "";
  if(oldv == tx.value) return;
  oldv = tx.value;
  tx.value = formatNumber(oldv);
}

//
function formatNumber(s) {
  var str  = s.replace(/\D/g,"");
  var len  = str.length;
  var tmp  = "";
  var tm2  = "";
  var i    = 0;
  while (str.charAt(i) == '0') i++;
  str = str.substring(i,len);
  len = str.length;
  if(len < 3) {
    return str;
  } else {
    var sit = len % 3;
    if (sit > 0) {
      tmp = tmp + str.substring(0,sit) + ',';
      len = len - sit;
    }
    while (len > 3) {
      tmp = tmp + str.substring(sit,sit+3) + ',';
      len = len - 3;
      sit = sit + 3;
    }
    tmp = tmp + str.substring(sit,sit+3) + tm2;
    str = tmp;
  }
  return str;
}

//--------------------------------------------------------------------------------------------------
//openWin_Scrollbars:PopUpÃ¢À» ¶ç¿ì´Â ÇÔ¼ö·Î Åø¹Ù,»çÀÌÁîº¯È­,½ºÅ©·Ñ¹ÙµîÀ» ¸ðµç °ªÀ» Á¤ÀÇÇÏ´Â Ã¢ÀÔ´Ï´Ù.)
//--------------------------------------------------------------------------------------------------
function openWinDefinition(url,Center,Toolbar,Resizable,Scrollbars,Width,Height,Left,Top) {
 	window.open(url, "", "toolbar=" + Toolbar + ",resizable=" + Resizable + ",scrollbars=" + Scrollbars + ",width=" + Width + ",height=" + Height + ",left=" + Left + ",top=" + Top);
}

//--------------------------------------------------------------------------------------------------
//¾÷·ÎµåÇÏ´Â ÆÄÀÏ Ã¼Å©
//	obj	ÆÄÀÏ°³Ã¼	ex) document.form.file_name
// exe	Çã¿ëÈ®ÀåÀÚ ex) jpg,gif
// maxFileSize		ex) 
//--------------------------------------------------------------------------------------------------
function chkUploadFile(object, exe, maxFileSize, isNull) {
	var src = getFileExtension(object.value);
	var tmp = object.value;

	/*nullÀÔ·Â Ã¼Å©*/
	if(src == "") {
			if(isNull) {
				return true;
			} 
			else {
				alert("ÆÄÀÏÀº ÇÊ¼öÇ×¸ñÀÔ´Ï´Ù.");
				return false;
			}
	} 
	else{
		var filename = tmp.substring(tmp.lastIndexOf('\\') + 1);

		/*Çã¿ëµÇ´Â È®ÀåÀÚ Ã¼Å©*/
		if(exe.trim() != "") {
			var fileEXE = exe.split(",");
			var cnt = 0;
			for(var i = 0; i < fileEXE.length; i++) if(fileEXE[i].toLowerCase().trim() == src.toLowerCase()) cnt++;
			if(cnt == 0) {
				alert('Çã¿ëµÇÁö ¾Ê´Â ÆÄÀÏÀÇ È®ÀåÀÚÀÔ´Ï´Ù.');
				return false;
			}
		}
		/*ÆÄÀÏÅ©±âÃ¼Å©*/
/*
		if(maxFileSize != "" & maxFileSize > 0){
			var imgInfo = new Image();
			imgInfo.src = object.value;
			if(parseInt(imgInfo.fileSize) > maxFileSize) {
				alert("ÆÄÀÏ Å©±â¸¦ Ã¼Å©ÇØ ÁÖ¼¼¿ä.");
				return false;
			} else {
				return true;
			}
		}
*/
	}
	return true;
}

//--------------------------------------------------------------------------------------------------
//·¹ÀÌ¾î show/hideºÎºÐ
//--------------------------------------------------------------------------------------------------
function MM_showHideLayers() { //v9.0
	var i,p,v,obj,args=MM_showHideLayers.arguments;
	for (i=0; i<(args.length-2); i+=3) 
		with (document) if (getElementById && ((obj=getElementById(args[i]))!=null)) { v=args[i+2];
			if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
		obj.visibility=v; }
}

//==================================================================================================
//¡áProgram Name		: chkJuminNo
//¡áDescription		: ÁÖ¹Î¹øÈ£ Ã¼Å© ÇÔ¼ö
//¡áValues			: str1 - ÁÖ¹Î¹øÈ£ ¾ÕÀÚ¸®
//					  str2 - ÁÖ¹Î¹øÈ£ µÞÀÚ¸®
//==================================================================================================
function chkJuminNo(str1, str2) {
	if (chkNumber(str1) == false) return false;
	if (chkNumber(str2) == false) return false;

	var x, y, z;
	var L11,L12,L13,L14,L15,L16;
	var L21,L22,L23,L24,L25,L26,L27;

	L11 = parseInt(str1.substring(0,1));
	L12 = parseInt(str1.substring(1,2));
	L13 = parseInt(str1.substring(2,3));
	L14 = parseInt(str1.substring(3,4));
	L15 = parseInt(str1.substring(4,5));
	L16 = parseInt(str1.substring(5,6));
	L21 = parseInt(str2.substring(0,1));
	L22 = parseInt(str2.substring(1,2));
	L23 = parseInt(str2.substring(2,3));
	L24 = parseInt(str2.substring(3,4));
	L25 = parseInt(str2.substring(4,5));
	L26 = parseInt(str2.substring(5,6));
	L27 = parseInt(str2.substring(6,7));
	x = (L11*2) + (L12*3) + (L13*4) + (L14*5) + (L15*6) + (L16*7) + (L21*8) + (L22*9) + (L23*2) + (L24*3) + (L25*4) + (L26*5);
	y = x % 11;
	z = 11 - y;

	if (z == 10) z = 0;
	else if (z == 11) z = 1;
	if (z == parseInt(str2.substring(6,7))) {
		return true;
	} else {
		return false;
	}

	return false;
}

//==================================================================================================
//¡áProgram Name		: chkNumber
//¡áDescription		: ÀÔ·Â ÇÊµå¿¡ µé¾î¿Â µ¥ÀÌÅ¸°¡ ¼ýÀÚ¸é true, ¼ýÀÚ°¡ ¾Æ´Ï¶ó¸é false¸¦ ¸®ÅÏÇÑ´Ù.
//¡áValues			: num   - Ã¼Å©ÇÏ°íÀÚÇÏ´Â ÇÊµå°ª
//					  fName - alert¸Þ¼¼Áö¸¦ »Ñ·ÁÁÙ°ÍÀÎÁö ±¸ºÐ ¸Þ¼¼Áö¸¦ ³Ö¾îÁÖ¸é ÇØ´ç¸Þ¼¼Áö¿Í ÇÔ²² alertÃ¢ÀÌ ¶ß°í
//							- ¸Þ¼¼Áö¸¦ ³Ö¾îÁÖÁö¾ÊÀ¸¸é alertÃ¢ÀÌ ¶ßÁö ¾Ê´Â´Ù.
//==================================================================================================
function chkNumber(num) {
	var numTemp   = Number(num);

	//°ªÀÌ ÀÖ´Ù¸é
	if(num != "") {
		//¼ýÀÚ¸é false¹ÝÈ¯ - if´Â ¹®ÀÚ¶ó¸é
		if(isNaN(numTemp)) return false;
		else return true;
	} else {
		return false;
	}
}

//»ç¾÷ÀÚµî·Ï¹øÈ£ Ã¼Å©
function chkREG_NO(strNumb) {
	sumMod	=	0;
	sumMod	+=	parseInt(strNumb.substring(0,1));
	sumMod	+=	parseInt(strNumb.substring(1,2)) * 3 % 10;
	sumMod	+=	parseInt(strNumb.substring(2,3)) * 7 % 10;
	sumMod	+=	parseInt(strNumb.substring(3,4)) * 1 % 10;
	sumMod	+=	parseInt(strNumb.substring(4,5)) * 3 % 10;
	sumMod	+=	parseInt(strNumb.substring(5,6)) * 7 % 10;
	sumMod	+=	parseInt(strNumb.substring(6,7)) * 1 % 10;
	sumMod	+=	parseInt(strNumb.substring(7,8)) * 3 % 10;
	sumMod	+=	Math.floor(parseInt(strNumb.substring(8,9)) * 5 / 10);
	sumMod	+=	parseInt(strNumb.substring(8,9)) * 5 % 10;
	sumMod	+=	parseInt(strNumb.substring(9,10));
	
	if	(sumMod % 10	!=	0)
	{		
		return false;
	}
	return	true;
}

//ÅëÇÕ°Ë»ö Enter Á¦¾î
function OnTopSearchEnter() {
	if (event.keyCode == "13") {
		OnTopSearch();
	}
}

//ÅëÇÕ°Ë»ö
function OnTopSearch() {
	var frm = document.topSearch;

	if (checkform(frm.topSearchText, "", "°Ë»ö¾î´Â", 50, 2) == false) {
		return;
	}

	if (isSearchText(frm.topSearchText.value) == false) {
		alert("°Ë»ö¾î¿¡ »ç¿ëÇÒ ¼ö ¾ø´Â ¹®ÀÚ°¡ ÀÖ½À´Ï´Ù.");
		frm.topSearchText.value = "";
		frm.topSearchText.focus();
		return;
	}
	
	frm.target = "_self";
	frm.action = "/Search_result.asp";
	frm.submit();
}

//³¯Â¥°è»ê
<!--
function addDay(yyyy, mm, dd, pDay) // ³â, ¿ù, ÀÏ, °è»êÇÒ ÀÏÀÚ (³âµµ´Â ¹Ýµå½Ã 4ÀÚ¸®·Î ÀÔ·Â)
{
	var oDate; // ¸®ÅÏÇÒ ³¯Â¥ °´Ã¼ ¼±¾ð
	dd = dd*1 + pDay*1; // ³¯Â¥ °è»ê
	mm--; // ¿ùÀº 0~11 ÀÌ¹Ç·Î ÇÏ³ª »©ÁØ´Ù
	oDate = new Date(yyyy, mm, dd) // °è»êµÈ ³¯Â¥ °´Ã¼ »ý¼º (°´Ã¼¿¡¼­ ÀÚµ¿ °è»ê)
	return oDate;
}

function addMonth(yyyy, mm, dd, pMonth) // ³â, ¿ù, ÀÏ, °è»êÇÒ ¿ù (³âµµ´Â ¹Ýµå½Ã 4ÀÚ¸®·Î ÀÔ·Â)
{
	var cDate; // °è»ê¿¡ »ç¿ëÇÒ ³¯Â¥ °´Ã¼ ¼±¾ð
	var oDate; // ¸®ÅÏÇÒ ³¯Â¥ °´Ã¼ ¼±¾ð
	var cYear, cMonth, cDay // °è»êµÈ ³¯Â¥°ªÀÌ ÇÒ´çµÉ º¯¼ö
	mm = mm*1 + ((pMonth*1)-1); // ¿ùÀº 0~11 ÀÌ¹Ç·Î ÇÏ³ª »©ÁØ´Ù
	cDate = new Date(yyyy, mm, dd) // °è»êµÈ ³¯Â¥ °´Ã¼ »ý¼º (°´Ã¼¿¡¼­ ÀÚµ¿ °è»ê)

	cYear = cDate.getFullYear(); // °è»êµÈ ³âµµ ÇÒ´ç
	cMonth = cDate.getMonth(); // °è»êµÈ ¿ù ÇÒ´ç
	cDay = cDate.getDate(); // °è»êµÈ ÀÏÀÚ ÇÒ´ç
	oDate = (dd == cDay) ? cDate : new Date(cYear, cMonth, 0); // ³Ñ¾î°£ ¿ùÀÇ Ã¹Â¶³¯ ¿¡¼­ ÇÏ·ç¸¦ »« ³¯Â¥ °´Ã¼¸¦ »ý¼ºÇÑ´Ù.

	return oDate;
}

function calcDate(f, y, m, d, i)
{

	var cDate;

	if(f == 1 ){
		cDate = addDay(y, m, d, i)
	}else{
		cDate = addMonth(y, m, d, i)
	}
	var sMonth;
	var sDay;

	sMonth = cDate.getMonth()+1;

	if (sMonth < 10){
		sMonth = "0" + sMonth;
	}

	sDay = cDate.getDate();
	if (sDay < 10){
		sDay = "0" + sDay;
	}

	var calDate = cDate.getFullYear() +"-" + sMonth +"-"+ sDay;

	return calDate;


}

/*replace all*/
function strReplaceAll(str, s, d){
   var i=0;
   while(i > -1){
      i = str.indexOf(s);
      str = str.substr(0,i) + d + str.substr(i+1, str.length);
   }
   return str;
}

// 
function SetLeftOil(val) {
	var elleftHOil = document.getElementById("leftHOil");
	var elleftKOil = document.getElementById("leftKOil");

	if (val == "K") {
		elleftHOil.style.display = "none";
		elleftKOil.style.display = "block";
	} else {
		elleftHOil.style.display = "block";
		elleftKOil.style.display = "none";
	}
}

//--------------------------------------------------------------------------------------------------
// µÎ ³¯Â¥»çÀÌÀÇ °£°Ý
//--------------------------------------------------------------------------------------------------
	//ÀÔ·ÂÇü½Ä:"YYYY/MM/DD"(´Ù¸¥ Çü½ÄÀº ¿¡·¯ÀÔ´Ï´Ù.)
	function DateDiff(FromDate, ToDate){
		var D1,D2,Diff;						//º¯¼ö¸¦ ¼±¾ðÇÕ´Ï´Ù.
		var MinMilli = 1000 * 60;			//º¯¼ö¸¦ ÃÊ±âÈ­ÇÕ´Ï´Ù.
		var HrMilli = MinMilli * 60;
		var DyMilli = HrMilli * 24;
		D1 = Date.parse(FromDate);			//±¸¹® ºÐ¼®ÇÕ´Ï´Ù.
		D2 = Date.parse(ToDate);			//±¸¹® ºÐ¼®ÇÕ´Ï´Ù.
		Diff = Math.round(Math.abs((D2-D1) / DyMilli))
		if (Diff>-1) {
			Diff= Diff + 1;
		} else {
			Diff= Diff - 1;
		}
		return(Diff);						//°á°ú¸¦ ¹ÝÈ¯ÇÕ´Ï´Ù.
	}
//--------------------------------------------------------------------------------------------------
// ¶óµð¿À ¹Ú½º Ã¼Å©
//--------------------------------------------------------------------------------------------------
	function GetRadioValue(opt) {		
		var leng = ((isNaN(opt.length*1))?1:opt.length*1);
		
		if (leng == 1)
		{
				if (opt.checked)
				{
					return opt.value;
				}
		}
		else {
			var n = opt.length;			
			for (i=0; i<n; i++) {
				if (opt[i].checked) {					
					return opt[i].value;
				}
			}
		}
		return "";
	}
//--------------------------------------------------------------------------------------------------
// Ã¼Å©¹Ú½º Ã¼Å©°³¼ö ¹ÝÈ¯
//--------------------------------------------------------------------------------------------------
	function GetCheckCount(opt) {		
		var leng = ((isNaN(opt.length*1))?1:opt.length*1);
		var chkcnt = 0;
		if (leng == 1)
		{
				if (opt.checked)
				{
					chkcnt = 1;
				}
		}
		else {
			var n = opt.length;			
			for (i=0; i<n; i++) {
				if (opt[i].checked) {					
					chkcnt = chkcnt + 1;
				}
			}
		}
		return chkcnt;
	}

//--------------------------------------------------------------------------------------------------
// Setting default value - combo, radio
//--------------------------------------------------------------------------------------------------
function setSelect(elName, targetValue){
    var el;
    el = document.getElementById(elName);
    
    switch (el.type) {
        case 'select-one':
            for (var i = 0; i < el.length; i++) {
                if (el.options[i].value == targetValue) {
                    el.options[i].selected = true;
                }
            }
            break;
            
        case 'radio':
            var radioEl = document.getElementsByName(elName);
            for (var i = 0; i < radioEl.length; i++) {
                if (radioEl[i].value == targetValue) {
                    radioEl[i].checked = true;
                    break;
                }
            }
            break;
    }
}

//--------------------------------------------------------------------------------------------------
// Next Form ÇÊµå
//--------------------------------------------------------------------------------------------------
	function Go_Next(curField, nextField, curLength){
		if (curField.value.length >= curLength){
			nextField.focus();
		}
	}


var imgObj = new Image();
function showImgWin(imgName) {
	imgObj.src = imgName;
	setTimeout("createImgWin(imgObj)", 100);
}
function createImgWin(imgObj) {
	if (! imgObj.complete) {
		setTimeout("createImgWin(imgObj)", 100);
		return;
	}
	imageWin = window.open("", "imageWin",
	"width="+imgObj.width+",height="+imgObj.height+"");
	imageWin.document.write("<html><body style='margin:0'>");
	imageWin.document.write("<a href='JavaScript:self.close();'><img src='" + imgObj.src + "' border='0' title='"+imgObj.src+"' width='"+imgObj.width+"' height='"+imgObj.height+"'></a>");
	imageWin.document.write("</body><html>");
	imageWin.document.title = imgObj.src;
}

//--------------------------------------------------------------------------------------------------
// ÁÖ¼Òº¹»ç
//--------------------------------------------------------------------------------------------------
function copyWid(objNm) {
	window.clipboardData.setData('Text', objNm);
	alert("°Ô½ÃÆÇ ÁÖ¼Ò°¡ º¹»çµÇ¾ú½À´Ï´Ù.\n¸Þ½ÅÁ®³ª °Ô½ÃÆÇ¿¡ Ctrl + V·Î ºÙ¿©³Ö±â ÇÏ¼¼¿ä.");
	return;
}

function popImage(clubid){
	open_wnd("/common/editor/Editor_About/inc_pop/popImage.asp?gubun="+clubid, "addimage", 330, 300);
}

function popFile(clubid){
	open_wnd("/common/editor/Editor_About/inc_pop/AttachFileView.asp?gubun="+clubid, "addfile", 330, 200);
}

function open_window(url, name, width, height, feature) {
    var oWnd;
	var IE4 = true;

    if (IE4 && width < window.screen.width && height < window.screen.height) 
    {
        var windowX = Math.ceil( (window.screen.width  - width) / 2 );
        var windowY = Math.ceil( (window.screen.height - height) / 2 );

        oWnd = window.open(url, name, feature+",width=" + width +",height=" + height+",left="+windowX+",top="+windowY + ",resizable=yes");
    }
    else 
    {
        oWnd = window.open(url, name, feature+",width=" + width +",height=" + height + ",resizable=yes");
    }

    return oWnd;
}

function open_wnd(url, name, width, height) {
    var oWnd = open_window(url, name, width, height, "toolbar=0,menubar=0,resizable=yes,scrollbars=no");
    return oWnd;
}


function addList(dirname, filename, filesize, filetype){// Æú Ã·ºÎ
	if (filename == 'poll@nhn'){
		document.getElementById("attachfilelist").options.add(new Option('ÆúÀÌ Ã·ºÎµÇ¾ú½À´Ï´Ù' , filename));

	}else{ // ÀÏ¹Ý ÆÄÀÏ Ã·ºÎ
		if (filesize){
			calcFileSize(filesize, filetype, 1);
			document.getElementById("attachfilelist").options.add(new Option(filename + "   " + parseInt(parseInt(filesize)/1024) + "KB", dirname +"/" + filename));
		}else{
			document.getElementById("attachfilelist").options.add(new Option(filename, dirname +"/" + filename));
		}
	}
}


function addListEn(dirname, filename, filesize, filetype){// Æú Ã·ºÎ
	if (filename == 'poll@nhn'){
		document.getElementById("attachfilelistEn").options.add(new Option('ÆúÀÌ Ã·ºÎµÇ¾ú½À´Ï´Ù' , filename));

	}else{ // ÀÏ¹Ý ÆÄÀÏ Ã·ºÎ
		if (filesize){
			calcFileSizeEn(filesize, filetype, 1);
			document.getElementById("attachfilelistEn").options.add(new Option(filename + "   " + parseInt(parseInt(filesize)/1024) + "KB", dirname +"/" + filename));
		}else{
			document.getElementById("attachfilelistEn").options.add(new Option(filename, dirname +"/" + filename));
		}
	}
}


function addFile(dirname, filename, filesize, filetype, thumbnailnameOrImagewidth, playtimeOrImageHeight, thumbnailtime){
	
	if (filetype == "F") document.getElementById("attachfileyn").value = "Y";

	if (filetype == "I"){	// image file
		document.getElementById("attachimageyn").value = "Y";
		document.getElementById("attachfiles").value = document.getElementById("attachfiles").value + dirname +"/" + filename + "|" + filetype + "|"
		+ thumbnailnameOrImagewidth + "|" + playtimeOrImageHeight + "||";	// imagewidth, imageheight ÀÇ ¿ëµµ·Î »ç¿ëµÊ.

	}else if (filetype == "M"){  // movie file 
		document.getElementById("attachmovie").value = "true";    
		document.getElementById("attachfiles").value = document.getElementById("attachfiles").value + dirname +"/" + filename + "|" + filetype + "|"
		+ thumbnailnameOrImagewidth + "|" + playtimeOrImageHeight + "|" + thumbnailtime + "||";	// thumbnail, playtimeÀÇ ¿ëµµ·Î »ç¿ëµÊ.

	}else		// other. include "F"
		document.getElementById("attachfiles").value = document.getElementById("attachfiles").value + dirname +"/" + filename + "|" + filetype + "||";
		document.getElementById("attachsizes").value = document.getElementById("attachsizes").value + filesize + "||"; 

}


function addFileEn(dirname, filename, filesize, filetype, thumbnailnameOrImagewidth, playtimeOrImageHeight, thumbnailtime){
	
	if (filetype == "F") document.getElementById("attachfileynEn").value = "Y";

	if (filetype == "I"){	// image file
		document.getElementById("attachimageynEn").value = "Y";
		document.getElementById("attachfilesEn").value = document.getElementById("attachfilesEn").value + dirname +"/" + filename + "|" + filetype + "|"
		+ thumbnailnameOrImagewidth + "|" + playtimeOrImageHeight + "||";	// imagewidth, imageheight ÀÇ ¿ëµµ·Î »ç¿ëµÊ.

	}else if (filetype == "M"){  // movie file 
		document.getElementById("attachmovieEn").value = "true";    
		document.getElementById("attachfilesEn").value = document.getElementById("attachfilesEn").value + dirname +"/" + filename + "|" + filetype + "|"
		+ thumbnailnameOrImagewidth + "|" + playtimeOrImageHeight + "|" + thumbnailtime + "||";	// thumbnail, playtimeÀÇ ¿ëµµ·Î »ç¿ëµÊ.

	}else		// other. include "F"
		document.getElementById("attachfilesEn").value = document.getElementById("attachfilesEn").value + dirname +"/" + filename + "|" + filetype + "||";
		document.getElementById("attachsizesEn").value = document.getElementById("attachsizesEn").value + filesize + "||"; 

}

function calcFileSize(filesize, filetype, oper){
	var objRealSum = document.getElementById("attachsizerealsum");
	var objImageSum = document.getElementById("attachimagesizesum");
	var objFileSum = document.getElementById("attachfilesizesum");

	if (oper == 1){
		objRealSum.value = parseInt(objRealSum.value,10) + parseInt(filesize,10);
		if(filetype=="I"){ //image
			objImageSum.value = parseInt(objImageSum.value,10) + parseInt(filesize,10);
		}else{ //file
			objFileSum.value = parseInt(objFileSum.value,10) + parseInt(filesize,10);
		}
	}else{
		objRealSum.value = parseInt(objRealSum.value,10) - parseInt(filesize,10);
		if(filetype=="I"){ //image
			objImageSum.value = parseInt(objImageSum.value,10) - parseInt(filesize,10);
		}else{ //file
			objFileSum.value = parseInt(objFileSum.value,10) - parseInt(filesize,10);
		}
	}
	document.getElementById("attachsizesum").value = parseInt(objRealSum.value/1024);
}


function calcFileSizeEn(filesize, filetype, oper){
	var objRealSum = document.getElementById("attachsizerealsumEn");
	var objImageSum = document.getElementById("attachimagesizesumEn");
	var objFileSum = document.getElementById("attachfilesizesumEn");

	if (oper == 1){
		objRealSum.value = parseInt(objRealSum.value,10) + parseInt(filesize,10);
		if(filetype=="I"){ //image
			objImageSum.value = parseInt(objImageSum.value,10) + parseInt(filesize,10);
		}else{ //file
			objFileSum.value = parseInt(objFileSum.value,10) + parseInt(filesize,10);
		}
	}else{
		objRealSum.value = parseInt(objRealSum.value,10) - parseInt(filesize,10);
		if(filetype=="I"){ //image
			objImageSum.value = parseInt(objImageSum.value,10) - parseInt(filesize,10);
		}else{ //file
			objFileSum.value = parseInt(objFileSum.value,10) - parseInt(filesize,10);
		}
	}
	document.getElementById("attachsizesumEn").value = parseInt(objRealSum.value/1024);
}

function removeAttach(clubid){
	
	var attachlist = document.getElementById("attachfilelist");

	if (attachlist.selectedIndex <= 0)
		return;

	if (confirm("Ã·ºÎµÈ ÆÄÀÏÀ» »èÁ¦ÇÏ½Ã°Ú½À´Ï±î?")) {
		if (attachlist.options[attachlist.selectedIndex].value == "poll@nhn")
			removePoll();
		else
			removeFile(attachlist.selectedIndex-1,clubid);

		attachlist.remove(attachlist.selectedIndex);    
	}
}

function removeFile(index,clubid){
	var reArrAttachfiles = "";
	var reArrAttachsize = "";

	arrAttachfile = document.getElementById("attachfiles").value.split("||");
	arrAttachsize = document.getElementById("attachsizes").value.split("||");
	arrAttach = document.getElementById("attachsizes").value.split("||");

	calcFileSize(arrAttachsize[index], -1);    

	filestring = arrAttachfile[index].split("|");
	var filename = filestring[0];
	
	document.getElementById("url").value = filename;
	document.regForm.target = "com_iFrame";
	document.regForm.method = "post";
	document.regForm.action = "/common/editor/Editor_About/UrlEncoding.asp?gubun="+clubid;
	document.regForm.submit();

	//remove(arrAttachfile,index);
	//remove(arrAttachsize,index);

	for (i = 0; i < arrAttachfile.length-1; i++) {
		if (i != index) {
			reArrAttachfiles += arrAttachfile[i] + "||";
		}
	}

	document.getElementById("attachfiles").value = reArrAttachfiles;
	document.getElementById("attachsizes").value = arrAttachsize.join("||");
	document.getElementById("attachfileyn").value = "";
	document.getElementById("attachimageyn").value = "";

	for (var i = 0; i<arrAttachfile.length; i++){
		if (arrAttachfile[i].match(/\|F$/)){
			document.getElementById("attachfileyn").value = "Y";
		}
		if (arrAttachfile[i].match(/\|I\|/)){
			document.getElementById("attachimageyn").value = "Y";
		}
		if (arrAttachfile[i].match(/\|M\|/)){
//			document.getElementById("attachmovie").value = "true";
		}
	}

}

function isImageFile(filename)
{
    if (filename.match(/(.jpg|.jpeg|.gif|.png)$/i))
        return true;
    else
        return false;
}

function isValidFilename(filename)
{
    if (!filename.match(/[\\\:\*\?\|<>]/))
        return true;
    else
        return false;
}

function imageopen(url,w,h)
{
	window.open(url);
}

// ÀÔ·Â°ªÀÇ ¹ÙÀÌÆ® ±æÀÌ¸¦ ¸®ÅÏ
function getByteLength(input) {
	var byteLength = 0;

	for (var inx=0; inx < input.value.length; inx++) {
		var oneChar = escape(input.value.charAt(inx));

		if (oneChar.length == 1) {
			byteLength++;
		} else if (oneChar.indexOf("%u") != -1) {
			byteLength += 2;
		} else if (oneChar.indexOf("%") != -1) {
			byteLength += oneChar.length/3;
		}
	}

	return byteLength;
}

/**
 * °´Ã¼¸¦ ÀÎÀÚ·Î ¹Þ¾Æ ÀÎÀÚ°¡ ¿ø·¡ array ÀÌ¸é ±×´ë·Î ¸®ÅÏÇÏ°í, ¾Æ´Ï¸é Å©±â°¡ 1ÀÎ array·Î ¸¸µé¾î ¸®ÅÏÇÑ´Ù.
 * @param oneOrArray
 */
function getObjArray(oneOrArray){

	if(oneOrArray==null) return null;
	else if(oneOrArray.length >= 1){
		return oneOrArray;
	}else{
		var newArray = new Array(1);
	    newArray[0]  = oneOrArray;
		return newArray;
	}

}

//¶óµð¿ÀÃ¼Å© °ªÀ» ¹ÝÈ¯ÇÑ´Ù.
function getChekcedValue(chkObj){

	var radio = getObjArray(chkObj);
	var val = "";
	for(var i=0; i<radio.length; i++){
		if(radio[i].checked){
			val = radio[i].value;
			break;
		}
	}

	return val;
}

function loginPopUp(){
	open_wnd("/member/login/login.asp", "login", 510, 295);
}

/**
 * µ¡±Û ÀÔ·Â½Ã ÇØ´ç ¿µ¿ª¿¡ ±ÛÀÚ ¼ö¸¦ Ãâ·ÂÇØÁÖ°í ÃÖ´ë ±ÛÀÚ ¼ö¿¡ °É¸®¸é alert ¸Þ½ÃÁö¸¦ Á¦°øÇÑ´Ù.
 * ex) µ¡±Û textarea¿¡ onkeyup="document.getElementById('±ÛÀÚ¼ö Ãâ·Â ¿µ¿ªID').innerHTML=getLength(µ¡±ÛÀÔ·Â textareaÀÇ value°ª, '±ÛÀÚ¼ö Ãâ·Â ¿µ¿ªID', 'µ¡±ÛÀÔ·Â textareaID', ÃÖ´ë ±ÛÀÚ ¼ö);"
 *
 */
function getLength(s, id, txtId, limit){
	document.getElementById(id).innerHTML = "";

    var sum = 0;
    var len = s.length;
    for (var i=0; i<len; i++) {
		sum++;
    }
	if(sum > limit){
		alert("ÃÖ´ë " + limit + "ÀÚ ÀÌ³»·Î ÀÛ¼ºÇØ ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.");
		sum = limit;
		document.getElementById(txtId).value = s.substring(0, limit);
	}
    return sum;
}
//****************************************************************************************
//ÇÑ±ÛÃ³¸® ½ºÅ©¸³Æ®
//****************************************************************************************
function setOnlyNumber(event)
{
    event = checkEvent(event);  /* ÀÌº¥Æ® °ª °¡Á®¿À±â */
    var pKey = String.fromCharCode(event.which);
    var intReg = /[0-9\\-]/g;

    if(pKey!="\r" && !intReg.test(pKey)) /* ¿£ÅÍÅ° ¹× regkey°¡ ¾Æ´Ò°æ¿ì ¸®ÅÏ */
        event.returnValue=false;

    delete intReg;
}

/**
 * ÀÌº¥Æ® Ã¼Å©
 * Firefox¿Í IE°£ È£È¯À» À§ÇÔ
 */
function checkEvent(event) {
 if (!event) { /* IEÀÏ °æ¿ì */
  event = window.event;
  event.target = event.srcElement;
  event.which = event.keyCode;
 }
 return event;
}


//-->
