//-----------------------------------------------------------------------------
// ¸ðµç ÀÌ¹ÌÁö¿Í ¸µÅ©¿¡ ¸µÅ©½Ã Æ÷Ä¿½º¸¦ ÀÚµ¿À¸·Î Á¦°Å ÇÑ´Ù.
//-----------------------------------------------------------------------------
function fn_Bluring(){ 
  if(event.srcElement.tagName=="A"||event.srcElement.tagName=="IMG") document.body.focus(); 
}
document.onfocusin=fn_Bluring; 

var _SITE_STATUS		= location.protocol +"://"+ document.domain +"/";
window.status		= "";
window.defaultStatus	= _SITE_STATUS;

//-----------------------------------------------------------------------------
// User Agent °Ë»ç... 
//-----------------------------------------------------------------------------
function fn_UserAgent() {
	var userAgent	= navigator.userAgent;
	this.win32Ver	= "";
	this.isNS			= navigator.appName == "Netscape";
	this.isNS4		= (document.layers ? true : false);	
	this.isDOM		= (document.getElementById ? true : false); 
	this.isIE4		= ((document.all && !this.isDOM) ? true : false);

    if(userAgent.indexOf("MSIE") != -1){
        this.isIE			= true;
		this.agentVer	= userAgent.charAt(userAgent.indexOf("MSIE") + 5);
		if (this.agentVer == 4) this.isIE4 = true;
		else if (this.agentVer == 5) this.isIE5 = true;
		else if (this.agentVer == 6) this.isIE6 = true;
		else if (this.agentVer == 7) this.isIE7 = true;		
		if (this.isIE6 && navigator.appMinorVersion.indexOf("SP2") != -1) {
			this.isXP2 = true;
		} else {
			this.isXP2 = false;
		}		

		this.bLan		= navigator.browserLanguage;
		this.uLan		= navigator.userLanguage;
		this.sLan	 		= navigator.systemLanguage;
		this.platform	= navigator.platform;		
		this.cpuClass	= navigator.cpuClass;
		this.isOnLine	= navigator.onLine;
		this.isCookie	= navigator.cookieEnabled;
		this.isJava		= navigator.javaEnabled();

    }else if(userAgent.indexOf("Mozilla") != -1 && userAgent.indexOf("compatible") == -1){
        this.isNav = true;
		this.agentVer	= userAgent.charAt(UA.indexOf("Mozilla") + 8);
        if(agentVer == 4 ) this.isNav4 = true;
        else if(agentVer == 5 ) this.isNav5 = true;
        else if(agentVer == 6 ) this.isNav6 = true;
        else if(agentVer == 7 ) this.isNav7 = true;
    }	
}
var oUABc = new fn_UserAgent();

//-----------------------------------------------------------------------------
// Cooki control
//-----------------------------------------------------------------------------
function getCookieVal(offset) {
	var endstr=document.cookie.indexOf(";",offset);
	if (endstr==-1) endstr=document.cookie.length;
	return unescape(document.cookie.substring(offset, endstr));
}
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 "";
}
function setCookie( name, value, expiredays ) {
	var todayDate = new Date();
	todayDate.setDate( todayDate.getDate() + expiredays );
	document.cookie = name + "=" + escape( value ) + "; path=/; expires=" + todayDate.toGMTString()  + ";"
}

//-----------------------------------------------------------------------------
// window.open
//-----------------------------------------------------------------------------
function win_pop(path, win_name, wi, he, scroll) {
	window.open(path,win_name,'width='+wi+',height='+he+',resizable=no,scrollbars='+scroll+', status=no,toolbar=no');
}
function win_pop(p_url, win_name, p_width, p_height, scroll_yn, p_left, p_top) 
{
	window.open(p_url, win_name, 'width=' + p_width + ',height=' + p_height + ',scrollbars=' + scroll_yn + ',left=' + p_left + ',top=' + p_top);
}
function win_pop_cookie(path, win_name, wi, he, scroll, cookie_name) {
	if ( getCookie( cookie_name ) == "" ) {
		window.open(path,win_name,'width='+wi+',height='+he+',resizable=no,scrollbars='+scroll+', status=no,toolbar=no');
	}
}
function win_pop_cookie(p_url, win_name, p_width, p_height, scroll_yn, cookie_name, p_left, p_top)
{
	if ( getCookie( cookie_name ) == "" ) 
	{
		window.open(p_url, win_name, 'width=' + p_width + ',height=' + p_height + ',scrollbars=' + scroll_yn + ',left=' + p_left + ',top=' + p_top);
	}
}

