// °ø¿ë js´Â ¾Æ·¡¿Í °°ÀÌ Æ÷ÇÔ½ÃÅ²´Ù.
document.write("<link rel='shortcut icon' type='image/x-icon' href='/favicon.ico' />");	// ÆÄºñÄÜ(ÁÖ¼ÒÃ¢ ¾ÆÀÌÄÜ)
document.write("<script type='text/javascript' src='/script/jquery.js'></script>");
document.write("<script type='text/javascript' src='/script/jquery.pngFix.js'></script>");
document.write("<script type='text/javascript' src='/script/jquery-ui-1.8.9.custom.min.js'></script>");
document.write("<script type='text/javascript' src='/script/jquery.cookie.js'></script>");
document.write("<script type='text/javascript' src='/script/jcookie.js'></script>");
document.write("<script type='text/javascript' src='/script/jquery.treeview.js'></script>");
document.write("<script type='text/javascript' src='/script/jquery.rolling.js'></script>");
document.write("");

// ¼ýÀÚ Ã¼Å©ÇÔ¼ö 
// ¼ýÀÚ¸¸ ÀÔ·Â °¡´É
// Àû¿ë¹ý : onkeyup="GetNumber(this);" 
// justmine
function GetNumber(obj)
{
	obj.value = obj.value.replace(/[^0-9.]/g, "");
	return;
}

// ¼ýÀÚ, ±Ý¾×´ÜÀ§ Ã¼Å©ÇÔ¼ö 
// Àû¿ë¹ý : onkeyup="GetAmount(this);" 
// justmine
function GetAmount(obj)
{
	if (obj.value.substr(0,1) == 0)
	{
		obj.value = obj.value.substr(0,obj.value.length-1);
		return;
	}

	var count = 0;

	for (var i = 0; i < obj.value.length; i++)
	{
		if(obj.value.substr(i,1) == ".")
		{
			count += 1;
		}
	}

	if (count > 1)
	{		
		obj.value = obj.value.substr(0,obj.value.length-1);
		return;
	}
	else
	{
		var head;
		var detail = "";
			
		for (var i = 0; i < obj.value.length; i++)
		{
			if(obj.value.substr(i,1) == ".")
			{
				// ¼Ò¼ýÁ¡ ¾Õ,µÚ ºÐ¸®				 
				head = obj.value.substr(0,i);
				detail = "."+obj.value.substr(i+1).replace(/\D/g,"");
			}
		}
		
		var s;
				
		if (count == 1)
		{
			s = head.replace(/\D/g,"");		
		}
		else
		{
			s = obj.value.replace(/\D/g,"");		
		}
		
		// 3ÀÚ¸®¸¶´Ù ÄÄ¸¶ »ðÀÔ
		var l = s.length-3;
		while (l>0) 
		{
			s = s.substr(0,l) + "," + s.substr(l);
			l -= 3;
		}
			
		// ¼Ò¼ýÁ¡ ¾Õ, µÚ ºÙÀÌ±â(3ÀÚ¸® ÄÄ¸¶ Æ÷ÇÔ)	
		obj.value = s+detail;		

		return;
	}
}


// ¼ýÀÚ°ª¿¡ ÄÞ¸¶À» ºÙ¿© ¹ÝÈ¯ÇÑ´Ù.
// justmine
function GetAddComma(iAccount)
{
	var bSign = iAccount < 0 ? "-" : "";
	iAccount = "" + iAccount;

	if(iAccount.length == 0)
	{
		return "0";
	}

	var count = 0;
	
	for(var i = 0; i < iAccount.length; i++)
	{
		if(iAccount.substr(i,1) == ".")
		{
			count += 1;
		}
	}

	if(count > 1)
	{		
		iAccount = iAccount.substr(0,iAccount.length-1);
		return iAccount;
	}
	else
	{
		var head;
		var detail = "";
			
		for(var i = 0; i < iAccount.length; i++)
		{
			if(iAccount.substr(i,1) == ".")
			{
				// ¼Ò¼ýÁ¡ ¾Õ,µÚ ºÐ¸®				 
				head = iAccount.substr(0,i);
				detail = "."+iAccount.substr(i+1).replace(/\D/g,"");
			}
		}
		
		var s;
				
		if(count == 1)
		{
			s = head.replace(/\D/g,"");		
		}
		else
		{
			s = iAccount.replace(/\D/g,"");		
		}
		
		// 3ÀÚ¸®¸¶´Ù ÄÄ¸¶ »ðÀÔ
		var l = s.length-3;
		while(l>0) 
		{
			s = s.substr(0,l) + "," + s.substr(l);
			l -= 3;
		}
			
		// ¼Ò¼ýÁ¡ ¾Õ, µÚ ºÙÀÌ±â(3ÀÚ¸® ÄÄ¸¶ Æ÷ÇÔ)	
		iAccount = bSign + s + detail;		

		return iAccount;
	}
}


// ³¯Â¥ Ã¼Å©ÇÔ¼ö
// ¼ýÀÚ¸¸ ÀÔ·Â°¡´ÉÇÔ
// Àû¿ë¹ý : onkeyup=ChkDate(this);
// MaxLength : 10
// Ã¹ ¼ýÀÚ : 1,2
// Çü½Ä : 2006-01-01
// ÁÖÀÇ ÆäÀÌÁö¿¡ <script src="/script/Format.vbs" language="vbscript"></script> 
// ÁÖÀÇ ÆäÀÌÁö¿¡ ¼ø¼­´ë·Î ´ÙÀ½¶óÀÎ Ãß°¡ÇÒ °Í
// <script src="/script/common.js" language="javascript"></script>
// <script src="/script/Format.vbs" language="vbscript"></script>
// justmine
function ChkDate(obj)
{
	// BackSpace Å° ÀÔ·Â½Ã ¹«Á¶°Ç ÇÑÀÚ¸®¾¿ Á¦°ÅÇÔ
	if (event.keyCode == 8)
	{
		return;				
	}

	var str = obj.value;
	// ¼ýÀÚ¸¸ ÀÔ·Â°¡´ÉÇÏµµ·Ï ÇÔ
	if (str.search( /[^0-9]/ ) != -1)
	{

		if(str.length > 5)
		{
			if(str.substr(5,1).search( /[^0-1]/ ) != -1)
			{
				obj.value = str.substr(0,str.length-1);
				return;
			}
			else if(str.substr(6,1).search( /[^0-9]/ ) != -1)
			{
				obj.value = str.substr(0,str.length-1);
				return;							
			}
			else if(str.substr(5,2) > 12)
			{
				obj.value = str.substr(0,str.length-1);
				return;							
			}
			else if(str.substr(8,1).search( /[^0-3]/ ) != -1)
			{
				obj.value = str.substr(0,str.length-1);
				return;							
			}
			else if(str.substr(9,1).search( /[^0-9]/ ) != -1)
			{
				obj.value = str.substr(0,str.length-1);
				return;							
			}
			else if(str.length > 9)
			{
				var iYear = str.substr(0,4);
				var iMonth = str.substr(5,2);
				var iDay = str.substr(8,2);

				var EDay = GetMaxDay(iYear,iMonth);

				if(iDay > EDay)
				{
					if(str.substr(5,2) == "02")
					{
						obj.value = str.substr(0,str.length-2);
					}
					else
					{
						obj.value = str.substr(0,str.length-1);
					}
				}
			}
		}
		else
		{
			obj.value = str.substr(0,str.length-1);
			return;
		}

	}

	if(str.length == 4)
	{
		obj.value = obj.value+"-";
	}
	else if(str.length == 7)
	{
		obj.value = obj.value+"-";
	}				
}


// ³¯Â¥ Format ÇÔ¼ö
// Àû¿ë¹ý : onblur=FormatDate(this);
// justmine
function FormatDate(obj)
{
	var str = obj.value;
	if (str == "")	return;

	var mat1 = str.match( /\d{4}-\d{2}-\d{2}/ );
	var mat2 = str.match( /\d{4}\d{2}\d{2}/ );

	if (mat1 == null && mat2 == null)
	{
		obj.value = "";
		obj.focus();
	}
	else
	{
		if (mat2 != null)
		{
			str = str.substr(0, 4) + "-" + str.substr(4, 2) + "-" + str.substr(6, 2);
		}

		var iYear	= str.substr(0,4);
		var iMonth	= str.substr(5,2);
		var iDay	= str.substr(8,2);

		// ³â, ¿ù, ÀÏ À¯È¿¼º °Ë»ç(smalldatetime ±âÁØ)
		if (iYear < 1900 || iYear > 2079	||
			iMonth < 1	 || iMonth > 12		||
			iDay < 1	 || iDay > 31)
		{
			DisplayMessage("³¯Â¥´Â 1900-01-01 ¿¡¼­ 2079-12-31±îÁö ÀÔ·ÂÇÒ ¼ö ÀÖ½À´Ï´Ù.", obj);
			obj.value = "";
			return;
		}

		var EDay = GetMaxDay(iYear,iMonth);

		if (iDay > EDay)
		{
			obj.value = "";
			obj.focus();
		}
		else
		{
			obj.value = str;
		}
	}
}


