/*
  doit Framework base class
*/
var doit={version: '0.1'};

/****************************

	#비동기 모드일경우 
	1. callback 함수 작성, 파라미터는 map || list || object
	var changeSelectBox = function (list) {
	  	for (var i =0 ; i < list.length;i ++) {
			alert (list[i].sgg_nm);
	  	}
	};
	
	2. ajax_call 호출, sql_id를 담은 map과 URL을 넘김
	var url = "/eduenv/insttclf/instt/sggList.aff";
	var map = {};
	  
	map['sql_id'] = 'eduenv.insttclf.instt.getSggnmList';
	map['sd_cd'] = '11';
	ajax_call(url, map, changeSelectBox, true);
	
	#동기 모드일경우 
	1. ajax_call 호출, sql_id를 담은 map과 URL을 넘김
	var url = "/eduenv/insttclf/instt/sggList.aff";
	var map = {};
	  
	map['sql_id'] = 'eduenv.insttclf.instt.getSggnmList';
	map['sd_cd'] = '11';
	var result = ajax_call(url, map, null, false);
	
	alert(result.length)
******************************/
var ajax_call = function (url, searchMap, cbFunc, asynchronous) {
	if (arguments.length == 3) {
		asynchronous = true;
	}
	var _result = null;
	
	new Ajax.Request(url, {
		asynchronous : asynchronous,
		method : 'POST',
		parameters : searchMap,
		onComplete : function (result) {
			if (asynchronous) {
				cbFunc (result.responseText.evalJSON());
			} else {
				_result = result.responseText.evalJSON();
			}
		}
	});
	
	if (asynchronous == false) {	// 동기모드이면 리턴
		return _result;
	}
};
var ajax_call_obj = function (url, searchMap, cbFunc, asynchronous) {
	if (arguments.length == 3) {
		asynchronous = true;
	}
	var _result = null;
	
	new Ajax.Request(url, {
		asynchronous : asynchronous,
		method : 'POST',
		parameters : searchMap,
		onComplete : function (result) {
			if (asynchronous) {
				cbFunc (result.responseText.evalJSON());
			} else {
				_result = result.responseText.evalJSON();
			}
		}
	});
	
	if (asynchronous == false) {	// 동기모드이면 리턴
		return _result;
	}
};

doit.lang = {
	version : '0.0.3_rc1',
	license : 'CTUnion. co. ltd.',
	build : '2009.04.21',
	author : 'dnsnl'
}

String.prototype.trim = function() {
	return this.replace(/(^\s*)|(\s*$)/gi, "");
}

String.prototype.replaceAll = function(str1, str2) {
	var temp_str = "";

	if (this.trim() != "" && str1 != str2) {
		temp_str = this.trim();

		while (temp_str.indexOf(str1) > -1) {
			temp_str = temp_str.replace(str1, str2);
		}
	}

	return temp_str;
 }
/**
 * @namespace doit.lang.string
 */
doit.lang.String = function(){
	return {
		
		
		/**
		 * 문자열 양옆 공백 제거 ex)"  1234  " -> "1234"
		 * @param {String} String
		 * @returns 공백리턴
		 */
		strTrim : function (str){
		    return str.replace(/(^\s*)|(\s*$)/g, "");
		},
		
		/**
		 * 문자열에서 모든 공백제거
		 * @param {String} String
		 * @returns 공백리턴
		 */ 
		getOnlyString : function (str)
		{
			var index, len;
		
			if ( doit.util.Validation.isNull(str) ) {
				// remove the null string
				while(true) {
					index = str.indexOf(" ");
					if( index == -1 ) break;
					len = str.length;
					str = str.substring(0, index) + str.substring((index+1),len);
				}
		
				// remove the carrage return
				while(true) {
					index = str.indexOf("\r");
					if( index == -1 ) break;
					len = str.length;
					str = str.substring(0, index) + str.substring((index+2),len);
				}
			}
		
			return str;
		},
		
		/**
		 * 문자열이 알파벳으로 구성 되어있는지를 체크.
		 * 단, 한글은 포함안됨.
		 * @param {String} String
		 * @returns 전부 알파벳일 경우 true를 return, 그렇지 않은 경우 false return.
		 */ 
		checkChar : function (checkStr) {
		
			checkNumber = 0;
			tempStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
		
			for (i=0; i<checkStr.length; i++) {
				for(j=0; j<tempStr.length; j++) {
					if (checkStr.charAt(i) == tempStr.charAt(j)) checkNumber++;
				}
			}
		
			if (checkNumber != checkStr.length) return false;
			else	return true;
		},
		
		/**
		 * 문자열이 숫자로 구성 되어있는지를 체크
		 * @param {String} String
		 * @returns 전부 숫자일경우 true를 return, 그렇지 않은 경우 false return.
		 */
		checkNumber : function (checkStr) {
			rValue = false;
			checkNum=0;
			tempStr = '0123456789';
		
			for (i=0; i<checkStr.length; i++) {
				for(j=0; j<tempStr.length; j++) {
					if (checkStr.charAt(i) == tempStr.charAt(j))
						checkNum++;
				}
			}
		
			if (checkNum != checkStr.length)
				rValue = false;
			else
				rValue = true;
		
			return rValue;
		},
		
		/**
		 * 한글만입력
		 * @param {obj} obj
		 * @returns 
		 */
		hangul : function (obj){
			var reg=/[A-Za-z0-9]/;
			if(reg.test(obj.value)){
				alert('한글만 입력이 가능합니다.');
				obj.focus();
				return;
			}
		},
		
		/**
		 * 문자열이 숫자로 구성 되어있는지를 체크(소수점 까지 허용할 시 사용)
		 * @param {String} String
		 * @returns  전부 숫자일경우 true를 return, 그렇지 않은 경우 false return.
		 */
		checkNumberWithComma : function (checkStr) {
		
			rValue = false;
			checkNumber=0;
			tempStr = '0123456789.';
		
			for (i=0; i<checkStr.length; i++) {
				for(j=0; j<tempStr.length; j++) {
					if (checkStr.charAt(i) == tempStr.charAt(j))
						checkNumber++;
				}
			}
		
			if (checkNumber != checkStr.length)
				rValue = false;
			else
				rValue = true;
		
			return rValue;
		},
		
		/**
		 * 문자열에 quot(', ")가 있는지 체크.
		 * @param {String} String
		 * @returns  quot가 없을경우 true를 return, 그렇지 않은 경우 false return.
		 */
		checkQuotChar : function (checkStr) {
			if ( checkStr == "" ) return true;
		
			result = true;
		
			quot = '"';
			apos = "'";
		
			if ( doit.util.Validation.isNull(checkStr) ) alert ( "'checkStr' Values is NULL OR EMPTY!");
		
			for (i=0; i<checkStr.length; i++) {
				if (checkStr.charAt(i) == quot) {
					result = false;
					break;
				}
				if (checkStr.charAt(i) == apos) {
					result = false;
					break;
				}
			}
		
			return result;
		},
		
		/**
		 * 문자열에 특수문자가 있는지 체크.
		 * @param {String} String
		 * @returns  특수문자가 없을경우 true를 return, 그렇지 않은 경우 false return.
		 */
		checkSpecialChar : function (checkStr) {
			if ( checkStr == "" ) return true;
			tempStr = '~`!@#$%^&*()_-+=|\\{}[]:;\'\"<>,.?/';
		
			if ( doit.util.Validation.isNull(checkStr) ) alert ( "'checkStr' Values is NULL OR EMPTY!");
		
			for (i=0; i<checkStr.length; i++) {
				for(j=0; j<tempStr.length; j++) {
					if (checkStr.charAt(i) == tempStr.charAt(j))
						return false;
				}
			}
		
			return true;
		},
		
		/**
		 * 한글 + 영문
		 * @param {String} 문자열
		 * @returns  boolean
		 */
		engNum : function(m) {
			if(doit.util.Validation.isNull(m)){
				return false;
			}
			m = this.strTrim(m).toUpperCase();
			var c = m.charAt(0);
			if(!('A' <= c && c <= 'Z')){
				alert("영문자와 숫자만 사용가능합니다.");
				return false;
			}
			var n = m.length;
			for(var i=1; i < n; i++) {
				c = m.charAt(i);
				if(!(('A' <= c && c <= 'Z') || ('0' <= c && c <= '9') )){
					alert("영문자와 숫자만 사용가능합니다.");
					return false;
				}
			}
			return true;
		},
		
		/**
		 * 문자열 크기 비교 
		 * @param {String} 문자열
		 * @param {String} size
		 * @returns  해당 문자열 크기가 요청한 크기보다 작으면 true return
		 */
		validateSize : function (str, size) {
			if( this.getStringLength(str) < size ) {
				return true;
			} else {
				return false;
			}
		},
		
		/**
		 * 라틴/아시아계 2Byte/캐릭탕 2bit 를 사용하는 문자열의 길이 구함.
		 * 사용예 : getStringLength('가나다라마'); ===> 숫자 10 이 리턴됨.
		 * @param {String} String
		 * @returns  문자열의 길이 return
		 */
		getStringLength : function (str) {
			return(str.length+(escape(str)+"%u").match(/%u/g).length-1);
		},
		
		/**
		 * 원하는 길이만큼 자르고, 뒤에 ... 을 붙여서 리턴
		 * @param {String} 문자열
		 * @param {Number} 길이
		 * @returns  String
		 */
		concatString : function ( _str, _len ) {
			var _return = "";
		
			if ( null != _str && 'undefined' != _str && "null" != _str ) {
		
				if ( this.getStringLength(_str) > _len ) {
					_return = _str.substring(0, _len) + "...";
				} else {
					_return = _str;
				}
			}
		
			return _return;
		},
		
		/**
		 * 원하는 길이만큼 자르고, 뒤에 ... 을 붙여서 리턴
		 * @param {String} 문자열
		 * @param {Number} 길이
		 * @returns  String
		 */
		concatStringToLine : function ( _str, _maxlength, _line ) {
			var _return = "";
			var lineNum = _line;
		
			if ( null != _str && 'undefined' != _str && "null" != _str ) {
		
				if ( _str.length > _maxlength ) {
					var _temp = _str.split("\r\n");
		
					for(var i=0; i < lineNum; i++) {
						var lineLength = this.getStringLength(_temp[i]);
						lineNum = lineNum - ( Math.round(lineLength / _maxlength));
		
						if( i < lineNum-1 ) {
							_return += _temp[i] + "\r\n";
						} else if( lineLength > _maxlength ){
							_return += _temp[i].substr(0, _maxlength) + "...";
						} else {
							_return += _temp[i];
						}
					}
				}
			}
		
			return _return;
		},
		
		/**
		 * 한글 및 영문 문자 길이로 자르는 함수
		 * 사용예 cutStr( '한글자르기',3);
		 * @param {String} 문자열
		 * @param {Number} 길이
		 * @returns  String
		 */
		cutStr : function (str,limit){
			var tmpStr = str;
			var byte_count = 0;
			var len = str.length;
			var dot = "";
			
			for(i=0; i<len; i++){
				byte_count += doit.lang.string.chr_byte(str.charAt(i)); 
				if(byte_count == limit-1){
					if(doit.lang.string.chr_byte(str.charAt(i+1)) == 2){
						tmpStr = str.substring(0,i+1);
						dot = "...";
					}else {
						if(i+2 != len) dot = "...";
						tmpStr = str.substring(0,i+2);
					}
					break;
				}else if(byte_count == limit){
					if(i+1 != len) dot = "...";
						tmpStr = str.substring(0,i+1);
						break;
				}
			}
			return (tmpStr+dot);
		},
		
		/**
		 * cutStr(str, limit)의함수에서 문자를 엔코딩해주기 위한 함수
		 * @param {String} 문자
		 * @returns  Number
		 */
		chr_byte : function (chr){
			if(escape(chr).length > 4)
			  return 2;
			else
			  return 1;
		},
		
		/**
		 * 원하는 자리수만큼 다른 문자열로 대체
		 * 일반적으로 쓰이는곳은 주민번호 뒤7자리 000000-*******
		 * @param {String} 문자열
		 * @returns  String
		 */
		replaceStringWithOthers : function ( _str ) {
			var _return = "";
		
			if ( null != _str && "null" != _str && "undefined" != _str && doit.lang.String.getOnlyString(_str).length > 6 ) {
				_return = _str.substr(0, 6) + "-*******";
			} else {
				_return = _str;
			}
		
			return _return;
		},
		
		/**
	     *  파라미터로 받은 딜리미터를 목표값으로 변환 후 값 반환
	     *  @param {String} 문자열
	     *  @param {String} 변환해야 할 문자
	     *  @param {String} 변환문자
	     *  @returns String
	     */	
		replaceDelimiter : function ( _str, _delimiter, _dest ) {
			_temp = _str.replaceAll(_delimiter, _dest);
		
			return _temp;
		}
	};
}();

/**
 * @namespace doit.lang.number
 */
doit.lang.Number = function(){
	return {
		
		/**
		 * 숫자만 입력FF, IE에서만 가능
		 * @param {event} event
		 * @returns boolean
		 */
		num_only : function ( Ev ){ 
		    var evCode = ( window.netscape ) ? Ev.which : event.keyCode ; 
		    /* FF일 경우 Ev.which 값을, 
		        IE을 경우 event.keyCode 값을 evCode에 대입 */ 
		    if ( ! ( evCode == 0 || evCode == 8 || ( evCode > 47 && evCode < 58 ) ) ) { 
		    /* 눌러진 키 코드가 숫자가 아닌 경우 
		        ( '0'은 FF에서 Tab 키, 
		          '8'은 FF에서 BackSpace가 먹히지 않아 삽입)    */ 
		        if ( window.netscape ) {        // FF일 경우 
		            Ev.preventDefault() ;        // 이벤트 무효화 
		        } else {                                // IE일 경우 
		            event.returnValue=false;    // 이벤트 무효화 
		        }
		    }
	    },
	    
	    /**
		 * 크롬, 오페라, 사파리 숫자만입력
		 * @param {value} val
		 * @returns boolean
		 */
		num_only2 : function (val){
			var value = val.value;
			for(var i=0; i < value.length; i++) {
				c = value.charAt(i);
				if(!('0' <= c && c <= '9')){
					alert("숫자만 입력해주세요.");
					val.value = "";
					val.focus();
					return false;
				}
			}
		},
		
		/**
		 * 알파벳이 하나라도 포함 되어 있는지 체크
		 * @param {value} val
		 * @returns boolean 숫자만 입력되어있다면 true, 아니면 false
		 */
		checkEachChar : function (checkStr) {
		
			rValue = true;
			checkNumber = 0;
			tempStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz';
		
			for (i=0; i<checkStr.length; i++) {
				for(j=0; j<tempStr.length; j++) {
					if (checkStr.charAt(i) == tempStr.charAt(j)){
						rValue = false;
						break;
					}
				}
			}
		
			return rValue;
		},
		
		/**
		 * 음수만 입력가능함
		 * @param {value} val
		 * @returns 
		 */
		negNum : function  (val){ 
			var value = val.value;
			if(value != ""){
				if(value.charAt(0)=="-"){
					if(value.length == 1){
						alert("숫자를 입력해주세요");
						val.focus();
			         	return;
					}
					for (i=1;i<value.length;i++){
			      		if(isNaN(value.charAt(i))){
							alert("숫자만 입력 가능합니다.");
							val.focus();
				         	return;
						}
				   	}
				} else if(value.charAt(0)!= "-"){
					alert("음수만 입력 가능합니다.");
					val.focus();
					return;
				}
			}
		},
	    
		/**
		 * 숫자 비교. 대상숫자가 min,max 사이값인지 검사.
		 * if min value null, alert 'max 값보다 작아야합니다', return false
		 * if max value null, alert 'min 값보다 커야 합니다', return false
		 * -> if min < num max, return true
		 * -> if min > num or max > num, return false
		 * @param {obj} obj
		 * @param {Number} 최소값
		 * @param {Number} 최대값
		 * @returns boolean
		 */
		checkInterval : function(obj, min, max) {
			num = obj.value;
		
			if ( doit.util.Validation.isNull(max) && doit.util.Validation.isNull(min) ) {
				//alert(min + "," + max + "잘못된 비교 입니다");
				return false;
			} else if (doit.util.Validation.isNull(min) ) {
				//alert(max+"보다 작아야 합니다");
				return false;
			} else if (doit.util.Validation.isNull(max) ) {
				//alert(min+"보다 커야 합니다");
				return false;
			} else if ( this.compare(num, min) && this.compare(max, num) ) {
				return true;
			} else {
				alert(obj.alt + " 값을 " + min + "과 " + max + "사이 값으로 입력해주세요");
				obj.focus();
				return false;
			}
		},
		
		/**
		 * compare
		 * @param {Number} seed
		 * @param {Number} tnum
		 * @returns boolean
		 */
		compare : function (seed, tnum) {
			if ( seed >= tnum ) return true;
		},
		
		/**
		 * 숫자를 세자리씩 끊어서 콤마(,)를 표시해 주는 function
		 * @param {Number} 숫자
		 * @returns String
		 */
		convertNumber : function (num) {
			var i=0, j;
			var len, startStrLen, divideNum;
			var tmpStr, remainStr, startStr, resultStr;
		
			num = num + "";
			len = num.length;
			divideNum = Math.floor(len / 3);
			startStrLen = len % 3;
		
			resultStr = num.substr(0, startStrLen );
		
			remainStr =  num.substr(startStrLen, len - startStrLen );
			tmpStr = "";
		
			if ( remainStr != "" ) {
				for ( i = 0; i < divideNum ; i++ ) {
					tmpStr = tmpStr + "," + remainStr.substr(i*3, 3);
				}
			}
		
			resultStr = resultStr + tmpStr;
		
			if ( startStrLen == 0 )
				resultStr = resultStr.substr(1, resultStr.length - 1);
		
			return resultStr;
		},
		
		/**
		 * 넘어온 파라미터에 소수점을 찍어서 리턴. 파라미터가 숫자가 아닌경우에는 공백문자 [ &nbsp; ]를 리턴
		 * @param {Number} p
		 * @param {Number} pow
		 * @param {Number} r
		 * @returns String
		 */
		getFloat : function (p, pow, r) {
			return  (!isNaN(p) && (p))?Math.round(p*Math.pow(10, (pow)?pow:0))/Math.pow(10, (pow)?pow:0):( (isNaN(r) || r == null)?'&nbsp;':r);
		},
		
		/**
		 * 숫자만 입력
		 * @returns 숫자가 아니면 false
		 */
		onlyNumber : function (evt){
			Event.extend(evt);
		    var keyCode = evt.keyCode ;
		    
		    //Special keys 8:delete, 9:tab, 46:left arrow, 47:right arrow, 0:non-standard keys
		    //Number keys 46~57: left number(Main number keys), 96~195:right number(Num Lock number keys)
		    
		    if(!(keyCode == 0 || keyCode == 8 || keyCode == 9 || keyCode == 46 || keyCode == 37 || keyCode == 39 ||
		    		( keyCode >= 46 && keyCode <= 57 ) || (keyCode >=96 && keyCode <= 105))){
		    		
		    	Event.stop(evt);
		    }
		},
		
		/**
		 * 갯수 표시 대표 메소드 
		 * @param {Number} p
		 * @param {Number} r
		 * @returns 파라미터가 숫자가 아닌경우에는 공백문자 [ &nbsp; ]를 리턴
		 */
		nvlCnt : function (p, r) {
			return (!isNaN(p) && (p))?convertNumber(p):((isNaN(r) || r == null)?'&nbsp;':r);
		},
		
		/**
		 * 성적 표시 대표 메소드
		 * nvlScore(p) 식으로 사용한경우는 소수점이 없음.
		 * nvlScore(p, pow)처럼 사용한 경우 pow는 소수점 자릿수를 의미
		 * @param {Number} p
		 * @param {Number} r
		 * @returns 파라미터가 숫자가 아닌경우에는 공백문자 [ &nbsp; ]를 리턴
		 */
		nvlScore : function (p, r) {
			return getFloat(p, 1, (isNaN(r) || r == null)?'&nbsp;':r);
		},
		
		/**
		 * 비율 표시  대표 메소드
		 * @param {Number} p
		 * @param {Number} r
		 * @returns 파라미터가 숫자가 아닌경우에는 공백문자 [ &nbsp; ]를 리턴
		 */
		nvlRate : function (p, r) {
			return this.getFloat(p, 0, (isNaN(r) || r == null)?'&nbsp;':r);
		}
	};
}();

