﻿	var basic_chk = false;
	function basicfocus(event){
	    var target = paid.UserEvent.getTarget(event);

	    if (target.id != null) {
	        if(!basic_chk){
	            basic_chk = true;
	            document.getElementById(target.id).value= "";
	        }
	    }
	}

	/* 1. 문자열의 양쪽(왼쪽, 오른쪽) 공백 제거 */
	function trim(pstr) {
		var search = 0
		while (pstr.charAt(search) == " ") {
			search = search + 1
		}
		pstr = pstr.substring(search, (pstr.length))
		search = pstr.length - 1
		while (pstr.charAt(search) ==" ")
		{
			search = search - 1
		}
		return pstr.substring(0, search + 1)
	}

	/* 2. 문자열의 BYTE 길이 구하기 */
	function bytelength(pstr) {
		var i, ch;
		len = pstr.length;
		for (i = 0; i < pstr.length; i++) {
			ch = pstr.substr(i,1).charCodeAt(0);
			if (ch > 127) { len++; }
		}
		return len;
	}

	/* 3. 한글 스트링 체크 */
	function hanstr(pstr) {
		var i, ch;
		for (i = 0; i < pstr.length; i++) {
			ch = escape(pstr.charAt(i));        //ISO-Latin-1 문자셋으로 변경
			//가 ==> %uAC00
			//힝 ==> %uD79D
			//?R ==> %uD7A3
			if (strCharByte(ch) != 2) {
				return false;
			}
		}
		return true;
	}

	/* 3-1. 한글 byte 체크 */
	function strCharByte(chStr) {

		if (chStr.substring(0, 2) == '%u') {

			/* alert(chStr.substring(2,6)); */
			if (chStr.substring(2,6) >= "AC00" && chStr.substring(2,6) <= "D7A3") {
				return 2;			/* 한글 */
			} else {
				return 1;
			}

			/* 구버전 */
			/*
			if (chStr.substring(2,4) == '00')
				return 1;
			else
				return 2;
			*/

		} else if (chStr.substring(0,1) == '%') {
			if (parseInt(chStr.substring(1,3), 16) > 127)
				return 2;			/* 한글 */
			else
				return 1;
		} else {
			return 1;
		}

	}

	/* 4. 숫자 스트링 체크 */
	function digitstr(pstr) {
		var valid = "0123456789";
		return checkstr(pstr, valid, 0);
	}



    /* 4. 전화번호 스트링 체크 */
	function phoneDigitstr(pstr) {
		var valid = "0123456789[]+-()";
		return checkstr(pstr, valid, 0);
	}

	/* 5. 영문자 스트링 체크 */
	function alphastr(pstr) {
		var valid = "ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz \\ .";
		return checkstr(pstr, valid, 0);
	}

	/* 5. 이름 스트링 체크 */
	function nameAlphastr(pstr) {
		var valid = "ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz,-";
		return checkstr(pstr, valid, 0);
	}

	/* 5. 영문자,숫자 스트링 체크 */
	function alphadigitstr(pstr) {
		var valid = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
		return checkstr(pstr, valid, 0);
	}

	/* 5. fileName 체크 */
	function fileNameAlphadigitstr(pstr) {
		var valid = "ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz0123456789_.-[]{}<>()";
		return checkstr(pstr, valid, 0);
	}

	/* 6. 영문자,숫자,특수문자 스트링 체크 */
	function charstr(pstr) {
		var valid = "ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz0123456789~!@#$%^*()_+`-={}|[]\\:\";'<>?,./&";
		return checkstr(pstr, valid, 0);
	}

	function checkstr(pstr, pvalid, han) {
		var valid = pvalid;
		var tmp;
		var flag = true;

		for (var i = 0; i < pstr.length; i++) {
			flag = true;
			tmp = "" + pstr.substring(i, i+1);

			if (han != 1) {
				if (valid.indexOf(tmp) == "-1") {
					return false;
				}
			} else {
				ch = escape(pstr.charAt(i));        //ISO-Latin-1 문자셋으로 변경
				if (valid.indexOf(tmp) == "-1" &&
					strCharByte(ch) != 2) {
					return false;
				}
			}
		}
		return true;;
	}

	/* 주민등록번호 체크 */
	function validPersono(fpersono1, fpersono2, fname) {
		var str1 = trim(fpersono1.value);
		var str2 = trim(fpersono2.value);
		var len1 = bytelength(str1);
		var len2 = bytelength(str2);
		if (!fname) fname = "Registration No.";

		var str = String(str1) + String(str2);
		var len = bytelength(str);

        var sex = str2.substring(0,1);

        if (str1 == "" || len1 == 0 || str2 == "" || len2 == 0) {
			alertErrorMessage(fname);
			return false;
		}

        if (len1 != 6 || len2 != 7 || len != 13) {
            alertErrorMessage(fname);
            return false ;
        }

        if (!digitstr(str1) || !digitstr(str2) || !digitstr(str)) {
            alertErrorMessage(fname);
            return false;
        }

        if (sex == "9" || sex == "0") {
            alertErrorMessage(fname);
            return false;
        }

        if (str1 == "570908" && str2 == "1009010")
        	return true;

        if (sex == "1" || sex == "2" || sex == "3" || sex == "4")
        {
			var chk = 0 ;
			total = 0;
			temp = new Array(13);

			for(i = 1; i <= 6; i++) {
				temp[i] = str1.charAt(i-1);
			}

			for(i = 7; i < 13; i++) {
				temp[i] = str2.charAt(i-7);
			}

			for(i = 1; i <= 12; i++ ) {
				k = i + 1;
				if( k >= 10 ) {
					k = k % 10 + 2;
				}
				total = total + temp[i] * k;
			}

			mm = temp[3] + temp[4];
			dd = temp[5] + temp[6];
			temp[13] = str2.charAt(6);

			totalmod = total % 11;
			chd = (11 - totalmod) % 10;

			if (chd == temp[13] && mm < 13 && dd < 32 &&
				(temp[7]==1 || temp[7] == 2 || temp[7] == 3 || temp[7] == 4)) {
				return true;
			}
			alertErrorMessage(fname);
			return false;
		}
		else
		{
			var sum = 0;
			var odd = 0;
			var reg_no = str1 + str2;

			buf = new Array(13);
			for (i = 0; i < 13; i++) buf[i] = parseInt(reg_no.charAt(i));

		    odd = buf[7]*10 + buf[8];

		    if (odd%2 != 0) {
				alertErrorMessage(fname);
				return false;
			}

			if ((buf[11] != 6)&&(buf[11] != 7)&&(buf[11] != 8)&&(buf[11] != 9)) {
				return false;
			}

			multipliers = [2,3,4,5,6,7,8,9,2,3,4,5];
			for (i = 0, sum = 0; i < 12; i++) sum += (buf[i] *= multipliers[i]);

			sum=11-(sum%11);

			if (sum>=10) sum-=10;

	    	sum += 2;

		    if (sum>=10) sum-=10;

		    if ( sum != buf[12]) {
				alertErrorMessage(fname);
				return false;
			} else {
				return true;
			}
		}
	}

	function alertErrorMessage(fieldName) {
		alert("'"+fieldName+"' has the wrong input. \nPlease, check and re-enter '"+fieldName+"'.");
	}

	function formCheck() {
		var form = document.Form;
		var peterName = trim(form.peter_name_v.value);
		var peterName1 = trim(form.USE_LANG.value);

		// 신청인 이름 체크
		//베트남어: ~은 필수입력사항입니다----> B&#7843;n n&agrave;y d&ugrave;ng đ&#7875; nh&#7853;p n&#7897;i dung.
		if (peterName == ""){
			if (peterName1 == "vtn") {
				alert("'Tên' Bản này dùng để nhập nội dung");
		  		form.peter_name_v.focus();
				return false;
			} else {
				alert("'Name' is a required field.");
		  		form.peter_name_v.focus();
				return false;
			}
		}

		// 신청인 이름이 영문인지 체크
		if (!nameAlphastr(peterName)) {
			if (peterName1 == "vtn") {
				alert("Hãy nhập tên của bạn bằng tiếng Anh. \nXin vui lòng nhập lại kiểm tra..");
	  		form.peter_name_v.focus();
				return false;
			} else {
				alert("Enter your name in English. \nPlease, check it and try it again.");
	  		form.peter_name_v.focus();
				return false;
			}
		}



		// 연락처1 체크
		if(!phoneDigitstr(form.tel_no_v.value)) {
			if (peterName1 == "vtn") {
				alertErrorMessage("Số điện thoại.");
				form.tel_no_v.focus();
				return false;
			} else {
				alertErrorMessage("Tel No.");
				form.tel_no_v.focus();
				return false;
			}
		}

		if(!phoneDigitstr(form.fax_no_v.value)) {
			if (peterName1 == "vtn") {
				alertErrorMessage("Số Fax.");
				form.fax_no_v.focus();
				return false;
			} else {
				alertErrorMessage("FAX No.");
				form.fax_no_v.focus();
				return false;
			}
		}

		if (form.address_v.value == ""){
			if (peterName1 == "vtn") {
				alert("'Địa chỉ nộp đơn' Bản này dùng để nhập nội dung.");
				form.address_v.focus();
				return false;
			} else {
				alert("'Residential address' is a required field.");
				form.address_v.focus();
				return false;
			}
		}
		else if (!charstr(form.address_v.value)) {
			if (peterName1 == "vtn") {
				alert("Nhập địa chỉ bằng tiếng Anh.");
				form.address_v.focus();
				return false;
			} else {
				alert("Enter Residential address in English.");
				form.address_v.focus();
				return false;
			}
		}
		//이메일 주소 체크
		if (form.email_v1.value == "" || form.email_v2.value == ""){
			if (peterName1 == "vtn") {
				alert("'Địa chỉ e-mail' Bản này dùng để nhập nội dung.");
				form.email_v1.focus();
				return false;
			} else {
				alert("'Email' is a required field.");
				form.email_v1.focus();
				return false;
			}
		}else{
			var fname = "Email";
			if(validMyemail(form.email_v1, form.email_v2, fname)){
				form.email_v.value = form.email_v1.value + "@" + form.email_v2.value;
			}else{
				return false;
			}
		}

		if (form.memPw.value.length < 8){
			if (peterName1 == "vtn") {
					alert("8 chỗ hoặc nhiều hơn, \n hoặc ít hơn 12 chữ số, nhập vào Hoa Kỳ.");
					form.memPw.focus();
					return false;
			} else {
					alert("For your password, \nplease enter the eight to twelve characters with English lower case letters and numbers.");
					form.memPw.focus();
					return false;
			}
		}
		else if (form.memPw2.value.length < 8) {
			if (peterName1 == "vtn") {
				alert(" 8-chữ số mật khẩu phải được nhập.  \nor Tiếng Anh chữ thường và chữ số, nhập.");
				form.memPw2.focus();
				return false;
			} else {
				alert("The 'Confirm Password' field must enter eight characters \nor more in combination with English small letters and numbers.");
				form.memPw2.focus();
				return false;
			}
		} 
		else if(form.memPw.value != form.memPw2.value){
			if (peterName1 == "vtn") {
				alert("Mật khẩu là khác nhau. Nhập đúng mật khẩu.");
				form.memPw2.focus();
				return false;
			} else {
				alert("The passwords are different from each other. Please check and re-enter your password");
				form.memPw2.focus();
				return false;
			}
			
		}

		//Attached File 중 첫 번째는 필수 입력항목으로 반드시 입력되어야 하고,
		//입력된 값이 doc 파일이 아닌경우 확인하고 넘어간다.
		if (form.file1.value.length < 1 ){
			if (peterName1 == "vtn") {
				alert("'Tập tin đính kèm' Bản này dùng để nhập nội dung.");
				form.file1.focus();
				return false;
			} else {
				alert("'Application Form' is a required field.");
				form.file1.focus();
				return false;
			}
			
		}
		else if (form.file1.value.toLowerCase().indexOf(".doc") < 1 && form.file1.value.toLowerCase().indexOf(".rtf") < 1) {
			if (peterName1 == "vtn") {
				alert("Tải chúng trên hệ thống cung cấp mẫu chính xác.");
				form.file1.focus();
				return false;
			} else {
				alert("You must only submit the appropriate \nform provided in the e-People service.");
				form.file1.focus();
				return false;
			}
		}

		//첨부파일1의 파일명은 영문 및 숫자만 가능함.
		var fileName = getFileName(form.file1.value);
		//var fileName2 = replaceFileStr(fileName);
		if (!fileNameAlphadigitstr(fileName)) {
			if (peterName1 == "vtn") {
				alert("Các tên tập tin của các tập tin đính kèm trong hai \n Mỹ và số điện thoại có sẵn.");
				form.file1.focus();
				return false;
			} else {
				alert("For the name of ‘Application Form’, \nplease enter English characters or numbers only");
				form.file1.focus();
				return false;
			}
		}
		/*
		fileValue = form.file1.value.replaceAll(fileName,fileName2);
		form.file1.outerHTML = "<input name= 'file1' id='file1' type='file' class='in3 input_1' style='background-color:#e6e6e6;' value='"+fileValue+"'/>";
		 */


		//첨부파일2의 파일명은 영문 및 숫자만 가능함.

		fileName = getFileName(form.file2.value);
		//fileName2 = replaceFileStr(fileName);
		if (!fileNameAlphadigitstr(fileName)) {
			if (peterName1 == "vtn") {
				alert("Các tên tập tin của các tập tin đính kèm trong hai \n Mỹ và số điện thoại có sẵn.");
				form.file2.focus();
				return false;
			} else {
				alert("For the name of ‘Attached File’, \nplease enter English characters or numbers only.");
				form.file2.focus();
				return false;
			}
		}


		return true;
	}

	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;
    }





	function replaceFileStr(Str){

		var Str1 = "~!@#$%^&+";
		var Str2 ="-";

		var Temp="";
		var Temp1="";
		for(i = 0;  i < Str.length ; i ++){
			Temp1 = Str.charAt(i);
			for(j = 0 ; j < Str1.length ; j ++){
				if(Str.charAt(i) == Str1.charAt(j)){
					Temp1 = Str2;
					break;
				}
			}
			Temp += Temp1;
		}

		return Temp;
	}

	function fileCheck(){

	    var Form = document.Form;
	    var obj;
	    var tmpName;
	    var fileName;
	    var subName;
	    var lastName;
	    var len;
	    var idx1;
	    var end;
	    var flag = true;
	    var token = ",;:'~!$%^&*+=|";
	    var token2 = "..";
	    var end2;
	    var bIsAttach = false;

	    for(var i = 1; i < 2; i++){

	    	var fieldName ="Application Form";

	    	if(i == 2){
	    		fieldName ="Attached File";
	    	}

	        obj = document.getElementById("file" + i);

	        tmpName = obj.value;
	        idx1 = tmpName.indexOf(":");
	        len = tmpName.lastIndexOf(".");
	        fileName = tmpName.substring(0, len);

	        subName = fileName.substring(idx1+1, len);
	        lastName = tmpName.substring(len+1, tmpName.length).toLowerCase();


	        fileName1 = tmpName.substring(0, len+1);
	        subName1 = fileName1.substring(idx1+1, len+1);

	        if(tmpName != ""){
	            bIsAttach = true;
	            if(lastName == "exe" || lastName == "php" || lastName == "asp" || lastName =="html" || lastName == "htm" || lastName == "jsp" || lastName == "java"){
	                alert("["+ lastName +  "]" + "'"+fieldName+"' has the wrong input. \nPlease, check and re-enter '"+fieldName+"'.");
	                obj.outerHTML = "<input name= 'file" + i + "' id='file" + i + "' type='file' class='in3 input_1' style='background-color:#e6e6e6;' />";
	                flag =  false;
	            }else if (len != -1) {
	                for (var j = 0; j<token.length; j++) {
	                    end = subName.lastIndexOf(token.charAt(j), len-1);
	                    if (end != -1 && len-1 != end) {
	                        alert("[" + token.charAt(j) + "] '"+fieldName+"' has the wrong input. \nPlease, check and re-enter '"+fieldName+"'.");
	                        obj.outerHTML = "<input name= 'file" + i + "' id='file" + i + "' type='file' class='in3 input_1' style='background-color:#e6e6e6;' />";
	                        flag = false;
	                    }
	                }
	                end2 = subName1.lastIndexOf(token2, len-1);
	                if (end2 != -1 && len-1 != end2) {
	                        alert("[..] '"+fieldName+"' has the wrong input. \nPlease, check and re-enter '"+fieldName+"'.");
	                        obj.outerHTML = "<input name= 'file" + i + "' id='file" + i + "' type='file' class='in3 input_1' style='background-color:#e6e6e6;'' />";
	                        flag = false;
	                }
	            }

	        }

	    }

	    if(bIsAttach){
	        Form.encoding = "multipart/form-data";

	    } else{
	        Form.encoding = "application/x-www-form-urlencoded";
	    }

	    return flag;
	}



	// 내용저장
	function contentSave(){
		formSubmit();
	}

	function formSubmit() {

		var form = document.Form;

		if(formCheck() && fileCheck()) {
			document.Form.method = "post";
			document.Form.mode.value = "createPcCvreq";
			document.Form.peter_name_v.value = trim(document.Form.peter_name_v.value);
			document.Form.submit();
		}
		return;
	}

	// File name Get
	function getFileName(filePath){
		for(i = filePath.indexOf("."); i >= 0; i--){
			if(filePath.substring(i,i+1) == "\\" || filePath.substring(i,i+1) == "\/"){
				return filePath.substring(i+1,filePath.length);
			}
		}
		return "";
	}

