/* 
 * ==========================================================================
 * 주 시스템 		: E-Service
 * 서브시스템 		: Rate Request
 * 프로그램 명  	: 
 * 프로그램 버젼 	: 
 * 프로그램 개요 	: 
 * 작성자		: 
 * 작성일		: YYYY.MM.DD.
 * ==========================================================================
 * 수정이력		:
 * ==========================================================================
 * 기타사항		:
 *
 * Copyrights 2005 by Cyberlogitec. All right reserved.
 *
 * ==========================================================================
*/

function vesselinfo(obj){
	window.open('/eservice/vessel/vesselinfo.jsp?vessel_cd='+obj+'','newwin','width=470,height=270,scrollbars=1')
}

function vesselinfo_k(obj){
	window.open('/korea/eservice/vessel/vesselinfo.jsp?vessel_cd='+obj+'','newwin','width=400,height=200,scrollbars=1')
}

function newcertify(obj){
	window.open('/about/safety/'+obj+'.jsp','newwin','width=618,height=700,scrollbars=1')
}

function whichCompany(obj){
	window.open('/maritime/iso/iso_svc.jsp?imi_company='+obj+'','isowin','width=820,height=450,scrollbars=1,resizable=1')
}

function City(obj){
	obj = "/service/business/exclusive/" + obj + ".jsp";
	window.open(obj,"City","width=550,height=550,scrollbars=yes");
}

function Commerce(obj1, obj2){
	window.open('/service/commerce/'+obj1+'.jsp','newwin','width=560,height='+obj2+',scrollbars=1')
}

function newwin(obj){
	window.open('/about/newwin/'+obj+'.jsp','newwin','width=800,height=600')
}

function newglobal(obj){
	window.open('/global/globalinfo.jsp?I_CNT_CD='+obj,'newglobal','width=570,height=700,scrollbars=1,resizable=1');
}

function newsc(obj){
	window.open('/eservice/schedule/'+obj+'.jsp','newwin','width=570,height=400,scrollbars=1');
}

function Notice(){
	window.open('/home/notice.jsp','newwin','width=570,height=400,scrollbars=1');
}

function Related(){
	window.open('/home/related2.jsp','newwin','width=570,height=400,scrollbars=1');
}

function Others(form){
	var myindex=form.others.selectedIndex
	if(form.others.options[myindex].value != null){
		window.location=form.others.options[myindex].value;
	}
}

function newphoto(obj){
	window.open('/about/photo/newphoto/'+obj+'.jsp','newphoto','width=800,height=600')
}

function newsckor(obj){
	window.open('/korea/eservice/schedule/'+obj+'.jsp','newwin','width=570,height=400,scrollbars=1');
}

function newroute(obj){
	window.open('/service/route/'+obj+'.jsp','newroute','width=570,height=700,scrollbars=1');
}

function Safety(obj){
	window.open('/about/safety/'+obj+'.jsp','Safety','width=600,height=700,scrollbars=1');
}

function qm_disappear(){
    select2.style.visibility="hidden";
}

function qm_reappear(){
    select2.style.visibility="visible";
}

function qc_disappear(){
    document.quickcargo.quicktype.style.visibility="hidden";
}

function qc_reappear(){
    document.quickcargo.quicktype.style.visibility="visible";
}

function qv_disappear(){
    document.vessel.vessel_cd.style.visibility="hidden";
}

function qv_reappear(){
    document.vessel.vessel_cd.style.visibility="visible";
}

function MM_findObj(n, d) { //v3.0
	var p,i,x;
	if(!d)
	d=document;

	if((p=n.indexOf("?"))>0&&parent.frames.length){
		d=parent.frames[n.substring(p+1)].document;
		n=n.substring(0,p);
	}

	if(!(x=d[n])&&d.all)
	x=d.all[n];

	for (i=0;!x&&i<d.forms.length;i++)
	x=d.forms[i][n];

	for(i=0;!x&&d.layers&&i<d.layers.length;i++)
	x=MM_findObj(n,d.layers[i].document);

	return x;
}

function MM_showHideLayers() { //v3.0
	var i,p,v,obj,args=MM_showHideLayers.arguments;
	for(i=0; i<(args.length-2); i+=3){
		if((obj=MM_findObj(args[i]))!=null){
			v=args[i+2];
			if(obj.style){
				obj=obj.style;
				v=(v=='show')?'visible':(v='hide')?'hidden':v;
			}
			obj.visibility=v;
		}
	}
}

function MM_preloadImages() { //v3.0
	var d=document;
	if(d.images){

		if(!d.MM_p) d.MM_p=new Array();
		var i,j=d.MM_p.length,a=MM_preloadImages.arguments;

		for(i=0; i<a.length; i++)

		if(a[i].indexOf("#")!=0){
			d.MM_p[j]=new Image;
			d.MM_p[j++].src=a[i];
		}
	}
}

function MM_swapImgRestore() { //v3.0
	var i,x,a=document.MM_sr;
	for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++)
	x.src=x.oSrc;
}

function MM_swapImage() { //v3.0
	var i,j=0,x,a=MM_swapImage.arguments;
	document.MM_sr=new Array;
	for(i=0;i<(a.length-2);i+=3)
	if((x=MM_findObj(a[i]))!=null){
		document.MM_sr[j++]=x;

		if(!x.oSrc)
		x.oSrc=x.src; x.src=a[i+2];
	}
}

function ImgOn(Name){
	ImgName  =  Name;
	KeepVar =  Name;
	SwitchImg = "/img/" + Name + ".gif";
	document.images[Name].src=SwitchImg;
}

function Fix(){
	SwitchImg = "/img/" + ImgName + ".gif";
	document.images[ImgName].src=SwitchImg;
}

function ImgOn_kor(Name_kor){
	ImgName_kor  =  Name_kor;
	KeepVar_kor =  Name_kor;
	SwitchImg_kor = "/img/korea/about/" + Name_kor + "_1.gif";
	document.images[Name_kor].src=SwitchImg_kor;
}

function Fix_kor(){
	SwitchImg_kor = "/img/korea/about/" + ImgName_kor + ".gif";
	document.images[ImgName_kor].src=SwitchImg_kor;
}

function Change(service, location) {
	var temp = service.value;
	if (temp == "1") {
		location.options[0] = new Option("Seattle");
		location.options[1] = new Option("Long beach");
		location.options[2] = new Option("Oakland");
		location.options[3] = new Option("Busan Kamcheon");
		location.options[4] = new Option("Busan Kamman");
		location.options[5] = new Option("Kwangyang");
		location.options[6] = new Option("Kaohsiung");
		location.options[7] = new Option("Tokyo");
		location.options[8] = new Option("Osaka");

		location.options.length = 9;
		select_maker="Terminal";
	}else if (temp == "2"){
		location.options[0] = new Option("Shanghai");
		location.options[1] = new Option("Tianjin");
		location.options[2] = new Option("Dailian");
		location.options[3] = new Option("Qingdao");
		location.options[4] = new Option("Lat Krabang");
		location.options[5] = new Option("Port Kelang");

		location.options.length = 6;
		select_maker="ODCY";
	}
	location.selectedIndex = 0;
	location.focus();
}