/**
 * @namespace doit.lang.date
 */
doit.lang.Date = function(){
		var MONTH_NAMES=new Array('January','February','March','April','May','June','July','August','September','October','November','December','Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
		var DAY_NAMES=new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sun','Mon','Tue','Wed','Thu','Fri','Sat');
		
		function LZ(x) {
			return(x<0||x>9?"":"0")+x;
		}MES=new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sun','Mon','Tue','Wed','Thu','Fri','Sat');
	return {
		
		/**
		 * 날짜형식 10자리까지
		 * @param {Date} 
		 * @returns String
		 */
		dateFormat : function ( _str ) {
		
			var _temp = _str;
		
			if ( null != _str && 'undefined' != _str && 'null' != _str) {
				if ( 10 < _str.length ) {
					_temp = _str.substring(0, 10);
				}
			}
		
			return _temp;
		},
		
		/**
		 * 현재 날짜를 YYYY-MM-DD 형식으로 반환
		 * @returns YYYY-MM-DD
		 */
		getCurrentDate : function (){
		  var dt = new Date();
		  var y = dt.getFullYear();
		  var mTemp = dt.getMonth();
		  var m = (mTemp < 9)? ('0'+(mTemp+1)):(mTemp+1); 
		  var d = dt.getDate();
		
		  var result = y + '-' + m + '-' + d;
		  return result;
		},
		
		/**
		 * 날짜형식 변경 (YYMMDD -->> YYYY-MM-DD)
		 * @param {Date} 
		 * @returns String
		 */
		convertBrith : function ( _str ) {
			var _temp = "";
			if ( null!= _str && 'undefined' != _str && 'null' != _str) {
				_temp = _str.substring(0,2) + "-" + _str.substring(2,4) + "-" + _str.substring(4,6);
			}
		
			return _temp;
		},
		
		/**
		 * 날짜형식 변경 (YYYYMMDD -->> YYYY-MM-DD)
		 * @param {Date} 
		 * @returns String
		 */
		convertDate : function ( _str ) {
			var _temp = "";
		
			if ( null!= _str && 'undefined' != _str && 'null' != _str) {
				_temp = _str.substr(0,4) + "-" + _str.substr(4,2) + "-" + _str.substr(6,2);
			}
		
			return _temp;
		},
		
		/**
		 * 날짜 형식 변환( YYYY-MM-DD HH:MM:SS.S  -->  YYYY/MM/DD(HH:MM)
		 * @param {Date} 
		 * @returns String
		 */
		convertDateWithTime : function (_date) {
			var _temp = "";
		
			if ( null != _date && 'undefined' != _date && 'null' != _date) {
				_temp = _date.substr(0,4) + "/" + _date.substr(5,2) + "/" + _date.substr(8,2) + " (" + _date.substr(11,2) + ":" + _date.substr(14, 2) + ")";
			}
		
			return _temp;
		},
		
		/**
		 * 날짜 형식 변환( YYYY-MM-DD HH:MM:SS.S  -->  YYYY-MM-DD HH:MM
		 * @param {Date} 
		 * @returns String
		 */
		convertDateWithTime2 : function (_date) {
			var _temp = "";
		
			if ( null != _date && 'undefined' != _date && 'null' != _date) {
				_temp = _date.substr(0,4) + "-" + _date.substr(5,2) + "-" + _date.substr(8,2) + " " + _date.substr(11,2) + ":" + _date.substr(14, 2);
			}
		
			return _temp;
		},
		
		/**
		 * 생년월일 8자리를 연도.월.일 형식으로 변경
		 * @param {Date} 
		 * @returns String
		 */
		replaceStringWithBirth : function  ( _str ) {
			var _return = "";
		
			if ( null != _str && "null" != _str && "undefined" != _str && doit.lang.String.getOnlyString(_str).length == 8 ) {
				_return = _str.substr(0, 4) + ".";
				_return += _str.substr(4, 2) + ".";
				_return += _str.substr(6, 2);
			} else {
				_return = _str;
			}
		
			return _return;
		
		},
		
		/**
		 * 날짜를 입력받아, 현재날짜가 포함되어 있는지 판단
		 * 현재날짜가 대상 두 날짜안에 포함되어 있으면 TRUE 반환
		 * 현재날짜가 대상 두 날짜안에 포함되어 있지 않으면 FALSE 반환
		 * @param {sdate} 시작일
		 * @param {edate} 종료일
		 * @param {cdate} 현재일
		 * @returns String
		 */
		isValidDateOrder : function (sdate, edate, cdate) {
		
			var _isValidateFlag = false;
		
			if ( compareDate (sdate, cdate) > 0 && compareDate (cdate, edate) > 0 )
				_isValidateFlag = true;
		
			return _isValidateFlag
		},
		
		/**
		 * 선행일자와, 후행일자를 비교하여
		 * 선행일자가 후행일자보다 빠르면 양수를 반환
		 * 선행일자가 후행일자보다 늦으면 음수를 반환
		 * @param {sdatestring} 시작일
		 * @param {edatestring} 종료일
		 * @returns String
		 */
		compareDate : function (sdatestring, edatestring) {
			var lastIndex = -1;
		
			while (sdatestring.indexOf (".") != -1) {
				sdatestring = sdatestring.replace (".", "-");
			}
		
			while (edatestring.indexOf (".") != -1) {
				edatestring = edatestring.replace (".", "-");
			}
		
			lastIndex = sdatestring.indexOf("-");
			var syear = sdatestring.substring (0, lastIndex);
			lastIndex = sdatestring.indexOf("-", lastIndex + 1)
			var smonth = sdatestring.substring (syear.length + 1, lastIndex);
			smonth = (smonth.charAt(0) == '0') ? smonth.substring(1) : smonth;
			var sday = sdatestring.substring (lastIndex + 1, sdatestring.length);
			sday = (sday.charAt(0) == '0') ? sday.substring(1) : sday;
		
			lastIndex = -1;
			lastIndex = edatestring.indexOf("-");
			var eyear = edatestring.substring (0, lastIndex);
			lastIndex = edatestring.indexOf("-", lastIndex + 1)
			var emonth = edatestring.substring (eyear.length + 1, lastIndex);
			emonth = (emonth.charAt(0) == '0') ? emonth.substring(1) : emonth;
			var eday = edatestring.substring (lastIndex + 1, edatestring.length);
			eday = (eday.charAt(0) == '0') ? eday.substring(1) : eday;
		
			var sdate = new Date (parseInt(syear), parseInt(smonth) - 1, parseInt(sday));
			var edate = new Date (parseInt(eyear), parseInt(emonth) - 1, parseInt(eday));
		
			var termMilli = edate.getTime() - sdate.getTime()
		
			return termMilli / 1000 / 60 / 60 / 24;
		},
		
		
		LZ : function (x) {return(x<0||x>9?"":"0")+x},
		
		/**
		 * isDate ( date_string, format_string )
		 * It is recommended that you trim whitespace around the value before
		 * passing it to this function, as whitespace is NOT ignored!
		 * @param {String} date_string
		 * @param {String} format_string
		 * @returns Returns true if date string matches format of format string and is a valid date. Else returns false.
		 */
		isDate : function (val,format) {
		  var date=this.getDateFromFormat(val,format);
		  if (date==0) { return false; }
		  return true;
		},
		
		/**
		 * formatDate (date_object, format)
		 * The format string uses the same abbreviations as in getDateFromFormat()
		 * @param {String} 날짜
		 * @param {String} 날짜형식
		 * @returns Returns a date in the output format specified.
		 */
		formatDate : function (date,format) {
		  format=format+"";
		  var result="";
		  var i_format=0;
		  var c="";
		  var token="";
		  var y=date.getYear()+"";
		  var M=date.getMonth()+1;
		  var d=date.getDate();
		  var E=date.getDay();
		  var H=date.getHours();
		  var m=date.getMinutes();
		  var s=date.getSeconds();
		  var yyyy,yy,MMM,MM,dd,hh,h,mm,ss,ampm,HH,H,KK,K,kk,k;
		  // Convert real date parts into formatted versions
		  var value=new Object();
		  if (y.length < 4) {y=""+(y-0+1900);}
		  value["y"]=""+y;
		  value["yyyy"]=y;
		  value["yy"]=y.substring(2,4);
		  value["M"]=M;
		  value["MM"]=this.LZ(M);
		  value["MMM"]=MONTH_NAMES[M-1];
		  value["NNN"]=MONTH_NAMES[M+11];
		  value["d"]=d;
		  value["dd"]=this.LZ(d);
		  value["E"]=DAY_NAMES[E+7];
		  value["EE"]=DAY_NAMES[E];
		  value["H"]=H;
		  value["HH"]=this.LZ(H);
		  if (H==0){value["h"]=12;}
		  else if (H>12){value["h"]=H-12;}
		  else {value["h"]=H;}
		  value["hh"]=this.LZ(value["h"]);
		  if (H>11){value["K"]=H-12;} else {value["K"]=H;}
		  value["k"]=H+1;
		  value["KK"]=this.LZ(value["K"]);
		  value["kk"]=this.LZ(value["k"]);
		  if (H > 11) { value["a"]="PM"; }
		  else { value["a"]="AM"; }
		  value["m"]=m;
		  value["mm"]=this.LZ(m);
		  value["s"]=s;
		  value["ss"]=this.LZ(s);
		  while (i_format < format.length) {
			 c=format.charAt(i_format);
			 token="";
			 while ((format.charAt(i_format)==c) && (i_format < format.length)) {
				token += format.charAt(i_format++);
				}
			 if (value[token] != null) { result=result + value[token]; }
			 else { result=result + token; }
			 }
		  return result;
		  },
		
		  /**
		 * getDateFromFormat( date_string , format_string )
		 * This function takes a date string and a format string. 
		 * @param {String} date_string
		 * @param {String} format_string
		 * @returns It matches If the date string matches the format string, it returns the getTime() of the date. If it does not match, it returns 0.
		 */
		getDateFromFormat : function (val,format) {
		  val=val+"";
		  format=format+"";
		  var i_val=0;
		  var i_format=0;
		  var c="";
		  var token="";
		  var token2="";
		  var x,y;
		  var now=new Date();
		  var year=now.getYear();
		  var month=now.getMonth()+1;
		  var date=1;
		  var hh=now.getHours();
		  var mm=now.getMinutes();
		  var ss=now.getSeconds();
		  var ampm="";
		
		  while (i_format < format.length) {
			 // Get next token from format string
			 c=format.charAt(i_format);
			 token="";
			 while ((format.charAt(i_format)==c) && (i_format < format.length)) {
				token += format.charAt(i_format++);
				}
			 // Extract contents of value based on format token
			 if (token=="yyyy" || token=="yy" || token=="y") {
				if (token=="yyyy") { x=4;y=4; }
				if (token=="yy")   { x=2;y=2; }
				if (token=="y")    { x=2;y=4; }
				year=this._getInt(val,i_val,x,y);
				if (year==null) { return 0; }
				i_val += year.length;
				if (year.length==2) {
				  if (year > 70) { year=1900+(year-0); }
				  else { year=2000+(year-0); }
				  }
				}
			 else if (token=="MMM"||token=="NNN"){
				month=0;
				for (var i=0; i<MONTH_NAMES.length; i++) {
				  var month_name=MONTH_NAMES[i];
				  if (val.substring(i_val,i_val+month_name.length).toLowerCase()==month_name.toLowerCase()) {
					 if (token=="MMM"||(token=="NNN"&&i>11)) {
						month=i+1;
						if (month>12) { month -= 12; }
						i_val += month_name.length;
						break;
						}
					 }
				  }
				if ((month < 1)||(month>12)){return 0;}
				}
			 else if (token=="EE"||token=="E"){
				for (var i=0; i<DAY_NAMES.length; i++) {
				  var day_name=DAY_NAMES[i];
				  if (val.substring(i_val,i_val+day_name.length).toLowerCase()==day_name.toLowerCase()) {
					 i_val += day_name.length;
					 break;
					 }
				  }
				}
			 else if (token=="MM"||token=="M") {
				month=this._getInt(val,i_val,token.length,2);
				if(month==null||(month<1)||(month>12)){return 0;}
				i_val+=month.length;}
			 else if (token=="dd"||token=="d") {
				date=this._getInt(val,i_val,token.length,2);
				if(date==null||(date<1)||(date>31)){return 0;}
				i_val+=date.length;}
			 else if (token=="hh"||token=="h") {
				hh=this._getInt(val,i_val,token.length,2);
				if(hh==null||(hh<1)||(hh>12)){return 0;}
				i_val+=hh.length;}
			 else if (token=="HH"||token=="H") {
				hh=this._getInt(val,i_val,token.length,2);
				if(hh==null||(hh<0)||(hh>23)){return 0;}
				i_val+=hh.length;}
			 else if (token=="KK"||token=="K") {
				hh=this._getInt(val,i_val,token.length,2);
				if(hh==null||(hh<0)||(hh>11)){return 0;}
				i_val+=hh.length;}
			 else if (token=="kk"||token=="k") {
				hh=this._getInt(val,i_val,token.length,2);
				if(hh==null||(hh<1)||(hh>24)){return 0;}
				i_val+=hh.length;hh--;}
			 else if (token=="mm"||token=="m") {
				mm=this._getInt(val,i_val,token.length,2);
				if(mm==null||(mm<0)||(mm>59)){return 0;}
				i_val+=mm.length;}
			 else if (token=="ss"||token=="s") {
				ss=this._getInt(val,i_val,token.length,2);
				if(ss==null||(ss<0)||(ss>59)){return 0;}
				i_val+=ss.length;}
			 else if (token=="a") {
				if (val.substring(i_val,i_val+2).toLowerCase()=="am") {ampm="AM";}
				else if (val.substring(i_val,i_val+2).toLowerCase()=="pm") {ampm="PM";}
				else {return 0;}
				i_val+=2;}
			 else {
				if (val.substring(i_val,i_val+token.length)!=token) {return 0;}
				else {i_val+=token.length;}
				}
			 }
		  // If there are any trailing characters left in the value, it doesn't match
		  if (i_val != val.length) { return 0; }
		  // Is date valid for month?
		  if (month==2) {
			 // Check for leap year
			 if ( ( (year%4==0)&&(year%100 != 0) ) || (year%400==0) ) { // leap year
				if (date > 29){ return 0; }
				}
			 else { if (date > 28) { return 0; } }
			 }
		  if ((month==4)||(month==6)||(month==9)||(month==11)) {
			 if (date > 30) { return 0; }
			 }
		  // Correct hours value
		  if (hh<12 && ampm=="PM") { hh=hh-0+12; }
		  else if (hh>11 && ampm=="AM") { hh-=12; }
		  var newdate=new Date(year,month-1,date,hh,mm,ss);
		  return newdate;
		  },

		 /**
		 * Utility functions for parsing in getDateFromFormat()
		 * @param {String} 
		 * @returns boolean
		 */
		_isInteger : function (val) {
		  var digits="1234567890";
		  for (var i=0; i < val.length; i++) {
			 if (digits.indexOf(val.charAt(i))==-1) { return false; }
			 }
		  return true;
		  },
		  
		 /**
		 * Utility functions for parsing in getDateFromFormat()
		 * @param {String} str
		 * @param {int} i
		 * @param {minlength} minlength
		 * @param {maxlength} maxlength
		 * @returns boolean
		 */
		_getInt : function (str,i,minlength,maxlength) {
		  for (var x=maxlength; x>=minlength; x--) {
			 var token=str.substring(i,i+x);
			 if (token.length < minlength) { return null; }
			 if (this._isInteger(token)) { return token; }
			 }
		  return null;
		},
		
		/**
		 * val 날짜형식이 inFmt와 같으면 outFmt의 날짜형식으로 반환
		 * @param {String} 날짜
		 * @param {String} 날짜형식
		 * @param {String} 날짜형식
		 * @returns formatDate값 리턴
		 */
		parseDate : function (val, inFmt, outFmt){
		  var dt = this.getDateFromFormat(val, inFmt);
		  return this.formatDate(dt, outFmt);
		}
		
	}
}();
/*
 * 화면 효과를 위한 Framework
 * Class : DoitUI
 * 
 * Constructor Summary
 * 
 * Method Summary
 *  
 * 
 */

doit.ui = {
	version : '0.0.3_rc1',
	license : 'CTUnion. co. ltd.',
	build : '2009.04.21',
	author : 'dnsnl'
}

/**
 * @namespace doit.ui.Effect
 */
doit.ui.Effect = function(){
	return {
		/**
		 * 화면나타내기
		 * @param {String} id
		 * @param {String} userFuntion
		 */
		Appear : function(id, userFunction) {
			new Effect.Appear(id, {			
				duration : 0.5,
				afterFinish : userFunction
			});
		},
		
		/**
		 * 화면 모두 나타내기
		 * @param {String} id_Array
		 * @param {String} userFuntion
		 */
		AppearAll : function(id_Array, userFunction) {
			for(var i=0; i<id_Array.length; i++) {
				if ($(id_Array[i]).style.display == 'none') {
					if( (i+1) == id_Array.length && userFunction != null) {
						this.Appear(id_Array[i], userFunction);
					} else {
						this.Appear(id_Array[i]);
					}
				}
			}
		},
		
		/**
		 * 화면 사라지기
		 * @param {String} id
		 * @param {String} userFunction
		 */
	    Fade : function(id, userFunction) {
			new Effect.Fade(id, {			
				duration : 0.5,
				afterFinish : userFunction
			});
		},
		
		/**
		 * 화면 모두 사라지기
		 * @param {String} id
		 * @param {String} userFunction
		 */
		FadeAll : function(id_Array, userFunction) {
			for (var i=0 ; i < id_Array.length ; i++) {
		     	if ($(id_Array[i]).style.display == '' || $(id_Array[i]).style.display == 'display') {
		     		if( (i+1) == id_Array.length && userFunction != null) {
		     			this.Fade(id_Array[i], userFunction);
		     		} else {
		     			this.Fade(id_Array[i]);
		     		}
				}
			}
		},
		
		/**
		 * 같은 영역에서 화면이 사라졌다 다시 나타내기
		 * @param {String} id
		 * @param {String} userFunction
		 */
		FadeAction : function(id, userFunction) {
			if ($(id).style.display == 'none') {
				this.Appear(id, userFunction); 
			} else {
				this.Fade(id, userFunction); 
			}
		},
		
		/**
		 * 불투명도
		 * @param {String} id
		 * @param {String} userFunction
		 */
		Opacity :  function(id, userFunction) {
			new Effect.Opacity(id, {
				to : 0.0, from : 1.0 , duration : 0.0,
				afterFinish : function() {
					Effect.SlideDown(id, { 
						duration : 0.05 ,
						afterFinish : function() {
							new Effect.Opacity(id, {
								to : 1.0, from : 0.0, duration : 0.5, 
								afterFinish : userFunction
							});
						}
					})
				}
			});
		},
		
		/**
		 * id영역을 지우기
		 * @param {String} id
		 * @param {String} userFunction
		 */
		Remove : function(id, userFunction) {
			new Effect.Fade(id, {
				duration : 0.5,
				afterFinish : function() {
					Element.remove(id);
					
					if (userFunction != null && userFunction != 'undefined') {
						userFunction();
					}
				}
			});
		},
		
		/**
		 * id영역을 모두 지우기
		 * @param {String} id
		 * @param {String} userFunction
		 */
		RemoveAll : function(id_Array, userFunction) {
			for (var i = 0 ; i < id_Array.length ; i++) {
		     	if ($(id_Array[i]).style.display == '' || $(id_Array[i]).style.display == 'display') {
					if ( (i+1) == id_Array.length && userFunction != null) {
		     			this.Remove(id_Array[i]);
		     		} else {
		     			this.Remove(id_Array[i], userFunction);
		     		}
		     	}
		    }
		},
		
		/**
		 * 나타내고 있는 id영역을 감추고 다른 id영역을 나타내기
		 * @param {String} fadeId
		 * @param {String} appearId
		 * @param {String} userFunction
		 */
		ChangeElement : function(fadeId, appearId, userFunction) {
			this.Fade(fadeId, function() {
				doit.ui.Effect.Appear(appearId,  userFunction);
			});	
		},
		
		/**
		 * 현재 id영역 내용을 감추고 그 영역 안에 다른 내용을 넣기
		 * @param {String} actionId
		 * @param {String} modifyHTML
		 * @param {String} userFunction
		 */
		ChangeContent : function(actionId, modifyHTML, userFunction) {
			this.Fade(actionId, function() {
				$(actionId).innerHTML = modifyHTML;
				doit.ui.Effect.Appear(actionId, userFunction);
			});		
		},
		
		/**
		 * 원하는 영역에 element추가
		 * @param {String} tagName
		 * @param {String} appendElementId
		 * @param {String} innerHtml
		 * @param {String} targetElementId
		 * @param {String} position
		 * @param {String} style
		 * @param {String} userFunction
		 */
		AppendElement : function(tagName, appendElementId, innerHtml, targetElementId, position, style, userFunction) {
			var styleAttributes = 'display:none;';
			
			if(arguments.length > 5 && arguments[5] != null) {
				var styleHash = $H(style);
				
				styleHash.each( function(pair) {
					styleAttributes += pair.key + ':' + pair.value + ';';
				});			
			}
			
			var appendElementHTML = '<' + tagName + ' id="' + appendElementId + '" name="' + appendElementId + '" '  
								  + 'style="'+ styleAttributes + '">' +  innerHtml + '</' + tagName + '>'; 
			
			switch(position.toUpperCase()) {
				case "AFTER" :
					new Insertion.After(targetElementId, appendElementHTML);
					break;
				case "BOTTOM" :
					new Insertion.Bottom(targetElementId, appendElementHTML);
					break;
				case "TOP" :
					new Insertion.Top(targetElementId, appendElementHTML);
					break;
				case "BEFORE" :
					new Insertion.Before(targetElementId, appendElementHTML);
					break;
			}
			
			this.Appear(appendElementId, userFunction);
		},
		
		/**
		 * 위에서 아래로 나타내기
		 * @param {String} element
		 * @param {String} userFunction
		 */
		Rollover : function(element, userFunction) {
	        new Effect.BlindDown(element, { 
	        	duration : 0.5,
				afterFinish : userFunction
	        });
	    },
		
	    /**
		 * 아래서 위로 나타내기
		 * @param {String} element
		 * @param {String} userFunction
		 */
	    Rollout : function(element, userFunction) {
			new Effect.BlindUp(element, {
				duration:0.3,
				afterFinish : userFunction
			});
	    },
	    
	    /**
		 * 테이블행배경색바꾸기
		 * changeColor(this,'000000'); restoreColor(thsi);
		 * @param {obj} obj
		 * @param {String} colorNo
		 */
		changeColor : function (obj,colorNo) {
			obj.style.backgroundColor = colorNo;
		},
	
		/**
		 * 테이블행배경색바꾸기
		 * @param {obj} obj
		 */
		restoreColor : function (obj) {
			obj.style.backgroundColor = '';
		},
		
		/**
		 * text박스 테투리선
		 * @param {obj} obj1
		 * @param {obj} obj2
		 */
		onfocus1 : function (obj1, obj2){
			$(obj1).style.border = '2px solid #9BBEE1';
			if(obj2 != null)
				$(obj2).style.display = "";
		},
		
		/**
		 * text박스 테투리선
		 * @param {obj} obj1
		 * @param {obj} obj2
		 */
		outfocus1 : function (obj1, obj2){
			$(obj1).style.border = '1px solid #C1C1C1';
			if(obj2 != null)
				$(obj2).style.display = "none";
		},
		
		/**
		 * MM_swapImgRestore
		 */
		MM_swapImgRestore : function () { //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;
		},
		
		/**
		 * MM_preloadImages
		 */
		MM_preloadImages : function (){ //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=this.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];}}
		},
		
		/**
		 * MM_findObj
		 * @param {n} n
		 * @param {d} d
		 */
		MM_findObj : function (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=this.MM_findObj(n,d.layers[i].document);
		  if(!x && d.getElementById) x=d.getElementById(n); return x;
		},
		
		/**
		 * MM_swapImage
		 */
		MM_swapImage :function () { //v3.0
		  var i,j=0,x,a=this.MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
		   if ((x=this.MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
		}
	};
}();

/**
 * @namespace doit.ui.Box
 */
doit.ui.Box = Class.create();
doit.ui.Box.prototype = {		
		/**
		* initialize
		* @param {ojb} cfgObj
		*/
		initialize: function(cfgObj){
			this.ctDivName = cfgObj.ctDivName;
			this.elName = cfgObj.elName;
			this.store = cfgObj.store;
			this.skin = cfgObj.skin;
			this.width = (cfgObj.width == undefined)? 28: cfgObj.width;
			this.dropDiv = this.createDropList();
			this.handler = cfgObj.handler;
			this.scope = cfgObj.scope;
			this.top = (cfgObj.top == undefined)?20: cfgObj.top ;
			this.left = (cfgObj.left == undefined)?6: cfgObj.left ;
		
			var listItems = this.dropDiv.getElementsBySelector('div');
			this.selectListener = this.select.bindAsEventListener(this);
			this.outClickListener = this.outClick.bindAsEventListener(this);
			this.overListener =  this.over.bindAsEventListener(this);
			this.outListener = this.out.bindAsEventListener(this);
				listItems.each(function(item){
					Event.observe(item, 'mouseover', this.overListener);
					Event.observe(item, 'mouseout', this.outListener);
					Event.observe(item, 'click', this.selectListener);
					Event.observe(document, 'click', this.outClickListener);
				}.bind(this));
		},
		
		/**
		* createDropList
		*/
		createDropList: function(){
			var dropDiv = document.createElement("div");
			var dropDivName  = 'pnl-gen:'+this.createUUID();
			dropDiv.id = dropDivName
			$(dropDiv).addClassName('pnl-ipp-droplist'+ this.skin);
			$(dropDiv).setStyle({width: this.width+'px'});
			for(var i= 0; i< this.store.length; i++ ){
				var item = document.createElement('div');
				$(item).addClassName('pnl-combo-list-item');
				if(i == 0 ) $(item).addClassName('pnl-combo-selected');
				$(item).innerHTML = this.store[i][1];
				$(dropDiv).appendChild(item);
			}
			$(this.ctDivName).appendChild(dropDiv);
			return dropDiv;
		},
		
		/**
		* createDropList
		* @param {value} val
		*/
	 	setValue: function(val){
			var listItems = this.dropDiv.getElementsBySelector('div');
			var selItem = null;
			listItems.each(function(item){
				if(item.hasClassName('pnl-combo-selected')){
					item.removeClassName('pnl-combo-selected');
				}
				if(item.innerHTML  == val){
					selItem = item;
				}
			});
			selItem.addClassName('pnl-combo-selected');
			$(this.elName).value = val;
		},
		
		/**
		* getValue
		* @returns
		*/
		getValue: function(){
			return $(this.elName).value;
		},
		
		/**
		* createUUID
		* @returns
		*/
		createUUID: function(){
		return [4, 2, 2, 2, 6].map(function(length) {
			var uuidpart = "";
			for (var i=0; i<length; i++) {
				var uuidchar = parseInt((Math.random() * 256)).toString(16);
				if (uuidchar.length == 1)
					uuidchar = "0" + uuidchar;
					uuidpart += uuidchar;
				}
				return uuidpart;
		 	}).join('-');
		},
	  /**
		* 주어진 노드가 주어진 노드 안에 포함되어 있는지 체크 한다.
		* @param {String} container
		* @param {String} container
		* @returns boolean
		*/
		containsDOM: function(container, containee) {
			//주어진 노드가 주어진 노드 안에 포함되어 있는지 체크 하다.
		  var isParent = false;
		  do {
			 if ((isParent = container == containee))
				break;
			 containee = containee.parentNode;
		  }
		  while (containee != null);
		  return isParent;
		},
		/**
		* 마우스가 주어진 element 영역에서만 들어갈때 true 리턴,아니면 false
		* @param {String} container
		* @param {String} container
		* @returns boolean
		*/
		checkMouseEnter: function(element, evt) {
			//마우스가 주어진 element 영역에서만 들어갈때 true 리턴,아니면 false
		  if (element.contains && evt.fromElement) {
			 return !element.contains(evt.fromElement);
		  }
		  else if (evt.relatedTarget) {
			 return !this.containsDOM(element, evt.relatedTarget);
		  }
		},
		
		/**
		* 마우스가 주어진 element 영역에서만 빠져나갈때 true 리턴,아니면 false
		* @param {String} container
		* @param {String} container
		* @returns boolean
		*/
		checkMouseLeave: function(element, evt) {
			//마우스가 주어진 element 영역에서만 빠져나갈때 true 리턴,아니면 false
		  if (element.contains && evt.toElement) {
			 return !element.contains(evt.toElement);
		  }
		  else if (evt.relatedTarget) {
			 return !this.containsDOM(element, evt.relatedTarget);
		  }
		},
		
		/**
		* hideIpp
		*/
		hideIpp: function(){
			this.dropDiv.style.visibility = 'hidden';
			this.dropDiv.style.top = '-1000px';
			this.dropDiv.style.left = '-1000px';
		},
		
		/**
		* showIpp
		*/
		showIpp: function(){
			var pnlIpp = $(this.ctDivName);
			var top = pnlIpp.cumulativeOffset().top;
			var left = pnlIpp.cumulativeOffset().left;
			this.dropDiv.style.top = (top+this.top)+'px';
			this.dropDiv.style.left = (left+this.left)+'px';
			this.dropDiv.style.visibility = 'visible';
		},
		
		/**
		* 콤보박스 handle
		* @param {event}
		*/
		handleIpp: function(event){
			Event.extend(event)
			event.stop();
			var pnlIpp = $(this.ctDivName);
			if(this.dropDiv.style.visibility == 'visible'){
				this.hideIpp();
			} else {
				this.showIpp();
			}
		},
		
		/**
		* over
		* @param {event}
		*/
		over: function(event){
			var item = event.target;
			if (this.checkMouseEnter(item, event)) {
				if(!item.hasClassName('pnl-combo-selected')){
					var listItems = this.dropDiv.getElementsBySelector('div');
					listItems.each(function(i){
						if(i.hasClassName('pnl-combo-selected')){
							i.removeClassName('pnl-combo-selected');
						}
					});
					item.addClassName('pnl-combo-selected');
				}
			}
		},
		
		/**
		* out
		* @param {event}
		*/
		out: function(event){
			var item = event.target;
			var dropDiv = item.up();
			var rel = event.relatedTarget, cur = event.currentTarget;
			if(!rel.hasClassName('pnl-combo-list-item'))
				return;
			if (this.checkMouseLeave(item, event)) {
				if(item.hasClassName('pnl-combo-selected')){
					item.removeClassName('pnl-combo-selected');
				}
			}
		},
		
		/**
		* select
		* @param {event}
		*/
		select: function(event){
			var item = event.target;
			$(this.elName).value = item.innerHTML;
			this.hideIpp();
	
		 var selValue = '';
		 for(var i=0; i< this.store.length;i++){
			if(item.innerHTML == this.store[i][1]){
			  selValue = this.store[i][0];
			  break;
			}
		 }
		 if(this.handler != undefined)
			this.handler.apply(this.scope, [selValue]);
		},
		
		/**
		* outClick
		* @param {event}
		*/
		outClick: function(event){
			var source = event.target;
			if(!this.containsDOM(this.dropDiv ,source) ){
				if(this.dropDiv.style.visibility == 'visible')
					this.dropDiv.style.visibility = 'hidden';
			}
		}
}

/**
 * @namespace doit.ui.Text
 */
doit.ui.Text = {
	textBoxId : 'tempTextBox',
	
	/**
	* EditTextBox
	* @param {textId} textId
	*/
	EditTextBox : function(textId) {
		var showTextBoxHTML = "<input id='" + this.textBoxId + "' name='" + this.textBoxId + "' type='text' value='" + $(textId).innerHTML + "' "
							+ "onBlur=\"javascript:doit.ui.Text.CommitTextBox('" + textId+ "');\" onKeydown=\"if (event.keyCode==13) { doit.ui.Text.CommitTextBox('" + textId+ "'); }\">"
		
		new Insertion.After(textId, showTextBoxHTML);
		Element.hide(textId);
		$(this.textBoxId).focus();
		$(this.textBoxId).select();
	},
	
	/**
	* CommitTextBox
	* @param {textId} textId
	*/
	CommitTextBox : function(textId) {
		$(textId).innerHTML = $F(this.textBoxId);
		Element.remove(this.textBoxId);
		Element.show(textId);
	}
}

/**
 * @namespace doit.ui.Textarea
 * 	TextArea 사용시 라인 자동 증가 스크립트
 */
doit.ui.Textarea = Class.create();
doit.ui.Textarea.prototype = {
		
		/**
		* initialize
		* -- Example --
		*  <textarea id="ta1" rows="5" style="width:500px;font-size:9pt;overflow:hidden"><//textarea>
		*  <script type="text/javascript">
		*   new doit.ui.Textarea('ta1');
		*  <//script>
		* @param {obj}
		*/
		initialize : function(obj) {
	  		this._obj = $(obj);
	  		
	  		if (this._obj == null || this._obj == 'undefined') {
				return;
			}
			
			this._fwidth = 0;
	  		this._fheight = 0;
	  		this._minRows = parseInt(this._obj.rows); // minimum size
	  		
	  		if (isNaN(this._minRows)) {
	  			this._minRows = 5;
	  		}
	  		
	  		Event.observe(this._obj, 'focus', this.init.bind(this));
	  		Event.observe(this._obj, 'keydown', this.onKeydown.bindAsEventListener(this));
	  		Event.observe(this._obj, 'keyup', this.onKeyup.bindAsEventListener(this));
		},
		
		/**
		* init
		*/
		init : function() {
	  		if (this._fwidth != 0) {
				return;
	  		}
	  		
	  		var container = document.createElement('SPAN');
	  		
	  		$(container).setStyle({
	    		'visibility' : 'hidden',
	    		'padding' : '0px',
	    		'fontSize' : this._obj.style.fontSize == '' ? '9pt' : this._obj.style.fontSize
	    	});
	    	
	  		document.body.appendChild(container);
	      	container.innerHTML = 'a'; // for width of 1 byte
	      	this._fwidth = container.offsetWidth;
	      	this._fheight = container.offsetHeight;
	      	document.body.removeChild(container);
		},
		
		/**
		* getBytes
		* @param {String}
		* @returns bytes
		*/
		getBytes : function(str) {
	  		var code,bytes = 0;
	  		var len = str.length;
	  		
	  		for(var i=0; i < len; i++) {
	    		code = str.charCodeAt(i);
	    		
	    		if (code > 128) {
					bytes += 2;
	    		} else if (code > 63 && code < 91) {
					bytes += 1.5;
	    		} else {
					bytes += 1;
	    		}
	  		}
	  		
	  		return bytes;
		},
		
		/**
		* onKeydown
		* @param {event}
		*/
		onKeydown : function(event) {
	  		if (event.keyCode == Event.KEY_RETURN || (event.ctrlKey && event.keyCode == 86)) {
	    		// enter key or Ctrl+V
	    		this.fitSize();
	  		}
		},
		
		/**
		* onKeyup
		* @param {event}
		*/
		onKeyup : function(event) {
	  		var k = event.keyCode;
	  		if (k < 65 || (k > 90 && k < 97) || (k > 122 && k < 127)) {
	    		this.fitSize();
	  		}
		},
		
		/**
		* fitSize
		* @param {event}
		*/
		fitSize : function() {
	  		var str   = this._obj.value + ' ';
	  		var strings = str.split(/\n/g);
	  		var bpl   = Math.floor(this._obj.offsetWidth / this._fwidth); // bytes per line
	  		var lines = 0;
	  		
	  		for(var i=0; i < strings.length; i++) {
	    		if (this.getBytes(strings[i]) < bpl) {
	      			lines++;
	    		} else {
	      			lines += Math.ceil(this.getBytes(strings[i]) / bpl);
	    		}
	  		}
	  		
	  		lines += 1;
	  		
	  		if (lines < this._minRows) {
	    		this._obj.rows = this._minRows;
	  		} else {
	    		this._obj.rows = lines;
	  		}
	  		
	  		this._obj.focus();
		}
}

/**
 * @namespace doit.ui.popup
 */
doit.ui.Popup = function(){
		var indicator_img_path = "/images/indicator.gif";
		var indicator_img_html = "<img name=\"ibox_indicator\" src=\""+indicator_img_path+"\" alt=\"Loading...\" style=\"width:128px;height:128px;\"/>"; // don't remove the name
		
		var opacity_level = 5; // how transparent our overlay bg is
		var ibAttr = "rel"; 	// our attribute identifier for our iBox elements
		
		var imgPreloader = new Image(); // create an preloader object
		var loadCancelled = false;
		var ibox_w_height = 0;
		var oldPosition = "divPosition";
		var currentPosition = "divPosition";
		
	return {
		
		/**
		* initialize
		* @param {event}
		*/
		initialize : function()
		{
			var elem_wrapper = "ibox";
			// initialize시 body에 div 영역을 생성
			this.createIbox(document.getElementsByTagName("body")[0]);
		},
		
		/**
		* setPosition
		* @param {event}
		*/
		setPosition : function(oldPosition)
		{
			box.oldPosition = oldPosition;
		},
		// type : 1 : 이미지
		// type : 2 : #
	 	// type : 3 : ajax
		// type : 4 : iframe
	 	
	 	/**
		* service
		* if (divHeight != null && divHeight == 'undefined')
		*	{
		*	var size = "height=";
		*			size += divHeight;
		*			size += "&";
		*			size += "width=";
		*			size += divWidth;
		*			var params = this.parseQuery(size);
		*	}
		* @param {url} url
		* @param {title} title
		* @param {divHeight} divHeight
		* @param {divWidth} divWidth
		* @param {type} type
		* @param {userFunction} userFunction
		* @param {finishFunction} finishFunction
		*/
		service : function(url, title, divHeight, divWidth, type, userFunction, finishFunction)
		{	
			var size = "height=";
			size += divHeight;
			size += "&";
			size += "width=";
			size += divWidth;
			var params = this.parseQuery(size);
			if (type > -1 && type < 5)
			{
				if(this.showIbox(url,title,params, type, userFunction, finishFunction))
				{
					this.showBG();
					window.onscroll = this.maintPos;
					window.onresize = this.maintPos;
				}
			}
			else if (type >= 5)
			{
				this.showBG();
				doitUI.fadeAction.fadeAction($('ibox_footer_wrapper'));
				var userFunction = function()
				{
					doitUI.fadeAction.fadeAction($('ibox_footer_wrapper'));
				}
				if(this.showIbox(url,title,params, 4, userFunction, finishFunction))
				{
					window.onscroll = this.maintPos;
					window.onresize = this.maintPos;
				}
			}
			return ;
		},
		
		/**
		* service
		* if (divHeight != null && divHeight == 'undefined')
		*	{
		*	var size = "height=";
		*			size += divHeight;
		*			size += "&";
		*			size += "width=";
		*			size += divWidth;
		*			var params = this.parseQuery(size);
		*	}
		* @param {url} url
		* @param {title} title
		* @param {divHeight} divHeight
		* @param {divWidth} divWidth
		* @param {type} type
		* @param {userFunction} userFunction
		* @param {finishFunction} finishFunction
		*/
		service1 : function(url, title, divHeight, divWidth, type, userFunction, finishFunction)
		{
			var size = "height=";
			size += divHeight;
			size += "&";
			size += "width=";
			size += divWidth;
			var params = this.parseQuery(size);
			if (type > -1 && type < 5)
			{
				if(this.showIbox(url,title,params, type, userFunction, finishFunction))
				{
	//				this.showBG();
					window.onscroll = this.maintPos;
					window.onresize = this.maintPos;
				}
			}
			else if (type >= 5)
			{
	//			this.showBG();
				doitUI.fadeAction.fadeAction($('ibox_footer_wrapper'));
				var userFunction = function()
				{
					doitUI.fadeAction.fadeAction($('ibox_footer_wrapper'));
				}
				if(this.showIbox(url,title,params, 4, userFunction, finishFunction))
				{
					window.onscroll = this.maintPos;
					window.onresize = this.maintPos;
				}
			}
			return ;
		},
		
		/**
		* showBG
		*/
		showBG : function()
		{
			var box_w = $('ibox_w');
			box_w.style.opacity = 0;
			box_w.style.filter = 'alpha(opacity=0)';
			setBGOpacity = this.setOpacity;
			for (var i=0;i<=opacity_level;i++) {setTimeout("setIboxOpacity('ibox_w',"+i+")",70*i);} // from quirksmode.org
	
			box_w.style.display = "";
			var pagesize = new this.getPageSize();
			var scrollPos = new this.getScrollPos();
			var ua = navigator.userAgent;
	
			if(ua.indexOf("MSIE ") != -1) {box_w.style.width = pagesize.width+'px';}
			/*else {box_w.style.width = pagesize.width-20+'px';}*/ // scrollbars removed! Hurray!
			box_w.style.height = pagesize.height+scrollPos.scrollY+'px';
		},
		
		/**
		* hideBG
		*/
		hideBG : function()
		{
			var box_w = $('ibox_w');
			box_w.style.display = "none";
	
		},
		
		/**
		* showIndicator
		*/
		showIndicator : function()
		{
			var ibox_p = $('ibox_progress');
			ibox_p.style.display = "";
			this.posToCenter(ibox_p);
			ibox_p.onclick = function()
			{
				doit.ui.Popup.hideIbox();
				doit.ui.Popup.hideIndicator();
				loadCancelled = true;
			}
		},
		
		/**
		* hideIndicator
		*/
		hideIndicator : function()
		{
			var ibox_p = $('ibox_progress');
			ibox_p.style.display = "none";
			ibox_p.onclick = null;
		},
		
		/**
		* createIbox
		*/
		createIbox : function(elem)
		{
			// a trick on just creating an ibox wrapper then doing an innerHTML on our root ibox element
			var strHTML = "<div id=\"ibox_w\" style=\"display:none;\">";
			strHTML +=    "</div>";
			strHTML +=	"<div id=\"ibox_progress\" style=\"display:none;\">";
			strHTML +=  indicator_img_html;
			strHTML +=  "</div>";
			strHTML +=	"<div id=\"ibox_wrapper\" style=\"display:none;overflow:hidden\">";
			strHTML +=	  "<div id=\"ibox_content\">";
			strHTML +=    "</div>";
			strHTML +=	  "<div id=\"ibox_footer_wrapper\">";
			strHTML +=      "<div id=\"ibox_footer\" style=\"float:left;margin-top:3px;\">";
			strHTML +=	    "</div>";
			strHTML +=	    "<div id=\"ibox_close\" style=\"float:right;\">";
			strHTML +=	      "<a id=\"ibox_close_a\" href=\"javascript:void(null);\" ><img src='/images/common/sub_btn_close.gif' border='0'></a>";
			strHTML +=	    "</div>";
			strHTML +=	  "</div>";
			strHTML +=	"</div>";
		//	strHTML +=	  "</div>";
	
			var docBody = document.getElementsByTagName("body")[0];
			var ibox = document.createElement("div");
			ibox.setAttribute("id","ibox");
			ibox.style.display = '';
			ibox.innerHTML = strHTML;
			elem.appendChild(ibox);
		},
		
		/**
		* showIbox
		*/
		showIbox : function(url,title,params, type, userFunction, finishFunction)
		{
			var ibox = $('ibox_wrapper');
			var ibox_type = 0;
			// set title here
			var ibox_footer = $('ibox_footer');
			if(title != "")
			{
				ibox_footer.innerHTML = title;
			}
			else
			{
				ibox_footer.innerHTML = "&nbsp;";
			}
			// file checking code borrowed from thickbox
			var urlString = /\.jpg|\.jpeg|\.png|\.gif|\.html|\.htm|\.php|\.cfm|\.asp|\.aspx|\.jsp|\.jst|\.rb|\.rhtml|\.txt/g;
			var urlType = url.match(urlString);
			if (type > -1 && type < 5)
			{
				ibox_type = type;
			}
			switch(ibox_type)
			{
				case 1:
					this.showIndicator();
					imgPreloader = new Image();
					imgPreloader.onload = function()
					{
						imgPreloader = doit.ui.Popup.resizeImageToScreen(imgPreloader);
						doit.ui.Popup.hideIndicator();
						var strHTML = "<img name=\"ibox_img\" src=\""+url+"\" style=\"width:"+imgPreloader.width+"px;height:"+imgPreloader.height+"px;border:0;cursor:hand;margin:0;padding:0;position:absolute;\"/>";
						if(loadCancelled == false)
						{
							// set width and height
							ibox.style.height = (imgPreloader.height)+'px';
							ibox.style.width =  (imgPreloader.width)+'px';
							ibox.style.visibility = "hidden";
							doit.ui.Popup.posToCenter(ibox);
							ibox.style.visibility = "visible";
							Effect.toggle(ibox,'appear',{duration : 0.8});
							doit.ui.Popup.setIBoxContent(strHTML);
						}
					}
					loadCancelled = false;
					imgPreloader.src = url;
					break;
				case 2:
					var strHTML = "";
					if(params['height'])
					{
						ibox.style.height = params['height']+'px';
					}
					else
					{
						ibox.style.height = '280px';
					}
					if(params['width'])
					{
						ibox.style.width = params['width']+'px';
					}
					else
					{
						ibox.style.width = '450px';
					}
					ibox.style.visibility = "hidden";
					doit.ui.Popup.posToCenter(ibox);
					ibox.style.visibility = "visible";
					$('ibox_content').style.overflow = "auto";
					Effect.toggle(ibox,'appear',{duration : 0.8});
	
					var elemSrcId = url.substr(url.indexOf("#") + 1,1000);
					var elemSrc = $(elemSrcId);
	
					this.setIBoxElement(elemSrc);
					break;
				case 3:
					this.showIndicator();
					http.open('get',url,true);
					http.onreadystatechange = function() {
						if(http.readyState == 4)
						{
							doit.ui.Popup.hideIndicator();
	
							if(params['height'])
							{
								ibox.style.height = params['height']+'px';
							}
							else
							{
								ibox.style.height = '280px';
							}
							if(params['width'])
							{
								ibox.style.width = params['width']+'px';
							}
							else
							{
								ibox.style.width = '450px';
							}
							ibox.style.visibility = "hidden";
							doit.ui.Popup.posToCenter(ibox);
							ibox.style.visibility = "visible";
							$('ibox_content').style.overflow = "auto";
		 					Effect.toggle(ibox,'appear',{duration : 0.8, afterFinish : userFunction});
							var response = http.responseText;
							doit.ui.Popup.setIBoxContent(response);
						}
					};
					http.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");
					http.send(null);
					break;
	
				case 4:
					this.showIndicator();
					this.hideIndicator();
					var strHTML = "<iframe name=\"ibox_img\" src=\""+url+"\" style=\"width:100%;height:99%;border:0;cursor:hand;margin:0;padding:0;position:absolute;\"/>";
					if(loadCancelled == false)
					{
						// set width and height
						if(params['height'])
						{
							ibox.style.height = params['height']+'px';
						}
						else
						{
							ibox.style.height = '280px';
						}
						if(params['width'])
						{
							ibox.style.width = params['width']+'px';
						}
						else
						{
							ibox.style.width = '450px';
						}
						ibox.style.visibility = "hidden";
						this.posToCenter(ibox);
						ibox.style.visibility = "visible";
						$('ibox_content').style.overflow = "auto";
	 					Effect.toggle(ibox,'appear',{duration : 0.8, afterFinish : userFunction});
						this.setIBoxContent(strHTML);
					}
					loadCancelled = false;
					imgPreloader.src = url;
					break;
				default:
	
			}
			ibox.style.opacity = 0;
			ibox.style.filter = 'alpha(opacity=0)';
			var ibox_op_level = 10;
			setIboxOpacity = this.setOpacity;
			this.hideSelectBoxes();
	
			if (ibox_type == 2)
			{
				ibox.onclick = null;
				$("ibox_close_a").onclick = function()
				{
					doit.ui.Popup.clearIboxElement($(elemSrcId));
					doit.ui.Popup.hideIbox(finishFunction);
					doit.ui.Popup.showSelectBoxes();
				}
			}
			else if(ibox_type == 3 || ibox_type == 4)
			{
				ibox.onclick = null;
				$("ibox_close_a").onclick = function()
				{
					doit.ui.Popup.hideIbox(finishFunction);
					doit.ui.Popup.showSelectBoxes();
				}
			}
	
			else
			{
				ibox.onclick = function()
				{
					doit.ui.Popup.hideIbox(finishFunction);
					doit.ui.Popup.showSelectBoxes();
				}
				$("ibox_close_a").onclick = null;
			}
			return true;
		},
		
		/**
		* hideSelectBoxes
		*/
		hideSelectBoxes : function()
		{
			selects = $$("select");
			for (i = 0; i != selects.length; i++)
			{
				selects[i].style.visibility = "hidden";
			}
		},
		
		/**
		* showSelectBoxes
		*/
		showSelectBoxes : function()
		{
			selects = $$("select");
			for (i = 0; i != selects.length; i++) {
				selects[i].style.visibility = "visible";
			}
		},
		
		/**
		* setOpacity
		*/
		setOpacity : function (elemid,value)
		{
			var e = $(elemid);
			e.style.opacity = value/10;
			e.style.filter = 'alpha(opacity=' + value*10 + ')';
		},
		
		/**
		* resizeImageToScreen
		*/
		resizeImageToScreen : function(objImg)
		{
			var pagesize = new this.getPageSize();
			var x = pagesize.width - 100;
			var y = pagesize.height - 100;
			if(objImg.width > x) {
				objImg.height = objImg.height * (x/objImg.width);
				objImg.width = x;
				if(objImg.height > y) {
					objImg.width = objImg.width * (y/objImg.height);
					objImg.height = y;
				}
			}
	
			else if(objImg.height > y) {
				objImg.width = objImg.width * (y/objImg.height);
				objImg.height = y;
				if(objImg.width > x) {
					objImg.height = objImg.height * (x/objImg.width);
					objImg.width = x;
				}
			}
			return objImg;
		},
		
		/**
		* maintPos
		*/
		maintPos : function()
		{
			var ibox = $('ibox_wrapper');
			var box_w = $('ibox_w');
			var pagesize = new doit.ui.Popup.getPageSize();
			var scrollPos = new doit.ui.Popup.getScrollPos();
			var ua = navigator.userAgent;
	
			if(ua.indexOf("MSIE ") != -1) {box_w.style.width = pagesize.width+'px';}
			/*else {box_w.style.width = pagesize.width-20+'px';}*/
	
			if(ua.indexOf("Opera/9") != -1) {box_w.style.height = document.body.scrollHeight+'px';}
			else {box_w.style.height = pagesize.height+scrollPos.scrollY+'px';}
	
			// alternative 1
			//box_w.style.height = document.body.scrollHeight+50+'px';
	
			doit.ui.Popup.posToCenter(ibox);
	
		},
		
		/**
		* hideIbox
		*/
		hideIbox : function(finishFunction)
		{
			this.hideBG();
			var ibox = $('ibox_wrapper');
			Effect.DropOut(ibox, {beforeStart : finishFunction});
			this.clearIboxContent();
			window.onscroll = null;
			doit.ui.Popup.showSelectBoxes();
		},
		
		/**
		* posToCenter
		*/
		posToCenter : function(elem)
		{
			var scrollPos = new this.getScrollPos();
			var pageSize = new this.getPageSize();
			var emSize = new this.getElementSize(elem);
			var x = Math.round(pageSize.width/2) - (emSize.width /2) + scrollPos.scrollX;
			var y = Math.round(pageSize.height/2) - (emSize.height /2) + scrollPos.scrollY;
			elem.style.left = x+'px';
			elem.style.top = y+'px';
		},
		
		/**
		* posToCenter
		*/
		getScrollPos : function()
		{
			var docElem = document.documentElement;
			this.scrollX = self.pageXOffset || (docElem&&docElem.scrollLeft) || document.body.scrollLeft;
			this.scrollY = self.pageYOffset || (docElem&&docElem.scrollTop) || document.body.scrollTop;
		},
		
		/**
		* getPageSize
		*/
		getPageSize : function()
		{
			var docElem = document.documentElement
			this.width = self.innerWidth || (docElem&&docElem.clientWidth) || document.body.clientWidth;
			this.height = self.innerHeight || (docElem&&docElem.clientHeight) || document.body.clientHeight;
		},
		
		/**
		* getElementSize
		*/
		getElementSize : function(elem)
		{
			if ( typeof ( elem.style.pixelWidth ) != 'undefined'
					&& typeof ( elem.style.pixelHeight ) != 'undefined' ) {
				this.width = elem.offsetWidth || elem.style.pixelWidth;
				this.height = elem.offsetHeight || elem.style.pixelHeight;
			} else {
				if ( typeof ( elem.style.width ) == 'string' ) {
					this.width = elem.offsetWidth || parseInt ( elem.style.width );
					this.height = elem.offsetHeight || parseInt ( elem.style.height );
				} else {
					this.width = elem.offsetWidth || elem.style.width;
					this.height = elem.offsetHeight || elem.style.height;
				}
			}
		},
		
		/**
		* setIBoxContent
		*/
		setIBoxContent : function(str)
		{
			this.clearIboxContent();
			var e = $('ibox_content');
			e.style.overflow = "auto";
			e.innerHTML = str;
		},
		
		/**
		* setIBoxElement
		*/
		setIBoxElement : function(element)
		{
			this.clearIboxContent();
			var e = $('ibox_content');
			e.style.overflow = "auto";
			e.insertAdjacentElement("afterBegin", $(element));
			$(element).style.display = '';
		},
		
		/**
		* clearIboxElement
		*/
		clearIboxElement : function(element)
		{
			var e = $('ibox_content');
			$(oldPosition).insertAdjacentElement("afterEnd", $(element));
			$(element).style.display = 'none';
			e.innerHTML = "";
		},
		
		/**
		* clearIboxContent
		*/
		clearIboxContent : function()
		{
			var e = $('ibox_content');
			e.innerHTML = "";
		},
		
		/**
		* getElem
		*/
		getElem : function(elemId)
		{
			return document.getElementById(elemId);
		},
		
		/**
		* parseQuery
		*/
		// parseQuery code borrowed from thickbox, Thanks Cody!
		parseQuery : function(query)
		{
			var Params = new Object ();
			if (!query) return Params;
			var Pairs = query.split(/[;&]/);
			for ( var i = 0; i < Pairs.length; i++ ) {
				var KeyVal = Pairs[i].split('=');
				if ( ! KeyVal || KeyVal.length != 2 ) continue;
				var key = unescape( KeyVal[0] );
				var val = unescape( KeyVal[1] );
				val = val.replace(/\+/g, ' ');
				Params[key] = val;
			}
			return Params;
		},
		
		
		
		/**
		* 팝업윈도우1
		* 파라미터 1) 팝업윈도우명 2) URL 3) 창 가로크기 4) 창 세로크기
		* 사용예 : popWindow('WIN', 'http://domain', 800, 600);
		* @param {String} objName
		* @param {String} URL
		* @param {String} 창 가로크기
		* @param {String} 창 세로크기
		* @returns 
		*/
		popWindow : function(objName, src, width, height) {
			var lSize = ( screen.width - width ) / 2;
			var tSize = ( screen.height - height ) / 2;
		
			var pWin = window.open( src,
						objName,
						"top="+tSize+",left="+lSize+",status=no,toolbar=no,scrollbars=yes,resizable=yes,menubar=no,width="+width+",height="+height );
		
			eval(pWin).focus();
		
			return pWin;
		},
		
		/**
		* 팝업윈도우2
		* 파라미터 1) 팝업윈도우명 2) URL 3) 창 가로크기 4) 창 세로크기 5) 툴바 6) 스크롤바 7) 사이즈조절
		* 사용예 : popWindow('WIN', 'http://domain', 800, 600, 'yes', 'yes', 'yes');
		* @param {String} objName
		* @param {String} URL
		* @param {String} 창 가로크기
		* @param {String} 창 세로크기
		* @param {String} 툴바
		* @param {String} 스크롤바
		* @param {String} 사이즈조절
		* @returns 
		*/
		popWindow : function(objName, src, width, height, toolbar, scrollbars, resizable){
			var lSize = ( screen.width - width ) / 2;
			var tSize = ( screen.height - height ) / 2;
		
			var pWin = window.open( src,
						objName,
						"top="+tSize+",left="+lSize+",status=no,toolbar="+toolbar+",scrollbars="+scrollbars+",resizable="+resizable+",menubar=no,width="+width+",height="+height );
		
			eval(pWin).focus();
		
			return pWin;
		},
		
		/**
		* 팝업윈도우3
		* 파라미터  0) 오프너윈도우의 폼객체명 1) 팝업윈도우명 2) URL 3) 창 가로크기 4) 창 세로크기 5) 툴바 6) 스크롤바 7) 사이즈조절
		* 사용예 : popWindowSubmit('WIN', 'http://domain', 800, 600, 'yes', 'yes', 'yes');
		* @param {String} 오프너윈도우의 폼객체명
		* @param {String} 팝업윈도우명
		* @param {String} URL
		* @param {String} 창 가로크기
		* @param {String} 창 세로크기
		* @param {String} 툴바
		* @param {String} 스크롤바
		* @param {String} 사이즈조절
		* @returns 
		*/
		popWindowSubmit: function(form, objName, src, width, height, toolbar, scrollbars, resizable) {
			var lSize = ( screen.width - width ) / 2;
			var tSize = ( screen.height - height ) / 2;
		
			var wmd = window.open( "",
						objName,
						"top="+tSize+",left="+lSize+",status=no,toolbar="+toolbar+",scrollbars="+scrollbars+",resizable="+resizable+",menubar=no,width="+width+",height="+height );
		
			var prevTarget = form.target;
			form.target = objName;
			form.action = src;
			form.submit();
			form.target = prevTarget;
		
			eval(wmd).focus();
		
			return wmd;
		},
		
		/**
		 * create innerWindow
		 */
		setInnerWindow : function (url, inWinWidth, inWinHeight, inWinScrolling, _innerFrameName) {
			
			inWin = this.getObject(_innerFrameName);
		
			this.getInnerWindow(inWin, url, inWinWidth, inWinHeight, inWinScrolling);
		
			this.getInnerWindowShow(inWin);
		},
		
		/**
		 * create innerWindow width event position
		 */
		setInnerWindowEvent : function (_event, url, inWinWidth, inWinHeight, inWinScrolling, _innerFrameName) {
		
			inWin = this.getObject(_innerFrameName);
		
			this.getInnerWindowEvent(_event, inWin, url, inWinWidth, inWinHeight, inWinScrolling);
		
			this.getInnerWindowShow(inWin);
		},
		
		//create innerWindow width event position
		setInnerWindowEventLeft : function (_event, url, inWinWidth, inWinHeight, inWinScrolling, _innerFrameName) {
		
			inWin = this.getObject(_innerFrameName);
		
			this.getInnerWindowEventLeft(_event, inWin, url, inWinWidth, inWinHeight, inWinScrolling);
		
			this.getInnerWindowShow(inWin);
		},
		
		//create innerWindow width event position
		setInnerWindowEventRight : function (_event, url, inWinWidth, inWinHeight, inWinScrolling, _innerFrameName) {
		
			inWin = this.getObject(_innerFrameName);
		
			this.getInnerWindowEventRight(_event, inWin, url, inWinWidth, inWinHeight, inWinScrolling);
		
			this.getInnerWindowShow(inWin);
		},
		
		//create innerWindow width event position
		setInnerWindowEventAlignCenter : function (event, url, inWinWidth, inWinHeight, inWinScrolling, _innerFrameName) {
		
			inWin = this.getObject(_innerFrameName);
		
			this.getInnerWindowEventAlignCenter(event, inWin, url, inWinWidth, inWinHeight, inWinScrolling);
		
			this.getInnerWindowShow(inWin);
		},
		
		//exit innerWindow
		exitInnerWindow : function (_innerFrameWin) {
			inWin = this.getObject(_innerFrameWin);
		
			this.getInnerWindowHide(inWin);
		},
		
		// inner window ( in DIV )
		// 파라미터 0) 이너윈도우의 폼객체명 1) DIV객체명 2) URL 3) 창 가로크기 4) 창 세로크기 5) 스크롤여부
		// 사용예 : getInnerWindow('WIN', 'http://domain', 800, 600, 'yes');
		getInnerWindow : function (iwObject, iwSrc, iwWidth, iwHeight, iwScrolling) {
		
			inWinIFSrc = "<iframe name='inWinIF' id='inWinIF' src='"+iwSrc+"' width='100%' height='100%' frameborder='no' scrolling='"+iwScrolling+"' marginwidth='0' marginheight='0' style='padding:5 5 5 5;'></iframe>";
		
			//getStyleObject() is declared in env.js
			thisDIVObject = this.getStyleObject( iwObject );
		
			var leftPos = ( document.body.clientWidth - parseInt(iwWidth) ) / 2;
			var topPos = ( document.body.clientHeight - parseInt(iwHeight) ) / 2;
		
			thisDIVObject.width = iwWidth;
			thisDIVObject.height = iwHeight;
			thisDIVObject.left = leftPos;
			thisDIVObject.top = topPos;
		
			iwObject.innerHTML = inWinIFSrc;
		},
		
		// inner window ( in DIV ) width event
		// 파라미터 0) 이너윈도우의 폼객체명 1) DIV객체명 2) URL 3) 창 가로크기 4) 창 세로크기 5) 스크롤여부
		// 사용예 : getInnerWindow('WIN', 'http://domain', 800, 600, 'yes');
		getInnerWindowEvent : function (_event, iwObject, iwSrc, iwWidth, iwHeight, iwScrolling) {
			inWinIFSrc = "<iframe name='inWinIF' id='inWinIF' src='"+iwSrc+"' width='99%' height='98%' frameborder='no' scrolling='"+iwScrolling+"' marginwidth='0' marginheight='0' style='padding:5 5 5 5;'></iframe>";
		
			//getStyleObject() is declared in env.js
			thisDIVObject = this.getStyleObject( iwObject );
		
			thisDIVObject.width = iwWidth;
			thisDIVObject.height = iwHeight;
		
			thisDIVObject.left = document.body.scrollLeft + _event.clientX - iwWidth;
			//클릭 아래 로 보이기.
			thisDIVObject.top = document.body.scrollTop + _event.clientY;
			//클릭 위로 보이기.
			//tmpTopPos = parseInt(event.clientY-iwHeight);
			//tmpTopPos = parseInt(event.clientY);
			//if ( tmpTopPos < 0 ) tmpTopPos = 0;
			//thisDIVObject.top = tmpTopPos;
		
		
			iwObject.innerHTML = inWinIFSrc;
		},
		
		// inner window ( in DIV ) width event
		// 파라미터 0) 이너윈도우의 폼객체명 1) DIV객체명 2) URL 3) 창 가로크기 4) 창 세로크기 5) 스크롤여부
		// 사용예 : getInnerWindow('WIN', 'http://domain', 800, 600, 'yes');
		getInnerWindowEventLeft : function (_event, iwObject, iwSrc, iwWidth, iwHeight, iwScrolling) {
			inWinIFSrc = "<iframe name='inWinIF' id='inWinIF' src='"+iwSrc+"' width='99%' height='98%' frameborder='no' scrolling='"+iwScrolling+"' marginwidth='0' marginheight='0' style='padding:5 5 5 5;'></iframe>";
		
			//getStyleObject() is declared in env.js
			thisDIVObject = this.getStyleObject( iwObject );
		
			thisDIVObject.width = iwWidth;
			thisDIVObject.height = iwHeight;
		
			thisDIVObject.left = document.body.scrollLeft + _event.clientX - iwWidth;
			//클릭 아래 로 보이기.
			thisDIVObject.top = document.body.scrollTop + (_event.clientY/2);
			//클릭 위로 보이기.
			//tmpTopPos = parseInt(event.clientY-iwHeight);
			//tmpTopPos = parseInt(event.clientY);
			//if ( tmpTopPos < 0 ) tmpTopPos = 0;
			//thisDIVObject.top = tmpTopPos;
		
		
			iwObject.innerHTML = inWinIFSrc;
		},
		
		// inner window ( in DIV ) width event
		// 파라미터 0) 이너윈도우의 폼객체명 1) DIV객체명 2) URL 3) 창 가로크기 4) 창 세로크기 5) 스크롤여부
		// 사용예 : getInnerWindow('WIN', 'http://domain', 800, 600, 'yes');
		getInnerWindowEventRight : function (_event, iwObject, iwSrc, iwWidth, iwHeight, iwScrolling) {
			inWinIFSrc = "<iframe name='inWinIF' id='inWinIF' src='"+iwSrc+"' width='99%' height='98%' frameborder='no' scrolling='"+iwScrolling+"' marginwidth='0' marginheight='0' style='padding:5 5 5 5;'></iframe>";
		
			//getStyleObject() is declared in env.js
			thisDIVObject = this.getStyleObject( iwObject );
		
			thisDIVObject.width = iwWidth;
			thisDIVObject.height = iwHeight;
		
			thisDIVObject.left = document.body.scrollLeft + _event.clientX;
			//클릭 아래 로 보이기.
			thisDIVObject.top = document.body.scrollTop + (_event.clientY/2);
			//클릭 위로 보이기.
			//tmpTopPos = parseInt(event.clientY-iwHeight);
			//tmpTopPos = parseInt(event.clientY);
			//if ( tmpTopPos < 0 ) tmpTopPos = 0;
			//thisDIVObject.top = tmpTopPos;
		
		
			iwObject.innerHTML = inWinIFSrc;
		},
		
		// inner window ( in DIV ) width event
		// 파라미터 0) 이너윈도우의 폼객체명 1) DIV객체명 2) URL 3) 창 가로크기 4) 창 세로크기 5) 스크롤여부
		// 사용예 : getInnerWindow('WIN', 'http://domain', 800, 600, 'yes');
		getInnerWindowEventAlignCenter : function (event, iwObject, iwSrc, iwWidth, iwHeight, iwScrolling) {
		
			inWinIFSrc = "<iframe name='inWinIF' id='inWinIF' src='"+iwSrc+"' width='99%' height='98%' frameborder='no' scrolling='"+iwScrolling+"' marginwidth='0' marginheight='0' style='padding:5 5 5 5;'></iframe>";
		
			//getStyleObject() is declared in env.js
			thisDIVObject = this.getStyleObject( iwObject );
		
			thisDIVObject.width = iwWidth;
			thisDIVObject.height = iwHeight;
		
			thisDIVObject.left = (parseInt(screen.availWidth) - parseInt(iwWidth))/2;
			thisDIVObject.top = ( document.body.clientHeight - parseInt(iwHeight) ) / 2;
		
			iwObject.innerHTML = inWinIFSrc;
		},
		
		
		// inner window ( in DIV ) visible
		getInnerWindowShow : function (iwObject) {
			//message() si declared in env.js
			//conceal() is message div visibility set to hide
			mi = new doit.ui.Message();
		
			mi.look(iwObject);
		},
		
		// inner window ( in DIV ) hidden
		getInnerWindowHide : function (iwObject) {
			
			//message() si declared in env.js
			//conceal() is message div visibility set to hide
			mi = new doit.ui.Message();
		
			iwObject.innerHTML = "";
		
			mi.conceal(iwObject);
		},
		
		//w3c style object
		getStyleObject : function ( el ) {
			styleObject = null;
			if ( el ) {
				if ( el.style )
					styleObject = el.style;
				else
					styleObject = el;
			}
		
			return styleObject;
		},
		// browser cross function
		// getObject 함수는 각각의 객체에 대한 객체를 리턴
		getObject : function  ( el ) {
		
			// 파라미터 el 검사
			if ( doit.util.Validation.isNull(el) )
				return null;
		
			obj = null;
		
			// DOM expression 이 가능한지 여부 판단 후 분기.
			// DOM expression 이 가능한 경우 convCollectionDOM() 사용.
			// DOM expression 이 안되는 경우 convCollectionOLD() 사용.
			if ( this.isValidateDOM() )
				obj = this.convCollectionDOM ( el );
			else
				obj = this.convCollectionOLD ( el );
		
			// return 된 obj 검사
			if ( doit.util.Validation.isNull(obj) ) {
				return null;
			}
		
			return obj;
		},
		// 클라이언트 브라우져 체크.
		// DOM expression이 가능한 경우 true, 그렇지 않은경우 false return (W3C DOM 적용가능한 버전인지에 따라 [IE 5.xx/Netscape 6.xx high]) VALIDATION 체크).
		isValidateDOM : function () {
		
			isValid = true;
		
			if(env.ie5up || env.nav6over) {
				isValid = true;
			} else {
				isValid = false;
			}
		
			return isValid;
		},
		
		// OBJECT COLLECTION DOM EXPRESSION ( CROSS BROWSING )
		// IE 5.x 이상, Netscape 6.x 이상 에서만 적용됨.
		// return object
		convCollectionDOM : function  ( el , arrayAllowFlag) {
		
			collObj = null;
		
			//collObj = eval('document.getElementById("'+el+'")');
			//var collObjs = document.getElementsByName(el);
			//collObj = collObjs[0];
		
			//ID로 element 객체 생성 가능 한지 판다.
			//element에 ID가 부여되지 않았다면, getElementsByName으로 객체 생성
			//IE는 구분하지 않으나,
			//mozilla에서는 반드시 element에 id 속성을 부여해야만 getElementById를 통해 객체 생성 가능함.
			tmp = document.getElementById(el);
		
			if (arrayAllowFlag)	{
				collObj = document.getElementsByName(el);
			} else {
				if ( tmp != null && tmp != undefined ) {
						collObj = tmp;
				} else {
					collObj = document.getElementsByName(el)[0];
				}
			}
		
		
			return collObj;
		},
		
		// OBJECT ELEMENT EXPRESSION ( CROSS BROWSING )
		// IE4.x 이하, Netscape 4.xx 이하 에서만 적용됨.
		// return collection object
		convCollectionOLD : function ( el ) {
		
			eleObj = null;
		
			if ( isOldIE() ) {
				eleObj = eval ('document.all["'+el+'"]');
			} else if ( this.isOldNAV() ) {
				eleObj = eval ('document["'+el+'"]');
			} else {
				eleObj = el;
			}
			return eleObj;
		},
		
		// 클라이언트 브라우져 체크.
		// 네스케이프 버전 4이상 인경우 true, 그렇지 않은경우 false return.
		isOldNAV : function () {
		
			isValid = true;
		
			if ( env.nav6 )
				isValid = true;
			else
				isvalid = false;
		
			return isValid;
		},
		
		// 클라이언트 브라우져 체크.
		// IE 버전 4(윈98기본설치버전) 인경우 true, 그렇지 않은경우 false return.
		isOldIE : function () {
		
			isValid = true;
		
			if ( env.ie4 )
				isValid = true;
			else
				isvalid = false;
		
			return isValid;
		}
	};
}();

var env  = new Is();

// browser cross function
// Is 함수는 web-client 환경 분석을 위한 로직 및 변수를 포함함.
function Is () {
     	var agent=navigator.userAgent.toLowerCase();

     	this.major = parseInt(navigator.appVersion);
     	this.minor = parseFloat(navigator.appVersion);

		this.nav = ((agent.indexOf('mozilla')!=-1) && ((agent.indexOf('spoofer')==-1) && (agent.indexOf('compatible') == -1)));
		this.navonly = (this.nav && ((agent.indexOf(";nav") != -1) || (agent.indexOf(";nav") != -1)));
     	this.nav2 = (this.nav && (this.major == 2));
     	this.nav3 = (this.nav && (this.major == 3));
     	this.nav4 = (this.nav && (this.major == 4));
     	this.nav6 = (this.nav && (this.major >= 4));

     	this.ie = (agent.indexOf("msie") != -1 && (agent.indexOf("opera") == -1));
     	this.ie3 = (this.ie && (this.major < 3));
     	this.ie4 = (this.ie && (this.major == 4) && (agent.indexOf("msie") == -1));
     	this.ie5 = (this.ie && (this.major == 4) && (agent.indexOf("msie 5.0") != -1));
     	this.ie5_5 = (this.ie && (this.major == 4) && (agent.indexOf("msie 5.5") != -1));
     	this.ie6 = (this.ie && (this.major == 5 || this.major == 6));

     	this.nav6over = this.nav && (this.major >= 5);
     	this.ie5up  = (this.ie && !this.ie3 && !this.ie4);
     	this.ie5_5up = (this.ie && !this.ie3 && !this.ie4 && !this.ie5);

     	this.gecko = (agent.indexOf("gecko") != -1);

     	this.opera = (agent.indexOf("opera") != -1);
     	this.opera4 = (agent.indexOf("opera 4") != -1);
     	this.opera5 = ((agent.indexOf("opera 5") != -1) && (this.major == 5));
     	this.opera5over = (this.opera && (this.major >= 5));

     	/********************************************************************************************
     	* AOL BROWSER Upversion Checking
     	*********************************************************************************************
     	* AOL : AOL(IE)
     	* AOL3 : AOL(IE) 3
     	* AOL4 : AOL(IE) 4
     	* AOL5 : AOL(IE) 5.xx
     	* AOL6 : AOL(IE) 6.xx
     	********************************************************************************************/
     	this.aol = (agent.indexOf("aol") != -1);
     	this.aol3 = (this.aol && this.ie3);
     	this.aol4 = (this.aol && this.ie4);
     	this.aol5 = (agent.indexOf("aol 5") != -1);
     	this.aol6 = (agent.indexOf("aol 6") != -1);

     	/********************************************************************************************
     	* HOTJAVA BROWSER Upversion Checking
     	*********************************************************************************************
	* HOTJAVA : Sun HotJava
	* HOTJAVA3 : Sun HotJava 3
	* HOTJAVA3UP : Sun HotJava 3.xx ~ Over
     	********************************************************************************************/
     	this.hotjava = (agent.indexOf("hotjava") != -1);
     	this.hotjava3 = (this.hotjava && (this.major == 3));
     	this.hotjava3up = (this.hotjava && (this.major >= 3));

     	/********************************************************************************************
     	* MAC BROWSER VERSION Checking
     	*********************************************************************************************
     	* isIE3Mac : this section is designed specifically for IE3 for the Mac
     	********************************************************************************************/
	this.isIE3Mac = (navigator.appVersion.indexOf("Mac")!=-1) && (navigator.appVersion.indexOf("MSIE"!=-1)) && (parseInt(navigator.appVersion) == 3);

	/********************************************************************************************
     	* BROWSER VERSION Checking
     	* WEBTV : Web TV
     	********************************************************************************************/
     	this.webtv = (agent.indexOf("webtv") != -1);

     	/********************************************************************************************
     	* Operating System Checking
     	*********************************************************************************************
     	* WIN9X
     	* WINNT
     	* OS2
     	* SUN
     	* IRIX
     	* HPUX
     	* AIX
     	* LINUX
     	* UNIXWARE
     	* MAC
     	* FREEBSD
     	* BSD
     	* VMS
     	********************************************************************************************/
     	this.win9x = (agent.indexOf("win") != -1);
     	this.winnt = (agent.indexOf("winnt") != -1);
     	this.os2 = (agent.indexOf("os/2") != -1);
     	this.sun = (agent.indexOf("sunos") != -1);
     	this.irix = (agent.indexOf("irix") != -1);
     	this.hpux = (agent.indexOf("hp-ux") != -1);
     	this.aix = (agent.indexOf("aix") != -1);
     	this.linux = (agent.indexOf("linux") != -1);
     	this.unixware = (agent.indexOf("unix_system_v") != -1);
     	this.mac = (agent.indexOf("mac") != -1);
     	this.freebsd = (agent.indexOf("freebsd") != -1);
     	this.bsd = (agent.indexOf("bsd") != -1);
     	this.vms = ((agent.indexOf("vax") != -1) || (agent.indexOf("openvms") != -1));

}

/**
 * @namespace doit.ui.message
 */
doit.ui.Message = Class.create();
doit.ui.Message.prototype = {
		
		initialize: function(){
			// div 보이기/숨기기 처리 시, 사용되는 value.
			// message() 함수에서 사용하기 위한 value.
			this.visibleValue = new Array(3);
			this.inVisibleValue = new Array(3);
			
			//DOM and IE
			this.visibleValue[0] = "visible";
			//NS
			this.visibleValue[1] = "show";
			this.visibleValue[2] = "";
			
			//DOM and IE
			this.inVisibleValue[0] = "hidden";
			//NS
			this.inVisibleValue[1] = "hide";
			this.inVisibleValue[2] = "none";
		},
		
		/**
	     *  메시지 표시
	     *  @param {target} target
	     *  @param {String} message
	     */
		display : function( _target, _message ) {
	
			//cross browsing
			if ( _target.innerText ) {
				_target.innerText = _message;
			} else {
					while ( _target.hasChildNodes() )
						_target.removeChild( _target.firstChild );
	
				_target.appendChild( document.createTextNode(_message) );
			}
		},
	
		/**
	     *  메시지  보이기
	     *  @param {element}
	     */
		look : function( el ) {
	
			_target = doit.ui.Popup.getStyleObject(el);
	
			if ( !doit.ui.Popup.isValidateDOM() && doit.ui.Popup.isOldNAV() )
				_target.visibility = this.visibleValue[1];
			else
				_target.visibility = this.visibleValue[0];
	
			_target.padding = "2";
		},
		
		/**
	     *  메시지  숨기기
	     *  @param {element}
	     */
		conceal : function( el ) {
		
			_target = doit.ui.Popup.getStyleObject(el);
	
			if ( !doit.ui.Popup.isValidateDOM() && doit.ui.Popup.isOldNAV() )
				_target.visibility = this.inVisibleValue[1];
			else
				_target.visibility = this.inVisibleValue[0];
		},
		
		/**
	     *  메시지  보이기
	     *  @param {element}
	     */
		show : function( el ) {
	
			_target = doit.ui.Popup.getStyleObject(el);
			_target.display = this.visibleValue[2];
		},
		
		/**
	     *  메시지  숨기기
	     *  @param {element}
	     */
		hide : function( el ) {
	
			_target = doit.ui.Popup.getStyleObject(el);
			_target.display = this.inVisibleValue[2];
		}
}

/********************************************************
 Make this IE7 Compatible ;)
 http://ajaxian.com/archives/ajax-on-ie-7-check-native-first
*********************************************************/
createRequestObject = function() {
	var xmlhttp;
		/*@cc_on
	@if (@_jscript_version>= 5)
			try {xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
			} catch (e) {
					try {xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");}
					catch (E) {xmlhttp = false;}
			}
	@else
		xmlhttp = false;
	@end @*/
	if (!xmlhttp && typeof XMLHttpRequest != "undefined") {
			try {xmlhttp = new XMLHttpRequest();} catch (e) {xmlhttp = false;}
	}
	return xmlhttp;
}

var http = createRequestObject();

/**
 * @namespace doit.ui.file
 */
doit.ui.File = function(){
	return {
		/**
		* 첨부파일 리스트를 HTML로 변환(List 화면에서)
		* @param {List} attach_list
		* @param {String} attachFilePath
		* @param {String} image_flag
		* @param {String} callback
		* @returns HTML
		*/
		// 첨부파일 리스트를 HTML로 변환(List 화면에서)
		createAttachFileHTML : function(attach_list, attachFilePath, image_flag, callback) {
		 var result = "";
		 if ( attach_list == null || attach_list.length == 0 || attach_list[0].idx == 0) {
			result = "-";
		 } else {
			for(i=0; i < (attach_list.length > 3 ? 3 : attach_list.length); i++) {
		
			  var file_ext = attach_list[i].file_ext.toLowerCase();
				imageSrc = returnImage(file_ext);
			 if(image_flag != undefined){
				if(file_ext == 'gif' || file_ext == 'png' ||  file_ext == 'jpg' || file_ext == 'jpeg'){
				  result += "<a href='#' onclick=\""+callback+"(event, '/FileDownLoader?saveName=" + attach_list[i].real_file_name + "&viewName=" + attach_list[i].file_name + "&attachFilePath="+ attachFilePath +"&image_flag=yes','"+attach_list[i].file_name+"')\">";
				} else {
				 result += "<a  href=\"/FileDownLoader?saveName=" + attach_list[i].real_file_name + "&viewName=" + attach_list[i].file_name + "&attachFilePath="+ attachFilePath +"\">";
				}
			 } else {
				result += "<a  href=\"/FileDownLoader?saveName=" + attach_list[i].real_file_name + "&viewName=" + attach_list[i].file_name + "&attachFilePath="+ attachFilePath +"\">";
			 }
			  result += "<img src=\"/images/common/" + imageSrc + "\" border=\"0\" align='absmiddle'> ";
			  result +="</a>";
			}
		 }
		
		 return result;
		},
		
		/**
		* 첨부파일 리스트를 HTML로 변환(List 화면에서)
		* @param {List} attach_list
		* @param {String} attachFilePath
		* @param {String} image_flag
		* @param {String} callback
		* @returns HTML
		*/
		// 첨부파일 리스트를 HTML로 변환(List 화면에서)
		viewAttachFileHTML : function(attach_list, attachFilePath, image_flag, callback) {
		var result = "";
		if ( attach_list == null || attach_list.length == 0) {
			result = "-";
		} else {
			for(i=0; i < attach_list.length; i++) {
			var file_ext = attach_list[i].file_ext.toLowerCase();
				imageSrc = returnImage(file_ext);
			if(image_flag != undefined){
				if(file_ext == 'gif' || file_ext == 'png' ||  file_ext == 'jpg' || file_ext == 'jpeg'){
					result += "<a href='#' onclick=\""+callback+"(event, '/FileDownLoader?saveName=" + attach_list[i].real_file_name + "&viewName=" + attach_list[i].file_name + "&attachFilePath="+ attachFilePath +"&image_flag=yes','"+attach_list[i].file_name+"')\">";
				} else {
					result += "<a  href=\"/FileDownLoader?saveName=" + attach_list[i].real_file_name + "&viewName=" + attach_list[i].file_name + "&attachFilePath="+ attachFilePath +"\">";
				}
			} else {
				result += "<a  href=\"/FileDownLoader?saveName=" + attach_list[i].real_file_name + "&viewName=" + attach_list[i].file_name + "&attachFilePath="+ attachFilePath +"\">";
			}
				result += "<img src=\"/images/common/" + imageSrc + "\" border=\"0\" align='absmiddle'> "+attach_list[i].file_name +" ("+Math.round(attach_list[i].file_size/1024*100)/100+"Kb)";
				result +="</a>&nbsp;";
			}
		}
		  return result;
		},
		
		/**
		* 공통 게시판 수정화면에서의 파일 첨부 리스트 (lms_bod_attach table)
		* @param {List} attach_list
		* @param {String} attachFilePath
		* @param {String} image_flag
		* @param {String} callback
		* @returns HTML
		*/
		createAttachCheckFileHTML : function(attach_list, attachFilePath, image_flag, callback) {
			var result = "";
			if ( attach_list == null || attach_list.length == 0 || attach_list[0].idx == 0) {return result="-";}
		
			for(i=0; i < attach_list.length; i++) {
			  var file_ext = attach_list[i].file_ext.toLowerCase();
				imageSrc = returnImage(file_ext);
			  result += "<div id='AttachFile_"+attach_list[i].file_idx+"' style='width:100%'>" ;
			  result += "<input type='checkbox' value='"+attach_list[i].file_idx+"' id='fileIdx"+attach_list[i].file_idx+"' class='fileIdx'>";
		
			 if(image_flag != undefined){
				if(file_ext == 'gif' || file_ext == 'png' ||  file_ext == 'jpg' || file_ext == 'jpeg'){
				  result += "<a href='#' onclick=\""+callback+"(event, '/FileDownLoader?saveName=" + attach_list[i].real_file_name + "&viewName=" + attach_list[i].file_name + "&attachFilePath="+ attachFilePath +"&image_flag=yes','"+attach_list[i].file_name+"')\">";
				} else {
				 result += "<a  href=\"/FileDownLoader?saveName=" + attach_list[i].real_file_name + "&viewName=" + attach_list[i].file_name + "&attachFilePath="+ attachFilePath +"\">";
				}
			 } else {
				result += "<a  href=\"/FileDownLoader?saveName=" + attach_list[i].real_file_name + "&viewName=" + attach_list[i].file_name + "&attachFilePath="+ attachFilePath +"\">";
			 }
			  result += "<img src=\"/images/common/" + imageSrc + "\" border=\"0\" align='absmiddle'> "+attach_list[i].file_name +" ("+Math.round(attach_list[i].file_size/1024*100)/100+"Kb)";
			  result += "</a><br/>";
			  result += "</div>";
			}
		
			return result;
		},
		
		/**
		* 공통 게시판 수정화면에서의 파일 첨부 리스트 (lms_bod_attach table)
		* @param {List} attach_list
		* @param {String} attachFilePath
		* @param {String} image_flag
		* @param {String} callback
		* @returns HTML
		*/
		// 공통 게시판 이외의 수정화면에서의 파일 첨부 리스트 (lms_com_file table)
		createCommonAttachCheckFileHTML : function(attach_list, attachFilePath,  image_flag, callback) {
			var result = "";
			if ( attach_list == null || attach_list.length == 0 || attach_list[0].idx == 0) {return result="-";}
		
			for(i=0; i < attach_list.length; i++) {
			 var file_ext = attach_list[i].file_ext.toLowerCase();
			  imageSrc = returnImage(file_ext);
			  result += "<div id='AttachFile_"+attach_list[i].idx+"' style='width:100%'>" ;
			  result += "<input type='checkbox' value='"+attach_list[i].idx+"' id='fileIdx"+attach_list[i].idx+"' class='fileIdx'>";
		
			 if(image_flag != undefined){
				if(file_ext == 'gif' || file_ext == 'png' ||  file_ext == 'jpg' || file_ext == 'jpeg'){
				  result += "<a href='#' onclick=\""+callback+"(event, '/FileDownLoader?saveName=" + attach_list[i].real_file_name + "&viewName=" + attach_list[i].file_name + "&attachFilePath="+ attachFilePath +"&image_flag=yes','"+attach_list[i].file_name+"')\">";
				} else {
				 result += "<a  href=\"/FileDownLoader?saveName=" + attach_list[i].real_file_name + "&viewName=" + attach_list[i].file_name + "&attachFilePath="+ attachFilePath +"\">";
				}
			 } else {
				result += "<a  href=\"/FileDownLoader?saveName=" + attach_list[i].real_file_name + "&viewName=" + attach_list[i].file_name + "&attachFilePath="+ attachFilePath +"\">";
			 }
			  result += "<img src=\"/images/common/" + imageSrc + "\" border=\"0\" align='absmiddle'> "+attach_list[i].file_name +" ("+Math.round(attach_list[i].file_size/1024*100)/100+"Kb)";
			  result += "</a><br/>";
			  result += "</div>";
			}
		
			return result;
		}
	};
}();

	
/**
 * @namespace doit.ui.menu
 */
doit.ui.Menu = function(){
	return {
		
		/**
		 * <ul id="tabmenu" onclick="doit_TabChange ( 'tabmenu', event );">
		 *		<li><a class="active">tab menu1</a></li>
		 *		<li><a>tab menu2</a></li>
		 *		<li><a>tab menu3</a></li>
		 * </ul>
		 * <div id="tabcontent">content</div>
		 * @param {Object} sTabParent
		 * @param {Object} oEvent
		 */
		doit_TabChange : function ( sTabParent, oEvent ) {
			try {
				Event.extend(oEvent);
				var oTabParent = $(sTabParent);
				var oSourceNode = oEvent.target;
		
				if ( oSourceNode.tagName == "A" ) {
					for ( var i = 0; i < oTabParent.childNodes.length; i++ ) {		// remove classname
						if ( oTabParent.childNodes[i].nodeType != 3 && oTabParent.childNodes[i].tagName == "LI" )  {
							oTabParent.childNodes[i].getElementsByTagName("a")[0].className = "";
						}
					}
					oSourceNode.className = "active";
				}
				oEvent.stop ();
			} catch ( err ) {
			}
		},
		
		moveRightEdge : function () {
			var yMenuFrom, yMenuTo, yOffset, timeoutNextCheck;
		
			yMenuFrom   = parseInt ($("persist").style.top, 10); // element top offset
			yMenuTo     = document.viewport.getScrollOffsets().top + 145; // top scroll offset
			timeoutNextCheck = 500;
		
			if (yMenuFrom != yMenuTo) {
				yOffset = Math.ceil(Math.abs(yMenuTo - yMenuFrom) / 20);
				if (yMenuTo < yMenuFrom)
					yOffset = -yOffset;
					
				$("persist").style.top = (parseInt ($("persist").style.top, 10) + yOffset)+"px";
				timeoutNextCheck = 5; // 베너 내려오는속도 조절
			}
			setTimeout ('doit.ui.Menu.moveRightEdge()', timeoutNextCheck);
		}
	}
}();

/**
 * @namespace doit.ui.Drag
 * dom-drag.js
 * 09.25.2001
 * www.youngpup.net
 * Script featured on Dynamic Drive (http://www.dynamicdrive.com) 12.08.2005
 * 10.28.2001 - fixed minor bug where events
 * sometimes fired off the handle, not the root.
 */
var Drag = {

	obj : null,
	
	/**
	 * init
	 * @param {o} o
	 * @param {oRoot} oRoot
	 * @param {minX} minX
	 * @param {maxX} maxX
	 * @param {minY} minY
	 * @param {maxY} maxY
	 * @param {bSwapHorzRef} bSwapHorzRef
	 * @param {bSwapVertRef} bSwapVertRef
	 * @param {fXMapper} fXMapper
	 * @param {fYMapper} fYMapper 
	 */
	init : function(o, oRoot, minX, maxX, minY, maxY, bSwapHorzRef, bSwapVertRef, fXMapper, fYMapper)
	{
		o.onmousedown	= Drag.start;

		o.hmode			= bSwapHorzRef ? false : true ;
		o.vmode			= bSwapVertRef ? false : true ;

		o.root = oRoot && oRoot != null ? oRoot : o ;

		if (o.hmode  && isNaN(parseInt(o.root.style.left  ))) o.root.style.left   = "0px";
		if (o.vmode  && isNaN(parseInt(o.root.style.top   ))) o.root.style.top    = "0px";
		if (!o.hmode && isNaN(parseInt(o.root.style.right ))) o.root.style.right  = "0px";
		if (!o.vmode && isNaN(parseInt(o.root.style.bottom))) o.root.style.bottom = "0px";

		o.minX	= typeof minX != 'undefined' ? minX : null;
		o.minY	= typeof minY != 'undefined' ? minY : null;
		o.maxX	= typeof maxX != 'undefined' ? maxX : null;
		o.maxY	= typeof maxY != 'undefined' ? maxY : null;

		o.xMapper = fXMapper ? fXMapper : null;
		o.yMapper = fYMapper ? fYMapper : null;

		o.root.onDragStart	= new Function();
		o.root.onDragEnd	= new Function();
		o.root.onDrag		= new Function();
	},
	
	/**
	 * start
	 */
	start : function(e)
	{
		var o = Drag.obj = this;
		e = Drag.fixE(e);
		var y = parseInt(o.vmode ? o.root.style.top  : o.root.style.bottom);
		var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );
		o.root.onDragStart(x, y);

		o.lastMouseX	= e.clientX;
		o.lastMouseY	= e.clientY;

		if (o.hmode) {
			if (o.minX != null)	o.minMouseX	= e.clientX - x + o.minX;
			if (o.maxX != null)	o.maxMouseX	= o.minMouseX + o.maxX - o.minX;
		} else {
			if (o.minX != null) o.maxMouseX = -o.minX + e.clientX + x;
			if (o.maxX != null) o.minMouseX = -o.maxX + e.clientX + x;
		}

		if (o.vmode) {
			if (o.minY != null)	o.minMouseY	= e.clientY - y + o.minY;
			if (o.maxY != null)	o.maxMouseY	= o.minMouseY + o.maxY - o.minY;
		} else {
			if (o.minY != null) o.maxMouseY = -o.minY + e.clientY + y;
			if (o.maxY != null) o.minMouseY = -o.maxY + e.clientY + y;
		}

		document.onmousemove	= Drag.drag;
		document.onmouseup		= Drag.end;

		return false;
	},
	
	/**
	 * drag
	 */
	drag : function(e)
	{
		e = Drag.fixE(e);
		var o = Drag.obj;

		var ey	= e.clientY;
		var ex	= e.clientX;
		var y = parseInt(o.vmode ? o.root.style.top  : o.root.style.bottom);
		var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );
		var nx, ny;

		if (o.minX != null) ex = o.hmode ? Math.max(ex, o.minMouseX) : Math.min(ex, o.maxMouseX);
		if (o.maxX != null) ex = o.hmode ? Math.min(ex, o.maxMouseX) : Math.max(ex, o.minMouseX);
		if (o.minY != null) ey = o.vmode ? Math.max(ey, o.minMouseY) : Math.min(ey, o.maxMouseY);
		if (o.maxY != null) ey = o.vmode ? Math.min(ey, o.maxMouseY) : Math.max(ey, o.minMouseY);

		nx = x + ((ex - o.lastMouseX) * (o.hmode ? 1 : -1));
		ny = y + ((ey - o.lastMouseY) * (o.vmode ? 1 : -1));

		if (o.xMapper)		nx = o.xMapper(y)
		else if (o.yMapper)	ny = o.yMapper(x)

		Drag.obj.root.style[o.hmode ? "left" : "right"] = nx + "px";
		Drag.obj.root.style[o.vmode ? "top" : "bottom"] = ny + "px";
		Drag.obj.lastMouseX	= ex;
		Drag.obj.lastMouseY	= ey;

		Drag.obj.root.onDrag(nx, ny);
		return false;
	},
	
	/**
	 * end
	 */
	end : function()
	{
		document.onmousemove = null;
		document.onmouseup   = null;
		Drag.obj.root.onDragEnd(	parseInt(Drag.obj.root.style[Drag.obj.hmode ? "left" : "right"]), 
									parseInt(Drag.obj.root.style[Drag.obj.vmode ? "top" : "bottom"]));
		Drag.obj = null;
	},
	
	/**
	 * fixE
	 */
	fixE : function(e)
	{
		if (typeof e == 'undefined') e = window.event;
		if (typeof e.layerX == 'undefined') e.layerX = e.offsetX;
		if (typeof e.layerY == 'undefined') e.layerY = e.offsetY;
		return e;
	}
};


doit.util = {
	version : '0.0.3_rc1',
	license : 'CTUnion. co. ltd.',
	build : '2009.04.21',
	author : 'dnsnl'
}

/**
 * @namespace doit.util.page
 */
doit.util.page = Class.create();
doit.util.page.prototype = {
	 /**
	  * cfg 파라미터의 changePage 속성이 넘어왔을때 페이지 이동시 호출함수 설정
	  * 값이 없을때 default으로 changePage 함수로 설정 
	  */
	  initialize: function(cfg){
		 this.current = '1',
		 this.first = '',
		 this.end = '',
		 this.next = '',
		 this.prev = '',
		 this.ipp = '10',
		 this.totalItem = '';
	
		 // 페이지 이동 시 호출되는 Function 이름
		 this.changePageFunction = (cfg != undefined && cfg.changePage != undefined)? cfg.changePage :'changePage';
	
		 // 이미지 경로 저장 변수
		 this.firstImagePath = '/images/board/btn/btn_list_bottom_prev1.gif';
		 this.prevImagePath = '/images/board/btn/btn_list_bottom_prev2.gif';
		 this.nextImagePath = '/images/board/btn/btn_list_bottom_next2.gif';
		 this.endImagePath = '/images/board/btn/btn_list_bottom_next1.gif';
	
	  },
	  
	  /**
	   *  ipp, current, totalItem을 입력하면 paging 계산
	   */
	  calcPaging : function() {
		 this.ipp = (this.ipp==0) ? 10 : this.ipp;
		 if ( this.totalItem != 0 ) {
			this.end = parseInt(this.totalItem/this.ipp) + (((this.totalItem%this.ipp)==0)?0:1);
			this.next = parseInt(Math.ceil( (this.current/10.0) )*10);
			this.prev = this.next - 9;
			this.next =  ( this.next > this.end)?this.end:this.next;
			this.first = 1;
		 } else {
			this.clear();
		 }
	  },
	  
	  /**
	   *  pageCondtion 를 초기화한다.
	   */
	  clear : function() {
		 this.current = '1',
		 this.first = '',
		 this.end = '',
		 this.next = '',
		 this.prev = '',
		 this.ipp = '10',
		 this.totalItem = '';
	  },
	  
	  /**
	   *  승인자 페이징 데이터를 리턴한다.
	   *  @returns pageHTML
	   */
	  getPaging: function(){
		 var pageHTML = '';
		 if (this.first != 0) {
			if (this.prev != this.first) {
			  pageHTML += "<a href=\"javascript:" + this.changePageFunction + "(" + Number(this.first) + ");\"><img src='" + this.firstImagePath + "' alt=\"첫페이지\" title=\"첫페이지\" /></a>";
			  pageHTML += "<a href=\"javascript:" + this.changePageFunction + "(" + Number(this.prev - 1) + ");\"><img src='" + this.prevImagePath + "' alt=\"첫페이지\" title=\"첫페이지\" /></a>";
			}
	
			pageHTML += '<span class="pnl-paging-list">';
			for (var i = this.prev; i <= this.next; i++) {
			  if (i == this.current) {
				 pageHTML += '<span class="item">' + i + '</span>';
			  }
			  else {
				 pageHTML += '<a href="javascript:' + this.changePageFunction + '(' + i + ');" class="item">' + i + '</a>';
			  }
			}
			pageHTML += '</span>';
	
			if (this.next != this.end) {
			  pageHTML += "<a href=\"javascript:" + this.changePageFunction + "(" + Number(this.next + 1) + ");\"><img src='" + this.nextImagePath + "' alt=\"다음 페이지\" title=\"다음 페이지\" /></a>";
			  pageHTML += "<a href=\"javascript:" + this.changePageFunction + "(" + Number(this.end) + ");\"><img src='" + this.endImagePath + "' alt=\"마지막 페이지\" title=\"마지막 페이지\" /></a>";
			}
		 }
		 return pageHTML;
	  },
	  
	  /**
	   *  승인자 페이징 데이터를 리턴한다.
	   *  @returns pageHTML
	   */
	  getPagingAdmin: function(){
		 var pageHTML = '';
		 if (this.first != 0) {
			if (this.prev != this.first) {
			  pageHTML += "<a href=\"javascript:" + this.changePageFunction + "(" + Number(this.first) + ");\"><img src='" + this.firstImagePath + "' align='absmiddle' style='margin:2px 0 0 0' border='0'></a>";
			  pageHTML += "<a href=\"javascript:" + this.changePageFunction + "(" + Number(this.prev - 1) + ");\"><img src='" + this.prevImagePath + "' align='absmiddle' style='margin:2px 10px 0 0' border='0'></a>";
			}
	
			for (var i = this.prev; i <= this.next; i++) {
			  if (i == this.current) {
				 pageHTML += "<b><u>" + i + "</u></b>";
			  }
			  else {
				 pageHTML += "<a href='javascript:" + this.changePageFunction + "(" + i + ");'>" + i + "</a>";
			  }
	
			  if (i != this.next && this.prev != this.next) {
				 pageHTML += "&nbsp;/&nbsp;";
			  }
			}
	
			if (this.next != this.end) {
			  pageHTML += "<a href=\"javascript:" + this.changePageFunction + "(" + Number(this.next + 1) + ");\"><img src='" + this.nextImagePath + "' align='absmiddle' style='margin:2px 0 0 10px' border='0'></a>";
			  pageHTML += "<a href=\"javascript:" + this.changePageFunction + "(" + Number(this.end) + ");\"><img src='" + this.endImagePath + "' align='absmiddle' style='margin:2px 0 0 0' border='0'></a>";
			}
		 }
		 return pageHTML;
	  }
}

/**
 * @namespace doit.util.Cookie
 */
doit.util.Cookie = Class.create();
doit.util.Cookie.prototype = {
	
	 /**
	   *  initialize
	   */
	initialize: function(){
		
		this.expDays = 365;//쿠키만료일
		this.exp = new Date();
		this.exp.setTime(this.exp.getTime() + (this.expDays*24*60*60*1000));
	},
	
	 /**
	   *  getDoitCookieVal
	   *  @param {offset}
	   *  @returns 
	   */
	getDoitCookieVal : function (offset) {
        var endstr = document.cookie.indexOf (";", offset);
        if (endstr == -1)
                endstr = document.cookie.length;
                return unescape(document.cookie.substring(offset, endstr));
	},
	
	/**
   	 *  getDoitCookie
     *  @param {name}
     *  @returns 
   	 */
	getDoitCookie : function (name) {
        var arg = name + "=";
        var alen = arg.length;
        var clen = document.cookie.length;
        var i = 0;
        while (i < clen) {
	        var j = i + alen;
	        if (document.cookie.substring(i, j) == arg) {
                return this.getDoitCookieVal (j);
			}
            i = document.cookie.indexOf(" ", i) + 1;
            if (i == 0) {
            	break;
            }
        }
        return null;
	},
	
	/**
   	 *  setDoitCookie
     *  @param {name}
     *  @param {value}
   	 */
	setDoitCookie : function (name, value) {
        var argv = this.setDoitCookie.arguments;
        var argc = this.setDoitCookie.arguments.length;
        var expires = (argc > 2) ? argv[2] : null;
//		expires = exp;
        var path = (argc > 3) ? argv[3] : null;
        var domain = (argc > 4) ? argv[4] : null;
        var secure = (argc > 5) ? argv[5] : false;
        document.cookie = name + "=" + escape (value) +
        ((expires == null) ? ("; expires=" + this.exp.toGMTString()) : ("; expires=" + expires.toGMTString())) +
        ((path == null) ? "" : ("; path=" + path)) +
        ((domain == null) ? "" : ("; domain=" + domain)) +
        ((secure == true) ? "; secure" : "");
	},
	
	/**
   	 *  delDoitCookie
     *  @param {name}
   	 */
	delDoitCookie :function (name) {
        var exp = new Date();
        exp.setTime (exp.getTime() - 1);
        // This cookie is history
        var cval = this.getDoitCookie (name);
        document.cookie = name + "=" + cval + "; expires=" + exp.toGMTString();

	}
}

/**
 * @namespace doit.util.validation
 */
doit.util.Validation = function(){
	return {
		
	  /**
	   *  OBJECT or VALUE NULL 체크
	   *  @param {obj}
	   *  @returns null이 아니면 true, null이면 false return;
	   */
		isNull : function( obj ) {
	
			isValid = true;
		
			if ( obj != null && obj != "null" && obj != "undefined" && obj != "" )
				isValid = false;
		
			return isValid;
		},
		
		/**
	     *  null이거나 빈스트링을 str2로 치환한다.
	     *  @param {String}
	     *  @param {String}
	     *  @returns String
	     */
		nvl : function( str, str2 ) {
			if ( str == null || str == "null" || str == "undefined" || str == '' ) return str2;
			else return str;
		},
		
		/**
	     *  NULL 또는 UNDEFINED 인 ELEMENT 를 위한 빈스트링 반환
	     *  @param {String}
	     *  @returns 공백리턴
	     */
		//NULL 또는 UNDEFINED 인 ELEMENT 를 위한 빈스트링 반환
		boundNullToString : function(_str) {
			if ( null == _str || 'undefined' == _str || 'null' == _str )
				_str = "";
			return _str;
		},
		
		/**
	     *  필수요소인 각 element validation 체크.
	     *  element 에 null 또는 공백 문자열만 입력된 경우 처리.
	     *  @param {obj} 체크하려는 폼
	     *  @returns boolean
	     */
		formNecessaryValidate : function (oForm) {
		
			for (var i = 0; i < oForm.length; i++) {
				if (oForm.elements[i].getAttribute("mandatory") != null) {
					if (doit.lang.String.getOnlyString(oForm.elements[i].value.trim()).length == 0) {
						alert (oForm.elements[i].alt + " 값이 없습니다!");
		
						if ( 'hidden' != oForm.elements[i].type )
							oForm.elements[i].focus();
		
						return false;
					}
				}
			}
			return true;
		},
		
		/**
		  * 라디오버튼값 쓰기(보기,수정폼에서 쓰임)
		  * @param {array} array
		  * @param {val} val
		  */
		setRadioButtonValue : function( array, val ){       
			for (var i =0; i<array.length; i++){           
				if( array[i].value == val ){               
					array[i].checked = true;
				}       
			}
		},
		
		/**
	     *  form radio element에서 체크된 값 반환
	     *  @param {array} 
	     *  @returns 체크값
	     */
		// form radio element에서 체크된 값 반환
		getRadioCheckedValue : function(array){
			var result;
			for (var i = 0; i < array.length; i++) {
				if ( array[i].checked ) {
					result = array[i].value;
					break;
				}
			}
		
			return result;
		},
		
		/**
	     *  form radio element에서 체크된 타이틀을 반환
	     *  @param {array} 
	     *  @returns 체크타이틀
	     */
		getRadioCheckedTitle : function (array) {
			var result;
			for (var i = 0; i < array.length; i++) {
				if ( array[i].checked ) {
					result = array[i].title;
					break;
				}
			}
		
			return result;
		},
		
		/**
	     *  주민등록번호 체크
	     *  @param {String} 주민등록번호 앞6자리
	     *  @param {String} 주민등록번호 뒤7자리
	     *  @returns boolean
	     */
		check_jumin : function(input, input2) {
		
			var p_no	= new Array(13);
			var preg1	= input.value;
			var preg2	= input2.value;
			var last_id, no_mod, no_minus, no_last;
		
			if (preg1 == '' || preg1.length !=6) {
				alert('주민등록번호 앞번호 6자리를 입력하세요.');
				input.focus();
				input.select();
				return false;
			}
		
			if (preg2 == '' || preg2.length !=7) {
			   alert('주민등록번호 뒷번호 7자리를 입력하세요.');
				input2.focus();
				input2.select();
				return false;
			}
			if (!((preg2.substring(0,1) == '1') || (preg2.substring(0,1) == '2') || (preg2.substring(0,1) == '3') || (preg2.substring(0,1) == '4'))) {
				alert('주민등록번호 뒷자리를 맞게 입력 해주세요.');
				input2.focus();
				input2.select();
				return false;
			}
		
			last_id		= parseInt(preg2.substring(6,7));
			p_no[0]		= parseInt(preg1.substring(0,1)) * 2;
			p_no[1]		= parseInt(preg1.substring(1,2)) * 3;
			p_no[2]		= parseInt(preg1.substring(2,3)) * 4;
			p_no[3]		= parseInt(preg1.substring(3,4)) * 5;
			p_no[4]		= parseInt(preg1.substring(4,5)) * 6;
			p_no[5]		= parseInt(preg1.substring(5,6)) * 7;
			p_no[6]		= parseInt(preg2.substring(0,1)) * 8;
			p_no[7]		= parseInt(preg2.substring(1,2)) * 9;
			p_no[8]		= parseInt(preg2.substring(2,3)) * 2;
			p_no[9]		= parseInt(preg2.substring(3,4)) * 3;
			p_no[10]	= parseInt(preg2.substring(4,5)) * 4;
			p_no[11]	= parseInt(preg2.substring(5,6)) * 5;
			p_no[12]	= 0;
		
			for (var i	= 0; i < 12; i++) {
				p_no[12] = p_no[12] + p_no[i];
			}
			no_mod		= p_no[12] % 11;
			no_minus	= 11 - no_mod;
			no_last		= no_minus % 10;
		
			if (no_last != last_id) {
				alert('주민등록번호가 맞지않습니다.');
				input.focus();
				input.select();
				return false;
			}
		
			return true;
		},
		
		/**
	     *  외국인 등록번호
	     *  @param {String} 외국인 등록번호 13자리
	     *  @returns boolean
	     */
		forignIdentity : function(foreignIdentity){
			if (foreignIdentity == ''){
				alert('외국인등록번호를 입력하십시오.');
				return false;
			}
		
			if (foreignIdentity.length != 13) {
				alert('외국인등록번호 자리수가 맞지 않습니다.');
				return false;
			}
			if ((foreignIdentity.charAt(6) == "5") || (foreignIdentity.charAt(6) == "6")) {
				birthYear = "19";
			}else if ((foreignIdentity.charAt(6) == "7") || (foreignIdentity.charAt(6) == "8")) {
				birthYear = "20";
			}else if ((foreignIdentity.charAt(6) == "9") || (foreignIdentity.charAt(6) == "0")) {
				birthYear = "18";
			}else{
				alert("등록번호에 오류가 있습니다. 다시 확인하십시오.");
				return false;
			}
		
			birthYear += foreignIdentity.substr(0, 2);
			birthMonth = foreignIdentity.substr(2, 2) - 1;
			birthDate = foreignIdentity.substr(4, 2);
			birth = new Date(birthYear, birthMonth, birthDate);
		
			if ( birth.getYear() % 100 != foreignIdentity.substr(0, 2) ||
				birth.getMonth() != birthMonth ||
				birth.getDate() != birthDate) {
				alert('생년월일에 오류가 있습니다. 다시 확인하십시오.');
				return false;
			}
		
			return true;
		},
		
		/**
	     *  전화 번호 체크 
	     *  전화 번호 타입 : '02-2540-3342'
	     *  @param {Input} objValue 전화 번호 
	     *  @returns boolean
	     */
		telNoChk : function(objValue){ 
			if(doit.lang.String.strTrim(objValue).length <= 0) return false;
		    if(doit.lang.String.strTrim(objValue) == '') return true;
		    
		    var text = objValue.split('-');  
		    var arrNo = new Array('02'    //서울 02
		          ,'031'   //경기 031
		          ,'032'     //인천 032  
		          ,'033'  //강원 033
		          ,'041'   //충남 041 
		          ,'042'  //대전 042 
		          ,'043'  //충북 043 
		          ,'051'  //부산 051
		          ,'052'  //울산 052 
		          ,'053'  //대구 053 
		          ,'054'  //경북 054 
		          ,'055'   //경남 055  
		          ,'061'  //전남 061 
		          ,'062'  //광주 062  
		          ,'063'  //전북 063  
		          ,'064'  //제주 064 
		          ,'010'  //핸펀
		          ,'011'
		          ,'016'
		          ,'017'
		          ,'018'
		          ,'019');
		          
		    var newLen = objValue.length; 
		    var flag = false;
		    
		     if(newLen  < 11 || newLen  > 14 || text[0].length > 3 || text[1].length > 4 || text[2].length != 4){
		      	alert('전화번호의 형식이 맞지 않습니다. 다시 입력하세요.');
		     	return false;
		     }     
		     
		     for(var i=0; i<arrNo.length; i++ )  {
		      if(text[0] == arrNo[i]) {
		       flag = true;
		       break;
		      }
		     }
		     if(!flag){
		      alert('전화번호의 형식이 맞지 않습니다. 다시 입력하세요.');
		      return false;
		     }
		     return true;
		},
		
		/**
	     *  연락처 체크 : 전화번호(핸드폰번호) 모두 가능
	     *  @param {Input} Value 전화 번호 
	     *  @returns boolean
	     */
		isSms : function(s) {
		  return s.search(/^0(?:\d{1}|\d{2}|\d{3}|\d{4})-(?:\d{3}|\d{4})-\d{4}$/g)>=0;
		},
		
		/**
	     *  이메일주소 체크
	     *  @param {Input} objValue 이메일주소
	     *  @returns boolean
	     */		
		isEmail : function(s) {
		  return s.search(/^\s*[\w\~\-\.]+\@[\w\~\-]+(\.[\w\~\-]+)+\s*$/g)>=0;
		},
		
		/**
	     *  TextArea 입력제한
	     *  <//textarea 태그안에  onkeyup='doit.util.Validation.limitTextarea(this, 200);' 같은 형식으로 사용
	     *  @param {obj}
	     *  @param {Number}
	     *  @returns 
	     */	
		limitTextarea : function(obj, max) {
			var size = doit.lang.String.getStringLength(obj.value);
			if(max <= size) {
				alert(max + 'Byte 까지만 입력가능합니다.!');
				obj.value = obj.value.substring(0, obj.value.length-2);
				return;
			}
		},
		
		/**
	     *  id형식 체크 영문과 숫자 '_' 만 허용.	
	     *  @param {String} id
	     *  @returns boolean
	     */	
		isID : function(m) {
			if(this.isNull(m)){
				return false;
			}
			m = doit.lang.String.strTrim(m).toUpperCase();
			var c = m.charAt(0);
			if(!('A' <= c && c <= 'Z')){
				alert("아이디는 영문자와 숫자 '_' 만 사용가능합니다.");
				return false;
			}
			var n = m.length;
			for(var i=1; i < n; i++) {
				c = m.charAt(i);
				if(!(('A' <= c && c <= 'Z') || ('0' <= c && c <= '9') ||
					 (c == '_'))){
					alert("아이디는 영문자와 숫자 '_' 만 사용가능합니다.");
					return false;
				}
			}
			return true;
		},
		
		/**
	     *  checkbox 체크된 값 가져오기
	     *  @param {obj} oForm
	     *  @returns 체크값
	     */	
		getCheckVal : function (oForm){
			var cnt = 0;
			var items = oForm.elements;
			var checkCode = '';
			
			for(var i=0; i<items.length ; i++){
				if(items[i].type == "checkbox") {
					if(items[i].checked == true) {
						if(checkCode == ''){
						     checkCode += items[i].value;
					    }else{
					     	checkCode += ","+items[i].value;
					    }
					}
				}
			}
			if(checkCode == '' || checkCode == 0){
				return false;
			}else{
				return checkCode;
			}
		},
		
		/**
	     *  checkbox 단일체크
	     *  @param {obj} oForm
	     *  @param {String} form name
	     *  @returns 체크값
	     */	
		checkSet : function (oForm, nm){
			var ele = oForm.elements;
			for ( var i=0; i<ele.length; i++) {
			  if(ele[i].type =="checkbox"){
			  	if(nm == ele[i].name){
					ele[i].checked = true;
				}else{
					ele[i].checked =false;
				}
			  }
			}
		}
	};
}();

/**
 * @namespace doit.util.convert
 */
doit.util.Convert = function(){
	return {
		
		/**
	     *  STRING 에서 \r\n(줄바꿈) 을 HTML BR 태그로 변환하여 반환
	     *  @param {String} 문자열
	     *  @param {String} 변환해야 할 문자
	     *  @param {String} 변환문자
	     *  @returns String
	     */
		convertFromNRToBR : function ( _str ) {
		
			if ( null != _str && 'undefined' != _str ) {
				_temp = _str.replace(/\r\n/gi, "<br>")
			} else {
				_temp = "";
			}
		
			return _temp;
		},
		
		/**
	     *  STRING 에서 BR태그를  \r\n(줄바꿈)변환하여 반환
	     *  @param {String}
	     *  @returns null이면 공백, 아니면 \r\n(줄바꿈)변환하여 반환
	     */
		convertFromBRToNR : function ( _str ) {
		
			if ( null != _str && 'undefined' != _str ) {
				_temp = _str.replace(/<BR>/gi, "\r\n");
			} else {
				_temp = "";
			}
		
			return _temp;
		},
		
		/**
	     *  STRING 에서 마지막 \r\n(줄바꿈) 을 공백으로 변환하여 반환
	     *  @param {String}
	     *  @returns null이면 공백, 아니면 \r\n(줄바꿈)을 공백으로 변환하여 반환
	     */
		convertFromNRToBlank : function ( _str ) {
			if ( null != _str && 'undefined' != _str ) {
				_temp = _str;
				while( _temp.substr(_str.length-2, 2) == "\r\n" ) {
					_temp = _temp.substr(0, _temp.length - 2);
				}
			} else {
				_temp = "";
			}
		
			return _temp;
		}
	};
}();

/**
 * @namespace doit.util.form 
 */
doit.util.Form = function(){
	return {
		/**
	     *  동적인 폼 생성을 위한 함수.
	     *  각 폼속성 및 input 명과 값을(배열) 이용한 동적으로 해당 폼 생성.
	     *  ex) createActionForm("src.jsp", "crForm", "post", "_blank", attrName[], attrValue[]);
	     *  @param {src} target url
	     *  @param {fName} form name
	     *  @param {fMethod} form method
	     *  @param {fTarget} form action target
	     *  @param {attrName[]} input name array
	     *  @param {attrValue[]} input value array
	     */
		createActionForm : function (src, fName, fMethod, fTarget, attrName, attrValue) {

			document.write("<form name="+fName+" method="+fMethod+">");
		
			for ( i=0; i<attrName.length;i++)
				document.write("<input type=hidden name='"+attrName[i]+"' value='"+attrValue[i]+"'>");
		
			document.write("</form>");
		
			aForm = eval(fName);
		
			aForm.target = fTarget;
			aForm.action = src;
			aForm.submit(true);
		}
	}
}();