//-----------------------------------------------------------------------------
// String Method
//-----------------------------------------------------------------------------
String.prototype.isEmpty = function() {
  return (this == null || this == "");
}
String.prototype.isAlphaNum = function() {
  if (this.search(/[^A-Za-z0-9_-]/) == -1)
	 return true;
  else 
	 return false;
}
String.prototype.isAlpha = function() {
  if (this.search(/[^A-Za-z]/) == -1)
	 return true;
  else
	 return false;
}
String.prototype.isNumber = function() {
  if (this.search(/[^0-9]/) == -1)
	 return true;
  else
	 return false;
}
String.prototype.isKor = function() {
	return (/^[°¡-ÆR]+$/).test(this.remove(arguments[0])) ? true : false;
}
String.prototype.isEmail = function() {
	return (/\w+([-+.]\w+)*@\w+([-.]\w+)*\.[a-zA-Z]{2,4}$/).test(this.trim());
}
String.prototype.int = function() 
{	// ¼ýÀÚ·Î º¯È¯.
	return isNaN(this) ? null : parseInt(this);
}
String.prototype.num = function() 
{	// ¼ýÀÚ¸¸ ¹ÝÈ¯
	return (this.trim().replace(/[^0-9]/g, ""));
}
String.prototype.money = function() 
{ // ¼ýÀÚ¿¡ 3ÀÚ¸®¸¶´Ù , ¸¦ Âï¾î¼­ ¹ÝÈ¯
	var num = this.trim();
	while((/(-?[0-9]+)([0-9]{3})/).test(num)) {
		num = num.replace((/(-?[0-9]+)([0-9]{3})/), "$1,$2");
	}
	return num;
}

function FormatNumber(price,num){ 
	var str=new Array(); 
	price=String(price); 
	
	for(var i=1;i<=price.length;i++){ 
		if(i%num) str[price.length-i]=price.charAt(price.length-i); 
		else  str[price.length-i]=','+price.charAt(price.length-i); 
	}
	
	return str.join('').replace(/^,/,''); 
}

String.prototype.digits = function(cnt) 
{	// ¼ýÀÚÀÇ ÀÚ¸®¼ö(cnt)¿¡ ¸Âµµ·Ï ¹ÝÈ¯
	 var digit = "";
	 if (this.length < cnt) {
		for(var i = 0; i < cnt - this.length; i++) {
			 digit += "0";
		}
	}
	return digit + this;
}
String.prototype.bytes = function() 
{	// ¹ÙÀÌÆ® °è»ê.
	var b = 0;
	for (var i=0; i<this.length; i++) b += (this.charCodeAt(i) > 128) ? 2 : 1;
	return b;
}
String.prototype.trim = function() {		// °ø¹é Á¦°Å
	return this.replace(/(^\s*)|(\s*$)/g, "");
}
String.prototype.ltrim = function() {	// ÁÂ °ø¹éÁ¦°Å
	return this.replace(/(^\s*)/, "");
}
String.prototype.rtrim = function() {	// ¿ì °ø¹éÁ¦°Å
	return this.replace(/(\s*$)/, "");
}

//-----------------------------------------------------------------------------
// ÀüÈ­¹øÈ£ Ã¼Å© - arguments[0] : ÀüÈ­¹øÈ£ ±¸ºÐÀÚ
// @return : boolean
//-----------------------------------------------------------------------------
String.prototype.isPhone = function() {
	var arg = arguments[0] ? arguments[0] : "";
	return eval("(/(02|0[3-9]{1}[0-9]{1})" + arg + "[1-9]{1}[0-9]{2,3}" + arg + "[0-9]{4}$/).test(this)");
}

//-----------------------------------------------------------------------------
// ÇÚµåÆù¹øÈ£ Ã¼Å© - arguments[0] : ÇÚµåÆù ±¸ºÐÀÚ
// @return : boolean
//-----------------------------------------------------------------------------
String.prototype.isMobile = function() {
	var arg = arguments[0] ? arguments[0] : "";
	return eval("(/01[016789]" + arg + "[1-9]{1}[0-9]{2,3}" + arg + "[0-9]{4}$/).test(this)");
}

//-----------------------------------------------------------------------------
// ÁÖ¹Î¹øÈ£ Ã¼Å© - arguments[0] : ÁÖ¹Î¹øÈ£ ±¸ºÐÀÚ
// XXXXXX-XXXXXXX
// @return : boolean
//-----------------------------------------------------------------------------
String.prototype.isJumin = function() {
	var arg = arguments[0] ? arguments[0] : "";
	var jumin = eval("this.match(/[0-9]{2}[01]{1}[0-9]{1}[0123]{1}[0-9]{1}" + arg + "[1234]{1}[0-9]{6}$/)");
	if(jumin == null) {
		return false;
	} else {
		jumin = jumin.toString().num().toString();
	}
	
	// »ý³â¿ùÀÏ Ã¼Å©
	var birthYY = (parseInt(jumin.charAt(6)) == (1 ||2)) ? "19" : "20";
	birthYY += jumin.substr(0, 2);
	var birthMM = jumin.substr(2, 2) - 1;
	var birthDD = jumin.substr(4, 2);
	var birthDay = new Date(birthYY, birthMM, birthDD);
	if(birthDay.getYear() % 100 != jumin.substr(0,2) || birthDay.getMonth() != birthMM || birthDay.getDate() != birthDD) {
		return false;
	}
	var sum = 0;
	var num = [2, 3, 4, 5, 6, 7, 8, 9, 2, 3, 4, 5];
	var last = parseInt(jumin.charAt(12));
	for(var i = 0; i < 12; i++) {
		sum += parseInt(jumin.charAt(i)) * num[i];
	}
	return ((11 - sum % 11) % 10 == last) ? true : false;
}

