/*************************************************
* °ªÀÌ ÀÖ´ÂÁö Ã¼Å©
* Á¤»óÀÎ °æ¿ì true, °ªÀÌ ¾øÀ» °æ¿ì´Â false¸¦ ¸®ÅÏ
*************************************************/
function TextBoxValidation( source, message, setFocus )
{
	if ( source.value == '' )
	{
		alert( message + 'À»/¸¦ ÀÔ·ÂÇÏ¼¼¿ä' );
		
		if ( setFocus )
			source.focus();
			
		return false;
	}
	else
		return true;
}

/*************************************************
* DropDownList¿¡¼­ ¾ÆÀÌÅÛÀ» ¼±ÅÃÇß´ÂÁö¸¦ Ã¼Å©
* errorValueÀÇ °ªÀÌ¸é ¾ÆÀÌÅÛÀ» ¼±ÅÃÇÏÁö ¾ÊÀº °ÍÀ¸·Î °£ÁÖ
* Á¤»óÀÎ °æ¿ì true, °ªÀÌ ¾øÀ» °æ¿ì´Â false¸¦ ¸®ÅÏ
*************************************************/
function DropDownListValidation( source, message, errorValue )
{
	if ( source[ source.selectedIndex ].value == '' )
	{
		alert( message + 'À»/¸¦ ÀÔ·ÂÇÏ¼¼¿ä' );
		source.focus();
		return false;
	}
	else
		return true;
}


/*************************************************
* ¿Ã¹Ù·Î µÈ ³¯Â¥ Æ÷¸ËÀ» ³Ö¾ú´ÂÁö °Ë»ç
* Á¤»óÀÎ °æ¿ì true, °ªÀÌ ¾øÀ» °æ¿ì´Â false¸¦ ¸®ÅÏ
*************************************************/
function DateTextBoxValidation( source )
{
	if ( source.value.match(/\S/)!=null && source.value.match(/\d\d\d\d+\-\d\d+\-\d\d/g) != source.value ) 
	{
		alert("³¯Â¥¸¦ Á¤È®È÷ ÀÔ·ÂÇØÁÖ¼¼¿ä.\n\n³¯Â¥´Â YYYY-MM-DDÀÇ Çü½ÄÀÔ´Ï´Ù.");
		source.focus();
		return false;
	}
	else
		return true;
}

/*************************************************
* ¸ð´Þ ´ÙÀÌ¾ó·Î±× ¹Ú½º¸¦ ¶ç¿î´Ù.
* ´ÙÀÌ¾ó·Î±×¿¡¼­ ³Ñ°ÜÁØ °ªÀ» ¸®ÅÏ
*************************************************/
function ShowModal( modalWindowName, arg, width, height, useQueryString )
{
	var arr;
	var left_p = (screen.width - 400)/2;
	var top_p = (screen.height - 300)/2;

	if ( !useQueryString )
	{
		arr = window.showModalDialog( modalWindowName, arg, "scroll:no; font-family:Verdana; font-size:12; status:no; dialogLeft:"+left_p+"; dialogTop:"+top_p+"; dialogWidth:" + width + "px; dialogHeight:" + height + "px;Help:No");
	}
	else
	{
		arr = window.showModalDialog( modalWindowName, self, "scroll:no; font-family:Verdana; font-size:12; status:no; dialogLeft:"+left_p+"; dialogTop:"+top_p+"; dialogWidth:" + width + "px; dialogHeight:" + height + "px;Help:No");
	}

	return arr;
}

/*************************************************
* ÆË¾÷ À©µµ¿ì¸¦ ¶ç¿î´Ù.
*************************************************/
function OpenPopup( url, name, width, height, scroll )
{
	window.open( url, 
		name, 
		'toolbar=no ,location=no ,directories=no ,status=no ,menubar=no ,scrollbars=' + scroll + ' ,resizable=no ,width=' + width + ' ,height=' + height);
}

function OpenPopup1( url, name, width, height, scroll )
{
	var win = window.open( url, 
		name, 
		'toolbar=no ,location=no ,directories=no ,status=no ,menubar=no ,scrollbars=' + scroll + ' ,resizable=no ,width=' + width + ' ,height=' + height);
	return win;
}

function SetSelected( ddl, code )
{
	for ( var i = 0 ; i < ddl.length ; i++ )
	{
		if ( ddl[ i ].value == code )
		{
			ddl.selectedIndex = i;
			break;
		}
	}
}


/*************************************************
* ´Þ·Â ÆË¾÷ À©µµ¿ì¸¦ ¶ç¿ö¼­ ³¯Â¥¸¦ ¹Þ¾Æ¿Â´Ù.
*************************************************/
function ShowCalendar( objTextBox )	
{
	var day ;
	day = ShowModal('../include/Calendar.htm', null, 275, 300, false);

	if ( day != null )
		document.forms[0].elements[ objTextBox ].value = day;
}