function emailstr(emailStr) {

	/* The following variable tells the rest of the function whether or not
	   to verify that the address ends in a two-letter country or well-known
	   TLD.  1 means check it, 0 means don't. */

	var checkTLD = 1;

	/* The following is the list of known TLDs that an e-mail address must end with. */

	var knownDomsPat=/^(com|net|org|edu|int|mil|gov|arpa|biz|aero|name|coop|info|pro|museum)$/;

	/* The following pattern is used to check if the entered e-mail address
	   fits the user@domain format.  It also is used to separate the username
	   from the domain. */

	var emailPat = /^(.+)@(.+)$/;

	/* The following string represents the pattern for matching all special
	   characters.  We don't want to allow special characters in the address.
	   These characters include ( ) < > @ , ; : \ " . [ ] */

	var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]";

	/* The following string represents the range of characters allowed in a
	   username or domainname.  It really states which chars aren't allowed.*/

	var validChars="\[^\\s" + specialChars + "\]";

	/* The following pattern applies if the "user" is a quoted string (in
	   which case, there are no rules about which characters are allowed
	   and which aren't; anything goes).  E.g. "jiminy cricket"@disney.com
	   is a legal e-mail address. */

	var quotedUser="(\"[^\"]*\")";

	/* The following pattern applies for domains that are IP addresses,
	   rather than symbolic names.  E.g. joe@[123.124.233.4] is a legal
	   e-mail address. NOTE: The square brackets are required. */

	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;

	/* The following string represents an atom (basically a series of non-special characters.) */

	var atom = validChars + '+';

	/* The following string represents one word in the typical username.
	   For example, in john.doe@somewhere.com, john and doe are words.
	   Basically, a word is either an atom or quoted string. */

	var word="(" + atom + "|" + quotedUser + ")";

	// The following pattern describes the structure of the user

	var userPat=new RegExp("^" + word + "(\\." + word + ")*$");

	/* The following pattern describes the structure of a normal symbolic domain,
	   as opposed to ipDomainPat, shown above. */

	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");

	/* Finally, let's start trying to figure out if the supplied address is valid. */

	/* Begin with the coarse pattern to simply break up user@domain into
	   different pieces that are easy to analyze. */

	var matchArray=emailStr.match(emailPat);

	if (matchArray == null) {

	/* Too many/few @'s or something; basically, this address doesn't
	   even fit the general mould of a valid e-mail address. */

		// alert("Email address seems incorrect (check @ and .'s)");
		return false;
	}

	var user=matchArray[1];
	var domain=matchArray[2];

	// Start by checking that only basic ASCII characters are in the strings (0-127).

	for (i=0; i<user.length; i++) {
		if (user.charCodeAt(i)>127) {
			// alert("Ths username contains invalid characters.");
			return false;
		}
	}

	for (i=0; i<domain.length; i++) {
		if (domain.charCodeAt(i)>127) {
			// alert("Ths domain name contains invalid characters.");
			return false;
		}
	}

	// See if "user" is valid
	if (user.match(userPat) == null) {

		// user is not valid

		// alert("The username doesn't seem to be valid.");
		return false;
	}

	/* if the e-mail address is at an IP address (as opposed to a symbolic
	   host name) make sure the IP address is valid. */

	var IPArray = domain.match(ipDomainPat);
	if (IPArray != null) {

		// this is an IP address
		for (var i = 1; i <= 4; i++) {
			if (IPArray[i] > 255) {
				// alert("Destination IP address is invalid!");
				return false;
			}
		}
		return true;
	}

	// Domain is symbolic name.  Check if it's valid.

	var atomPat = new RegExp("^" + atom + "$");
	var domArr = domain.split(".");
	var len = domArr.length;
	for (i = 0; i < len; i++) {
		if (domArr[i].search(atomPat)==-1) {
			// alert("The domain name does not seem to be valid.");
			return false;
		}
	}

	/* domain name seems valid, but now make sure that it ends in a
	   known top-level domain (like com, edu, gov) or a two-letter word,
	   representing country (uk, nl), and that there's a hostname preceding
	   the domain or country. */

	if (checkTLD && domArr[domArr.length-1].length!=2 &&
		domArr[domArr.length-1].search(knownDomsPat)==-1) {
		// alert("The address must end in a well-known domain or two letter " + "country.");
		return false;
	}

	// Make sure there's a host name preceding the domain.
	if (len<2) {
		// alert("This address is missing a hostname!");
		return false;
	}

	// If we've gotten this far, everything's valid!
	return true;
}

	/* 이메일 필드 체크 */
	function validMyemail(fuserid, fdomain, fname) {

		if (!fname)		fname = "Email";
		var str = trim(fuserid.value) + "@" + trim(fdomain.value);
		var form = document.Form;
		var peterName = trim(form.peter_name_v.value);
		var peterName1 = trim(form.USE_LANG.value);
		str= str.toLowerCase();
		if (!emailstr(str)) {
			if (peterName1 == "vtn") {
				alert("‘E-mail’ đã được nhập không chính xác. \nXin vui lòng nhập một email hợp lệ ‘E-mail’");
				fuserid.focus();
				return false;
			} else {
				alert("‘E-mail’ has the wrong input. \nPlease check and re-enter ‘E-mail’");
				fuserid.focus();
				return false;
			}
		}
		return true;
	}

	/* 이메일 필드 체크 (단일 TEXT BOX) */
	function validMyemailText(fmyemail, fname) {
		if (!fname)		fname = "Eamil";
		var str = fmyemail.value;
		var form = document.Form;
		var peterName = trim(form.peter_name_v.value);
		var peterName1 = trim(form.USE_LANG.value);
		if (!emailstr(str)) {
			if (peterName1 == "vtn") {
				alert("‘E-mail’ đã được nhập không chính xác. \nXin vui lòng nhập một email hợp lệ ‘E-mail’");
				return false;
			} else {
				alert("‘E-mail’ has the wrong input. \nPlease check and re-enter ‘E-mail’");
				return false;
			}
		} else {
			return true;
		}
		return true;
	}

	/* 자동 Tab */
	var isNN = (navigator.appName.indexOf("Netscape")!=-1);
	function autoTab(input,len, e) {
		var keyCode = (isNN) ? e.which : e.keyCode;
        var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
        if(input.value.length >= len && !containsElement(filter,keyCode)) {
            input.value = input.value.slice(0, len);
			input.form[(getIndex(input)+1) % input.form.length].focus();
		}
		return true;
	}

	function containsElement(arr, ele) {
		var found = false, index = 0;
          while(!found && index < arr.length) {
              if(arr[index] == ele)
                  found = true;
              else
                  index++;
		  }
          return found;
      }

		function getIndex(input) {
			var index = -1, i = 0, found = false;
			while (i < input.form.length && index == -1) {
	               if (input.form[i] == input)
					index = i;
				else
					i++;
			}
			return index;
			}

	function fileDownload(){
		fileName = "/jsp/user/on/eng/petition-" + document.Form.USE_LANG.value.toLowerCase() + ".doc";
		window.open("http://www.epeople.go.kr/FileDownload.do?file="+ fileName +"&filename=petition.doc","fileDownloadFrame");
	}
	function installFileDownload(){
		fileName = "/jsp/user/on/eng/Unikey.zip";
		window.open("http://www.epeople.go.kr/FileDownload.do?file="+fileName + "&filename=Unikey.zip","fileDownloadFrame");
	}
	function manuFileDownload(){
		fileName = "/jsp/user/on/eng/manual_vtn.doc";
		window.open("http://www.epeople.go.kr/FileDownload.do?file="+ fileName +"&filename=manual_vtn.doc","fileDownloadFrame");
	}
	