//-----------------------------------------------------------------------------
// ¿Ü±¹ÀÎ µî·Ï¹øÈ£ Ã¼Å© - arguments[0] : µî·Ï¹øÈ£ ±¸ºÐÀÚ
// XXXXXX-XXXXXXX
// @return : boolean
//-----------------------------------------------------------------------------
String.prototype.isForeign = function() {
	var arg = arguments[0] ? arguments[0] : "";
	var jumin = eval("this.match(/[0-9]{2}[01]{1}[0-9]{1}[0123]{1}[0-9]{1}" + arg + "[5678]{1}[0-9]{1}[02468]{1}[0-9]{2}[6789]{1}[0-9]{1}$/)");
	if(jumin == null) {
		return false;
	} else {
		jumin = jumin.toString().num().toString();
	}
	
	// »ý³â¿ùÀÏ Ã¼Å©
	var birthYY = (parseInt(jumin.charAt(6)) == (5 || 6)) ? "19" : "20";
	birthYY += jumin.substr(0, 2);
	var birthMM = jumin.substr(2, 2) - 1;
	var birthDD = jumin.substr(4, 2);
	var birthDay = new Date(birthYY, birthMM, birthDD);
	if(birthDay.getYear() % 100 != jumin.substr(0,2) || birthDay.getMonth() != birthMM || birthDay.getDate() != birthDD) {
		return false;
	}
	if((parseInt(jumin.charAt(7)) * 10 + parseInt(jumin.charAt(8))) % 2 != 0) {
		return false;
	}
	var sum = 0;
	var num = [2, 3, 4, 5, 6, 7, 8, 9, 2, 3, 4, 5];
	var last = parseInt(jumin.charAt(12));
	for(var i = 0; i < 12; i++) {
		sum += parseInt(jumin.charAt(i)) * num[i];
	}
	return (((11 - sum % 11) % 10) + 2 == last) ? true : false;
}

//-----------------------------------------------------------------------------
// »ç¾÷ÀÚ¹øÈ£ Ã¼Å© - arguments[0] : µî·Ï¹øÈ£ ±¸ºÐÀÚ
// XXX-XX-XXXXX
// @return : boolean
//-----------------------------------------------------------------------------
String.prototype.isBiznum = function() {
	var arg = arguments[0] ? arguments[0] : "";
	var biznum = eval("this.match(/[0-9]{3}" + arg + "[0-9]{2}" + arg + "[0-9]{5}$/)");
	if(biznum == null) {
		return false;
	} else {
		biznum = biznum.toString().num().toString();
	}
	var sum = parseInt(biznum.charAt(0));
	var num = [0, 3, 7, 1, 3, 7, 1, 3];
	for(var i = 1; i < 8; i++) {
		sum += (parseInt(biznum.charAt(i)) * num[i]) % 10;
	}
	sum += Math.floor(parseInt(parseInt(biznum.charAt(8))) * 5 / 10);
	sum += (parseInt(biznum.charAt(8)) * 5) % 10 + parseInt(biznum.charAt(9));
	return (sum % 10 == 0) ? true : false;
}

//-----------------------------------------------------------------------------
// ¹ýÀÎ µî·Ï¹øÈ£ Ã¼Å© - arguments[0] : µî·Ï¹øÈ£ ±¸ºÐÀÚ
// XXXXXX-XXXXXXX
// @return : boolean
//-----------------------------------------------------------------------------
String.prototype.isCorpnum = function() 
{
	var arg = arguments[0] ? arguments[0] : "";
	var corpnum = eval("this.match(/[0-9]{6}" + arg + "[0-9]{7}$/)");
	if(corpnum == null) {
		return false;
	} else {
		corpnum = corpnum.toString().num().toString();
	}
	var sum = 0;
	var num = [1, 2, 1, 2, 1, 2, 1, 2, 1, 2, 1, 2];
	var last = parseInt(corpnum.charAt(12));
	for(var i = 0; i < 12; i++) {
		sum += parseInt(corpnum.charAt(i)) * num[i];
	}
	return ((10 - sum % 10) % 10 == last) ? true : false;
}

String.prototype.substringBytes = function(start, limitBytes) 
{	// ¿øÇÏ´Â ¹ÙÀÌÆ® ±îÁö Àß¶ó¼­ ¹ÝÈ¯.
	var b = 0;
	var L = 0;
	var s = "";	
	for (var i=0; i<this.length; i++) {
		b = (this.charCodeAt(i) > 128) ? 2 : 1;
		if (i >= start) {
			L += b;
			s += this.charCodeAt(i);
		}
		if (L >= limitBytes)
			break;
	}
	return s;
}
String.prototype.delHtmlTag = function() {
	var objStrip = new RegExp();
	objStrip = /[<][^>]*[>]/gi;
	return this.replace(objStrip, " ");
}
String.prototype.indexesOf = function(ptn) {
	var position = 0;
	var hits = -1;
	var start = -1;

	while( position != -1 ) {
		position = this.indexOf(ptn, start+1);
		hits += 1;
		start = position;
	}
	return hits;
}
String.prototype.replaceAll = function(source, target) {
	source = source.replace(new RegExp("(\\W)", "g"), "\\$1");
	target = target.replace(new RegExp("\\$", "g"), "$$$$");
	return this.replace(new RegExp(source, "gm"), target);
}
String.prototype.toLower = function() {
	return this.toLowerCase();
}
String.prototype.toUpper = function() {
	return this.toUpperCase();
}
String.prototype.getFileName = function() {
	if (this.indexOf("/") > 0)
		return this.split('/')[this.split('/').length-1].toLower();
	else
		return this.split('\\')[this.split('\\').length-1].toLower();
}
String.prototype.getFileExpName = function() {
	return this.split('.')[this.split('.').length-1].toLower();
}
String.prototype.toDateString = function() {	
	if (this.indexOf("-") > 0) 
	{	// 2008-04-23
		s = this.split("-");
		return s[0] +"³â "+ s[1] +"¿ù "+ s[2] +"ÀÏ"
	} 
	else if (this.indexOf("/") > 0) 
	{	// 2008/04/23
		s = this.split("/");
		return s[0] +"³â "+ s[1] +"¿ù "+ s[2] +"ÀÏ"
	}
	else if (this.length == 8) 
	{
		return this.substring(0,4) +"³â "+ this.substring(4,2) +"¿ù "+ this.substring(6,2) +"ÀÏ"
	}
}
String.prototype.Left = function(intLEN) {
//Left ÇÔ¼ö ±â´É
	if (intLEN > String(this).length) {
		return this;
	} else {
		return String(this).substring(0, intLEN);
	}
}
String.prototype.Right = function(intLEN) {
//Right ÇÔ¼ö ±â´É
	if (intLEN > String(this).length) {
		return this;
	} else {
		var intTEMP = String(this).length;
		return String(this).substring(intTEMP, intTEMP - intLEN);
	}
}