/* 새로 추가 */
function cfNumChk(num){
	if( String != "" ){
		count = 0;
		cp_string = "1234567890";

		for(i = 0 ; i < 12 ; i++){
			for(j = 0 ; j < num.length ; j++){
				if(cp_string.charAt(i) == num.charAt(j)){
					count++;
				}
			}
		}

		if(count == num.length){
			return true;
		}else{
			return false;
		}
	}
	return true;
}

function chkString(str , type, errmsg){
	if(str != ""){
		type = type.toUpperCase();

		count = 0;
		roof  = 0;

		if(type == "DIGIT"){
			cp_string = "1234567890";
			roof = 10;
		}else if(type == "DIGITPOINT"){
			cp_string = "1234567890.-";
			roof = 12;
		}else if(type == "ID" ){
			cp_string = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,~!@#$%^&*()_+-= ";
			roof = 26 + 26 + 10 + 18;
		}else if(type == "DIGITREEFER"){
			if(isNaN(parseInt(str))){
				alert(errmsg);
				return false;
			}
			cp_string = "1234567890.-";
			roof = 12;
		}else if(type == "CO2"){
			if(isNaN(parseInt(str))){
				alert(errmsg);
				return false;
			}
			cp_string = "1234567890.";
			roof = 11;
		}


		for(i = 0 ; i < roof ; i++){
			for(j = 0 ; j < str.length ; j++){
				if(cp_string.charAt(i) == str.charAt(j) ){
					count++;
				}
			}
		}

		if( count == str.length ){
			return true;
		}else{
			alert(errmsg);
			return false;
		}
	}else{
		return true;
	}
}

function chkDate(fm){
	var tmp = '';
	var txt = fm.value;
	var mm;
	var dd;
	var yyyy;

	for(var i=0;i<txt.length;i++){
		if(txt.charAt(i)!=' ')
			tmp = tmp + txt.charAt(i);
		}

		if(tmp.length != 6){
			alert('Input Data Invalid...(Ex:010101)');
			return false;
		}else{
			mm = tmp.substring(0,2);
			if( mm.charAt(0) == "0" )
				mm = parseInt( mm.charAt(1) );
			else
				dd = parseInt( dd );

			dd = tmp.substring(2,4);
			if( dd.charAt(0) == "0" )
				dd = parseInt( dd.charAt(1) );
			else
				dd = parseInt( dd );

			if(isNaN(mm)!=false || isNaN(dd)!=false){
				alert('Not Number Type Data');
				return;
			}

			if(mm < 1 || mm > 12){
				alert('Month Data Invalid');
				return;
			}else{
				if(mm != 2){
					if(dd <= 0 || dd > 31){
						alert('Day Data Invalid');
						return;
				}
			}else{
				if(dd <= 0 || dd > 29){
					alert('Day Data Invalid');
					return;
				}
			}
		}
	}
	return true;
}

function check_float(str, errmsg){
    if(str != ""){
		cp_string = "1234567890.";
		roof = 11;
		count = 0;

		for( i = 0 ; i < roof ; i++ ){
			for( j = 0 ; j < str.length ; j++ ){
				if(cp_string.charAt(i) == str.charAt(j)){
					count++;
				}
			}
		}

		if( count == str.length ){
			return true;
		}else{
			alert(errmsg);
			return false;
		}
    }else{
		return true;
    }
}

function check_float2(str, len, len2){
	if(isNaN(str)){
		alert('Invalid Number Type!');
		return false;
	}
	var f = new Array();
	var digit = '';
	var deci = '';
    if(str != ""){
		if(str.indexOf('.')!=-1){
			f = str.split('.');
			digit = f[0];
			deci = f[1];
			// 전체 자리수가 11자리가 넘는지 판단
			if(digit.length + deci.length > len){
				alert('You must input data less than '+len+'!');
				return false;
			}else if(deci.length > len2){
				alert('Decimal value length cannot over ' + len2 + '!');
				return false;
			}else{
				return true;
			}
		}else{
			return true;
		}
    }else{
		return true;
    }
}

function check_value(name,errmsg){
	if((name == '') || (name == null) || (name == ' ')){
		alert(errmsg);
		return false;
	}else{
		return true;
	}
}

function check_digit(str, errmsg){
	if(str != ""){
		cp_string = "1234567890";
		roof = 10;
		count = 0;
		
		for(i = 0 ; i < roof ; i++){
		     for(j = 0 ; j < str.length ; j++){
		          if(cp_string.charAt(i) == str.charAt(j)){
		               count++;
		          }
		     }
		}
		
		if(count == str.length){
		     return true;
		}else{
		     alert(errmsg);
		     return false;
		}
	}else{
		return true;
	}
}

function check_temp(str, errmsg){
	if(str != ""){
		cp_string = "1234567890-.";
		roof = 12;
		count = 0;
		
		for(i = 0; i < roof; i++){
			for( j = 0 ; j < str.length ; j++ ){
				if( cp_string.charAt(i) == str.charAt(j) ){
					count++;
				}
			}
		}
		
		if(count == str.length){
		     return true;
		}else{
		     alert(errmsg);
		     return false;
		}
	}else{
		return true;
	}
}

