/////////// ¼ýÀÚ Á¡ÇÁ ÇÏ±â //////////////
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(); 
	} 
	
	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; 
	} 
	return true; 
} 
/////////// ¼ýÀÚ Á¡ÇÁ ÇÏ±â //////////////

/////////// ¼ýÀÚ¸¸ ÀÔ·ÂÇÏ±â /////////////
function num_only(fl){
 
 t = fl.value ;
	
	for(i=0;i<t.length;i++) 
		if (t.charAt(i)<'0' || t.charAt(i)>'9') {
			alert("¼ýÀÚ¸¸ ÀÔ·ÂÇØÁÖ¼¼¿ä.") ;
			 fl.value="";
			 fl.focus() ;
			 return false ;
		}
}
/////////// ¼ýÀÚ¸¸ ÀÔ·ÂÇÏ±â /////////////

//////////// Æ®¸²//////////////////////
String.prototype.trim = function(){	
	return this.replace(/(^\s*)|(\s*$)/g, "");
}
//////////// Æ®¸²//////////////////////

////////////ÀÌ¸áÃ¼Å©////////////////////
function validateEmail(emailad) { 

var exclude=/[^@\-\.\w]|^[_@\.\-]|[\._\-]{2}|[@\.]{2}|(@)[^@]*\1/; 
var check=/@[\w\-]+\./; 
var checkend=/\.[a-zA-Z]{2,3}$/; 

        if(((emailad.search(exclude) != -1)||(emailad.search(check)) == -1)||(emailad.search(checkend) == -1)){ 
                alert("ÀÌ¸ÞÀÏ Çü½ÄÀÌ ¾Æ´Õ´Ï´Ù");
				return ;
        }
}
////////////ÀÌ¸áÃ¼Å©////////////////////

//////////// ÇÑ±ÛÀÔ·Â ±ÝÁö //////////////
function hanCheck(x) {
	for(i=0;i<x.value.length;i++) {
		var a=x.value.charCodeAt(i);
		if (a > 128) {
			alert('¿µ¹® ¼ýÀÚ·Î Ç¥±â ÇÏ½Ê½Ã¿ä');
			x.value = "";
			x.focus();
			return;
		}
	}
}
//////////// ÇÑ±ÛÀÔ·Â ±ÝÁö //////////////

//////////// Æ¯¼ö¹®ÀÚ ÇÊÅÍ///////////////
function chkOtherStr(strEmailId) {		// Çã¿ëµÇÁö ¾Ê´Â ¹®ÀÚ°¡ ÀÖ´ÂÁö °Ë»ç
	var strUnValidChar = " `~!@#$%^&*()+=|\\{}[]:;\"'?/<>,";
	for (var i=0; i < strEmailId.length; i++) {
		if (strUnValidChar.indexOf(strEmailId.charAt(i)) != -1)
		{
			return false;
		}
	}
	return true;
}
//////////// Æ¯¼ö¹®ÀÚ ÇÊÅÍ///////////////

//////////// Çã¿ëµÈ ¹®ÀÚÀÎÁö ÇÊÅÍ ////////
function chkKoreanStr(strEmailId) {
	var validChar = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_";
	for (var i = 0; i < strEmailId.length; i++) {
		if (validChar.indexOf(strEmailId.charAt(i)) == -1) {
			return false;
		}
	}
	return true;
}
//////////// Çã¿ëµÈ ¹®ÀÚÀÎÁö ÇÊÅÍ ////////


////////////////////////ÆÄÀÏÃ·ºÎ////////////////////////
function preUpload()
{
	with(document.preForm)
	{
		if(file1.value==null || file1.value.length == 0){
			alert('¾÷·ÎµåÇÒ ÆÄÀÏÀ» ¼±ÅÃÇÏ¿© ÁÖ½Ê½Ã¿ä');
			return;
		}
		
		target="preUpload";
		action = "/iope/global/pre_Upload.jsp";
		submit();
	}
}

function fileDelete()
{
	with(document.preForm)
	{

		if(fileList.selectedIndex==null || fileList.selectedIndex < 0){
			alert('»èÁ¦ÇÒ ÆÄÀÏÀ» ¼±ÅÃÇØ ÁÖ½Ê½Ã¿ä');
			fileList.focus();
			return;
		}
		
		if(confirm('Á¤¸»·Î »èÁ¦ ÇÏ½Ã°Ú½À´Ï±î?')){
			idx = fileList.selectedIndex;
			cnt = fileList.options.length;
			
			for(i=idx;i< fileList.options.length-1;i++){
				fileList.options[i] = new Option(fileList.options[i+1].text,fileList.options[i+1].value);
			}

			fileList.options[cnt - 1] = null;
		}
	}
}

function addFileList(fileName)
{
	with(document.preForm)
	{
		if(fileName!=""){
			fileList.options[fileList.options.length] = new Option(fileName,fileName);
		}

		file1.value = file1.title;
	}
}

function sentRefer()
{
	if(document.preForm.fileList.options.length > 0)
	{
		document.writeForm.hiddenFileList.value = "";
		for(i=0;i<document.preForm.fileList.options.length;i++)
		{
			  if(i==0){
				document.writeForm.hiddenFileList.value += document.preForm.fileList.options[i].value + "\n";
			  }else{
				document.writeForm.hiddenFileList.value += "|"+document.preForm.fileList.options[i].value + "\n";
			  }
		}
	}
	else
	{
		document.writeForm.hiddenFileList.value = "0";
	}
}
////////////////////////ÆÄÀÏÃ·ºÎ////////////////////////


///////////////Ã¼Å©¹Ú½º ÀüÃ¼¼±ÅÃ & ÇØÁ¦ ////////////////

function cbAll(oCb) {

 if (typeof(oCb) == "undefined") { // °´Ã¼°¡ Á¸ÀçÇÏÁö ¾Ê´Â´Ù¸é
  return;
 }
 

 if (typeof(oCb.length) == "undefined") { // Ã¼Å©¹Ú½º°¡ ÇÏ³ª¸¸ Á¸Àç
  if (setstatus!="undefined") {
   oCb.checked = true;
  }
  return;
 }

 var isAllTrue = true;


//ÀüÃ¼¼±ÅÃÀÎÁö ÀüÃ¼ Ãë¼ÒÀÎÁö ¿©ºÎ Ã¼Å©

 for (var i = 0; i < oCb.length; i++) {
  if (oCb[i].checked == false) {
    isAllTrue = true;
    break;
  }else{
    isAllTrue = false;
    break;
  }
 }

 var status = !isAllTrue;


 if (status!=false) {
  status = true;
 }else{
  status = false;
 }

 

 //Ã¼Å©¹Ú½º¿¡ Ã¼Å©ÇÏ±â
 for (var i = 0; i < oCb.length; i++) {
  oCb[i].checked = status;
 }

}

///////////////Ã¼Å©¹Ú½º ÀüÃ¼¼±ÅÃ & ÇØÁ¦ ////////////////