// ///////////////////////////////////////////////////////////////////////////////////////////////////
// DateTime Method...
Date.prototype.addDay = function(day) {
	return new Date(this.getYear(), this.getMonth(), this.getDate() + day);
}
Date.prototype.addMonth = function(month) {
	return new Date(this.getYear(), this.getMonth() + month, this.getDate());
}
Date.prototype.addYear = function(year) {
	return new Date(this.getYear() + year, this.getMonth(), this.getDate());
}
Date.prototype.now = function() {
	return new Date();
}
Date.prototype.compare = function(date) 
{	// ÇöÀç ³¯Â¥°¡ dateº¸´Ù ÀÌÀüÀÌ¸é 2, °°À¸¸é 0, ÀÌÈÄÀÌ¸é 1ÀÌ´Ù.
	var cDate = this.calculator(date);
	if (this.getYear() == date.getYear() && this.getMonth() == date.getMonth() && this.getDate() == date.getDate())
		return 0;
	else if (cDate.getYear() > 0 || cDate.getMonth() > 0 || cDate.getDate() > 0)
		return 1;
	else	
		return 2;
}
Date.prototype.calculator = function(date) 
{	// ÁöÁ¤µÈ ³¯ÀÚ¿¡¼­ date ¸¸Å­À» »©ÁØ´Ù.
	var day		= this.getDate() - date.getDate();
	var month	= this.getMonth() - date.getMonth();
	var year		= this.getYear() - date.getYear();

	if (day < 0) {
		month--;
		day		= 1;
	}
	if (month < 0) {
		year--;
		month	= 0;
	}
	if (year < 0) {
		return new Date(0, 0, 0);
	} else {
		return new Date(year, month, day);
	}
}
Date.prototype.getLastDay = function() 
{	// ÇØ´ç¿ùÀÇ ¸¶Áö¸· ÀÏÀ» ¹ÝÈ¯.
	var days = "31,28,31,30,31,30,31,31,30,31,30,31";
	if (this.getMonth() == 1 && this.isLeapYear())	// À±³â 2¿ù´ÞÀÌ¸é ÀÏ¼ö°¡ ´Ù¸£´Ù.
		return 29;
	else
		return days.split(',')[this.getMonth()];
}
Date.prototype.isLeapYear = function() 
{	// À±³âÀÎÁö °Ë»ç.
	var year = (this.getYear() < 1900) ? this.getYear() + 1900 : this.getYear();
	return ((year % 4 == 0 && year % 100 != 0) || year % 400 == 0);
}
Date.prototype.toString = function()
{
	var type = typeof(arguments[0]) == "number" ? arguments[0] : 0;
	return this.toDateString(type) +" "+ this.toDateTimeString(type);
}
Date.prototype.toDateString = function()
{
	var type = typeof(arguments[0]) == "number" ? arguments[0] : 0;
	if (type == 1)
		return this.getYear() +"-"+ getDigitThisLength((this.getMonth()+1),2) +"-"+ getDigitThisLength(this.getDate(),2);
	else if (type == 2)
		return this.getYear() +"/"+ getDigitThisLength((this.getMonth()+1),2) +"/"+ getDigitThisLength(this.getDate(),2);
	else if (type == 10)
		return this.getYear() +"³â "+ getDigitThisLength((this.getMonth()+1),2) +"¿ù "+ getDigitThisLength(this.getDate(),2) +"ÀÏ "+ this.toWeekString(2);
	else if (type == 11)
		return this.getYear() +"-"+ getDigitThisLength((this.getMonth()+1),2) +"-"+ getDigitThisLength(this.getDate(),2) +" "+ this.toWeekString(1);
	else if (type == 12)
		return this.getYear() +"/"+ getDigitThisLength((this.getMonth()+1),2) +"/"+ getDigitThisLength(this.getDate(),2) +" "+ this.toWeekString(0);
	else
		return this.getYear() +"³â "+ getDigitThisLength((this.getMonth()+1),2) +"¿ù "+ getDigitThisLength(this.getDate(),2) +"ÀÏ";

}
Date.prototype.toDateTimeString = function()
{
	var type = typeof(arguments[0]) == "number" ? arguments[0] : 0;
	if (type == 1)
		return getDigitThisLength(this.getHours(),2) +":"+ getDigitThisLength(this.getMinutes(),2) +":"+ getDigitThisLength(this.getSeconds(),2);
	else if (type == 2)
		return getDigitThisLength(this.getHours(),2) +":"+ getDigitThisLength(this.getMinutes(),2) +":"+ getDigitThisLength(this.getSeconds(),2);
	else if (type == 10)
		return getDigitThisLength(this.getHours(),2) +"½Ã "+ getDigitThisLength(this.getMinutes(),2) +"ºÐ "+ getDigitThisLength(this.getSeconds(),2) +"ÃÊ";
	else if (type == 11)
		return getDigitThisLength(this.getHours(),2) +":"+ getDigitThisLength(this.getMinutes(),2) +":"+ getDigitThisLength(this.getSeconds(),2);
	else if (type == 12)
		return getDigitThisLength(this.getHours(),2) +":"+ getDigitThisLength(this.getMinutes(),2) +":"+ getDigitThisLength(this.getSeconds(),2);	
	else
		return getDigitThisLength(this.getHours(),2) +"½Ã "+ getDigitThisLength(this.getMinutes(),2) +"ºÐ "+ getDigitThisLength(this.getSeconds(),2) +"ÃÊ";
}
Date.prototype.toWeekString = function()
{
	var type = typeof(arguments[0]) == "number" ? arguments[0] : 0;
	var weeks = "";
	if (type == 1)
		weeks = "ÀÏ,¿ù,È­,¼ö,¸ñ,±Ý,Åä".split(",");
	else if (type == 2)
		weeks = "ÀÏ¿äÀÏ,¿ù¿äÀÏ,È­¿äÀÏ,¼ö¿äÀÏ,¸ñ¿äÀÏ,±Ý¿äÀÏ,Åä¿äÀÏ".split(",");
	else
		weeks = "Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday".split(",");

	return weeks[this.getDay()];
}
function $D() {
	return new Date();
}


