
function checkFileList() {
	for (i = 1; i <   form_write.attached_file_list.options.length ; i++){  // 시작 1 은 제일 위에 쓰여진 글자 이후 부터 			
			form_write.attached_file_list.options[i].selected = true; 			
		}
	form_write.attached_file_list.options[0].selected = false;  //1은 체크되면 에러가 남 false로 만들어줌 ...
}

//수출기업화용
function checkFileListExp() {
	for (i = 1; i <   f.attached_file_list.options.length ; i++){  // 시작 1 은 제일 위에 쓰여진 글자 이후 부터 			
			f.attached_file_list.options[i].selected = true; 			
		}
}

//파일리스트 추가
function fileAddList(fname, fRname, fsize){
	if( fname!="" ){
		var option=new Option( fRname, form_write.attached_file_list.options.length );
		form_write.attached_file_list.options.add(option, form_write.attached_file_list.options.length );
		form_write.attached_file_list.options[form_write.attached_file_list.options.length-1].value = fRname + "/" + fname + "/" + fsize
		form_write.filesize.value =  eval( form_write.filesize.value ) + eval(fsize);
	}
}


//파일리스트 추가(수출기업화)
function fileAddListExp(fname, fRname, fsize){

	if( fname!="" ){
			var option=new Option( fRname, f.attached_file_list.options.length );
			f.attached_file_list.options.add(option, f.attached_file_list.options.length );
			f.attached_file_list.options[f.attached_file_list.options.length-1].value = fRname + "/" + fname + "/" + fsize
			f.filesize.value =  eval( f.filesize.value ) + eval(fsize);
	}
}

//파일리스트에서 삭제 (수출기업화)
function fileListDeleteExp() {
	var select=f.attached_file_list
			
	if (select.selectedIndex < 1) return;
	if ( confirm('선택된 파일을 삭제 하시겠습니까?') ) {
		// 삭제 하기 전에 filesize 를 조절한다.
		var n =  f.attached_file_list[select.selectedIndex].value;
		select.remove(select.selectedIndex);
	}
}	


function fileListDelete() {
	var select=form_write.attached_file_list
			
	if (select.selectedIndex < 1) return;
	if ( confirm('선택된 파일을 삭제 하시겠습니까?') ) {
		// 삭제 하기 전에 filesize 를 조절한다.
		var n =  form_write.attached_file_list[select.selectedIndex].value;
		// 사이즈 조정 부분 추가..
		var oldSize = n.split("/");
		form_write.filesize.value = Number(form_write.filesize.value) - Number(oldSize[2]);
		select.remove(select.selectedIndex);
	}
}	



//첨부파일 download
function FileDown(sFilePath, sFileName, sFileNameOrg) {
	document.location.href = "/include/common/down.jsp?sFilePath="+sFilePath+"&sFileName="+sFileName+"&FileNameOrg="+sFileNameOrg;
}

	/*****************************************************************************************************************
 	무역 촉진단에서 사용되는 파일첨부시의 스크립트 추가.
	@date : 2006-11-29 by triple96
	@desript : 	기존의 form name과 select 컨트롤의 name이 fix 되어 처리되는 경우는
			한 화면에 여러개의 파일 첨부가 존재할 경우 또는 멀티로 List 처럼 생겨날 수 있는 경우는 직접 추가 혹은 처리가 불가능 하므로 
			form name과 select 컨트롤의 name 을 변수로 받아서 공통적으로 처리 할 수 있도록 추가.
	@param : form = form name
			 controll = 입력 controll(select box) name
			 sizefield = 파일 size(text field) name
			 count = select box 갯수(화면에서 조회된...)
	******************************************************************************************************************/
	// 첨부파일 멀티 파일리스트 선택(무역촉진단 용)
	function checkFileListMulti(form, controll, count) {
		for(i = 0; i < count; i++){
			var sControll = controll+(i+1);
			var iCount = parseInt(eval(form+"."+sControll+".options.length"));
			for (j = 1; j < iCount ; j++){  // 시작 1 은 제일 위에 쓰여진 글자 이후 부터 
				eval(form+"."+sControll+".options["+j+"].selected = true");
			}
			eval(form+"."+sControll+".options[0].selected = false");  //1은 체크되면 에러가 남 false로 만들어줌 ...
		}
	}

	// 첨부파일 멀티 파일리스트 추가(무역촉진단 용)
	function fileAddListMulti(form, controll, sizefield, fname, fRname, fsize){
		if( fname!="" ){
			var option=new Option( fRname, eval(form+"."+controll+".options.length") );
			eval(form+"."+controll+".options.add(option,"+form+"."+controll+".options.length)" );
			var tvalue = fRname + "/" + fname + "/" + fsize;
			eval(form+"."+controll+".options["+form+"."+controll+".options.length - 1].value = tvalue");
			eval(form+"."+sizefield+".value = Number("+form+"."+sizefield+".value) + Number("+fsize+")");	
		}
	}
	// 첨부파일 멀티 파일리스트 삭제(무역촉진단 용)
	function fileListDeleteMulti(form, controll, sizefield) {
		var select= eval(form+"."+controll)

		if (select.selectedIndex < 1) return;
		if ( confirm('선택된 파일을 삭제 하시겠습니까?') ) {
			// 삭제 하기 전에 filesize 를 조절한다.
			var n =  eval(form+"."+controll+"[select.selectedIndex].value");
			var oldSize = n.split("/");
			eval(form+"."+sizefield+".value = Number("+form+"."+sizefield+".value) - Number(oldSize[2])");
			select.remove(select.selectedIndex);
		}
	}	

	/*****************************************************************************************************************/

	//현장사진 파일리스트 선택(무역촉진단 용)
	function checkFileListPhoto() {
		for (i = 1; i <   form_write.photo_file_list.options.length ; i++){  // 시작 1 은 제일 위에 쓰여진 글자 이후 부터 			
				form_write.photo_file_list.options[i].selected = true; 			
			}
		form_write.photo_file_list.options[0].selected = false;  //1은 체크되면 에러가 남 false로 만들어줌 ...
	}
	
	//현장사진 파일리스트 추가(무역촉진단 용)
	function fileAddListPhoto(fname, fRname, fsize, FFRname){
	
		if( fname!="" ){
				var option=new Option( fRname, form_write.photo_file_list.options.length );
				form_write.photo_file_list.options.add(option, form_write.photo_file_list.options.length );
				form_write.photo_file_list.options[form_write.photo_file_list.options.length-1].value = fRname + "/" + fname + "/" + fsize + "/" + FFRname
				form_write.photofilesize.value =  eval( form_write.photofilesize.value ) + eval(fsize);
		}
	}
	
	//현장사진 파일리스트 삭제(무역촉진단 용)
	function fileListDeletePhoto() {
		var select=form_write.photo_file_list
				
		if (select.selectedIndex < 1) return;
		if ( confirm('선택된 파일을 삭제 하시겠습니까?') ) {
			// 삭제 하기 전에 filesize 를 조절한다.
			var n =  form_write.photo_file_list[select.selectedIndex].value;
			var oldSize = n.split("/");
			form_write.photofilesize.value = Number(form_write.photofilesize.value) - Number(oldSize[2]);
			select.remove(select.selectedIndex);
		}
	}	