/*************************************************
* ÀÔ·ÂµÈ °ªÀÌ ÀûÀýÇÑ ³¯Â¥ÀÎÁö¸¦ ÆÇ´ÜÇÏ°í 
* ÀûÀýÇÑ ³¯Â¥¶ó¸é ³âµµ-¿ù-ÀÏ ÀÇ ÇüÅÂ·Î ¸¸µé¾îÁØ´Ù.
*************************************************/
function CheckDate( obj )
{
	var InsertedDate ;
	InsertedDate = obj.value;
	var Loop = 0 
	// ¸ðµÎ ¼ýÀÚ¸¸ ÀÔ·ÂÀ» Çß´ÂÁö °Ë»ç
	for ( Loop = 0 ; Loop < InsertedDate.length ; Loop++ )
	{
		
		if ( InsertedDate.charAt( Loop ) != '-' )
		{
			if ( !IsDigit( InsertedDate.charAt( Loop ) ) )
			{
				alert( '³¯Â¥´Â Á¤È®ÇÑ ¼ýÀÚ¸¸ ÀÔ·ÂÇÒ ¼ö ÀÖ½À´Ï´Ù.' );
				obj.value = '';
				return;
			}
		}
	}

	

	if ( InsertedDate.length <= 4 )
	{
		return;
	}
	else if ( InsertedDate.length > 10 )
	{
		alert( '³¯Â¥´Â YYYYMMDD ÀÇ 8ÀÚ¸®ÀÔ´Ï´Ù.' );
		obj.value = '';
		return;
	}	

	// YYYY-MM-DD ÇüÅÂ·Î ¹®ÀÚ¿­À» º¯°æÇØÁØ´Ù.
	var NewValueOfDate = InsertedDate;
	
	if ( ( InsertedDate.length > 4 ) && ( InsertedDate.length <= 7 ) )
	{
		if ( InsertedDate.charAt( 4 ) != '-' )
			NewValueOfDate = InsertedDate.substring( 0, 4 ) + '-' + InsertedDate.substring( 4 );
	}
	else
	{
		if ( InsertedDate.charAt( 7 ) != '-' )
			NewValueOfDate = InsertedDate.substring( 0, 7 ) + '-' + InsertedDate.substring( 7 );
	}


	obj.value = NewValueOfDate;
	
	var YYMMDD = NewValueOfDate.split( '-' );

	var Year = YYMMDD[0];
	var Month = YYMMDD[1];
	var Day = YYMMDD[2];
	// ³âµµ °Ë»ç
	if ( ( obj.value.length >= 4 ) && ( Year < 1900 ) )
	{
		alert( '³âµµ¸¦ È®ÀÎÇÏ½Ê½Ã¿ä.' );
		obj.value = '';
		obj.focus();
		return;
	}
	
	// ¿ù °Ë»ç
	if ( ( obj.value.length == 7 ) && ( ( Month > 12 ) || ( Month < 1 ) ) )
	{
		alert( '¿ù¸¦ È®ÀÎÇÏ½Ê½Ã¿ä.' );
		obj.value = obj.value.substring( 0, 5 );
		return;
	}
	// ÀÏ °Ë»ç - ÇØ´ç ¿ùÀÇ ¸¶Áö¸· ³¯Â¥¸¦ ±¸ÇØ¼­ °Ë»ç
	var LastDay = GetLastOfMonth( Year, Month );
	
	if ( ( obj.value.length == 10 ) && ( ( Day > LastDay ) || ( Day < 1 ) ) )
	{
		alert( '³¯Â¥¸¦ È®ÀÎÇÏ½Ê½Ã¿ä.' );
		obj.value = obj.value.substring( 0, 8 );
		return;
	}	
}

/*************************************************
* Æ¯Á¤ ³â ¿ùÀÇ ¸¶Áö¸· ³¯ÀÚ¸¦ ±¸ÇÏ´Â ¸Þ¼­µå
*************************************************/
function GetLastOfMonth( year, month )
{
	// ÇØ´ç ³âµµ, ¿ùÀÇ Ã¹¹øÂ° ³¯Â¥¸¦ ±¸ÇÑ´Ù.
	var TheFirstDay = new Date( year, month, "1");

	// ÀÌÀü ³¯Â¥¸¦ ±¸ÇÑ´Ù.
	TheFirstDay.setDate(0);

	// ¸¶Áö¸· ³¯ÀÚ¸¦ ¹ÝÈ¯
	return TheFirstDay.getDate();
}

/*************************************************
* ÆÄ¶ó¹ÌÅÍÀÇ °ªÀÌ ¼ýÀÚ¶ó¸é true ¸¦ ¹ÝÈ¯
*************************************************/
function IsDigit ( num )
{
	return ( ( num >= "0" ) && ( num <= "9" ) );
}