// ///////////////////////////////////////////////////////////////////////////////////////////////////
// Dictionary object
function Dictionary(id, value) {
	this.id		= id;
	this.value	= value;
}
// Size object
function Size(x, y) {
	this.x	= parseInt(x);
	this.y	= parseInt(y);
}
Size.prototype.Balance = function(maxLimit) 
{	// ÃÖ´ë Size¿¡ ºñ·ÊÇÏ´Â Size¸¦ °è»êÇÏ¿© ¹ÝÈ¯.
	var balance = new Size(0,0);
	if ((this.x != 0 && this.y != 0) && (maxLimit.x != 0 || maxLimit.y != 0) && (this.x > maxLimit.x || this.y > maxLimit.y)) {
		
		var aW	= (maxLimit.x  > 0) ? (maxLimit.x / this.x) : 1;
		var aH	= (maxLimit.y  > 0) ? (maxLimit.y / this.y) : 1;

		if (aW <= aH) {
			balance.x	= parseInt(this.x * aW);
			balance.y	= parseInt(this.y * aW);
		} else {
			balance.x	= parseInt(this.x * aH);
			balance.y	= parseInt(this.y * aH);
		}
	} else {
		balance.x	= orignal.x;
		balance.y	= orignal.y;
	}
	return balance;
}
Size.prototype.Compare = function(size) 
{	// µÎ°³ÀÇ Size°¡ °°À¸¸é true, ´Ù¸£¸é false
	return ((this.x == size.x) && (this.y == size.y));
}

// ///////////////////////////////////////////////////////////////////////////////////////////////////
// String Builder..
var StringBuilder = function()
{ 
	this.buffer = new Array(); 
}
StringBuilder.prototype.append=function(str)
{ 
	this.buffer[this.buffer.length] = str; 
}
StringBuilder.prototype.toString = function()
{ 
	return this.buffer.join(""); 
}

// ///////////////////////////////////////////////////////////////////////////////////////////////////
// ex) onkeydown="onlyNumber(event);"
function onlyNumber(e) {
	if(
		((getKeyCode(e) >= 48) && (getKeyCode(e) <= 57)) || 
		(getKeyCode(e) >= 37 && getKeyCode(e) <= 40) || 
		(getKeyCode(e) >= 96 && getKeyCode(e) <= 105) || 
		(getKeyCode(e) == 13) || (getKeyCode(e) == 8) || (getKeyCode(e) == 46) || (getKeyCode(e) == 9) || (getKeyCode(e) == 16) || (getKeyCode(e) == 0)
	) {
		e.returnValue = true;
	} else {
		if (window.event) {
			e.returnValue = false;
		} else {
			e.preventDefault();
		} 
	}
}

function onlyAlphaNumer(e) {
	if(
		getKeyCode(e) == 13 || getKeyCode(e) == 16 || getKeyCode(e) == 20 || getKeyCode(e) == 45 || getKeyCode(e) == 46 ||
		getKeyCode(e) == 8 || getKeyCode(e) == 9 || getKeyCode(e) == 0 || 
		(getKeyCode(e) >= 37 && getKeyCode(e) <= 40) || 
		(getKeyCode(e) >= 48 && getKeyCode(e) <= 57) ||
		(getKeyCode(e) >= 65 && getKeyCode(e) <= 90) ||
		(getKeyCode(e) >= 97 && getKeyCode(e) <= 122)
	) {
		e.returnValue = true;
	
	} else {
		if (window.event) {
			e.returnValue = false;
		} else {
			e.preventDefault();
		} 
	}
}