// Open Modal Popup......added by Roh(2004.11.09)
function getOpenModalPopupScroll(webapp, popTitle, urlStr, object, iWidth, iHeight) {
	var rtnVal;
	var param;
    var arrArg = new Array(2);
	var iLeft, iTop;

	if (iHeight == null || iHeight == "") {
	    iHeight = "480";
	}

	iLeft = window.screen.width - (iWidth+10);
	iTop = 30;

	if(object != null) {
		if(object.type.indexOf("select") >= 0 ) {
			len       = object.length -1;
			param     = new ParamArray(len);
			for(i=0; i<len; i++) {
				param[i].value = object.options[i+1].text;
				param[i].text  = object.options[i+1].text;
			}
		} else if(object.type.indexOf("text") >= 0 || object.type.indexOf("hidden") >= 0 || object.type.indexOf("textarea") >= 0) {
			objValue = object.value;
			objValue = objValue.replace(/;/gi,",");
			len = getColInfo(objValue,",");

			param = new ParamArray(len);
			for ( var i = 0 ; objValue.indexOf(",") > -1; i++) {	
				subValue = objValue.substring(0,objValue.indexOf(","));
				param[i].value = subValue;
				param[i].text  = subValue;
				objValue = objValue.substring(objValue.indexOf(",")+1, objValue.length) ;
			}
			
			if (objValue != "") {
				param[i].value = objValue;
				param[i].text  = objValue;
			}
		}
	}
	arrArg [0] = urlStr;
	arrArg [1] = param;

	rtnVal = window.showModalDialog(webapp+"/ssi/modalDialogMainScroll.jsp?Title="+popTitle+"", arrArg, "dialogHeight:"+iHeight+"px;dialogWidth:"+iWidth+"px;help:No;resizable:No;status:no;scroll:on;center:yes");
	if(rtnVal == null) return null;

	//호출 후 작업
	if(object != null) {
		if(object.type.indexOf("select") >= 0 ) {
			object.length = rtnVal.length + 1;

			for(i=1; i<object.length; i++){
				object.options[i].value = rtnVal[i-1].text;
				object.options[i].text  = rtnVal[i-1].text;
			}
		} else if(object.type.indexOf("text") >= 0 || object.type.indexOf("hidden") >= 0 || object.type.indexOf("textarea") >= 0) {
			object.value = "";
			for(i=0; i<rtnVal.length; i++) {
				object.value += rtnVal[i].text+",";
			}

			if(object.value.lastIndexOf(",") == object.value.length -1 ) {
				object.value = object.value.substring(0,object.value.length - 1);
			}
		}
	}
	return rtnVal;
}

// used in Modal Popup......added by Roh(2004.11.09)
function ParamArray(n) {
	this.length = n;
	for(var i =0; i< n; i++) {
		this[i] = new ParamObject("","","");
	}
	return this;
}

// used in Modal Popup......added by Roh(2004.11.09)
function ParamObject() {
	this.value;
	this.text;
	this.etc0;
	this.etc1;
	this.etc2;
	this.etc3;
	this.etc4;
	this.etc5;
	this.etc6;
	this.etc7;
	this.etc8;
	this.etc9;
}

// used in Modal Popup......added by Roh(2004.11.09)
function getColInfo(str,delim) {
	var rtnCnt = 1;
	if(str == "" || str == null) return 0;;

	for ( var i = 0 ; str.indexOf(delim) > -1; i++) {	
		str = str.substring(str.indexOf(delim)+1, str.length) ;
		rtnCnt++;
	}	
	return rtnCnt;
}

/**
 * @type   : function
 * @access : private
 * @desc   : 입력값이 숫자만 입력된다.
 *
 * </pre>
 * @sig    :
 * @param  :
 * @return : boolean
 * @author : 이영혜
 */
function cfOnlyNumber() {
  if((event.keyCode<48) || (event.keyCode>57)){
    event.returnValue=false;
  }
}		

/**
 * @type   : function
 * @access : public
 * @desc   : 값이 null 이거나 white space 문자로만 이루어진 경우 true를 리턴한다.
 * <pre>사용예 :
 *     cfIsNull("  ");
 * </pre>
 * 위와같이 사용했을 경우 true를 리턴한다.
 * @sig    : value
 * @param  : value required 입력값
 * @return : boolean. null(혹은 white space) 여부
 * @author : 이영혜
 */
function cfIsNull( value ) {
	if (value == null || (typeof(value) == "string" && value.trim() == "") ) {
		return true;
	}

	return false;
}
	
/**
 * @type   : prototype_function
 * @access : public
 * @desc   : 자바스크립트의 내장 객체인 String 객체에 trim 메소드를 추가한다. trim 메소드는 스트링의 앞과 뒤에
 *           있는 white space 를 제거한다.
 * <pre>사용예 :
 *     var str = " abcde "
 *     str = str.trim();
 * </pre>
 * 위의 예에서 str는 "abede"가 된다.
 * @return : trimed String.
 * @author : 이영혜
 */
String.prototype.trim = function() {
    return this.replace(/(^\s*)|(\s*$)/g, "");
}
	
/**
 * @type   : prototype_function
 * @access : public
 * @desc   : 두 일자에 대한 검색기간(mmddyy)를 체크
 * <pre>사용예 :
 *     cfCompareDate('021505','021005');
 * </pre>
 * 위의 예에서 결과값이 false 된다.
 * @return : boolean
 * @author : 이영혜
 */
function cfCompareDate(fromdt, todt){
  var fromdt = '20' + fromdt.substr(4,6) + fromdt.substr(0,2) + fromdt.substr(2,4);
  var todt   = '20' + todt.substr(4,6) + todt.substr(0,2) + todt.substr(2,4);
  if(fromdt > todt){
      return false;
  }else{
      return true;
  }
}

/**
 * @type   : prototype_function
 * @access : public
 * @desc   : to date - max일자를 제한 값이 from date보다 크면 false return
 * <pre>사용예 :
 *     cfCompareDate('021505','021005', 180);
 * </pre>
 * 위의 예에서 결과값이 false 된다.
 * @return : boolean
 * @author : 계기훈
 */
function cfCompareDate2(fromdt, todt, max){
	var from = '20' + fromdt.substr(4,2) + fromdt.substr(0,2) + fromdt.substr(2,2);
	var to   = new Date('20' + todt.substr(4,2), todt.substr(0,2), todt.substr(2,2));
	to.setDate(to.getDate() - max);

	var toYYYY = '';
	if(navigator.appName=="Netscape"){
		toYYYY = '20' + (to.getYear()+'').substring(1,3);
	}else{
		toYYYY = '20' + (to.getYear()+'').substring(2,4);
		
	}
	var toMM = to.getMonth();
	if(toMM < 10){
		toMM = "0"+toMM;
	}

	var toDD = to.getDate();
	if(toDD < 10){
		toDD = "0"+toDD;
	}
	var fromDt2 = toYYYY + '' + toMM + ''  + toDD;
	//alert(from + " : " + fromDt2);
	if(from < fromDt2){
		return toMM + ''  + toDD + '' + toYYYY.substr(2,4);
	}else{
		return fromdt;
	}
}


/**
 * @type   : prototype_function
 * @access : public
 * @desc   : 입력된 날짜(mmddyy)를 검증하는 함수
 * <pre>사용예 :
 *     cfCheckDate('02','15','05');
 * </pre>
 * 위의 예에서 결과값이 false 된다.
 * @return : boolean
 * @author : 
 */