/*************************************************
* ±×¸®µåÀÇ »ó´Ü Ã¼Å©¹Ú½º¸¦ Å¬¸¯ÇÏ¸é ÇÏ´Ü Ã¼±×¹Ú½ºÀÇ »óÅÂ¸¦ º¯È¯
*************************************************/
function SelectAll( allObj, gridName )
{
	var values = document.all.tags("INPUT");
	var check = ( allObj.checked );
	
	for( var i = 0 ; i < values.length ; i++ )
	{
		if ( ( values(i).type == "checkbox" )
			&& ( values(i).id.substring( 0, gridName.length ) == gridName ) )
		{
			if ( gridName == 'dgEmployInGroup' )
			{
				if ( values(i).id.substring( values(i).id.length - 2, values(i).id.length ) != 'YN' )
					values(i).checked = check;
			}
			else
				values(i).checked = check;
		}
	}
}

/*************************************************
* ±×¸®µåÀÇ ¾ÆÀÌÅÛÀ» ¼±ÅÃÇß´ÂÁö ÆÇ´Ü.
*************************************************/
function CheckSelect( gridName )
{
	var values = document.all.tags("INPUT");
	var bChecked = false;
	
	for( var i = 0 ; i < values.length ; i++ )
	{
		if ( ( values(i).type == "checkbox" )
			&& ( values(i).id.substring( 0, gridName.length ) == gridName ) )
		{
			if ( values(i).checked )
			{
				bChecked = true;
				break;
			}
		}
	}
	
	if ( !bChecked )
	{
		alert( 'Ã¼Å©¹Ú½º¸¦ ¼±ÅÃÇÏ¼¼¿ä.' );
		return false;
	}
	else
		return true;
}

////////////////////////////////////////////////////////////////
// ValueCheck 
// 1 -> ÁÖ¹Î¹øÈ£
// 2 -> »ç¾÷ÀÚ ¹øÈ£
// 3 -> ¹ýÀÎ ¹øÈ£
// 4 -> ÀÌ¸ÞÀÏ Ã¼Å©
// 5 -> ÀºÇàÁöÁ¡ÄÚµå Ã¼Å©
/////////////////////////////////////////////////////////////////
function ValueCheck(obj, type)
{
	if(obj.value.length == 0)
	{
	 return;
	}
	
	switch(type)
	{
		case 1:
			JuminCheck(obj);
			break;
		case 2:
			SupNoCheck(obj);
			break;
		case 3: 
			BubNoCheck(obj);
			break;
		case 4: 
			EmailCheck(obj);
			break;
		case 5: 
			BANK_BR_CD_Check(obj);
			break;			
		default:
			break;
	}
}

// ÁÖ¹Î¹øÈ£ Ã¼Å©
function JuminCheck(JuminNo) 
{ 
	
	var entry_no = JuminNo;
	entry_no = entry_no.replace("-","");
	var len =  entry_no.length;
	if(len != 13)
	{
		alert("ÁÖ¹Îµî·Ï ¹øÈ£´Â '-'À» Á¦¿ÜÇÑ 13ÀÚ¸®¿©¾ß ÇÕ´Ï´Ù.")
		return 0;
	}
	

	var no_1 = entry_no.substr(0,1); 
	var no_2 = entry_no.substr(1,1); 
	var	no_3 = entry_no.substr(2,1); 
	var	no_4 = entry_no.substr(3,1); 
	var	no_5 = entry_no.substr(4,1); 
	var	no_6 = entry_no.substr(5,1); 
	var	no_7 = entry_no.substr(6,1); 
	var	no_8 = entry_no.substr(7,1); 
	var	no_9 = entry_no.substr(8,1); 
	var	no_10 = entry_no.substr(9,1); 
	var	no_11 = entry_no.substr(10,1); 
	var	no_12 = entry_no.substr(11,1); 
	var no_13 = entry_no.substr(12,1); 
	
	var no_ck;
	no_ck = no_1 * 9;		  	

	no_ck += no_2 * 8;			 
	no_ck += no_3 * 7; 
	no_ck += no_4 * 6; 
	no_ck += no_5 * 5; 
	no_ck += no_6 * 4; 
	no_ck += no_7 * 3; 
	no_ck += no_8 * 2; 
	no_ck += no_9 * 9; 
	no_ck += no_10 * 8; 
	no_ck += no_11 * 7; 
	no_ck += no_12 * 6; 
	
	no_ck = no_ck % 11; 
	
	
	if(no_ck == 10)
	{
		no_ck = 0;
	}
	else if(no_ck == 0)
	{
		no_ck = 1;
	}

	if(no_ck == no_13)
	{
		 return 1; 
	} 
	else 
	{ 
		alert("ÁÖ¹Îµî·Ï¹øÈ£°¡ Á¤È®ÇÏÁö ¾Ê½À´Ï´Ù.");
		return 0; 
	}
}