function getKeyCode(e){
	var result;
	if(window.event) {
		result = window.event.keyCode;
	} else if(e) {
		result = e.which;
	}
	return result;
}

function getDigitThisLength(intValue, intLength) {
	var strValue;
	var strtmp	= String(intValue);
	if (strtmp.length < intLength) {
		strValue = getDigitThisLength(String("0"+strtmp), intLength);
	} else {
		strValue = strtmp;
	}
	return strValue;
}
function gatNumber(timeString, index) {
	if (isNaN(timeString))
		return 0;
	else
	{
		if (typeof(index)!="number")
			return gatNumber(timeString, 0);
		else
		{
			if (timeString.length <= index)
				return parseInt(timeString.substring(index, timeString.length-(index-1)));
			else
				return (timeString.substring(index, index+1) == 0) ? gatNumber(timeString, index+1) : parseInt(timeString.substring(index, timeString.length-(index-1)));
		}
	}
}
// Querystring¿¡¼­ °ªÀ» °Ë»öÇØ ¹ÝÈ¯.
function getQueryData (name, query) {
	var n, u, s, q;
	if (typeof(query) == "string" && query != "")
		q = query;
	else
		q = document.URL;
	
	n = name.trim()+"=";
	u = q.trim();	
	s = q.search(n);
	if (s > 0) {
		u	= u.substring(parseInt(s + n.length), u.length);
		s	= u.search("&");
		if (s > 0)	
			return u.substring(0,s).trim();
		else
			return u.trim();
	} else {
		return "";
	}
}

// ÇØ´ç ³â,¿ù,ÀÏÀÌ ³¯ÀÚ Çü½ÄÀÌ ¿Ã¹Ù¸¥Áö¸¦ °Ë»çÇÑ´Ù.
function isDateValidation(strYear, strMonth, strDate) {
	var isDateValid = true;
	try {
		var startDate = new Date(strYear, strMonth-1, strDate);
		if (typeof(startDate.getYear()) == "number" && typeof(startDate.getMonth()) == "number" && typeof(startDate.getDate()) == "number"){
			if (
				getDigitThisLength(startDate.getYear(),4) != strYear || 
				getDigitThisLength(startDate.getMonth()+1,2) != strMonth || 
				getDigitThisLength(startDate.getDate(),2) != strDate
			){
				isDateValid = false;	
			}
		} else {
			isDateValid = false;
		}
	} catch (e) {
		isDateValid = false;
	}
	return isDateValid;
}

function getCheckedBoxValues(obj) {
	var Value = "";
	if(typeof(obj.length)=="number")	{		// ¹è¿­·Î ÀÌ·ç¾îÁü.
		for(i=0;i<obj.length;i++) {
			if(obj[i].checked==true) {
				Value += obj[i].value +",";
			}
		}
	} else {	// ´ÜÀÏ°³Ã¼·Î ÀÌ·ç¾îÁü
		if(obj.checked)
			Value = obj.value +",";
	}

	if (Value.length > 0) {
		Value = Value.substring(0, Value.length-1);
	}
	return Value;
}
function setCheckedBoxValue(obj, strValue) {
	if (typeof(obj) == "object" && strValue != "") {
		if (strValue.indexOf(",") > 0) {
			var sp = strValue.split(",");
			for (x=0;x<sp.length;x++) {
				setRadioValue(obj, sp[x]);
			}
		} else {
			if(typeof(obj.length)=="number")
				for(i=0;i<obj.length;i++) {
					if (obj[i].value == strValue)
						obj[i].checked = true;
				}
			else 
				obj.checked = (obj.value == strValue);
		}
	}
}

//-----------------------------------------------------------------------------
// ¹®ÀÚ¿­ ±æÀÌÁ¦ÇÑ
//-----------------------------------------------------------------------------
function strLength(field) {
	var Length = 0;
	var Nav = navigator.appName;
	var Ver = navigator.appVersion;
	var IsExplorer = false;
	var ch;
	
	if ( (Nav == 'Microsoft Internet Explorer') && (Ver.charAt(0) >= 4) ) {
		IsExplorer = true;
	}
	
	if(IsExplorer) {
		for(var i = 0 ; i < field.value.length; i++) {
			ch = field.value.charAt(i);
	
			if ((ch == "\n") || ((ch >= "¤¿") && (ch <= "È÷")) || ((ch >="¤¡") && (ch <="¤¾"))) {
				Length += 2;
			} else {
				Length += 1;
			}
		}
	} else {
		Length = field.value.length ;
	}
	return Length;
}
function isOutOfRange(field, min, max, error_msg)
{
	if(strLength(field) < min || strLength(field) > max)
	{
		alert(error_msg);
		field.focus();
		field.select();
		return true;
	}
	return false;
}
function isNotExactLength(field, len, error_msg) {
	if(strLength(field) != len) {
		alert(error_msg);
		field.focus();
		field.select();
		return true;
	}
	return false;
}
function isOutOfNumericRange(field, min, max, error_msg) {
	if(field.value < min || field.value > max) {
		alert(error_msg);
		field.focus();
		field.select();
		return true;
	}
	return false;
}