// ÀüÈ­¹øÈ£ Ã¼Å©
// ¼ýÀÚ¸¸ ÀÔ·Â°¡´ÉÇÔ
// Àû¿ë¹ý :onkeyup=CheckPhone(this);
// Çü½Ä	1. 02-###-####
//		2. 02-####-####
//		3. 0##-###-####
//		4. 0##-####-####
//		5. 01#-###-####
//		6. 01#-####-####
// justmine
function CheckPhone(obj)
{
	var str = obj.value;

	// BackSpace Å° ÀÔ·Â½Ã ¹«Á¶°Ç ÇÑÀÚ¸®¾¿ Á¦°ÅÇÔ
	if (event.keyCode == 8)
	{
		return;				
	}
				
	var mat1 = str.match( /\d{2}-\d{3}-\d{4}/ );
	var mat2 = str.match( /\d{2}-\d{4}-\d{4}/ );
	var mat3 = str.match( /\d{3}-\d{3}-\d{4}/ );
	var mat4 = str.match( /\d{3}-\d{4}-\d{4}/ );

	if ((mat1 != null)||(mat2 != null)||(mat3 != null)||(mat4 != null))
	{
		return;
	}

	// ¼ýÀÚ¸¸ ÀÔ·Â°¡´ÉÇÏµµ·Ï ÇÔ
	if (str.search( /[^0-9]/ ) != -1)
	{
		if(str.substr(2,1) == "-")	// ¼­¿ï ÀüÈ­¹øÈ£ÀÏ °æ¿ì
		{
			if(str.substr(3,1).search( /[^1-9]/ ) != -1)
			{
				obj.value = str.substr(0,str.length-1);
				return;
			}
			else if(str.substr(3).search( /[^0-9]/ ) != -1)
			{
				obj.value = str.substr(0,str.length-1);
				return;							
			}
		}
		else if(str.substr(3,1) == "-")	// ¼­¿ï ÀÌ¿Ü ÀüÈ­¹øÈ£ÀÏ °æ¿ì
		{
			if(str.substr(4,1).search( /[^1-9]/ ) != -1)
			{
				obj.value = str.substr(0,str.length-1);
				return;
			}
			else if(str.substr(5).search( /[^0-9]/ ) != -1)
			{
				obj.value = str.substr(0,str.length-1);
				return;							
			}
		}											
		else
		{
			obj.value = str.substr(0,str.length-1);
			return;
		}
	}
	else if(str.substr(0,1) != "0")
	{
		obj.value = str.substr(0,str.length-1);
		return;
	}
	else if(str.substr(1,1) == "1")	// ÀÌµ¿ÀüÈ­(010,011,016,017,018,019)
	{
		if(str.length > 2)
		{
			if(str.substr(2,1) == "0"||str.substr(2,1) == "1"||str.substr(2,1) == "6"||str.substr(2,1) == "7"||str.substr(2,1) == "8"||str.substr(2,1) == "9")
			{
				obj.value = obj.value+"-";
			}
			else
			{
				obj.value = str.substr(0,str.length-1);
			}
		}
		return;					
	}
	else if(str.substr(1,1) == "2")
	{
		obj.value = obj.value+"-";
		return;						
	}
	else if((str.substr(1,1) == "3")||(str.substr(1,1) == "4"))
	{
		if(str.length > 2)
		{
			if((str.substr(2,1) == "1")||(str.substr(2,1) == "2")||(str.substr(2,1) == "3"))
			{
				obj.value = obj.value+"-";
			}
			else
			{
				obj.value = str.substr(0,str.length-1);
			}
		}
		return;
	}
	else if(str.substr(1,1) == "5")
	{
		if(str.length > 2)
		{	
			if((str.substr(2,1) > 0)&&(str.substr(2,1) < 6))
			{
				obj.value = obj.value+"-";
			}
			else
			{
				obj.value = str.substr(0,str.length-1);
			}
		}
		return;					
	}
	else if(str.substr(1,1) == "6")	//  ÀüÈ­¹øÈ£(Àü³²,±¤ÁÖ,ÀüºÏ,Á¦ÁÖ)
	{
		if(str.length > 2)
		{				
			if((str.substr(2,1) > 0)&&(str.substr(2,1) < 5))
			{
				obj.value = obj.value+"-";
			}
			else
			{
				obj.value = str.substr(0,str.length-1);
			}
		}
		return;					
	}	
}

// ÀüÈ­¹øÈ£ Format ÇÔ¼ö 
// Àû¿ë¹ý : onblur = FormatPhone(this);
// justmine
function FormatPhone(obj)
{
	var str = obj.value;
		
	var mat1 = str.match( /\d{2}-\d{3}-\d{4}/ );
	var mat2 = str.match( /\d{2}-\d{4}-\d{4}/ );
	var mat3 = str.match( /\d{3}-\d{3}-\d{4}/ );
	var mat4 = str.match( /\d{3}-\d{4}-\d{4}/ );
	
	if ((mat1 == null)&&(mat2 == null)&&(mat3 == null)&&(mat4 == null))
	{
		str = str.substr(0,str.length-4)+"-"+str.substr(str.length-4);

		mat1 = str.match( /\d{2}-\d{3}-\d{4}/ );
		mat2 = str.match( /\d{2}-\d{4}-\d{4}/ );
		mat3 = str.match( /\d{3}-\d{3}-\d{4}/ );
		mat4 = str.match( /\d{3}-\d{4}-\d{4}/ );

		if ((mat1 == null)&&(mat2 == null)&&(mat3 == null)&&(mat4 == null))
		{
			obj.value = "";
		}
		else
		{
			obj.value = str;
		}
	}		
}



//½Ã°£Ã¼Å©(HH:MM)
//justmine
function CheckTime(str, errorfocus){
	var msg = false ;

    if (str == "") { return true; }

    str = str + ':00:00';
    str = str.substr(0, 5);

    if (str.substr(2,1) != ':') { msg = true; }

    var hh = str.substr(0,2);
    var mm = str.substr(3,2);

    if (hh.length != 2) { msg = true; }
    if (mm.length != 2) { msg = true; }

    if (msg){
        alert('½Ã°£ÀÔ·ÂÇü½ÄÀÌ Àß¸øµÇ¾ú½À´Ï´Ù.[ÀÔ·Â¿¹ : 00:00]');
        errorfocus.focus();
        return false;
    }

    hh = parseInt(hh, 10);
    mm = parseInt(mm, 10);

    if (hh < 0 || hh > 23)
    {
        alert('½Ã°£ÀÔ·ÂÀÌ Àß¸øµÇ¾ú½À´Ï´Ù.');
        errorfocus.focus();
        return false;
    }

    if (mm < 0 || mm > 59)
    {
        alert('ºÐÀÔ·ÂÀÌ Àß¸øµÇ¾ú½À´Ï´Ù.');
        errorfocus.focus();
        return false;
    }
    
    errorfocus.value = str;
    return true;
}


//¼¿·ºÆ® ¹Ú½ºÀÇ ÇØ´ç ¿ù¿¡ µû¸¥ ÀÏ °è»ê
//ÀÓÃ¶¿µ
function CheckDate(cmbYear, cmbMonth, cmbDay){	
	var selectmonth = cmbMonth.selectedIndex;
	var monthday, i;
	selectmonth = selectmonth + 1;
	
	// Æò³âÀÏ¶§ ³¯ÀÚÃ³¸®
	if (selectmonth == 1) monthday = 31;
	if (selectmonth == 3) monthday = 31;
	if (selectmonth == 4) monthday = 30;
	if (selectmonth == 5) monthday = 31;
	if (selectmonth == 6) monthday = 30;
	if (selectmonth == 7) monthday = 31;
	if (selectmonth == 8) monthday = 31;
	if (selectmonth == 9) monthday = 30;
	if (selectmonth == 10) monthday = 31;
	if (selectmonth == 11) monthday = 30;
	if (selectmonth == 12) monthday = 31;
	if (selectmonth == 13) monthday = 30;

	// À±³âÃ³¸®
	if(selectmonth == 2) {
		var y = cmbYear.value;
		//À±³â
		if ((y % 4) == 0) {
			//Æò³â
			if ((y % 100) == 0) {
				//À±³â
				if ((y % 400) == 0) {
					monthday = 29;
				}
				//Æò³â
				else {
					monthday = 28;
				}
			}
			//À±³â
			else {
				monthday = 29;
			}
		}
		//Æò³â
		else {
			monthday = 28;
		}
	}
	cmbDay.length = monthday;	
	for(i=0 ; i < monthday ;i++) {
		if (i < 9) {
			var option = new Option('0'+(i+1),'0'+(i+1));
			}
		else {
			var option = new Option(i+1, i+1);
			}
		cmbDay.options[i] = option;
	}
	
	getDayOfWeek(document.frm1);
	return true;
}