//¹ýÀÎ µî·Ï ¹øÈ£ Ã¼Å©
function BubNoCheck(obj)
{
	var entry_no = obj.value;
	entry_no = entry_no.replace("-","");
	var len =  entry_no.length; 
	if(len != 13)
	{
		alert("¹ýÀÎ µî·Ï ¹øÈ£´Â '-'À» Á¦¿ÜÇÑ 13ÀÚ¸®¿©¾ß ÇÕ´Ï´Ù.")
		return 0;
	}

	var no_1 =  entry_no.substr(0,1); 
	var no_2 = entry_no.substr(1,1); 
	var	no_3 = entry_no.substr(2,1); 
	var	no_4 = entry_no.substr(3,1); 
	var	no_5 = entry_no.substr( 4,1); 
	var	no_6 = entry_no.substr( 5,1); 
	var	no_7 = entry_no.substr( 6,1); 
	var	no_8 = entry_no.substr( 7,1); 
	var	no_9 = entry_no.substr( 8,1); 
	var	no_10 = entry_no.substr( 9,1); 
	var	no_11 = entry_no.substr( 10,1); 
	var	no_12 = entry_no.substr( 11,1); 
	var no_13 = entry_no.substr( 12,1); 

    var	no_ck;
    no_ck = no_1 * 1; 
	no_ck += no_2 * 2; 
	no_ck += no_3 * 1; 
	no_ck += no_4 * 2; 
	no_ck += no_5 * 1; 
	no_ck += no_6 * 2; 
	no_ck += no_7 * 1; 
	no_ck += no_8 * 2; 
	no_ck += no_9 * 1; 
	no_ck += no_10 * 2; 
	no_ck += no_11 * 1; 
	no_ck += no_12 * 2; 
	no_ck = no_ck % 10; 
	if(no_ck == 0)
	{
		no_ck = 10;
	}
	no_ck = 10 - no_ck; 
	if(no_ck == no_13) 
	{ 
		obj.value = entry_no.substr(0,6)  + entry_no.substr(6,7);
		return 1;
	} 
	else 
	{
		alert("¹ýÀÎ ¹øÈ£°¡ Á¤È®ÇÏÁö ¾Ê½À´Ï´Ù.");
		return 0; 
	} 
		
}

//»ç¾÷ÀÚ¹øÈ£ Ã¼Å©
function SupNoCheck(SaupNo)
{
	
	var entry_no = SaupNo;
	entry_no = entry_no.replace("-","");
	var len =  entry_no.length;
	if(len != 10)
	{
		alert("»ç¾÷ÀÚ µî·Ï ¹øÈ£´Â '-'À» Á¦¿ÜÇÑ 10ÀÚ¸®¿©¾ß ÇÕ´Ï´Ù.")
		return 0;
	}
	
	var no_1 =  entry_no.substr(0,1); 
	var no_2 = entry_no.substr(1,1); 
	var	no_3 = entry_no.substr(2,1); 
	var	no_4 = entry_no.substr(3,1); 
	var	no_5 = entry_no.substr(4,1); 
	var	no_6 = entry_no.substr(5,1); 
	var	no_7 = entry_no.substr(6,1); 
	var	no_8 = entry_no.substr(7,1); 
	var	no_9 = entry_no.substr(8,1); 
	var	no_10 = entry_no.substr( 9,1); 

	var no_ck;
	no_ck = no_1 * 1; 
	no_ck += no_2 * 3; 
	no_ck += no_3 * 7; 
	no_ck += no_4 * 1; 
	no_ck += no_5 * 3; 
	no_ck += no_6 * 7; 
	no_ck += no_7 * 1; 
	no_ck += no_8 * 3; 

	var no_ck_temp = no_9 * 5; 
		
				
	no_ck += parseInt((no_ck_temp / 10), 10);
	no_ck += no_ck_temp % 10;
		
		
	no_ck = no_ck % 10;
		
	no_ck = 10 - no_ck;
		
	if(no_ck == 10)
	{
		no_ck = 0;
	}
		
	if(no_ck == no_10) 
	{
		 return 1; 
	} 
	else 
	{
		alert("»ç¾÷ÀÚ ¹øÈ£°¡ Á¤È®ÇÏÁö ¾Ê½À´Ï´Ù.");
		return 0; 
	} 
} 


//Email Ã¼Å©
function EmailCheck(obj)
{
	var sEmail = obj.value;
	
	var index1 = sEmail.indexOf("@");
	
	var index2 = sEmail.indexOf(".");
	
	var len = sEmail.length;
	
	if(index1 < 1 || index2 < 1  )
	{
		alert("Email ÁÖ¼Ò Çü½ÄÀÌ Àß¸ø µÇ¾ú½À´Ï´Ù. ´Ù½Ã ÀÔ·ÂÇÏ¿© ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.!");
		return false;
	}
	else if( index1 > index2)
	{
		alert("Email ÁÖ¼Ò Çü½ÄÀÌ Àß¸ø µÇ¾ú½À´Ï´Ù. ´Ù½Ã ÀÔ·ÂÇÏ¿© ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.!");
		return false;
	}
	else if(index2 == len)
	{
		alert("Email ÁÖ¼Ò Çü½ÄÀÌ Àß¸ø µÇ¾ú½À´Ï´Ù. ´Ù½Ã ÀÔ·ÂÇÏ¿© ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.!");
		obj.focus();
		obj.select();
		return false;
	}
	return true;
}