//-----------------------------------------------------------------------------
// SELECT, CHECK BOX °ü·Ã ÇÔ¼ö
//-----------------------------------------------------------------------------
function isNotSelected(field, error_msg) {
	//Select Box ¼±ÅÃ¿©ºÎ °Ë»ç
	if(field.selectedIndex == 0) {
		alert(error_msg);
		field.focus() ;
		return true;
	} else {
		return false;
	}
}
function isNotCheckedRadio(field, error_msg) {
	//Radio Button Check
	if ( field == null ) {
		alert(error_msg);
		return true;
	}

	if ( field.length == null ) {
		if ( field.checked == true ) {
			return false;
		} else {
			alert(error_msg);
			return true;
		}
	}

	for(i = 0; i < field.length; i++) {
		if(field[i].checked == true) {
			return false;
		}
	}
	alert(error_msg);
	return true;
}
function uncheckRadio(field) {
	//Radio ButtonÀ» ¼±ÅÃÇØÁ¦
	for(i = 0; i < field.length; i++) {
		field[i].checked = false;
	}
}
function getRadioVal(field) {
	//Radio ButtonÀÇ ¼±ÅÃµÈ °ªÀ» °¡Á®¿Â´Ù
	if (field.length == undefined) {
		if (field != null)	{
			return field.value;
		} else {
			return "";
		}
	} else {
		for(i = 0; i < field.length; i++) {
			if(field[i].checked == true)
				return field[i].value;
		}
	}
}

//-----------------------------------------------------------------------------
// Çã¿ë ¹®ÀÚ Ã¼Å©
//-----------------------------------------------------------------------------
function isNotValidChar(field,error_msg) {
	var Count;
	var PermitChar = "0123456789-";  // Çã¿ë°¡´ÉÇÑ ¹®ÀÚµéÀ» ¸ðµÎ ±â·ÏÇÑ´Ù.
	
	for (var i = 0; i < field.value.length; i++) {
		Count = 0;
		
		for (var j = 0; j < PermitChar.length; j++) {
			if(field.value.charAt(i) == PermitChar.charAt(j)) {
				Count++;
				break;
			}
		}
	
		if (Count == 0) {
			alert(error_msg);
			field.focus();
			field.select();
			return true;
			break;
		}
	}
	return false;
}
function isNotValidChar2(field,error_msg) {
	var NotPermitChar = "\"";  //Çã¿ëµÇ¾î¼­´Â ¾ÈµÇ´Â ¹®ÀÚµéÀ» ¸ðµÎ ±â·ÏÇÑ´Ù.
	//   var NotPermitChar = "<>\"^&|'\\ ";  //Çã¿ëµÇ¾î¼­´Â ¾ÈµÇ´Â ¹®ÀÚµéÀ» ¸ðµÎ ±â·ÏÇÑ´Ù.
	
	if(field.value == "") return false;
	
	for (var i = 0; i < field.value.length; i++) {
		for (var j = 0; j < NotPermitChar.length; j++) {
			if(field.value.charAt(i) == NotPermitChar.charAt(j)) {
				ans = confirm(error_msg);
				
				if(ans == true) {
					return false;
				} else {
					field.focus();
					field.select();
					return true;
				}
			}
		}
	}
	return false;
}

