  
//보여줄지 닫을지 보여주는 부분
function viewHidden(gubun,str){
	if (gubun == "view"){
		clickHandler(str,'Outline','view');
		clickHidden(str,'Outline','view');
	}else{
		clickHandler(str,'Outline','hidden');
		clickHidden(str,'Outline','hidden');
	}

	
}

//상세정보 view또는 hidden
function clickHandler(sele,cname,flag) {
	var targetId, srcElement, targetElement;
	if (cname == "Outline"){
		targetId = 'Out'+sele + "details";
		targetElement = document.all(targetId);
		
		if (flag == "view"){
			if (targetElement.style.display == ""){ 
				targetElement.style.display = "none";
			}else{
				targetElement.style.display = "";
				//var e = eval("document.all.imgclose" + sele);
				//e.focus();
			}	
			
		}
		else{
			targetElement.style.display = "none";
		}
	}
}

//상세정보를 볼 경우 밑에 라인을 보여준다
function clickHidden(sele,cname,flag) {
	var targetId, srcElement, targetElement;
	if (cname == "Outline"){
		targetId = 'Out'+sele + "line";
		targetElement = document.all(targetId);
		
		if (flag == "view"){
			if (targetElement.style.display == ""){ 
				targetElement.style.display = "none";
			}else{
				targetElement.style.display = "";
			}
		}	
		else{
			targetElement.style.display = "none";
		}
	}
}


function onloadview(gubun,str){
	if (str == "0" || str == 0){
	}else{
		viewHidden(gubun,str);

	}
}

//등록스크립트
function insert(){
	document.listform.target="";
	document.listform.action="/Guide/FreeBoard/FreeBoard_NW.asp";
	document.listform.submit();
}

function goEnter() {
	if(event.keyCode == 13)  {
		search_list()
		}
	}

//검색할때 스크립트
function search_list(){
	var len = document.listform.find.value.length;
	if (len > 50){
		alert("The keyword cannot be over 50 characters.");
		document.listform.find.focus();
		return;
	}else if(len < 2){
		alert("The keyword must be two or more letters.");
		document.listform.find.focus();
	}else{
		document.listform.target="";
		document.listform.action = "/Guide/FreeBoard/FreeBoard.asp";
		document.listform.submit();
		}
	}

//수정할때 스크립트
function mod_list(bullidx){	
	document.listform.hidx.value=bullidx;
	document.listform.target="";
	document.listform.action = "/Guide/FreeBoard/FreeBoard_EW.asp";
	document.listform.submit();
}

//삭제할때 스크립트
function del_list(bullidx){
	if(confirm("Will you really delete?")){
		document.listform.hidx.value = bullidx;
		document.listform.action="/Guide/FreeBoard/FreeBoard_D.asp";
		document.listform.submit();
	}else{
		return;
	}
}

// DB등록화면으로 이동
function FreeBoard_write() {
		if (document.writefrom.title.value == "") {
			alert("Please type in the title.");
			document.writefrom.title.focus();
			return;
		}
		if (document.writefrom.content.value == "") {
			alert("Please fill in the content.");
			document.writefrom.content.focus();
			return;
		}		
		else{
				//document.writefrom.action = "/Common/fileupload/Common_file_C.asp";
				document.writefrom.action = "/Guide/FreeBoard/FreeBoard_C.asp";	
				document.writefrom.submit();
			}
	}

//목록으로이동
function FreeBoard_cancel(){
		document.canform.action="/Guide/FreeBoard/FreeBoard.asp";
		document.canform.submit();
	}

function FreeBoard_edit(str1,str2,str3) {
	var delcnt = 0;
	if (document.writefrom.title.value == "") {
		alert("Please type in the title.");
		document.writefrom.title.focus();
		return;
	}  
		if (document.writefrom.content.value == "") {
			alert("Please fill in the content.");
			document.writefrom.content.focus();
			return;
		}		
//	if (document.writefrom.content.value == "") {
//		alert("Please fill in the content.");
//		return;
//	}
	if (str2 - 1 != 0){
		for (i=0;i < str2 ; i++){
			dfv = eval("document.writefrom.delfile_"+i)
			if (dfv.checked){
				delcnt++
			}
		}
	}

	document.writefrom.del_cnt.value = delcnt
	document.writefrom.total_cnt.value = str2
	document.writefrom.bullidx.value = str1
	document.writefrom.fileid.value = str3
	//document.writefrom.action = "/Common/fileupload/Common_file_C.asp";
	document.writefrom.action = "/Guide/FreeBoard/FreeBoard_C.asp";	
	document.writefrom.submit();
}
 