// ÀºÇàÁöÁ¡ÄÚµå Ã¼Å©
function BANK_BR_CD_Check(obj) 
{ 
	
	///alert("111");
	var entry_no = obj.value;
	entry_no = entry_no.replace("-","");
	var len =  entry_no.length;
	
	
	if(len != 6)
	{
		alert("ÀºÇà ÁöÁ¡ÄÚµå´Â 6ÀÚ¸®¿©¾ß ÇÕ´Ï´Ù.")
		return 0;
	}
	
	//alert(len);
	var no_1 = entry_no.substr(0,1) * 3; 
	var no_2 = entry_no.substr(1,1) * 7; 
	var no_3 = entry_no.substr(2,1) * 1; 
	var no_4 = entry_no.substr(3,1) * 3; 
	var no_5 = entry_no.substr(4,1) * 7; 
	var no_6 = entry_no.substr(5,1); 
	
	
		//alert("333");
	
	var no_ck = no_1 + no_2 + no_3 + no_4 + no_5;
	//alert(no_ck);
	
	var len_2 = no_ck.toString().length;	
	//alert(len_2);
	
	var no_ck_end = no_ck.toString().substr(len_2-1,1);
	//alert(no_ck_end);
	
	var last = 10 - no_ck_end;
	
	if(last == no_6)
	{
		 return 1; 
	} 
	else 
	{ 
		alert("ÀºÇàÁöÁ¡ÄÚµå°¡ Á¤È®ÇÏÁö ¾Ê½À´Ï´Ù.");
		return 0; 
	}		


}



/*----------------------------------------------------------------------------*/
/* ³» ¿ë : ÇÊµåÀÇ À¯È¿¼º °Ë»ç																		*/
/* ÆÄ¶ó¸ÞÅÍ : pObject - °Ë»çÇÒ ÀÔ·Â ÇÊµå														*/
/*				 pMaxSize - °Ë»çÇÒ ÀÔ·Â ÇÊµåÀÇ ÇÊ¼ö Å©±â										*/
/*				 pAllowNull - null check¿©ºÎ N:nullÃ¼Å©ÇÔ, Y:nullÇã¿ë						*/
/*				 pIsNumber - ¼ýÀÚ ÀÎÁö Ã¼Å©¿©ºÎ "Number":¼ýÀÚ Ã¼Å©, N:¼ýÀÚ Ã¼Å©¾ÈÇÔ		*/
/*				 pFieldLabel - °Ë»çÇÒ ÀÔ·Â ÇÊµåÀÇ ¶óº§											*/
/*----------------------------------------------------------------------------*/
	function fCheckField(pObject, pMaxSize, pAllowNull, pIsNumber, pFieldLabel)
	{
		// Null ¿©ºÎ Ã¼Å©¸¦ È®ÀÎÇÑ´Ù.
		if(pAllowNull == "N")
		{
			// °ø¹éÀÌ¸é alert
			if(pObject.value == "")
			{
			   alert(pFieldLabel+"¿¡ °ªÀ» ÀÔ·ÂÇÏ½Ê½Ã¿ä.");
				pObject.focus();
				pObject.select();
				return false;
			}
		}
		// NullÀÌ Çã¿ëµÈ°æ¿ì
		else if(pObject.value == "")
		{
		   return true;
		}

		// ¼ýÀÚ ¿©ºÎ Ã¼Å©¸¦ È®ÀÎÇÑ´Ù.
		if(pIsNumber == "Number")
		{
			// ¼ýÀÚÀÌ¸é true , ¼ýÀÚ°¡ ¾Æ´Ï¸é alert
			if(fCheckNumber(pObject.value) == false)
			{
			   alert(pFieldLabel+"°ªÀ» ¼ýÀÚ·Î ÀÔ·ÂÇÏ½Ê½Ã¿ä.");
				pObject.focus();
				pObject.select();
				return false;
			}
		}
		// ³¯Â¥¿©ºÎ¸¦ Ã¼Å©ÇÑ´Ù
		else if(pIsNumber == "Date")
		{
			// ³¯Â¥ÀÌ¸é true , ³¯Â¥°¡ ¾Æ´Ï¸é alert
			if(fCheckDate(pObject.value) == false)
			{
			   //alert(pFieldLabel+"°ªÀ» ³¯Â¥·Î ÀÔ·ÂÇÏ½Ê½Ã¿ä.");
				pObject.focus();
				pObject.select();
				return false;
			}
		}
		// ³âµµ¿©ºÎ¸¦ Ã¼Å©ÇÑ´Ù
		else if(pIsNumber == "Year")
		{
			// ³âµµÀÌ¸é true , ³âµµ°¡ ¾Æ´Ï¸é alert
			if(fCheckYear(pObject.value) == false)
			{
			   alert(pFieldLabel+"°ªÀ» ³âµµ·Î ÀÔ·ÂÇÏ½Ê½Ã¿ä.");
				pObject.focus();
				pObject.select();
				return false;
			}
		}
		// ¿ù¿©ºÎ¸¦ Ã¼Å©ÇÑ´Ù
		else if(pIsNumber == "Month")
		{
			// ¿ùÀÌ¸é true , ¿ùÀÌ ¾Æ´Ï¸é alert
			if(fCheckMonth(pObject.value) == false)
			{
			   alert(pFieldLabel+"°ªÀ» ¿ùÇü½ÄÀ¸·Î ÀÔ·ÂÇÏ½Ê½Ã¿ä.");
				pObject.focus();
				pObject.select();
				return false;
			}
		}
		// ÀÏ¿©ºÎ¸¦ Ã¼Å©ÇÑ´Ù
		else if(pIsNumber == "Day")
		{
			// ÀÏÀÌ¸é true , ÀÏÀÌ ¾Æ´Ï¸é alert
			if(fCheckDay(pObject.value) == false)
			{
			   alert(pFieldLabel+"°ªÀ» ÀÏÇü½ÄÀ¸·Î ÀÔ·ÂÇÏ½Ê½Ã¿ä.");
				pObject.focus();
				pObject.select();
				return false;
			}
		}

		// ±æÀÌ¸¦ Ã¼Å©ÇÑ´Ù.
		if(pMaxSize > 0)
		{
			// ÁöÁ¤µÈ ±æÀÌº¸´Ù ÀÛÀ¸¸é alert
			if(pObject.value.length < pMaxSize)
			{
				alert(pFieldLabel + "¿¡ ÀÔ·ÂÇÑ ³»¿ëÀÌ ºÎÁ·ÇÕ´Ï´Ù \n" + pMaxSize + " ÀÚ¸®ÀÇ ÀÔ·ÂÀÌ ÇÊ¿äÇÕ´Ï´Ù.");
				pObject.focus();
				pObject.select();
				return false;
			}
		}

		return true;
	}


