<!--// Create by JKLEE  2002.10.6
	// HTML¿¡ À§Ä¡ÇÑ Form Data¸¦ SettingÇÏ¿©ÁØ´Ù...

	/*
	 * »ç¿ë¿¹
	 *

	function checkValue() {

        if ( !isAvailable("testForm", "text1") )        return setFocus("testForm", "text1", "text1 is unselected");
        if ( !isAvailable("testForm", "textarea1") )    return setFocus("testForm", "textarea1", "textarea1 is unselected");
        if ( !isAvailable("testForm", "check1") )       return setFocus("testForm", "check1", "check1 is unselected");
        if ( !isAvailable("testForm", "text2") )        return setFocus("testForm", "text2", "text2 is unselected");
        if ( !isAvailable("testForm", "textarea2") )    return setFocus("testForm", "textarea2", "textarea2 is unselected");
        if ( !isAvailable("testForm", "radio1") )       return setFocus("testForm", "radio1", "radio1 is unselected");
        if ( !isAvailable("testForm", "check2") )       return setFocus("testForm", "check2", "check2 is unselected");
        if ( !isAvailable("testForm", "select1") )      return setFocus("testForm", "select1", "select1 is unselected");
        if ( !isAvailable("testForm", "select2") )      return setFocus("testForm", "select2", "select2 is unselected");

		setValue("testForm", "text1", "10,20,");
        setValue("testForm", "textarea1", "10,20,");
        setValue("testForm", "check1", "0");
        setValue("testForm", "text2", "10,20,30,");
        setValue("testForm", "textarea2", "10,20,30,");
        setValue("testForm", "radio1", "01");
        setValue("testForm", "check2", "00110011");
        setValue("testForm", "select1", "00100");
        setValue("testForm", "select2", "00100,00001,");

        setIndex("testForm", "select1", "1");
        setIndex("testForm", "select2", "12");

		return false;
	}

	*
	*/
	function newWinNameOpen( url, winName ) {
 	    printWin = window.open( url, winName, "toolbar=no,width=720,height=700,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes");
 	    printWin.focus();
	}
	
	function newWindowsOpen( url ) {
    	newWinNameOpen( url, "printWin" )
	}
	
	function isObject(form, obj) {
		if ( typeof document.all[form][obj] == "undefined" ) return false;
		else return true;
	}

	function getType(form, obj) {
	    
        var cnt = isArray(form,obj);
        var objtype = "";
        
        if (cnt > 0 && typeof document.all[form][obj].name == "undefined" ) {
            objtype = document.all[form][obj][0].type;
        }
        else {
			objtype = document.all[form][obj].type;
        }

        return objtype.toUpperCase();
	}

	function setFocusByIndex(form, obj, index, msg) {
        var i = 0;
        var cnt = isArray(form,obj);

        if ( getType(form,obj) == "FILE" || getType(form,obj).substring(0,4) == "TEXT" ) {

            for (i=0; i<cnt; i++) {
				document.all[form][obj][index].focus();
				return confirm(msg);
            }
            if (cnt < 0) {
                document.all[form][obj].focus();
            }
        }
        else {
            if ( getType(form,obj).substring(0,7) == "SELECT-" ) { 
                if ( typeof document.all[form][obj].name == "undefined" ) {  // ÇÑ°³ ÀÌ»óÀÏ ¶§
                    for (i=0; i<cnt; i++) {
						document.all[form][obj][index].focus();
						return confirm(msg);
                    }
                }
                else {
                    document.all[form][obj].focus();
                }

            }

			if (cnt > 0) {
                document.all[form][obj][index].focus();
            }
            else {
                document.all[form][obj].focus();
            }
        }

		return confirm(msg);
	}

	function setFocus(form, obj, msg) {
        var i = 0;
        var cnt = isArray(form,obj);

        if ( getType(form,obj) == "FILE" || getType(form,obj).substring(0,4) == "TEXT" ) {

            for (i=0; i<cnt; i++) {
                if (document.all[form][obj][i].value == "") {
                    document.all[form][obj][i].focus();
                    alert(msg);
                    return false;
                }
            }
            if (cnt < 0) {
                if (document.all[form][obj].value == "") {
                    document.all[form][obj].focus();
                }
            }
        }
        else {
            if ( getType(form,obj).substring(0,7) == "SELECT-" ) { 
                if ( typeof document.all[form][obj].name == "undefined" ) {  // ÇÑ°³ ÀÌ»óÀÏ ¶§
                    for (i=0; i<cnt; i++) {
                        if (!isAvailableSelectArray(form,obj,i)) {
                            document.all[form][obj][i].focus();
                            alert(msg);
                            return false;
                        }
                    }
                }
                else {
                    document.all[form][obj].focus();
                }

            }

            if (cnt > 0) {
                document.all[form][obj][i].focus();
            }
            else {
                document.all[form][obj].focus();
            }
        }

        alert(msg);
        return false;
	}


    function isAvailable(form, obj) {

        var i = j = 0;
        var check = 0;

        var cnt = isArray(form,obj);
        
        for (i=0; i<cnt; i++) {
            
            if ( getType(form,obj) == "FILE" || getType(form,obj) == "HIDDEN" || getType(form,obj).substring(0,4) == "TEXT" || getType(form,obj) == "PASSWORD" ) {
				if (document.all[form][obj][i].value != "" && document.all[form][obj][i].value.trim().length > 0) {				
                    check++;
                }
				else {
                    return false;
                }
            }
            else if ( getType(form,obj) == "CHECKBOX" || getType(form,obj) == "RADIO" ) {
				if (document.all[form][obj][i].checked == true) {
                    check++;
                }
            }
            else if ( getType(form,obj).substring(0,7) == "SELECT-" ) { 
                if ( typeof document.all[form][obj].name == "undefined" ) {  // ÇÑ°³ ÀÌ»óÀÏ ¶§
                    check=0;
                    if (isAvailableSelectArray(form,obj,i)) {
                        check++;
                    }
                    else {
                        return false;
                    }
                }
                else {                                              // ÇÑ°³ÀÏ¶§
                    if (i >= cnt-1) {
                        break;
                    }
                    if (document.all[form][obj][i+1].selected == true) {
                        check++;
                    }
                }
            }
			else
				alert("Object Type : " + getType(form,obj));
        }
        
        if (cnt < 0) {
            if ( getType(form,obj) == "FILE" || getType(form,obj) == "HIDDEN" || getType(form,obj).substring(0,4) == "TEXT" || getType(form,obj) == "PASSWORD" ) {

                if (document.all[form][obj].value == "" || document.all[form][obj].value.trim().length <= 0) {				
                    return false;
                }
                else {
                    check++;
                }
            }
            else if ( getType(form,obj) == "CHECKBOX" || getType(form,obj) == "RADIO" ) {
				if (document.all[form][obj].checked == true) {
                    check++;
                }
            }
            else if ( getType(form,obj).substring(0,7) == "SELECT-" ) { 
				alert(getType(form,obj));
            }
			else
				alert(getType(form,obj));
        }

        return (check > 0);
    }

    function isAvailableSelectArray(form, obj, index, data) {
        var i = 0;
        var check = 0;
        var cnt = isArray2(form,obj,index);

        for (i=1; i<cnt; i++) {
            if (document.all[form][obj][index][i].selected == true) {
                check++;
            }
        }
        return (check > 0);
    }

    function setIndex(form, obj, index) {
        var i = 0;
        var cnt = isArray(form,obj);
        
        for (i=0; i<cnt; i++) {
            if ( getType(form,obj).substring(0,7) == "SELECT-" ) {
                if ( typeof document.all[form][obj].name == "undefined" ) {  // ÇÑ°³ ÀÌ»óÀÏ ¶§
                    setSelectIndex(form, obj, i, index.substring(i,i+1));
                }
                else {
                    document.all[form][obj][index].selected = true;
                }
            }
            else {
                if ( i == index ) {
                    document.all[form][obj][i].checked = true;
                }
            }
        }
    }

    function setSelectIndex(form, obj, index, value) {
        document.all[form][obj][index][value].selected = true;
    }


    function setValue(form, obj, data) {
        var i = 0;
        var cnt = isArray(form,obj);

        for (i=0; i<cnt; i++) {
            if ( getType(form,obj) == "FILE" || getType(form,obj).substring(0,4) == "TEXT" ) {
                document.all[form][obj][i].value = str2Arr(data)[i];
            }
            else if ( getType(form,obj) == "CHECKBOX" || getType(form,obj) == "RADIO" ) {
                document.all[form][obj][i].checked = (data.substring(i,i+1) > 0);
            }
            else if ( getType(form,obj).substring(0,7) == "SELECT-" ) {
                if ( typeof document.all[form][obj].name == "undefined" ) {  // ÇÑ°³ ÀÌ»óÀÏ ¶§
                    setSelectArray(form, obj, i, str2Arr(data)[i]);
                }
                else {
                    setSelectArray(form, obj, i, data);
                }
            }
        }
        if (cnt < 0) {
            if ( getType(form,obj) == "FILE" || getType(form,obj).substring(0,4) == "TEXT" ) {
                document.all[form][obj].value = data;
            }
            else if ( getType(form,obj) == "CHECKBOX" ) {
                document.all[form][obj].checked = (data.substring(i,i+1) > 0);
            }
        }
    }

    function setSelectArray(form, obj, index, data) {
        var i = 0;
        var cnt = isArray2(form,obj,index);
        for (i=0; i<cnt; i++) {
            document.all[form][obj][index][i].selected = (data.substring(i,i+1) > 0);
        }
    }

	function isArray(form, name) {
        var i = 0;

		for (i=0; i<document.all.length; i++) {
			if ( typeof document.all[form] != "undefined" ) {
				if ( typeof document.all[form][name] != "undefined"  ) {
					return (typeof document.all[form][name].length == "undefined") ? -1 : document.all[form][name].length;
                }
                else {
                    return -1;
                }
            }

		}
	}

	function isArray2(form, name, index) {
        var i = 0;
		for (i=0; i<document.all.length; i++) {
			if ( typeof document.all[form] != "undefined" ) {
				if ( typeof document.all[form][name] != "undefined"  ) {
					return (typeof document.all[form][name][index].length == "undefined") ? -1 : document.all[form][name][index].length;
                }
                else {
                    return -1;
                }
            }
		}
	}

    function str2Arr(value) {
        var cnt=sp=ep=0;
        var result = new Array();
        while ( (ep=value.indexOf(",", sp)) > 0 ) {
            result[cnt++] = value.substring(sp,ep);
            sp = ep+1;
        }
        return result;
    }

	function swap01(value) {
             if ( value == 0 ) return 1;
		else if ( value == 1 ) return 0;
	}

	function checkChar(str){

	   len = str.value.length;

	   for(i=0;i<len;i++){
		   if(   str.value.charAt(i)=="" || str.value.charAt(i)=="%" 
			  || str.value.charAt(i)=="\"" || str.value.charAt(i)=="&" ){

			  alert("The email address format is wrong. Please check your email address.");
			  str.value="";
			  str.focus();
			  return false;
		   }
	   }

	   return true;
	}
	
	function emailAvailableCheck(str)
	{
	   var emailStr=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i
	   if (emailStr.test(str)) { return true; }
	   else { return false; }
	}
		
	function emailConfirm(eml){

	   if( checkChar( eml ) == false ) return false;

	   comIndex = eml.value.indexOf(",");
	   aIndex = eml.value.indexOf("@");

	   len = eml.value.length;

	   if( len == 0 )  return false;
	   else if( comIndex == "-1" && aIndex > 1){  return 1;  }
	   else { return 0; }

	   return 1;
	}
	
	function chkMail(eml, userAction) {

	   if( checkChar( eml ) == false ) return false;

	   comIndex = eml.value.indexOf(",");
	   aIndex = eml.value.indexOf("@");

	   len = eml.value.length;

	   if( len == 0 ) { 
		  document.emailSubscription.userAction.value = userAction;
		  return false;
	   }
	   else if( comIndex == "-1" && aIndex > 1){
		  document.emailSubscription.userAction.value = userAction;
		  return true;
	   }
	   else{
		  alert("The email address format is wrong. Please check your email address.");
		  eml.value = "";
		  eml.focus();
		  return false;
	   }

	   document.emailSubscription.userAction.value = userAction;
	   return true;
	}

	function CheckID( UserID ){

		var cgiProgram;

		if (UserID == ""){
			alert("Please Insert Userid.");
		} else {
			if (navigator.appName == "Netscape"){
				cgiProgram = "/Cyber/servlet/UserCheckid?userid="+escape(UserID);
			} else {
				cgiProgram = "/Cyber/servlet/UserCheckid?userid="+UserID;
			} /* endif */

			window.open(cgiProgram, "StartWindow", "scrollbars=yes,toolbar=no,location=no,directories=no,width=300,height=100,resizable=no,mebar=no,left=250,top=100");
		} /* endif */
	  //location.href=cgiProgram;
	}


	function Tcheck(id) {
		 var Alpha = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIGKLMNOPQRSTUVWXYZ';
		 var Digit = '1234567890';
		 var sum = Alpha + Digit; 
		 var inputid = id; 
		 if(sum.length > 1)
		 {
			 for(i=0 ; i < inputid.length ; i++) {
				if(sum.indexOf(inputid.substring(i,i+1)) < 0) {
				   alert("¾ÆÀÌµð´Â ¿µ¾î¿Í ¼ýÀÚÀÇ Á¶ÇÕÀ¸·Î ¸¸µé¾î ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.");
				   return true;
				}
			  }
		 }
			return false;
	}
	
	function PrintFormView( viewURL )
	{
	  var PosX,PosY;
	  PosX = parseInt ((screen.width-608) /2 );
	  PosY = parseInt ((screen.height-440) /2 );
	  window.open(viewURL,"","status=no,resizable=no,width=650,height=600,scrollbars=yes,toolbar=no,location=no,menubar=no,top="+PosY+",left="+PosX);
	}
	
	function _private_trim()
	{
		var tmpStr, atChar;
		tmpStr = this;

		if (tmpStr.length > 0) atChar = tmpStr.charAt(0);
		while (_private_isSpace(atChar))
		{
			tmpStr = tmpStr.substring(1, tmpStr.length);
			atChar = tmpStr.charAt(0);
		}

		if (tmpStr.length > 0) atChar = tmpStr.charAt(tmpStr.length-1);
		while (_private_isSpace(atChar))
		{
			tmpStr = tmpStr.substring(0,( tmpStr.length-1));
			atChar = tmpStr.charAt(tmpStr.length-1);
		}

		return tmpStr;
	}

	function _private_left(inLen)
	{
		return this.substring(0,inLen);
	}

	function _private_right(inLen)
	{
		return this.substring((this.length-inLen),this.length);
	}

	function _private_mid(inStart,inLen)
	{
		var iEnd;

		if (!inLen)
			iEnd = this.length;
		else
			iEnd = inStart + inLen;

		return this.substring(inStart,iEnd);
	}

	function _private_isSpace(inChar)
	{
		return (inChar == ' ' || inChar == '\t' || inChar == '\n');
	}
	
	String.prototype.trim     = _private_trim;
	String.prototype.left     = _private_left;
	String.prototype.right    = _private_right;
	String.prototype.mid      = _private_mid;
	

//-->