function cfCheckDate(strMonth, strDay, strYear) {
	if (strYear == null || strYear == "" || strMonth == null || strMonth == "" || strDay == null || strDay == "" ){
		return false;
	}

	var iYear = parseInt(strYear,10);
	var iMonth = parseInt(strMonth,10);
	var iDay = parseInt(strDay,10);
	
	if( iMonth<1 || iMonth>12 ){
		return false;
	}
	 
	if( iDay<1 || iDay > 31){
		return false;
	}
	
	if( iMonth<10 ) strMonth = "0"+iMonth;
	else strMonth = ""+iMonth;
	
	if( iDay<10)strDay = "0"+iDay;
	else if( iDay<29)strDay = ""+iDay;
	else {
		if(iMonth==2){
			if  (( ( iYear%400 == 0 ) || ( ( iYear%100 != 0 ) && ( iYear%4 == 0 ) ) ) ) { if (iDay>29) { return false;}}
			else if (iDay>28) return false;
		}else if(iMonth==4 || iMonth==6 || iMonth==9 || iMonth==11){
			if(iDay>30 ) return false;
		}else{
			if(iDay>31 ) return false;
		}
	}			
	
	if(iYear<10 ){
		strYear = "000"+iYear;
	} else if(iYear<100 ){
		strYear = "00"+iYear;
	} else if(iYear<1000 ){
		strYear = "0"+iYear;
	}else	strYear = ""+iYear;
	
	return true;		  
}

/**
 * @type   : function
 * @access : public
 * @desc   : 팝업창을 보인다.
 * <pre>사용예 :
 *
 *     cfOpenPopupRtn( openUrl, winNm, h, w );
 *
 * </pre>
 * @sig    : 
 * @param  : Url
 * @param  : winNm : window 이름
 * @param  : h height
 * @param  : w width
 * @return : popup 객체
 * @author : 이영혜
 */
function cfOpenPopupRtn( openUrl, winNm, h, w  ) {
  //pop화면의 가로,세로크기
  var varHeight = h;
  var varWidth = w;

	var pop = window.open(openUrl,winNm,
              "width=" + varWidth + ",height=" + varHeight + ",top=" + (screen.height - varHeight)/2 + ",left=" + (screen.width - varWidth)/2 +
              "toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=1,resizable=yes, copyhistory=1");
    return pop;
}

/**
 * @type   : function
 * @access : public
 * @desc   : 팝업창을 보인다.
 * <pre>사용예 :
 *
 *     cfOpenPopup( openUrl, winNm, h, w );
 *
 * </pre>
 * @sig    : 
 * @param  : Url
 * @param  : winNm : window 이름
 * @param  : h height
 * @param  : w width
 * @return : none
 * @author : 이영혜
 */
function cfOpenPopup( openUrl, winNm, h, w, status ) {
  //pop화면의 가로,세로크기
  var varHeight = h;
  var varWidth = w;

	if(!status) {
		status = 0;
	}
	window.open(openUrl,winNm,
              "width=" + varWidth + ",height=" + varHeight + ",top=" + (screen.height - varHeight)/2 + ",left=" + (screen.width - varWidth)/2 +
              "toolbar=0,location=0,directories=0,status="+status+",menubar=0,scrollbars=1,resizable=yes, copyhistory=1");
}

/**
 * @type   : function
 * @access : public
 * @desc   : 문자,숫자,- 검증하는 함수
 * <pre>사용예 :
 *
 *     cfDigitChk( 'asdfdf02-' );
 *
 * </pre>
 *     위 결과는 true
 * @sig    : 
 * @param  : str
 * @return : none
 * @author : 
 */
function cfDigitChk(str) {
	if( String != "" ) {
		count = 0;
		cp_string = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890-@.";

		for( i = 0 ; i < cp_string.length ; i++ ){
			for( j = 0 ; j < str.length ; j++ ){
				if( cp_string.charAt(i) == str.charAt(j) ){
					count++;
				}
			}
		}

		if( count == str.length ){
			return true;
		}else{
			return false;
		}
	}
	
	return true;
}

/**
 * @type   : function
 * @access : public
 * @desc   : 문자,숫자,- 검증하는 함수
 * <pre>사용예 :
 *
 *     cfChkCharNum( 'asdfdf02' );
 *
 * </pre>
 *     위 결과는 true
 * @sig    : 
 * @param  : str
 * @return : none
 * @author : 
 */
function cfChkCharNum(str) {
	if( String != "" ) {
		count = 0;
		cp_string = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,~!@#$%^&*()_+-= ";

		for( i = 0 ; i < cp_string.length ; i++ ){
			for( j = 0 ; j < str.length ; j++ ){
				if( cp_string.charAt(i) == str.charAt(j) ){
					count++;
				}
			}
		}

		if( count == str.length ){
			return true;
		}else{
			return false;
		}
	}
	
	return true;
}

function cfChkCharNumCol(str) {
	if( str != "" ) {
		count = 0;
		cp_string = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890/,-. ";

		for( i = 0 ; i < cp_string.length ; i++ ){
			for( j = 0 ; j < str.length ; j++ ){
				if( cp_string.charAt(i) == str.charAt(j) ){
					count++;
				}
			}
		}

		if( count == str.length ){
			return true;
		}else{
			return false;
		}
	}
	return true;
}

/**
 * @type   : function
 * @access : public
 * @desc   : 문자,숫자,- 검증하는 함수
 * <pre>사용예 :
 *
 *     cfChkZicpCd( 'asdfdf02' );
 *
 * </pre>
 *     위 결과는 true
 * @sig    : 
 * @param  : str
 * @return : none
 * @author : 
 */
function cfChkZicpCd(str) {
	if( String != "" ) {
		count = 0;
		cp_string = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890-";

		for( i = 0 ; i < cp_string.length ; i++ ){
			for( j = 0 ; j < str.length ; j++ ){
				if( cp_string.charAt(i) == str.charAt(j) ){
					count++;
				}
			}
		}

		if( count == str.length ){
			return true;
		}else{
			return false;
		}
	}
	
	return true;
}

/**
 * @type   : function
 * @access : public
 * @desc   : 문자,숫자,- 검증하는 함수
 * <pre>사용예 :
 *
 *     cfChkZicpCd( 'asdfdf02' );
 *
 * </pre>
 *     위 결과는 true
 * @sig    : 
 * @param  : str
 * @return : none
 * @author : 
 */
function cfChkEmail(str) {
	if( String != "" ) {
		count = 0;
		
		cp_string = "@";

		for( i = 0 ; i < cp_string.length ; i++ ){
			for( j = 0 ; j < str.length ; j++ ){
				if( cp_string.charAt(i) == str.charAt(j) ){
					count++;
				}
			}
		}

		if( count == cp_string.length ){
			return true;
		}else{
			return false;
		}
	}
	
	return true;
}

/**
 * @type   : function
 * @access : public
 * @desc   : 사용자가 입력한 영문자를 대문자로 변경해준다.
 * <pre>사용예 :
 *
 *     cfAllCodeUpper( txt_modelCd );
 *
 *     abcd -> ABCD
 *
 * </pre>
 * @sig    :
 * @param  : textObj
 * @return : 대문자로 변경된 영문 소문자
 * @author : 이영혜
 */