//¼ýÀÚ, ',', '.'¸¸ ÀÔ·Â°¡´ÉÇÑ ÅØ½ºÆ® ¹Ú½º ½ºÅ©¸³Æ® function
//¼ýÀÚ¿Ü¿¡ ´Ù¸¥ ¹®ÀÚ ÀÔ·Â½Ã ±âÁ¸ÀÇ °ªÀº À¯Áö
function NumericCheck(thisone)
{ 
    //alert('aa');
    
    var tempnum=thisone.value;
    var check = 0;
    
    for (i=0;i<=tempnum.length;i++)
    { 
        if(tempnum.charCodeAt(i) == 46)
        {
            if(check != 0 || i == 0)
            {
                thisone.value = tempnum.substring(0,i);
                break;
            }
            check = check + 1;
        }
        if(tempnum.charCodeAt(i) != 44 && tempnum.charCodeAt(i) != 46 && tempnum.charCodeAt(i) < 48 || tempnum.charCodeAt(i) > 57)
        {
            thisone.value = tempnum.substring(0,i);
            break ;
        }
    }
			
    CommaFormat(thisone);
}

/*
   ³»    ¿ë : ÆÄ¶ó¹ÌÅÍ °ªÀÌ ¼ýÀÚ·Î¸¸ ÀÌ·ç¾îÁ®ÀÖ´ÂÁö¸¦ Ã¼Å©
   ÆÄ¶ó¹ÌÅÍ : pNumber - Ã¼Å©ÇÒ ¼öÄ¡ ¶Ç´Â ¹®ÀÚ¿­
   Return°ª : TRUE or FALSE
*/
function fCheckNumber(pNumber)
{
   // °ªÀÌ ¾øÀ¸¸é FALSE ¸®ÅÏ
   if(typeof(pNumber) == "undefined") return false;
   if(pNumber.length == 0) return false;

   // ¹®ÀÚ¿­È­½ÃÄÑ º¯¼ö¿¡ ÀúÀå
   var vNumber = pNumber.toString();

   // ¹®ÀÚ¿­ ±æÀÌ¸¸Å­ loop
   for(var i=0; i<vNumber.length; i++)
   {
      var vTemp = vNumber.substring(i, i+1);
      
      // ¼ýÀÚ°¡ ¾Æ´Ï¸é FALSE ¸®ÅÏ
      if(isNaN(vTemp)) return false;
      
      // °ø¹éÀÌ¸é FALSE ¸®ÅÏ
      if(" " == vTemp) return false;
   }

   // ÀÌ»ó ¾øÀ¸¹Ç·Î TRUE ¸®ÅÏ
   return true;
}