//-----------------------------------------------------------------------------
// AJXA °³Ã¼ »ý¼º
//-----------------------------------------------------------------------------
function createRequest() {	
	var xmlHttp = null;
	try {
		xmlHttp = new XMLHttpRequest();
	} catch (trymicrosoft) {
		try {
			xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (othermicrosoft) {
			try {
				xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (failed) {
				xmlHttp = null;
			}
		}
	}
	
	if (xmlHttp == null) {
		alert("Error creating xmlHttp object!");
	} else {
		return xmlHttp;
	}
}

//-----------------------------------------------------------------------------
// FRAME ¸®»çÀÌÁî
//-----------------------------------------------------------------------------
function autoResize(name) {
	var frameName  = document.getElementById(name);
	
	if(document.all) {
		var iframeHeight = frames[name].document.body.scrollHeight;
	} else {
		var iframeHeight=  frameName.contentWindow.document.body.offsetHeight;
	}
	frameName.height=iframeHeight;
}


function parentAutoResize(name) {
	var frameName  = parent.document.getElementById(name);
	
	if(document.all) {
		var iframeHeight = parent.frames[name].document.body.scrollHeight;
	} else {
		var iframeHeight=  frameName.contentWindow.document.body.offsetHeight;
	}
	frameName.height=iframeHeight;
}

//-----------------------------------------------------------------------------
// ½½¶óÀÌµå¸Þ´º
//-----------------------------------------------------------------------------
var stmnGAP1	= 230;	//ÃÊ±â »ó´Ü°£°Ý
var stmnGAP2	= 50;	//½ºÅ©·Ñ ÈÄ »ó´Ü°£°Ý
var stmnGAP3	= 300;	//ÃÊ±â »ó´Ü°£°Ý
var stmnGAP4	= 50;	//½ºÅ©·Ñ ÈÄ »ó´Ü°£°Ý
var stmnBASE	= 400;
var stmnActivateSpeed	= 300; 
var stmnScrollSpeed	= 10; 

        function RefreshStaticMenu()
        {
                var stmnStartPoint, stmnEndPoint, stmnRefreshTimer;

                stmnStartPoint	= parseInt(STATICMENU.style.top, 10);
                stmnEndPoint	= document.body.scrollTop + stmnGAP2;
                if (stmnEndPoint < stmnGAP1) stmnEndPoint = stmnGAP1;

                if ( stmnStartPoint != stmnEndPoint ) {
                        stmnScrollAmount		= Math.ceil( Math.abs( stmnEndPoint - stmnStartPoint ) / 15 );
                        STATICMENU.style.top	= parseInt(STATICMENU.style.top, 10) + ( ( stmnEndPoint<stmnStartPoint ) ? -stmnScrollAmount : stmnScrollAmount );
                        stmnRefreshTimer		= stmnScrollSpeed;
                } else {
                        stmnRefreshTimer = stmnActivateSpeed;
                }

                setTimeout ("RefreshStaticMenu();", stmnRefreshTimer);
        }




        function InitializeStaticMenu()
        {
                STATICMENU.style.top = document.body.scrollTop + stmnBASE;
                RefreshStaticMenu();
        }


/*
½½¶óÀÌµå¸Þ´º : html ¿¡ »ðÀÔºÎºÐ
<div id="STATICMENU" style="width:81px; height:294px; position:absolute; left:878px; top:231px; z-index:100;" >
<table cellpadding="0" cellspacing="0">
    <table align="center" cellpadding="0" cellspacing="0" width="140" height="20">
        <tr>
            <td>
            </td>
        </tr>
    </table>
</div>     
<script language="javascript">InitializeStaticMenu();</script> 
*/

 function encodeURL(str){
    var s0, i, s, u;
    s0 = ""; 
    for (i = 0; i < str.length; i++){  
        s = str.charAt(i);
        u = str.charCodeAt(i);
        if (s == " "){
            s0 += "+";
        }else {
            if ( u == 0x2a || u == 0x2d || u == 0x2e || u == 0x5f || ((u >= 0x30) && (u <= 0x39)) || ((u >= 0x41) && (u <= 0x5a)) || ((u >= 0x61) && (u <= 0x7a))){       
                s0 = s0 + s;  
            }else { 
                if ((u >= 0x0) && (u <= 0x7f)){     
                    s = "0"+u.toString(16);
                    s0 += "%"+ s.substr(s.length-2);
                }else if (u > 0x1fffff){
                    s0 += "%" + (0xf0 + ((u & 0x1c0000) >> 18)).toString(16);
                    s0 += "%" + (0x80 + ((u & 0x3f000) >> 12)).toString(16);
                    s0 += "%" + (0x80 + ((u & 0xfc0) >> 6)).toString(16);
                    s0 += "%" + (0x80 + (u & 0x3f)).toString(16);
                }else if (u > 0x7ff){        
                    s0 += "%" + (0xe0 + ((u & 0xf000) >> 12)).toString(16);
                    s0 += "%" + (0x80 + ((u & 0xfc0) >> 6)).toString(16);
                    s0 += "%" + (0x80 + (u & 0x3f)).toString(16);
                }else { 
                    s0 += "%" + (0xc0 + ((u & 0x7c0) >> 6)).toString(16);
                    s0 += "%" + (0x80 + (u & 0x3f)).toString(16);
                }
            }
        }
    }
    return s0;
}

function decodeURL(str){
    var s0, i, j, s, ss, u, n, f;
    s0 = "";
    if (str) {
	    for (i = 0; i < str.length; i++){
	        s = str.charAt(i);
	        if (s == "+"){
	            s0 += " ";
	        }else{
	            if (s != "%"){
	                s0 += s;
	            }else{
	                u = 0;
	                f = 1;
	                while (true) {
	                    ss = "";
	                    for (j = 0; j < 2; j++ ) {
	                        sss = str.charAt(++i);
	                        if (((sss >= "0") && (sss <= "9")) || ((sss >= "a") && (sss <= "f"))  || ((sss >= "A") && (sss <= "F"))) {
	                            ss += sss;
	                        }else{
	                            --i;
	                            break;
	                        }
	                    }
	                    n = parseInt(ss, 16);
	                    if (n <= 0x7f){u = n; f = 1;}
	                    if ((n >= 0xc0) && (n <= 0xdf)){u = n & 0x1f; f = 2;}
	                    if ((n >= 0xe0) && (n <= 0xef)){u = n & 0x0f; f = 3;}
	                    if ((n >= 0xf0) && (n <= 0xf7)){u = n & 0x07; f = 4;}
	                    if ((n >= 0x80) && (n <= 0xbf)){u = (u << 6) + (n & 0x3f); --f;}
	                    if (f <= 1){break;}
	                    if (str.charAt(i + 1) == "%"){
	                        i++ ;
	                    }else {
	                        break;
	                    }
	                }
	                s0 += String.fromCharCode(u);
	            }
	        }
	    }
    }
    return s0;
} 

function viewBG_DIV()
{
	var  panelBG= document.getElementById('BG_DIV');
	panelBG.style.top = 0;
	panelBG.style.left = 0;
	panelBG.style.display = "";
	if (document.documentElement.scrollHeight > document.body.scrollHeight) {
		panelBG.style.height = document.documentElement.scrollHeight + 'px';
	} else { 
		panelBG.style.height = document.body.scrollHeight + 'px';
	}
}