function cfAllCodeUpper( textObj ) {
  var code = textObj.value;

  for ( i = 0; i < textObj.value.length; i++ ) {
    if ((code.charAt(i)>unescape('%60')) && (code.charAt(i)<unescape('%7b'))) {
      textObj.value = code.toUpperCase();
      break;
    }
  }
}

/**
 * @type   : function
 * @access : public
 * @desc   : 현재 일자를 리턴해준다.
 * <pre>사용예 :
 *
 *     cfGetToday(); => 20030411
 * </pre>
 * @sig    :
 * @param  :
 * @return : 현재일자(YYYYMMDD)
 * @author : 이영혜
 */
function cfGetToday( splitForm ) {
	var day = new Date();
	var year = day.getYear();
	var month = day.getMonth()+1;
	var mdate = day.getDate();

	if( month < 10 ) month = "0" + month;
	if( mdate < 10 ) mdate = "0" + mdate;
	if( splitForm == null ) splitForm = "";
	
	var currentDate = year + splitForm + month + splitForm + mdate;

	return currentDate;
}

/**
 * @type   : function
 * @access : public
 * @desc   : 현재 일자를 리턴해준다.
 * <pre>사용예 :
 *     cfGetToday(splitForm, term); => 20030411
 * </pre>
 * @sig    :
 * @param  : splitForm : Date가 출력될 입력 Form 값, term : 며칠 이후, 이전 체크여부
 * @return : 현재일자(YYYYMMDD)
 * @author : NDY
 */
function cfGetToday2( splitForm, term ){
	var day = new Date();
	day.setDate(day.getDate());
	var year;
	
	if(navigator.appName=="Netscape"){
		var year = day.getYear()+"";
		year = "20"+year.substring(1,3);
	}else{
		year = day.getYear();
		
	}
	var month = day.getMonth()+1;
	var mdate = day.getDate();
	
	if( month < 10 ) month = "0" + month;
	if( mdate < 10 ) mdate = "0" + mdate;
	if( splitForm == null ) splitForm = "";
	
	var currentDate = year + splitForm + month + splitForm + mdate;

	return currentDate;
}

/**
 * @type   : function
 * @access : public
 * @desc   : 현재 일자를 리턴해준다.
 * <pre>사용예 :
 *     cfGetToday(splitForm, term); => 20030411
 * </pre>
 * @sig    :
 * @param  : splitForm : Date가 출력될 입력 Form 값, term : 며칠 이후, 이전 체크여부
 * @return : 현재일자(YYYYMMDD)
 * @author : NDY
 */
function cfGetToday2( splitForm, term ){
	var day = new Date();
	day.setDate(day.getDate());
	var year;
	
	if(navigator.appName=="Netscape"){
		var year = day.getYear()+"";
		year = "20"+year.substring(1,3);
	}else{
		year = day.getYear();
		
	}
	var month = day.getMonth()+1;
	var mdate = day.getDate();
	
	if( month < 10 ) month = "0" + month;
	if( mdate < 10 ) mdate = "0" + mdate;
	if( splitForm == null ) splitForm = "";
	
	var currentDate = year + splitForm + month + splitForm + mdate;

	return currentDate;
}

/**
 * @type   : function
 * @access : public
 * @desc   : 멀티건 행추가
 * <pre>사용예 :
 *
 *     insertRowWithHeadTbl(srcTBL,destTBL,headTBL);
 *
 *     - srcTBL   : templateTABLE ID
 *     - destTBL  : 실제 추가할 TABLE ID
 *     - headTBL : Header TABLE ID
 * </pre>     
 * @sig    : 
 * @param  : srcTBL,destTBL,headTBL
 * @return : none
 * @author : raika
 */
function insertRowWithHeadTbl(srcTBL,destTBL,headTBL){
	try{
		if(destTBL.tBodies(0).rows(0).id.toUpperCase() == "NOTFOUND"){
			destTBL.deleteRow(0);
		}
	}catch(Exception){}
	
	var aRow = srcTBL.rows(0).cloneNode(true);
	var rowCount = destTBL.tBodies(0).rows.length;
	
	destTBL.tBodies(0).appendChild(aRow);
	
	/*Align조정*/
	var headRow = headTBL.rows(0);
	var bodyRow = destTBL.tBodies(0).rows(0);

	for(var i=0 ; i < bodyRow.cells.length ; i++)   {
		if(bodyRow.cells(i).clientWidth == '')  {
			headRow.cells(i).width = 100;
		}else   {
			bodyRow.cells(i).width = headRow.cells(i).width + 1 ;
		}
	}
	return rowCount;
}

/**
 * @type   : function
 * @access : public
 * @desc   : 멀티건 행추가
 * <pre>사용예 :
 *
 *     insertRowWithTextParam(srcTBL,destTBL,arrayList);
 *
 *     - srcTBL   : templateTABLE ID
 *     - destTBL  : 실제 추가할 TABLE ID
 *     - paramArray : 배열로 Row의 Text value로 세팅할 정보를 넘긴다.
 * </pre>     
 * @sig    : 
 * @param  : srcTBL,destTBL,paramArray
 * @return : none
 * @author : raika
 */
function insertRowWithTextParam(srcTBL,destTBL,paramArray){
	var newRow = srcTBL.rows(0).cloneNode(true);
	destTBL.tBodies(0).appendChild(newRow);

	if(paramArray != null) {
		for(var i=0; i<paramArray.length; i++) {
			var keyValueStr = paramArray[i];
			
			var key = keyValueStr.substring(0, keyValueStr.indexOf("="));
			var value = keyValueStr.substring(keyValueStr.indexOf("=") + 1, keyValueStr.length);
			var cells = newRow.cells;
			for(var j=0; j<cells.length; j++) {
				var strHTML = cells(j).innerHTML;
				while(strHTML.indexOf("$" + key) != -1) {
					strHTML = strHTML.replace("$" + key, value);
				}
				
				cells(j).innerHTML = strHTML;
			}
		}
	}
	
}

/**
 * @type   : function
 * @access : public
 * @desc   : 멀티건 행추가
 * <pre>사용예 :
 *
 *     insertRow(srcTBL,destTBL);
 *
 *     - srcTBL   : templateTABLE ID
 *     - destTBL  : 실제 추가할 TABLE ID
 * </pre>     
 * @sig    : 
 * @param  : srcTBL,destTBL
 * @return : none
 * @author : raika
 */
function insertRow(srcTBL,destTBL){	
	destTBL.tBodies(0).appendChild(srcTBL.rows(0).cloneNode(true));
}

/**
 * @type   : function
 * @access : public
 * @desc   : 멀티건 행추가
 * <pre>사용예 :
 *
 *     insertRowWithFocus(srcTBL,destTBL, );
 *
 *     - srcTBL   : templateTABLE ID
 *     - destTBL  : 실제 추가할 TABLE ID
 * </pre>     
 * @sig    : 
 * @param  : srcTBL,destTBL
 * @return : none
 * @author : raika
 */