//¼ýÀÚ¿Í¹®ÀÚÃ¼Å© ÇÔ¼ö
//ÀÓÃ¶¿µ
function IsValidSting(strText)
{
	for(var i=0; i<strText.length; i++)
	{
		var chr = strText.substr(i, 1);
		
		if((chr < '0' || chr > '9') && (chr < 'a' || chr > 'z') && (chr < 'A' || chr > 'Z')) { return false; }
	}

	return true;
}


//ÇÑ±ÛÃ¼Å©
//ÀÓÃ¶¿µ
function IsValidHangul(strText)
{
	var pattern = /[°¡-ÆR]/;
	
	if(pattern.test(strText))
	{
		return true;
	}
	else
	{
		return false;
	}
}

//ÇÑ±Û¼º¸í Ã¼Å©
//lee
function IsValidKorName(strText)
{
	var pattern = /[°¡-Èþ]{2,}/;

	if (pattern.test(strText))
	{
		return true;
	}
	else
	{
		return false;
	}
}

//¼ýÀÚÃ¼Å© ÇÔ¼ö
//ÀÓÃ¶¿µ
function IsValidNumber(strText)
{
	for(var i=0; i<strText.length; i++)
	{
		var chr = strText.substr(i, 1);
		
		if(chr < '0' || chr > '9') { return false; }
	}

	return true;
}


//¼ýÀÚ¹× µµÆ®Ã¼Å© ÇÔ¼ö
//ÀÓÃ¶¿µ
function IsValidNumberPoint(strText)
{
	for(var i=0; i<strText.length; i++)
	{
		var chr = strText.substr(i, 1);
		
		if((chr < '0' || chr > '9') && chr != '.') { return false; }
	}

	return true;
}


//Æ¯¼ö¹®ÀÚÃ¼Å© ÇÔ¼ö
//ÀÓÃ¶¿µ
function IsValidOther(strText)
{
	for (var i=0; i<strText.length; i++)
	{
		if(strText.charAt(i) >= 0) { return false; 	}
	}
	
	return true;
}