//¼ýÀÚÀÔ·Â¹Ú½ºÀÇ ÄÄ¸¶¸¦ Âï¾îÁÖ´Â ½ºÅ©¸³Æ® function
function CommaFormat(thisone)
{ 
    return;
    var tempnum = "";
    
    if(thisone.value.split(",").length ==1)
    {
        tempnum=thisone.value;
    }
    else
    {
        for(i = 0; i < thisone.value.split(",").length ; i++)
        {
            tempnum = tempnum + thisone.value.split(",")[i]
				}
    }
    
    var str = "";
    var count = 0;
    
    for (i = tempnum.length; i > 0; i--)
    { 
        if(tempnum.charCodeAt(i) == 46)
        {
            var tempnum2 = "";
            
            if(str.split(".").length == 1)
            {
                str = str;
            }
            else
            {
                for(k = 0; k < str.split(",").length; k++)
                {
                    tempnum2 = tempnum2 +  str.split(",")[k]
                }
                
                str = tempnum2;
                count = 0;
            }
        }
        if(count == 3)
        {
            str = "," + str;
            count = 0;
				}
        str = tempnum.substring(i,i-1) +str;
        count = count + 1 ;
    }
    thisone.value = str;
    //thisone.focus();
}

function CommaDel(val)
{
	while(val.indexOf(',') > -1) {
		val = val.replace(',','');
	}
	
	return val;
}

//±âÁ¸ÀÇ ½ºÅ©¸³Æ® ¿¬»êÀ» À§ÇÑ ','¿Í'.'À» Á¦°ÅÇØÁÖ´Â function
function CommaRemove(thisbox)
{
    var tempnum = thisbox.value;
    
    if(tempnum == "")
    {
        return 0;
    }
    
    var value = "";
    
    for(i = 0; i < tempnum.split(",").length; i++)
    {
		value = value + tempnum.split(",")[i]
    }
    
    //return parseFloat(value);
    thisbox.value = parseFloat(value);
}

//¿À·ÎÁö ¼ýÀÚ¸¸ ÀÔ·Â°¡´ÉÇÑ ... 
function OnlyNumericCheck(thisone)
{ 
    var tempnum=thisone.value;
    for (i = 0; i <= tempnum.length; i++)
    { 
        if(tempnum.charCodeAt(i) < 48 || tempnum.charCodeAt(i) > 57)
        {
            thisone.value = tempnum.substring(0,i);
            break ;
        }
    }
}


function checkLanguage(pElement, pTitle)	// ¸Þ¼¼Áö ±æÀÌ °Ë»ç
{

	var i=0,l=0;

	var temp, lastl;

	//±æÀÌ¸¦ ±¸ÇÑ´Ù.
	while(i < pElement.value.length)
	{
		temp = pElement.value.charAt(i);

		if (escape(temp).length > 4)
		{
			alert(pTitle + "Àº ¿µ¹®È¤Àº ¼ýÀÚ¸¸ ÀÔ·Â°¡´ÉÇÕ´Ï´Ù.");
			return false;
		}
		i++
	}

	return true;
}

function checkStringLength(pElement, pTitle)	// ¸Þ¼¼Áö ±æÀÌ °Ë»ç
{

	var i=0,l=0;

	var temp, lastl;

	//±æÀÌ¸¦ ±¸ÇÑ´Ù.
	while(i < pElement.value.length)
	{
		temp = pElement.value.charAt(i);

		if (escape(temp).length > 4)//¾Æ½ºÅ°ÄÚµå ±æÀÌ ºñ±³
			l+=2;
		else if (temp!='\r')
			l++;
		// OverFlow

		if(l > pElement.maxLength)
		{
			l = lastl;
			pElement.focus();
			alert(pTitle + "Àº(´Â) ÇÑ±Û " +  pElement.maxLength/2 + "ÀÚ, ¿µ¹® " +  pElement.maxLength + "ÀÚ±îÁö¸¸ ÀÔ·ÂÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù");
			return false;
		}

		lastl = l;
		i++;
	}

	return true;
}

function checkTextAreaLength(pElement, pTitle,maxlength)	// ¸Þ¼¼Áö ±æÀÌ °Ë»ç
{

	var i=0,l=0;

	var temp, lastl;

	//±æÀÌ¸¦ ±¸ÇÑ´Ù.
	while(i < pElement.value.length)
	{
		temp = pElement.value.charAt(i);

		if (escape(temp).length > 4)//¾Æ½ºÅ°ÄÚµå ±æÀÌ ºñ±³
			l+=2;
		else if (temp!='\r')
			l++;
		// OverFlow

		if(l > maxlength)
		{
			l = lastl;
			pElement.focus();
			alert(pTitle + "Àº(´Â) ÇÑ±Û " +  maxlength/2 + "ÀÚ, ¿µ¹® " +  maxlength + "ÀÚ±îÁö¸¸ ÀÔ·ÂÇÏ½Ç ¼ö ÀÖ½À´Ï´Ù");
			return false;
		}

		lastl = l;
		i++;
	}

	return true;
}