function insertRowWithFocus(srcTBL,destTBL, focusEleNm){	
	var row = destTBL.tBodies(1).appendChild(srcTBL.rows(0).cloneNode(true));	
	
	cfSetUnit(destTBL); //2007.02.23 yhlee 추가
	
	// 하드코딩으로 첫번째 Cell(TD)의 첫번째  ChildNode(Input) 객체를 찾아 Focus(임시)
	row.cells(0).childNodes(0).focus();
	
	/*var elements = row.getElementsByTagName("INPUT");
	if(elements && elements.length) {
		for(var i=0; i<elements.length; i++) {
			if(elements(i).name == focusEleNm) {
				elements(i).focus();
				break;
			}
		}
	}
	for(var i=0; i<row.cells.length; i++) {
		var cell = row.cells(i);
		for(var j=0; j<cell.childNodes.length; j++) {
			var inputObject = cell.childNodes(j);
			if(inputObject.name == focusEleNm) {
				inputObject.focus();
				break;
			}
		}
	}*/
}

/**
 * @type   : function
 * @access : public
 * @desc   : blins 에서 행 추가 후 신규행의 단위부분을 변경한 것으로 셋팅
 * <pre>사용예 :
 *
 *     cfSetUnit(destTBL, );
 *
 *     - destTBL  : 실제 추가할 TABLE ID
 * </pre>
 * @sig    :
 * @param  : destTBL
 * @return : none
 * @author : yhlee
 */
function cfSetUnit(destTBL){
	var rowsLen = destTBL.tBodies(1).rows.length;
	
	if( destTBL.tBodies(1).rows.length != 1 ){
		for(var x=0; x<destTBL.tBodies(1).rows(0).cells.length;x++){
			var cnt = 0;
			
			for(var y=0; y<destTBL.tBodies(1).rows(0).cells[x].children.length;y++){
				if( destTBL.tBodies(1).rows(0).cells[x].children(y,cnt).tagName == "SELECT" ){
					destTBL.tBodies(1).rows(rowsLen-1).cells[x].children(y,cnt).value = destTBL.tBodies(1).rows(0).cells[x].children(y,cnt).value;
				}
				cnt++;
			}
		}
		
	}
}

/**
 * @type   : function
 * @access : public
 * @desc   : 멀티건 행추가
 * <pre>사용예 :
 *
 *     insertRowWithHeadTbl(srcTBL,destTBL,headTBL);
 *
 *     - srcTBL   : templateTABLE ID
 *     - destTBL  : 실제 추가할 TABLE ID
 *     - headTBL : Header TABLE ID
 * </pre>     
 * @sig    : 
 * @param  : srcTBL,destTBL,headTBL
 * @return : none
 * @author : raika
 */
function insertRowWithHeadTbl(srcTBL,destTBL,headTBL){
	try{
		if(destTBL.tBodies(0).rows(0).id.toUpperCase() == "NOTFOUND"){
			destTBL.deleteRow(0);
		}
	}catch(Exception){}
	
	var aRow = srcTBL.rows(0).cloneNode(true);
	var rowCount = destTBL.tBodies(0).rows.length;
	
	destTBL.tBodies(0).appendChild(aRow);
	
	/*Align조정*/
	var headRow = headTBL.rows(0);
	var bodyRow = destTBL.tBodies(0).rows(0);

	for(var i=0 ; i < bodyRow.cells.length ; i++)   {
		if(bodyRow.cells(i).clientWidth == '')  {
			headRow.cells(i).width = 100;
		}else   {
			bodyRow.cells(i).width = headRow.cells(i).width + 1 ;
		}
	}
	return rowCount;
}

/**
 * @type   : function
 * @access : public
 * @desc   : 멀티건 행삭제
 * <pre>사용예 :
 *
 *     insertRow(TBL);
 *
 *     - TBL   : 멀티건 포함한 TABLE ID (삭제할 Row를 체크박스(chk_del)로 전해준다)
 * </pre>     
 * @sig    : 
 * @param  : TBL
 * @return : none
 * @author : raika
 */
function deleteRow(TBL) {
	var elements = TBL.getElementsByTagName("INPUT");
	
	if(elements && elements.length) {
		for(var i=0; i<elements.length; i++) {
			if((elements(i).type).toUpperCase() == "CHECKBOX") {
				if(elements(i).checked) {
					var parentTr = getParentNode(elements(i), "TR");
					if(!parentTr || (parentTr.tagName).toUpperCase() != "TR") {
						continue;
					}
					
					parentTr.removeNode(true);					
					
					// object가 하나 삭제 되었으므로, i값을 discount한다.
					i--;
				}
			}
		}
	}
}

/**
 * @type   : function
 * @access : public
 * @desc   : 해당 Object의 상위 Object를 반환한다.
 * <pre>사용예 :
 *
 *     insertRow(oInput, "TABLE");
 *
 *     - oInput   : HTML Object
 *     - "TABLE"  : HTML Object의 상위 Object중 TABLE을 찾는다.
 * </pre>     
 * @sig    : 
 * @param  : TBL
 * @return : Object (Object를 찾지 못한 경우 null 리턴)
 * @author : raika
 */
function getParentNode(srcObj, parentTagName) {
	var targetObj = srcObj;
	while(targetObj.parentNode && targetObj.parentNode.tagName) {
		targetObj = targetObj.parentNode;
		if((targetObj.tagName).toUpperCase() == parentTagName.toUpperCase()) {
			break;
		}
	}
	
	if((targetObj.tagName).toUpperCase() != parentTagName.toUpperCase()) {
		targetObj = null;
	}
	
	return targetObj;
}

/**
 * @type   : function
 * @access : public
 * @desc   : jsp 화면에서 mail을 보내는 함수 
 * <pre>사용예 :
 *
 *     sendMail(title);
 *
 *     - title   : 
 * </pre>     
 * @sig    : 
 * @param  : title
 * @return : none
 * @author :  
 */
function sendMail(){
	if (document.all.mail_print != null){
		cfOpenPopup( "/eservice/cn/common/sendEmailIn.jsp", "Mail", 170, 520 );
	}else{
	  alert("Sorry this page is not support Mail");
	}
}

/**
 * @type   : function
 * @access : public
 * @desc   : jsp 화면에서 print하는 함수
 * <pre>사용예 :
 *
 *     sendPrint();
 *
 * </pre>     
 * @sig    : 
 * @param  : none
 * @return : none
 * @author :  
 */

function sendPrint(){
	if (document.all.mail_print != null){
		cfOpenPopup( "/eservice/cn/common/sendprint.jsp", "Print", 500, 800 );
	}else{
	  alert("Sorry this page is not support Print");
	}
}