// Email À¯È¿¼º °Ë»ç
// justmine
function IsValidEmail(val)
{
	var obj = val.match(/^([\w-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([\w-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/);
	
	return obj == null ? false : true;
}

// ÁÖ¹Îµî·Ï¹øÈ£ Ã¼Å©
// Á¤¼Ò¿µ
function CheckjuminNum(num1, num2)    
{
	var m_jumin1;
	var m_jumin2;
	var m_prevResult = false;

	if (num1 == m_jumin1 && num2 == m_jumin2)
		return m_prevResult;

	var regExpr1 = /^[0-9]{6}$/;
	var regExpr2 = /^[0-9]{7}$/;

	// ¼ýÀÚÀÎÁö ¿©ºÎ¿Í ±æÀÌ¸¦ °Ë»ç
	if (!regExpr1.test(num1) || !regExpr2.test(num2)) 
		return false;

	var intYear = parseInt(num1.substring(0,2), 10);
	var intMonth = parseInt(num1.substring(2,4), 10);
	var intDay = parseInt(num1.substring(4,6), 10);

	// À±³â °è»ê
	if(num2.charAt(0) == "3" || num2.charAt(0) == "4")
		intYear += 2000
	else
		intYear += 1900
	
	if (intYear % 4 == 0)
		leapDay = 29;
	else
		leapDay = 28;
	
	if(intMonth < 0 || intMonth > 12)
		return false;

	// ³¯ÀÚ ¹üÀ§¸¦ °Ë»ç
	switch(intMonth)
	{
		case 2 :
			if(intDay < 0 || intDay > leapDay)
			{
				return false;
			}
		case 4 :
			if(intDay < 0 || intDay > 30)
			{
				return false;
			}
		case 6 :
			if(intDay < 0 || intDay > 30)
			{
				return false;
			}
		case 9 :
			if(intDay < 0 || intDay > 30)
			{
				return false;
			}
		case 11 :
			if(intDay < 0 || intDay > 30)
			{
				return false;
			}
		default :
			if(intDay < 0 || intDay > 31)
			{
				return false;
			}
	}
	
	var sum;
	sum = num1.charAt(0)*2
	sum += num1.charAt(1)*3
	sum += num1.charAt(2)*4  
	sum += num1.charAt(3)*5
	sum += num1.charAt(4)*6
	sum += num1.charAt(5)*7  
	sum += num2.charAt(0)*8
	sum += num2.charAt(1)*9
	sum += num2.charAt(2)*2  
	sum += num2.charAt(3)*3
	sum += num2.charAt(4)*4
	sum += num2.charAt(5)*5
	
	var checkSum = (11 - (sum % 11)) % 10;

	//alert("½ÇÇàµÇ°í ÀÖÀ½");
	return parseInt(num2.charAt(6)) == checkSum
}


//ÇÑ±Û, ¼ýÀÚ, ¿µ¹®(´ë/¼Ò), '_' Ã¼Å© ÇÔ¼ö
//justmine
function IsValidSign(str)
{
	var pattern = /[\~\`\|\!\@\#\$\%\^\&\*\(\)\-\+\=\{\[\]\}\|\:\;\'\"\<\,\>\.\?\/]/;
	var rtnBool = true;

	for (var i=0; i < str.length; i++)
	{
		var chr = str.substr(i, 1);

		if (chr.search(str) != -1) {
			rtnBool = false;
		}
	}

	return rtnBool;
}


// TextArea¿¡¼­ ¶óÀÎ¼ö Á¦ÇÑ
//justmine
function CheckLine(str, maxLine){
	var cnt = GetDeliCnt(str, "\n");

	if (cnt >= maxLine)
	{
		return false;
	} 
	else 
	{
		return true;
	}
}


//euc-kr byte length
//±èÇüÁø
String.prototype.ByteLength = function()
{
	for(var i = 0, c = 0, len = 0; !isNaN(c = this.charCodeAt(i)); i++)
		len += (c > 0xFF ? 2 : 1);
	return len;
}

String.prototype.trim = function()
{
	return this.replace(/^\s+|\s+$/g, "");
}


//¿ÞÂÊ ¹®ÀÚ¿­ÀÇ °ø¹éÁ¦°Å
//justmine
function LTrim(str)
{
    var li_length, ls_return, ls_temp;
    li_length = str.length;
    ls_return = str;

    for (i = 0 ; i < li_length ; i++)
    {
        ls_temp = str.substr(i, 1);
        if (ls_temp == " ")
        { 
			ls_return = str.substr(i+1, li_length -1 + i);
		}
        else
        { 
			break;
		}
    }

    return ls_return;
}


//¿À¸¥ÂÊ ¹®ÀÚ¿­ÀÇ °ø¹éÁ¦°Å
//justmine
function RTrim(str)
{
    var li_length, ls_return, ls_temp;
    li_length = str.length;
    ls_return = str;
    for (i = li_length - 1 ; i >= 0 ; i--)
    {
        ls_temp = str.substr(i,1);
        if (ls_temp == " ")
        {  
			ls_return = str.substr(0,i);
		}
        else
        {
			break;
		}
    }

    return ls_return;
}


//¹®ÀÚ¿­ ÁÂ¿ì °ø¹éÁ¦°Å
//justmine
function Trim(str)
{
    return str.replace(/ /g, "");
}


//¹®ÀÚ¿­ Á¶¸³
//±èÇüÁø
function FormatString()
{
	/**	
	 *	usage : var str = formatString(strFormat, arg1, arg2, ..., [argN]);
	 *		var format = "List.aspx?code={0}&game={1}&local={2}";
	 *		var url = formatString(format, form.code.value, form.game.value, form.local.value);
	 */
	if(arguments.length == 0)
		return null;
	var str = new String(arguments[0]);
	for(var i = 1; i < arguments.length; i++)
	{
		str = str.split("{" + (i - 1) + "}").join(new String(arguments[i]));
	}
	return str;
}


//ÀÌ¹ÌÁö »çÀÌÁî ÁÙÀÌ±â
//±èÇüÁø
function PreviewPopUp(url, width, height)
{
	this.preview = function()
	{
		var wndWidth = width;
		var wndHeight = height;
		var scrollbars = "no";
		if(wndWidth > 800)
		{
			wndWidth = 800;
			scrollbars = "yes";
		}
		if(wndHeight > 600)
		{
			wndHeight = 600;
			scrollbars = "yes";
		}
		var imgUrl = "/webbase/popup/ImgPopup.aspx?img=" + escape(url);
		var wndPreview = window.open(imgUrl, "wndPreview", "width=" + wndWidth + "px,height=" + wndHeight + "px,resizable=yes,scrollbars=" + scrollbars);
		wndPreview.focus();
		wndPreview.moveTo(10, 10);
		return wndPreview;
	}
}


//usage : <img src="test.gif" style="display:none;" onload="ResizeImage(this, 50);">
function ResizeImage(image, max, preview)
{
	var src = image.src;
	var tempImage = new Image();
	tempImage.onload = function(){
		var previewPopUp = new PreviewPopUp(this.src, this.width, this.height);
		if(this.width > this.height)
		{
			if(this.width > max)
			{
				image.width = max;
			}
		}
		else
		{
			if(this.height > max)
			{
				image.height = max;
			}
		}
		if(preview)
		{
			image.style.cursor = "pointer";
			image.onclick = previewPopUp.preview;
		}
		image.style.display = "block";
	}
	tempImage.src = src;
}


//¿äÀÏ°è»ê
//justmine
function CalcDayOfWeek( x_nMonth, x_nDay, x_nYear) {
	if (x_nMonth >= 3)
	{
		x_nMonth -= 2;
	}
	else 
	{
		x_nMonth += 10;
	}

	if ( (x_nMonth == 11) || (x_nMonth == 12))
	{
		x_nYear--;
	}

	var nCentNum = parseInt(x_nYear / 100);
	var nDYearNum = x_nYear % 100;
	var g = parseInt(2.6 * x_nMonth - .2);

	g += parseInt(x_nDay + nDYearNum);
	g += nDYearNum / 4;
	g = parseInt(g);
	g += parseInt(nCentNum / 4);
	g -= parseInt(2 * nCentNum);
	g %= 7;

	if (x_nYear >= 1700 && x_nYear <= 1751) 
	{
		g -= 3;
	} 
	else 
	{
		if (x_nYear <= 1699) 
		{
			g -= 4;
		}
	}

	if (g < 0)
	{
		g += 7;
	}
	
	return g;
}


//CalcDayOfWeekÀÇ ¿äÀÏ¿¡ ´ëÇÑ ¼ýÀÚ¸¦ ÇØ´ç ¿äÀÏ·Î º¯È¯
//justmine
function WhatDayOfToday(form, x_nDayOfWeek) {
	switch (x_nDayOfWeek) {
	case 0:
		form.value = "ÀÏ";
		break;
	case 1:
		form.value = "¿ù";
		break;
	case 2:
		form.value = "È­";
		break;
	case 3:
		form.value = "¼ö";
		break;
	case 4:
		form.value = "¸ñ";
		break;
	case 5:
		form.value = "±Ý";
		break;
	case 6:
		form.value = "Åä";
		break;
	default:
		form.value = "";
		break;
	}
}


//¾ÆÀÌÅÛ Ç×¸ñ º¸ÀÌ´Â ÇÔ¼ö
//ÀÓÃ¶¿µ
function ItemsVisible(items)
{
	if (navigator.appName != "Netscape")
	{
        document.all[items].style.display = "block";
	}
	else
	{
        document.layers[items].display = "block";
	}
}


//¾ÆÀÌÅÛ Ç×¸ñ ¼û±â´Â ÇÔ¼ö
//ÀÓÃ¶¿µ
function ItemsHidden(items)
{
	if (navigator.appName != "Netscape")
	{
		document.all[items].style.display = "none";
	}
	else
	{
		document.layers[items].display = "none";
	}
}	


//ÀÌ¹ÌÁöÃ³¸®
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}


function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}


function MM_findObj(n, d) { //v4.01
var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
	d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}


function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; 
document.MM_sr=new Array; 
for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}


// layer view
function layerView(layer, display)
{	
	document.getElementById(layer).style.display = display;
}

// Image ¼­¼­È÷ ¹Ù²Ù±â
function ChangeImage(obj, url)
{
        obj.filters.blendTrans.apply();
        obj.src = url;
        obj.filters.blendTrans.play();
}


//image »õÃ¢¶ç¿ì±â
//justmine
function PopImage(image){
	var tempImage = new Image();
	tempImage.onload = function()
	{
		var w = tempImage.width + 35;
		var h = tempImage.height + 30;
		var maxw = 800;
		var maxh = 600;
		var fg = false;

		if (w > maxw){	w = maxw;	fg=true;}
		if (h > maxw){	h = maxh;	fg=true;}
	
		if (fg)
		{
			window.open(tempImage.src, "Pop","scrollbars=yes,width=" + w + ", height=" + h);
		}
		else
		{
			window.open(tempImage.src, "Pop","scrollbars=no,width=" + w + ", height=" + h);
		}
	}
	tempImage.src = image.src;
}


//String¿¡¼­ ÇØ´ç delimeter °¹¼ö ¹ÝÈ¯
//justmine
function GetDeliCnt(str, deli){
    var rtnCnt = 0;
    
    for (i = 0 ; i < str.length ; i++)
    {
        ch = str.substr(i, 1);

        if (ch == deli) { 
			rtnCnt++;
		}
    }

    return rtnCnt;
}


//Æû ÇÊ¼öÇ×¸ñ Ã¼Å©
//±èÇüÁø
function requiredFieldValidate(formName, elemNameParams)
{
	function trim(str)
	{
		return str.replace(/^\s+|\s+$/, "");
	}
	var form = document.forms[formName];
	for (var i = 1; i < arguments.length; i++)
	{
		if (trim(form.elements[arguments[i]].value) == "")
		{
			alert("ÇÊ¼öÇ×¸ñÀ» ±âÀçÇÏÁö ¾Ê¾Ò½À´Ï´Ù");
			try
			{
				form.elements[arguments[i]].focus();
			}catch(e){}

			return false;
		}
	}
	return true;
}


// Modal ¶ç¿ì±â
// justmine
function Show(fg)
{
	if (fg == "OzoneSms")
	{
		var feature = "help:no; status:no; center:yes; dialogHeight:320px; dialogWidth:500px; edge:sunken; scroll:no; ";
		window.showModalDialog("/Life_Information/OzoneSms.aspx", self, feature);
	}
}


// Modal ¶ç¿ì±â
// justmine
function ShowModal(url, width, height)
{
	feature = "help:no; status:no; center:yes; edge:sunken; scroll:no; ";
	feature += " dialogWidth:" + width + "px; ";
	feature += " dialogHeight:" + height + "px; ";

	var rtnValue = window.showModalDialog(url, self, feature);
	
	return rtnValue;
}

// Modal ¶ç¿ì±â(½ºÅ©·Ñ¹Ù »ç¿ë)
// justmine
function ShowModal2(url, width, height)
{
	//feature = "help:no; status:no; center:yes; edge:sunken; scroll:auto; ";
	feature = " dialogWidth:" + width + "px; ";
	feature += " dialogHeight:" + height + "px; ";

	var rtnValue = window.showModalDialog(url, self, feature);
	
	return rtnValue;
}


// Ã¢ ¶ç¿ì±â
// justmine
function ShowWin(Url, Width, Height, Center, name)
{
	if (name == null)
	{
		name = "popWin";
	}

	if (Center == true)
	{
	  	window.open(Url, name, "toolbar=no,resizable=no,scrollbars=no,status=no,width=" + Width + ",height=" + Height + ",left=" + (window.screen.width/2-Width/2) + ",top=" + (window.screen.height/2-Height/2));
	}
	else
	{
		window.open(Url, name, "toolbar=no,resizable=no,scrollbars=no,status=no,width=" + Width + ",height=" + Height);
	}
}

// Ã¢ ¶ç¿ì±â(½ºÅ©·Ñ¹Ù »ç¿ë)
// justmine
function ShowWin2(Url, Width, Height, Center, name)
{
	if (name == null)
	{
		name = "popWin";
	}

	if (Center == true)
	{
	  	window.open(Url, name, "toolbar=no,resizable=no,scrollbars=yes,status=no,width=" + Width + ",height=" + Height + ",left=" + (window.screen.width/2-Width/2) + ",top=" + (window.screen.height/2-Height/2));
	}
	else
	{
		window.open(Url, name, "toolbar=no,resizable=no,scrollbars=yes,status=no,width=" + Width + ",height=" + Height);
	}
}

// »õÃ¢ ¶ç¿ì±â
// Á¤¼Ò¿µ
// javascript:window.open(url)½Ã object ¹®Á¦·Î µû·Î ÇÔ¼ö Á¤ÀÇ
function WinOpen(url)
{
	window.open(url);
}

// ÄíÅ°Á¤º¸¸¦ °¡Á®¿Â´Ù.
// ÆË¾÷Ã¢¿¡¼­ »ç¿ë
// justmine
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 "";
}

// ÄíÅ°Á¤º¸¸¦ ¼³Á¤ÇÑ´Ù.
// ÆË¾÷Ã¢¿¡¼­ »ç¿ë
// justmine
function SetCookie(name, value, expiredays)
{
	var todayDate = new Date();
	todayDate.setDate(todayDate.getDate() + expiredays);
	document.cookie = name + "=" + escape(value) + "; path=/; /*domain='daegu.go.kr';*/ expires=" + todayDate.toGMTString() + ";"
} 


// µ¿¿µ»ó ±×·ì°ü¸®
// justmine
function HosuMng(infoID)
{
	var feature = "help:no; status:no; center:yes; dialogHeight:550px; dialogWidth:520px; edge:sunken; scroll:no; ";
	window.showModalDialog("/boards/skin/G_VideoMng.aspx?infoID=" + infoID, self, feature);
}


// ¸Þ½ÃÁö Ç¥½Ã(window.alert ´ëÃ¼)
// args°¡ nullÀÌ ¾Æ´Ò°æ¿ì Æ÷Ä¿½º ¸ÂÃã
// DisplayMessage("¿¡·¯~", document.forms[0].txtUserID);
// justmine
function DisplayMessage(message, args)
{
	message = message.replace(/\r\n/g, "<BR>").replace(/\n/g, "<BR>").replace(/\"/g, "").replace(/\'/g, "").replace(/\\/g, "");
	window.showModalDialog("/Common/Message.aspx?Msg=" + message, self, "status:no;dialogWidth:290px;dialogHeight:160px;help:no;scroll:no;");

	if (args != null && typeof(args) != "undefined")
		args.focus();
}


// È®ÀÎ/Ãë¼Ò ¸Þ½ÃÁö Ç¥½Ã(window.confirm ´ëÃ¼)
// ¸®ÅÏ°ª : È®ÀÎ(true), Ãë¼Ò(false)
// »ç¿ë¹ý : if (ConfirmMessage('»èÁ¦ÇÏ½Ã°Ú½À´Ï±î?'))
// justmine
function ConfirmMessage(message)
{
	message = "" + message;
	message = message.replace(/\r\n/g, "<BR>").replace(/\n/g, "<BR>").replace(/\"/g, "").replace(/\'/g, "").replace(/\\/g, "");
	var rtnValue = window.showModalDialog("/Common/ConfirmMessage.aspx?Msg=" + message, self, "status:no;dialogWidth:290px;dialogHeight:160px;help:no;scroll:no;");
	
	return rtnValue == true;
}


// ³¯Â¥ ÀÔ·ÂÃ¢À» Ç¥½ÃÇÑ´Ù.
// »ç¿ë¹ý : ½ºÅ©¸³Æ®ÀÌº¥Æ®="ShowCalendar(°ªÀ» ÀÔ·ÂÇÒ °³Ã¼)"
// <img onclick='ShowCalendar(document.forms[0].txtDate)'>
// justmine
function ShowCalendar(obj)
{
	strleft = "dialogleft:" + eval(window.screenLeft + window.event.clientX + 10) ;
	strtop = ";dialogtop:" + eval(window.screenTop + window.event.clientY + 10 ) ;
	var rtnValue = window.showModalDialog("/Common/Calendar.htm", self, strleft +  strtop +";dialogWidth:186px; dialogHeight:205px;scroll:no;status:no;titlebar:no;help:no");

	if (rtnValue == undefined)
	{
		if (obj.value.length != 10)
		{
			obj.value = "";
		}
	}
	else
	{
		obj.value = rtnValue;
	}
}



// ÄÁÅÙÃ÷ ÀúÀå½Ã À¯È¿¼º¿©ºÎ¸¦ Ã¼Å©ÇÑ´Ù.
// justmine
var maxSize = 4200000;	// ÄÁÅÙÃ÷ ÀúÀå ÃÖ´ë¿ë·®
var maxMsg = "³»¿ëÀº 4MB±îÁö ÀúÀåÇÒ ¼ö ÀÖ½À´Ï´Ù.";	// ÃÊ°ú½Ã ¸Þ½ÃÁö
function IsValidContent()
{
	var wec = document.forms[0].Wec;

	// ÅÂ±× Á¤¸®¿É¼Ç
	wec.CleanupOptions = "msword2000 | redundant_nested";
	wec.Value = wec.CleanupHtml(wec.Value);

	// 2009.08.24, ±èÀÎÈ£, Body Tag ³»ºÎÀÇ ³»¿ë¸¸ ÀúÀåÇÑ´Ù.
	wec.Value = wec.BodyValue;
	document.forms[0].hdnContents.value = wec.MimeValue;

	if (wec.GetDocumentSize() > maxSize)
	{
		DisplayMessage(maxMsg);
		return false;
	}

	return true;
}

// ÀÌ¸ÞÀÏ Àü¼Û ÆË¾÷ ¶ç¿ì±â
// »ç¿ë¹ý : onClick="ShowMailSend(¹Þ´ÂÀÌ ¸ÞÀÏ ÁÖ¼Ò);" 
// ¹Þ´ÂÀÌ ¸ÞÀÏ ÁÖ¼Ò°¡ ¾øÀ¸¸é ±âº» °ü¸®ÀÚ ¸ÞÀÏ ÁÖ¼Ò(webmaster@daegu.go.kr) Àû¿ë
// Á¤¼Ò¿µ
function ShowMailSend(mail)
{
	window.open("/Popup/MailSend.aspx?to="+mail,"","width=550,height=410,left=" + (window.screen.width/2-550/2) + ",top=" + (window.screen.height/2-400/2));
}

// Á÷¿ø¸ÞÀÏÁÖ¼Ò ´©Ãâ¹æÁö¸¦ À§ÇÑ Ã³¸®
function ShowMailSend2(mail)
{
	window.open("/Employees/MailSend.aspx?to="+mail,"","width=550,height=410,left=" + (window.screen.width/2-550/2) + ",top=" + (window.screen.height/2-400/2));
}

function AdminMailSend()
{
	window.open("/Popup/AdminMailSend.aspx","","width=560,height=470,left=" + (window.screen.width/2-550/2) + ",top=" + (window.screen.height/2-400/2));
}

// ¿Ü±¹ÀÎ Ã¼Å©
function fgn_no_chksum(reg_no)
{
    buf = new Array(13);
    for (i = 0; i < 13; i++) 
		buf[i] = parseInt(reg_no.charAt(i));

    odd = buf[7]*10 + buf[8];
    
    if (odd%2 != 0)
      return false;
    

    if ((buf[11] != 6)&&(buf[11] != 7)&&(buf[11] != 8)&&(buf[11] != 9))
      return false;
    
     
    multipliers = [2,3,4,5,6,7,8,9,2,3,4,5];
    for (i = 0, sum = 0; i < 12; i++) sum += (buf[i] *= multipliers[i]);


    sum=11-(sum%11);
    
    if (sum>=10) sum-=10;

    sum += 2;

    if (sum>=10) sum-=10;

    if ( sum != buf[12])
        return false;
    else
        return true;
}

// ¿Ü±¹ÀÎ µî·Ï¹øÈ£ Ã¼Å©
function CheckForeignerNum(num1, num2)    
{
	var m_jumin1;
	var m_jumin2;
	var m_prevResult = false;

	if (num1 == m_jumin1 && num2 == m_jumin2)
		return m_prevResult;

	var fgn_reg_no = num1 + num2;

	if ((fgn_reg_no.charAt(6) == '5') || (fgn_reg_no.charAt(6) == '6'))
		birthYear = '19';
	else if ((fgn_reg_no.charAt(6) == '7') || (fgn_reg_no.charAt(6) == '8'))
		birthYear = '20';
	else if ((fgn_reg_no.charAt(6) == '9') || (fgn_reg_no.charAt(6) == '0'))
		birthYear = '18';
	else
		return false;

	birthYear += fgn_reg_no.substr(0, 2);
	birthMonth = fgn_reg_no.substr(2, 2) - 1;
	birthDate = fgn_reg_no.substr(4, 2);
	birth = new Date(birthYear, birthMonth, birthDate);
        
	if (birth.getYear() % 100 != fgn_reg_no.substr(0, 2) ||
		birth.getMonth() != birthMonth ||
		birth.getDate() != birthDate)
	{
		return false;
	}

	return fgn_no_chksum(fgn_reg_no) != false;
}

// ÀÌ¹ÌÁö ¿ÀÇÂ ÆË¾÷Ã¢
// Á¤¼Ò¿µ
function PopImage2(imagesrc, imageTitle)
{
	if (imageTitle != undefined) {
		if (imageTitle.length == 0)
			imageTitle = "Á¦¸ñÀÌ ¾ø½À´Ï´Ù.";
	} else
		var imageTitle = "Á¦¸ñÀÌ ¾ø½À´Ï´Ù.";

	var _img = new Image();
	
	_img.onload = function()
	{
		// Left, Top, Height, Width ÁöÁ¤    
		LeftPosition = (screen.width) ? (screen.width - _img.width) / 2 : 0;
		TopPosition = (screen.height) ? (screen.height - _img.height) / 2 : 0;
		Height = _img.height > 750 ? 750 : _img.height;
		Width = _img.width > 1000 ? 1000 : _img.width;
			    
	    // ½ºÅ©·Ñ ¿©ºÎ
		var scroll = (_img.height > 750 || _img.width > 1000) ? "yes" : "no";	    
	    
		look = 'height=' + Height + ',width=' + Width + ',top=' + TopPosition + ',left=' + LeftPosition + ',scrollbars=' + scroll + ',resizable'; 
		popwin=window.open("","viewImg",look);
		popwin.document.open();
		popwin.document.write('<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\r');
		popwin.document.write('<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ko" lang="ko">\r<head>\r<title>ÆË¾÷ : '+ imageTitle +'</title>\r</head>\r');
		popwin.document.write('<body style="margin:0;padding:0">\r')
		popwin.document.write('<img style="cursor:pointer;" onclick="self.close()" onkeypress="if (event.keyCode == 13) {self.close();}" src="' + _img.src + '" alt="'+ imageTitle +', ÀÌ¹ÌÁö¸¦ Å¬¸¯ÇÏ¸é ÆË¾÷Ã¢ÀÌ ´ÝÈü´Ï´Ù." />\r');
		popwin.document.write('</body>\r</html>');
		popwin.document.close();
	}
	
	 _img.src = imagesrc;   
}

// ÄÃ·¯ÆÄÄ¿ ¸ð´ÞÃ¢
// »ç¿ë¹ý : onClick="ColorPicker(ÀÔ·Â¹ÞÀ» input ¹Ú½º¸í, »ö»óÀ» º¸¿©ÁÙ input ¹Ú½º¸í);" 
// <input type="text" name="txtName" onclick="ColorPicker('txtName', 'txtView')">
// <input type="text" name="txtView" size="2" readonly>
// Á¤¼Ò¿µ
function ColorPicker(name, view)
{
	window.showModalDialog ("/Popup/ColorPicker.aspx?ReturnText=" + name + ";" + view ,self,"dialogWidth:470px; dialogHeight:280px; scroll:0; help:1; status:0");
}

// Æ÷Ä¿½º ÀÌµ¿
// »ç¿ë¹ý : onClick="checkLength(ÇöÀç input ¹Ú½º¸í, ÀÌµ¿ÇÒ input ¹Ú½º¸í, Ã¼Å© ±æÀÌ);" 
// »ç¿ë¿¹ : onkeyup="checkLength(this.name, 'txtJumin2', 6)"
// Á¤¼Ò¿µ
function checkLength(currfield, nextfield, chars) 
{
	x = eval('document.forms[0].' + currfield + '.value.length');
	if (x == chars) {
		eval('document.forms[0].' + nextfield + '.focus();');
	}
}

// Loading ·¹ÀÌ¾î Ç¥½Ã/¼û±â±â
// »ç¿ë¹ý : ¸Þ´ºÅ¬¸¯½Ã(Ç¥½Ã) SetLoading(true);
// ÀÌÁ¤ÈÆ
function ShowLoading()
{
	var div = document.createElement('div');
	div.style.cssText = 'position:absolute; font-size:40px; background-color:white; color:red; top:' + (screen.availHeight / 2 - 200) + 'px;left:' + (screen.availWidth / 2 - 200) + 'px;';
	div.innerHTML = 'loading...';
	document.body.appendChild(div);
}

// ÀÔ·Â¹®ÀÚ¿­ ±æÀÌ Ã¼Å©(Byte·Î Ã¼Å©)
// »ç¿ë¹ý : onkeyup="CheckStringLength(this, 400)"
// ÀÌÁ¤ÈÆ
function CheckStringLength(ctrl, len)
{
	sum = 0;

	for (i = 0 ; i < ctrl.value.length ; i++)
	{
		if (ctrl.value.charCodeAt(i) < len)
			sum += 1; // ¿µ¾î³ª ¼ýÀÚ
		else
			sum += 2; // ÇÑ±ÛÀÌ³ª Æ¯¼ö¹®ÀÚ
	}

	if (sum > len)
	{
		ctrl.value = ctrl.value.substring(0, i - 1);
		DisplayMessage(len + "ÀÚ ÀÌ»óÀº ÀÔ·ÂÇÒ ¼ö ¾ø½À´Ï´Ù.", ctrl)
	}
}

// Àü´ÞµÈ <div> ¿ä¼Ò¸¦ È®ÀåÇÏ°Å³ª Á¢´Â´Ù.
function expandDiv(ctrl)
{
	if (document.getElementById(ctrl))
	{
		ctl = document.getElementById(ctrl);
		if (ctl.style.display == "none") 
			ctl.style.display = "";
		else
			ctl.style.display = "none";
	}
}
// ½Ç±¹ ¸Þ´º ÆîÄ§ ±â´É
function ShowDiv(val)
{

	if (document.getElementById("office_left") && document.getElementById(val))
	{
		var all = document.getElementById("office_left").getElementsByTagName("ul")[0];
		var valDisplay = document.getElementById(val).style.display;
		
		if (valDisplay == "none")
		{
			// 2Â÷ ¸ðµÎ ¼û±è
			for (i=0; i<all.getElementsByTagName("ul").length; i++) {
					all.getElementsByTagName("ul")[i].style.display = "none";
			}
			
			document.getElementById(val).style.display = "block";
		} 
		else 
			document.getElementById(val).style.display = "none";
	}

	if (document.getElementById("office_menu") && document.getElementById("office")) {
		if (document.getElementById("office_menu").offsetHeight > document.getElementById("office").offsetHeight) {			
			document.getElementById("office").style.height = document.getElementById("office_menu").offsetHeight + "px";
		}
	}
}

// ½Ç±¹ ¸Þ´º ÆîÄ§ ±â´É2 2009.07.16
function initTabMenu(tabContainerID) {
	var tabContainer = document.getElementById(tabContainerID);
	var tabAnchor = tabContainer.getElementsByTagName("a");
	var i = 0;

	for(i=0; i<tabAnchor.length; i++) {
		if (tabAnchor.item(i).className == "tab")
			thismenu = tabAnchor.item(i);
		else
			continue;

		thismenu.container = tabContainer;
		thismenu.targetEl = document.getElementById(tabAnchor.item(i).href.split("#")[1]);
		thismenu.targetEl.style.display = "none";
		thismenu.imgEl = thismenu.getElementsByTagName("img").item(0);
		if (thismenu.imgEl) {
			thismenu.onmouseover = function () {
				//this.onclick();
			}
		}
		thismenu.onclick = tabMenuClick;
		
		//if (!thismenu.container.first)
			//thismenu.container.first = thismenu;
	}
	//tabContainer.first.onclick();
}
function tabMenuClick() {
	currentmenu = this.container.current;
	if (currentmenu != this) {
		if (currentmenu) {
			currentmenu.targetEl.style.display = "none";			
		}

		this.targetEl.style.display = "block";
		
		this.container.current = this;
	}
	return false;
}



//	È®´ë Ãà¼Ò ½ÃÀÛ
/*
var offset = 2;
var minZoom = 12;
var maxZoom = 24;
var zoomVal = GetCookie("zoomVal");
var obj;

var objBody = null;
var browser = null;

if ( navigator.userAgent.indexOf("MSIE") != -1 ) 
{
	browser = "MSIE";
	objBody = document.body;
} 
else 
{
	browser = "Other";
	objBody = document.getElementsByTagName("BODY");
}

if ( ( zoomVal == null ) || ( zoomVal == "" ) ) 
	zoomVal = 12;
else 
	zoomVal = parseInt( zoomVal );

SetZoom(objBody, zoomVal);

function ZoomReset()
{
	SetZoom(objBody, 12);
}

function ZoomIn()
{
	if ( zoomVal < maxZoom )
	{
		zoomVal += offset;
		SetZoom(objBody, zoomVal);
	}
	else
	{
		DisplayMessage("´õÀÌ»ó È®´ëµÇÁö ¾Ê½À´Ï´Ù.");
	}
}
function ZoomOut()
{
	if ( zoomVal > minZoom ) 
	{
		zoomVal -= offset;
		SetZoom(objBody, zoomVal);
	}
	else
	{
		DisplayMessage("´õÀÌ»ó Ãà¼ÒµÇÁö ¾Ê½À´Ï´Ù.");
	}
}

function SetZoom(obj, val)
{
	var val2;
	if (obj != null && obj != "undefined")
	{
		val2 = val + 88;
		obj.style.fontSize = val + "px";		
		obj.style.zoom = val2 + "%";		
		SetCookie("zoomVal", val, 30);
	}
}
*/
// È®´ë Ãà¼Ò ³¡

/*	±ÛÀÚÈ®´ëÃà¼Ò */	
var currentFontSize = 2;

function zoomUtil(state, e){

	var idx = currentFontSize;
	var arrFontSize = new Array();
	
	arrFontSize[0] = "9px";
	arrFontSize[1] = "10px";
	arrFontSize[2] = "12px";
	arrFontSize[3] = "14px";
	arrFontSize[4] = "16px";
	arrFontSize[5] = "18px";
	arrFontSize[6] = "20px";
	
	if (isAccess(e)) {
		if (state == "plus") {		
						
			if (currentFontSize < 6 ) {				
				idx = currentFontSize + 1;
				currentFontSize = idx;
			}
		
		} else if (state == "default") {
			idx = 2;
			currentFontSize = idx;
		
		} else if (state == "minus") {			
			
			if ( currentFontSize >= 1) {
				idx = currentFontSize - 1;
				currentFontSize = idx;
			}	
		}		
	}
	
	if ( navigator.userAgent.indexOf("MSIE") != -1 ) 
	{
		document.body.style.fontSize = arrFontSize[idx];
	} 
	else 
	{
		document.getElementsByTagName("BODY").style.fontSize = arrFontSize[idx];
	}	
	
	return false;
}

function isAccess(e) {
	
	var keynum;
	var ismouseClick = 1;
	
	if (window.event) {		//IE &amp; Safari
		keynum = e.keyCode;
		
		//SafariÀÇ °æ¿ì ¸¶¿ì½ºÅ¬¸¯Àº keynum 0 ÀÌ ³Ñ¾î¿È
		if (event.button == 0 || keynum == 0){
			ismouseClick = 0;
		}		
		
	} else if ( e.which ){		// Netscape/Firefox/Opera
		keynum = e.which;
		
		if (keynum == 1) {
			ismouseClick = 0;
		}		
		
	}
	
	//¸¶¿ì½º Å¬¸¯ÀÌ°Å³ª ¿£ÅÍÅ°¸¦ ´©¸¥°æ¿ì true°ª ¹ÝÈ¯
	if ( ismouseClick == 0 || keynum == 13 ) {
		return true;
	} else {
		return false;
	}
}


// Äü¸Þ´º ½ºÅ©¸³Æ® ½ÃÀÛ
var isDOM = (document.getElementById ? true : false); 
var isIE4 = ((document.all && !isDOM) ? true : false); 
var isNS4 = (document.layers ? true : false); 
 
function getRef(id) 
{ 
        if (isDOM) return document.getElementById(id); 
        if (isIE4) return document.all[id]; 
        if (isNS4) return document.layers[id]; 
} 
 
var isNS = navigator.appName == "Netscape"; 
 
function moveRightEdge() 
{ 
        var yMenuFrom, yMenuTo, yOffset, timeoutNextCheck; 
        if (isNS4) 
        { 
                yMenuFrom   = quickmenu.top; 
                yMenuTo     = windows.pageYOffset + 0;   // À§ÂÊ À§Ä¡ 
        } 
        else if (isDOM) 
        { 
                yMenuFrom   = parseInt (quickmenu.style.top, 0); 
                yMenuTo     = (isNS ? window.pageYOffset : document.body.scrollTop) + 85; // À§ÂÊ À§Ä¡ 
        } 
 
        timeoutNextCheck = 500; 
 
        if (yMenuFrom != yMenuTo) 
        { 
                yOffset = Math.ceil(Math.abs(yMenuTo - yMenuFrom) / 20); 
                if (yMenuTo < yMenuFrom) 
                        yOffset = -yOffset; 
                if (isNS4) 
                        quickmenu.top += yOffset; 
                else if (isDOM) 
                        quickmenu.style.top = parseInt (quickmenu.style.top, 10) + yOffset; 
                        timeoutNextCheck = 10; 
        } 
        setTimeout ("moveRightEdge()", timeoutNextCheck); 
} 

// Äü¸Þ´º ½ºÅ©¸³Æ® ³¡


// ÀÌ¹ÌÁö ·Ñ¿À¹ö ½ÃÀÛ
actor = "";
old_actor = "";

function img_act(imgName) {
        if (((init=="net")&&(browserVer >= 3)) || ((init == "ie") && (browserVer >= 4)))
        {
        imgOn = eval(imgName + "on.src");
        document [imgName].src = imgOn;
        }
}
function img_inact(imgName) {
 if(actor != imgName) {
        if (((init=="net")&&(browserVer >= 3)) || ((init == "ie") && (browserVer >= 4)))
        {
        imgOff = eval(imgName + "off.src");
        document [imgName].src = imgOff;
        }
    }
}
function img_onact(imgName) {
 if (actor == "") {
  old_actor = imgName; 
  actor = imgName;
 }else {
  old_actor = actor;
  actor = imgName;
  img_inact(old_actor);
 }
 
 img_act(actor);
}

var old_menu = ''; 
var old_cell = ''; 

function menuclick( submenu ,cellbar) { 

        if( old_menu != submenu ) { 

                if( old_menu !='' ) { 
                        old_menu.style.display = 'none'; 
                } 

                submenu.style.display = 'block'; 
                old_menu = submenu; 
                old_cell = cellbar; 

        } else { 
                submenu.style.display = 'none'; 
                old_menu = ''; 
                old_cell = ''; 
        } 
} 
// ÀÌ¹ÌÁö ·Ñ¿À¹ö ³¡


// ÀÌº¥Æ® Âü°¡ ÆË¾÷ ¶ç¿ì±â
// »ç¿ë¹ý : onClick="ShowEvent(ÀÌº¥Æ®ID);" 
// Á¤¼Ò¿µ
function ShowEvent(eventID)
{	
	ShowWin("/Events/EventApplication.aspx?eventID="+eventID, 500, 320, true, 'event');
}

// Á÷¿ø °Ë»ö
function fns_OpenWin()
{
	window.open("/Employees/EmpMain.htm","Á¶Á÷µµ","toolbar=no,location=no,directories=no,status=no,menubar=no, scrollbars=yes, resizable=no,copyhistory=no,width=790, height=600,left=100,top=100") 
}


// GIS Áöµµ º¸±â
// »ç¿ë¹ý : onClick="ShowGIS('2711015600124660092')" 
// Á¤¼Ò¿µ
function ShowGIS(pnu)
{
	ShowWin("http://www.gis.go.kr/mapPage/mapFrame.jsp?lm=JK001&li=" + pnu + "&width=1280&height=956&st=1",1000, 700, true, 'GIS');
}

// ÀÌ¹ÌÁö ·Ñ¿À¹ö Å°º¸µå ´ëÀÀ 2009.07.10 Á¤Áö¿õ
function initChange(tabContainerID,seq) {
	nav = document.getElementById(tabContainerID);
	nav.menu = new Array();
	nav.current = null;
	nav.menuseq = 0;
	navLen = nav.childNodes.length;
	
	allA = nav.getElementsByTagName("a")
	for(k = 0; k < allA.length; k++) {
		allA.item(k).onmouseover = allA.item(k).onfocus = function () {
			nav.isOver = true;
		}
		allA.item(k).onmouseout = allA.item(k).onblur = function () {
			nav.isOver = false;
			setTimeout(function () {
				if (nav.isOver == false) {
					if (nav.menu[seq])
						nav.menu[seq].onmouseover();
					else if(nav.current) {
						menuImg = nav.current.childNodes.item(0);
						menuImg.src = menuImg.src.replace("_ov.gif", ".gif");
						if (nav.current.submenu)
							nav.current.submenu.style.display = "none";
						nav.current = null;
					}
				}
			}, 10);
		}
	}

	for (i = 0; i < navLen; i++) {
		navItem = nav.childNodes.item(i);
		if (navItem.tagName != "LI")
			continue;

		navAnchor = navItem.getElementsByTagName("a").item(0);
		navAnchor.submenu = navItem.getElementsByTagName("ul").item(0);
		
		navAnchor.onmouseover = navAnchor.onfocus = function () {
			if (nav.current) {
				menuImg = nav.current.childNodes.item(0);
				menuImg.src = menuImg.src.replace("_ov.gif", ".gif");
				if (nav.current.submenu)
					nav.current.submenu.style.display = "none";
				nav.current = null;
			}
			if (nav.current != this) {
				menuImg = this.childNodes.item(0);
				menuImg.src = menuImg.src.replace(".gif", "_ov.gif");
				if (this.submenu)
					this.submenu.style.display = "block";
				nav.current = this;
			}
			nav.isOver = true;
		}
		nav.menuseq++;
		nav.menu[nav.menuseq] = navAnchor;
	}
	if (nav.menu[seq])
		nav.menu[seq].onmouseover();
}

function CheckSearch(oForm, oField, buttonName) {
	if (oField.value.length < 2) {
		DisplayMessage('°Ë»ö¾î¸¦ ÀÔ·ÂÇÏ¼¼¿ä.', oField); 
		return false;
	}
	__doPostBack(buttonName, '');
	return false;
}

function CheckSearchKeypress(oForm, oField, buttonName) {
	if (event.keyCode==13) {
		CheckSearch(oForm, oField, buttonName);
	}
}

		
/* --------- --------- --------- --------- --------- --------- --------- --------- --------- --------- 
ÀÛ¼º : 2009.12.14, ±èÀÎÈ£
¼³¸í : ºê¶ó¿ìÀú °ü·Ã Á¤º¸ ¾ò±â
*/
function BrowserInfo() {
	var bName = navigator.appName;
	var bVer = parseInt(navigator.appVersion);
	
	if (bName == "Microsoft Internet Explorer") { //ÀÍ½ºÇÃ·Î·¯
		if (navigator.appVersion.indexOf("MSIE 6") != -1) 
			bName = "MSIE 6";
		else if (navigator.appVersion.indexOf("MSIE 7") != -1)
			bName = "MSIE 7";
		else if (navigator.appVersion.indexOf("MSIE 8") != -1)
			bName = "MSIE 8";
		else
			bName = "MSIE 5.5 >=";
	} 
	else if (bName == "Netscape") { //³ÝÃ÷ÄÉÀÌÇÁ
		if (navigator.appVersion.indexOf("Chrome") != -1)
			bName = "Chrome";
		else if (navigator.appVersion.indexOf("Safari") != -1)
			bName = "Safari";
		else 
			bName = "Firefox";
	}
	else { //±âÅ¸
		bName = "None";
	}
	
	return bName;
}

function DocumentHeight() {
	var iScreenHeight = 0;
	if (BrowserInfo().indexOf("MSIE") != -1)
		iScreenHeight = document.body.clientHeight;
	else
		iScreenHeight = window.innerHeight;
	
	return iScreenHeight;
}

function ScreenHeight() {
	var iScreenHeight = 0;
	iScreenHeight = window.screen.availWidth;
	
	return iScreenHeight;
}

function GetToday() {
	var today = new Date();
	var currYear = today.getFullYear();
	var currMonth = today.getMonth() + 1;
	currMonth = currMonth < 10 ? "0"+ currMonth : currMonth;
	var currDay = today.getDate();
	currDay = currDay < 10 ? "0"+ currDay : currDay;
	var currHour = today.getHours();
	currHour = currHour < 10 ? "0"+ currHour : currHour;
	
	var sToday = currYear +" "+ currMonth +" "+  currDay +" "+  currHour;
	return sToday.replace(/ /g, "");
}
/* --------- --------- --------- --------- --------- --------- --------- --------- --------- --------- */


/* --------- --------- --------- --------- --------- --------- --------- --------- --------- --------- 
ÀÛ¼º : 2009.12.14, ±èÀÎÈ£
¼³¸í : ¸®´º¾óÇÏ´Â »çÀÌÆ®ÀÇ ÅëÇÕ°Ë»ö Ã³¸®
»ç¿ë :	CheckSearch2009(Æû°´Ã¼, °Ë»ö¾î°´Ã¼, °Ë»ö¹üÀ§°´Ã¼)
		CheckSearchKeypress2009(Æû°´Ã¼, °Ë»ö¾î°´Ã¼, °Ë»ö¹üÀ§°´Ã¼)
*/
function CheckSearch2009(oForm, oKeyValue, oKeyWord) {
	if (oKeyValue.value == ""){
		alert('°Ë»ö¾î¸¦ ÀÔ·ÂÇÏ¼¼¿ä!');
		oKeyValue.focus();
		return false;
	}
	var uri = "http://152.99.22.239/RSA/front/Search.jsp?qt="+ oKeyValue.value +"&menu="+ oKeyWord.options[oKeyWord.selectedIndex].value;
	
	var showWindow = window.open(uri, "_blank", "");
	try {
		showWindow.focus();
	} catch (e) {
	}
	
	return false;
}
function CheckSearchKeypress2009(oForm, oField, oKeyWord) {
	if (event.keyCode == 13) {
		return CheckSearch2009(oForm, oField, oKeyWord);
	}
}



/* --------- --------- --------- --------- --------- --------- --------- --------- --------- --------- */
// 2011.02.28, ±èÀÎÈ£, SNS°ü·Ã Ã³¸®
function sendTwitter(title) {
    var url = '';
    url = window.location;
    title = title.replace('&', '');

    var postBody = '';
    postBody = title;
    postBody += ' ';
    postBody += url;
    postBody = encodeURIComponent(postBody);

    var sURL = '';
    sURL = 'http://twitter.com/home';
    sURL += '?status=';
    sURL += postBody;

    window.open(sURL);

    return false;
}

function sendMe2day(title) {
    var url = '';
    url = window.location;

    var newPostBody = '';
    newPostBody = '"';
    newPostBody += title;
    newPostBody += '":';
    newPostBody += url;
    newPostBody += '&sns=me2day';
    newPostBody = encodeURIComponent(newPostBody);

    var newPostTags = '';
    newPostTags = '´ë±¸±¤¿ª½Ã';
    newPostTags = encodeURIComponent(newPostTags);

    var sURL = '';
    sURL = 'http://me2day.net/posts/new';
    sURL += '?new_post[body]=';
    sURL += newPostBody;
    sURL += '&new_post[tags]=';
    sURL += newPostTags;

    window.open(sURL);

    return false;
}

function sendFacebook(title) {
    var url = '';
    url = window.location;

    var pTitle = '';
    pTitle = title;
    pTitle = encodeURIComponent(pTitle);

    var pUrl = '';
    pUrl = url;
    pUrl += '&sns=facebook';
    pUrl = encodeURIComponent(pUrl);

    var sURL = '';
    sURL = 'http://www.facebook.com/sharer.php';
    sURL += '?s=100';
    sURL += '&p[title]=';
    sURL += pTitle;
    sURL += '&p[url]=';
    sURL += pUrl;

    window.open(sURL);

    return false;
}

function sendYozm(title) {
    var url = '';
    url = window.location + '';
    
    url = url.replace('&section_id=', '&amp;section_id=');

    var m = '';
    m = title;
    m += ' ';
    m += url;
    m += '&sns=yozm';
    m = encodeURIComponent(m);

    var sURL = '';
    sURL = 'http://yozm.daum.net/home';
    sURL += '?m=';
    sURL += m;

    window.open(sURL);

    return false;
}

function sendClog(title) {
    var url = window.location + '';
    url += "&sns=clog";

    var sURL = '';
    sURL += 'http://csp.cyworld.com/bi/bi_recommend_pop.php';
    sURL += '?url=' + encodeURIComponent(url);
    sURL += '&writer=';
    sURL += '&title=' + encodeURIComponent(title);    
    sURL += '&summary=';
	
    window.open(sURL,'recom_icon_pop', 'width=400,height=364,scrollbars=no,resizable=no');

    return false;
}