function noenter() 
{
  if(window.event && window.event.keyCode == 13) event.returnValue=false;
}

function enter()
{
  return (window.event && window.event.keyCode == 13);
}

/*************************************************
* ÀÔ·ÂÆû¿¡ ÄÄ¸¶ Á¦°Å
*************************************************/
function OutComma(str){

    comm_str = String(str);
	uncomm_str="";

	for(i=0; i<comm_str.length; i++){
	substr=comm_str.substring(i,i+1);
	if(substr!=",")
	uncomm_str += substr;
	}

return uncomm_str;
}

/*************************************************
* ³â/¿ù/ÀÏ °³º°°Ë»ç
*************************************************/
function checkYear(obj)
{
	// ³âµµ °Ë»ç
	Year = obj.value;
	if(!Year) return;
	
	if ( ( Year.length != 4 ) || ( Year < 1900 ) )
	{
		alert( '³âµµ¸¦ È®ÀÎÇÏ½Ê½Ã¿ä.' );
		obj.value = '';
		return false;
	}
}

// Focus out Àû¿ë
function checkMonth(obj)
{	
	// ¿ù °Ë»ç
	Month = obj.value;
	if(!Month) return;
	
	if (( Month > 12 ) || ( Month < 1 ))
	{
		alert( '¿ù¸¦ È®ÀÎÇÏ½Ê½Ã¿ä.' );
		obj.value = '';
		return;
	}

	if(Month.length == 1) {
		obj.value = '0'+obj.value;
		return;
	}
}

// Focus out Àû¿ë
function checkDay(obj)
{
	// ÀÏ °Ë»ç
	Day = obj.value;
	if(!Day) return;
	
	if (( Day > 31 ) || ( Day < 1 ))
	{
		alert( '³¯Â¥¸¦ È®ÀÎÇÏ½Ê½Ã¿ä.' );
		obj.value = '';
		return;
	}	

	if(Day.length == 1) {
		obj.value = '0'+obj.value;
		return;
	}
}


/*************************************************
* ¿ìÆí¹øÈ£ °Ë»öÃ¢ ¿­±â
*************************************************/
function zip_open(zdiv) {
     var Loc = centerPosition(400,250).split('/');
     var wName = window.open('../zip/zip_search.php?zdiv='+zdiv,'zip','height=250,width=400,resizable=0,scrollbars=no,left='+Loc[0]+',top='+Loc[1]);
     //wName.resizeTo(400+10,250+50);
     wName.focus();
}

/*************************************************
* ÆË¾÷Ã¢ ¿­±â
*************************************************/
function popup_open(url, wSize, hSize, bar, winName) {
     //alert(navigator.appVersion.indexOf("MSIE 7"));
     //if(navigator.appVersion.indexOf("MSIE 7") > -1 || navigator.appVersion.indexOf("MSIE 8") > -1) hSize += 30;

     if(!winName) winName = 'pop';
     var Loc = centerPosition(wSize,hSize).split('/');
     var wName = window.open(url,winName,'width='+wSize+',height='+hSize+',toolbar=0,location=0,directories=0,status=1,menubar=0,resizable=yes,scrollbars='+bar+',left='+Loc[0]+',top='+Loc[1]);
     wName.focus();
}

/*************************************************
* ÆË¾÷Ã¢ Áß¾ÓÁÂÇ¥ ±¸ÇÏ±â
*************************************************/
function centerPosition(wSize, hSize)
{
	s_width = screen.width; // ½Ã½ºÅÛ °¡·Î ÇØ»óµµ¸¦ ¾ò´Â´Ù.
	s_height = screen.height; // ½Ã½ºÅÛ ¼¼·Î ÇØ»óµµ¸¦ ¾ò´Â´Ù.

	l = (s_width - wSize) / 2 - 1; //¿ÀÇÂÇÒ À©µµ¿ìÀÇ °¡·Î ÁÂÇ¥
	t = (s_height - (hSize + 100)) / 2 - 1; //¿ÀÇÂÇÒ À©µµ¿ìÀÇ ¼¼·Î ÁÂÇ¥

	return l+'/'+t;
}

/*************************************************
* TEXTÆû Æ÷Ä¿½º Á¡ÇÁ
*************************************************/
function jump_keyup(objFrom, objTo, len)
{
	if(objFrom.value.length >= len || len == 0) objTo.focus();
	else return;
}