/**
 * @type   : function
 * @access : public
 * @desc   : 해당 data가 정수와 소수 자리가 정해져 있을때 이를 검증하기 위해 사용한다.
 * <pre>사용예 :
 *
 *     checkDecimal(weight, 11,2, "중량");
 * </pre>
 * @sig    :
 * @param  : field : 해당 field object
 * @param  : fieldLength : 허용된 총자리
 * @param  : deciAllowed : 허용된 소수자리
 * @param  : fieldDesc : 해당 field의 실제 field명
 * @return : void
 * @author : 계기훈
 */
function checkDecimal(field, fieldLength, deciAllowed, fieldDesc){
	var fieldValue = field.value;
	var num;
	var deci;
	var numAllowed = fieldLength - deciAllowed;
	//if (isNaN(fieldValue) || fieldValue == "") {
	if (isNaN(fieldValue)) {
		alert("Input Digit : " + fieldDesc);
		field.select();
		return false;
	}else{
		if(fieldValue.indexOf('.') == -1) fieldValue += ".";
		num  = fieldValue.substring(0, fieldValue.indexOf('.'));
		deci = fieldValue.substring(fieldValue.indexOf('.')+1, fieldValue.length);

		if (deci.length > deciAllowed){
			alert (fieldDesc + " allows to be input " + deciAllowed + " digits decimal data!");
			field.select();
			return false;
		}

		if (num.length > numAllowed){
			alert (fieldDesc + " allows to be input " + numAllowed + " digits numeric data!");
			field.select();
			return false;
		}
	}
	return true;
}

var cntr_qty_error_msg = "Please check quantity of the container that you inserted.";

/**
 * @type   : function
 * @access : public
 * @desc   : 해당 data가 정수와 소수 자리가 정해져 있을때 이를 검증하기 위해 사용한다.
 * <pre>사용예 :
 *
 *     checkDecimal(weight, 11,2, "중량");
 * </pre>
 * @sig    :
 * @param  : field : 해당 field object
 * @param  : fieldLength : 허용된 총자리
 * @param  : deciAllowed : 허용된 소수자리
 * @param  : fieldDesc : 해당 field의 실제 field명
 * @return : void
 * @author : 계기훈
 */
function checkDecimal2(field, fieldLength, deciAllowed, fieldDesc){
	var fieldValue = field.value;
	var num;
	var deci;
	var numAllowed = fieldLength - deciAllowed;
	
	if (isNaN(fieldValue)) {
		alert("Input Digit : " + fieldDesc);
		field.select();
		return false;
	}else{
		if(fieldValue.indexOf('.') == -1) fieldValue += ".";
		num  = fieldValue.substring(0, fieldValue.indexOf('.'));
		deci = fieldValue.substring(fieldValue.indexOf('.')+1, fieldValue.length);

		if (deci.length > deciAllowed){
			alert (fieldDesc + " allows to be input " + deciAllowed + " digits decimal data!");
			field.select();
			return false;
		}

		if (num.length > numAllowed){
			alert (fieldDesc + " allows to be input " + numAllowed + " digits numeric data!");
			field.select();
			return false;
		}
		
		if( !check_float(fieldValue, cntr_qty_error_msg) ){
			return false;
		}
	}
	return true;
}

var n4 = (document.layers)?1:0; e4 = (document.all)?1:0 
//풍선 도움말..
function popUp(L, e){ 
	if(n4){ 
		var barron = document.layers[L] 
			barron.left = e.pageX+15; 
			barron.top = e.pageY + 5; 
			barron.visibility = "visible"; 
	}else if(e4){ 
		var barron = document.all[L]; 
		barron.style.pixelLeft = event.clientX + document.body.scrollLeft+15; 
		barron.style.pixelTop = event.clientY + document.body.scrollTop + 5; 
		barron.style.visibility = "visible"; 
	} 
} 

function popUpL(L, e, size){ 
	if(n4){ 
		var barron = document.layers[L] 
		barron.left = e.pageX - size; 
		barron.top = e.pageY + 2; 
		barron.visibility = "visible"; 
	}else if(e4){ 
		var barron = document.all[L]; 
		barron.style.pixelLeft = event.clientX + document.body.scrollLeft - size;
		barron.style.pixelTop = event.clientY + document.body.scrollTop + 2; 
		barron.style.visibility = "visible"; 
	} 
} 

function popUpLup(L, e, size){
	if(n4){ 
		var barron = document.layers[L]; 
		barron.left = e.pageX - size; barron.top = e.pageY - 70; 
		barron.visibility = "visible"; 
	}else if(e4){
		var barron = document.all[L]; 
		barron.style.pixelLeft = event.clientX + document.body.scrollLeft - size; 
		barron.style.pixelTop = event.clientY + document.body.scrollTop - 70; 
		barron.style.visibility = "visible"; 
	} 
} 

function popUpRup(L, e){
	if(n4){ 
		var barron = document.layers[L];
		barron.left = e.pageX; 
		barron.top = e.pageY - 70; 
		barron.visibility = "visible"; 
	}else if(e4){ 
		var barron = document.all[L]; 
		barron.style.pixelLeft = event.clientX - 60 ; 
		barron.style.pixelTop = event.clientY + document.body.scrollTop - 70; 
		barron.style.visibility = "visible"; 
	} 
} 

function popDown(L){ 
	if(n4)document.layers[L].visibility = "hidden"; 
	else if(e4)document.all[L].style.visibility = "hidden"; 
}

/**
 * @type   : function
 * @access : private
 * @desc   : 입력값이 알파벳, 숫자인지 체크한다.
 *
 * </pre>
 * @sig    :
 * @param  :
 * @return : boolean
 * @author : 이영혜 
 */
function cfCheckAlphaNum( input ) {
    var string = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";

    for ( var inx = 0; inx < input.length; inx++) {
       if ( string.indexOf( input.charAt( inx ) ) == -1 )
           return true;
    }

    return false;
}

/**
 * @type   : function
 * @access : public
 * @desc   : 문자,숫자 검증하는 함수
 * <pre>사용예 :
 *
 *     cfChkZicpCd( 'asdfdf02' );
 *
 * </pre>
 *     위 결과는 true
 * @sig    : 
 * @param  : str
 * @return : none
 * @author : 
 */
function cfChkVerCd(str) {
	if( String != "" ) {
		count = 0;
		cp_string = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890";

		for( i = 0 ; i < cp_string.length ; i++ ){
			for( j = 0 ; j < str.length ; j++ ){
				if( cp_string.charAt(i) == str.charAt(j) ){
					count++;
				}
			}
		}

		if( count == str.length ){
			return true;
		}else{
			return false;
		}
	}
	
	return true;
}

/**
 * @type   : function
 * @access : public
 * @desc   : 1개의 element정보를 체크한다.
 *
 * </pre>
 * @sig    :
 * @param  : input field, return여부
 * @return : boolean
 * @author : shlee
 */
function objCheck(inputObj,rtn) {
	var nbytes = 0;
	var availMsg = "";
	var chk=0;
	for (var i=0; i<inputObj.value.length; i++) {
		var ch = inputObj.value.charAt(i);
		if(escape(ch).length > 4) {
			nbytes += 2;
		} else if (ch == '\n') {
			if (inputObj.value.charAt(i-1) != '\r') {
				nbytes += 1;
			}
		} else {
			nbytes += 1;
		}
		if(inputObj.maxlen != undefined) {
			if (inputObj.maxlen*1 < nbytes*1) {
				//alert("'"+ availMsg +"'까지만 입력 가능합니다.");
				alert("You must input data less than "+inputObj.maxlen+"!");
				inputObj.value = availMsg;
				inputObj.focus();
				if(rtn == "Y")
					return false;
				else
					return;
			}
		}		
		if(inputObj.fieldtype == "N") {
			if(!cfNumChk(ch)) {
				//alert("'1234567890'만 입력 가능합니다.");
				alert("Not Number Type Data");
				inputObj.value = availMsg;
				inputObj.focus();
				if(rtn == "Y")
					return false;
				else
					return;
			}
		}
		if(inputObj.fieldtype == "F") {
			//if(!check_float(ch,"'1234567890.'만 입력 가능합니다.")) {
			if(!check_float(ch,"Not Number Type Data")) {
				inputObj.value = availMsg;
				inputObj.focus();
				if(rtn == "Y")
					return false;
				else
					return;
			}
		}
		if(inputObj.style.imeMode == "disabled") {
			if(escape(ch).length > 4) {
				//alert("한글은 입력할수 없습니다.");
				alert("Can't input Korean");
				inputObj.value = availMsg;
				inputObj.focus();
				if(rtn == "Y")
					return false;
				else
					return;
			}
		}
		if(inputObj.fieldtype == "VER") {
			if(!cfChkVerCd(ch)) {
				//alert("'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890'만 입력 가능합니다.");
				alert("Can input only 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890'");
				inputObj.value = availMsg;
				inputObj.focus();
				if(rtn == "Y")
					return false;
				else
					return;
			}
		}
		/*
		if(inputObj.fieldtype == "CN"
		|| inputObj.fieldtype == "NC") {
			if(!cfChkZicpCd(ch)) {
				alert("'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890-'만 입력 가능합니다.");
				inputObj.value = availMsg;
				inputObj.focus();
				if(rtn == "Y")
					return false;
				else
					return;
			}
		}
		*/
		availMsg += ch;
	}
	if(rtn == "Y") return true;
}

/**
 * @type   : function
 * @access : public
 * @desc   : form에 있는 elements정보를 체크한다.
 *
 * </pre>
 * @sig    :
 * @param  : form object, return여부
 * @return : boolean
 * @author : shlee
 */
function formCheck(frmObj,rtn) {
	for(var i=0; i<frmObj.elements.length; i++) {
		if(!objCheck(frmObj.elements[i],"Y")) {
			return;
		}
		if(frmObj.elements[i].fieldtype == "EMAIL") {
			if (frmObj.elements[i].value != ""
			&& !cfChkEmail(frmObj.elements[i].value)) {
				//alert("mail형식에 맞지 않습니다.");
				alert("Not Mail Type Data");
				frmObj.elements[i].focus();
				if(rtn == "Y")
					return false;
				else
					return;
			}
		}
		if(frmObj.elements[i].mandatory == "Y") {
			if (frmObj.elements[i].value == "") {
				//alert("필수항목입니다.");
				alert("This is mandatory item");
				frmObj.elements[i].focus();
				if(rtn == "Y")
					return false;
				else
					return;
			}
		}
	}
	if(rtn == "Y") return true;
}

/**
 * @type   : function
 * @access : public
 * @desc   : MMDDYY 날짜형식의 Validation을 체크한다. 
 *
 * </pre>
 * @sig    :
 * @param  : str_date => 날짜  
 * @return : boolean
 * @author : NDY
 */
function chkDateMMddyy(str_date){
	var tmp = '';
	
	var mm;
	var dd;
	var yyyy;
	
	var chk_string = "1234567890";
	for( i = 0 ; i < str_date.length ; i++ ){
		for( j = 0 ; j < chk_string.length ; j++ ){
			if( str_date.charAt(i) == chk_string.charAt(j)){
				tmp = tmp + str_date.charAt(i);
			}
		}	
	}
	
	if(tmp.length != 6) {
		return false;
	} else {
		mm = tmp.substring(0,2);
		dd = tmp.substring(2,4);
		yyyy = tmp.substring(4);
		
		if(isNaN(mm) != 0 || isNaN(dd) != 0 || isNaN(yyyy) != 0) {
			return false;
		}
		
		if(mm <= 0 || mm > 12) {
			return false;
		} else {
			if(mm == 2) {
				if(dd <= 0 || dd > 29) {
					return false;
				}
			}else if(mm == 1 ||  mm == 3 || mm == 5 || mm == 7 || mm == 8 || mm == 10 || mm == 12) {
				if(dd <= 0 || dd > 31) {
					return false;
				}
			}else {
				if(dd <= 0 || dd > 30) {
					return false;
				}
			}
		}
	}

	return true;
}

/**
 * @type   : function
 * @access : public
 * @desc   : MMDDYY 날짜형식을 체크한 뒤 Calendar를 호출한다. 
 *
 * </pre>
 * @sig    :
 * @param  : obj => Input Name
             tt => Title
             xxx, yyy => 화면에서 Calendar 위치 
 * @return : boolean
 * @author : NDY
 */
function cfOpenCalendar(obj, tt, xxx, yyy){
	if(!chkDateMMddyy(obj.value)) {
		obj.value = cfGetToday2("", tt).substring(4,6)+cfGetToday2("", tt).substring(6,8)+cfGetToday2("", tt).substring(2,4);
	}
	Calendar2(obj, tt, xxx, yyy);
}

function cfCheckNumeric(){

   if(event.keyCode < 48 || event.keyCode > 57){
      return false;
   }
   return true;

}

/*
2009.02.19 - 김종명
Date Format Check(MMddyy)
*/
function chkDateMMddyy2(str_date){
    var b = false;
    var rg = new RegExp("[0-9]{6}");
    if(rg.test(str_date)){
        var y = 2000+Number(str_date.substr(4,2));
        var m = Number(str_date.substr(0,2))-1;
        var d = Number(str_date.substr(2,2));
        if(m>=0 && d>0){
            var dt = new Date(y,m,d);
            if(dt.getMonth()==m){
                b = true;
            }
        }
    }
    return b;
}