function board_read( bid, no ) {
	div_update("main_lyr", "board/view.php?BID="+bid+"&no="+no);
}

function attach_file_down(BID,path){
    document.getElementById("inside_ifrm").src = "board/attach_down.php?BID="+BID+"&path="+escape(path);
}

function board_img_view( f, stat) {
	if(typeof window.pageYOffset == "undefined") {
		to_y = document.body.scrollTop;
	} else {
		to_y = window.pageYOffset;
	}
	if(stat){
		var ta = document.createElement("div");
		ta.setAttribute("id", "main_img_bg");
		ta.style.backgroundColor = "#000000";
		ta.style.position = "absolute";
		ta.style.top = to_y;
		ta.style.left = 0;
		ta.style.filter = "alpha(opacity=60)";
		ta.style.MozOpacity = "0.6";
		ta.style.width = document.body.clientWidth;
		ta.style.height = document.body.clientHeight+10;
		ta.style.zIndex = 10;

		var in_l = $("inside_lyr");
		var img_l = document.createElement("img");
		img_l.setAttribute("src",f);
		img_l.style.cursor="pointer";
		img_l.setAttribute("onclick",function(){board_img_view()});
		in_l.appendChild(img_l);
		in_l.parentNode.insertBefore(ta, $("inside_lyr"));
		in_l.style.zIndex = 15;
		in_l.style.top = ((parseInt(ta.style.height)-500)/2)+parseInt(ta.style.top)-5;
		in_l.style.left = (parseInt(ta.style.width)-500)/2;
		in_l.style.display = "inline";
	}else{
		var ta = $("main_img_bg");
		var in_l = $("inside_lyr");
		document.body.removeChild(ta);
		in_l.innerHTML = "";
		in_l.style.display="none";
	}
}

function board_del( bid, no, keyword, page ) {
    if( confirm("Do you really want to delete?") ) div_update("inside_lyr", "board/write.php?action=delete&BID="+bid+"&no="+no+"&keyword="+keyword+"&page="+page);
}

function chk_ask_frm( frm ) {
        if(frm.pwd.value.length < 1) {
        alert("Enter the Password.");
        frm.pwd.focus();
        return false;
        } else {
        div_update("inside_lyr", "board/ask_password.php?action=ok&BID="+frm.BID.value+"&no="+frm.no.value+"&page="+frm.page.value+"&keyword="+frm.keyword.value+"&mode="+frm.mode.value+"&pwd="+frm.pwd.value);
        return false;
        }
return false;
}

function chk_search_frm( frm ) {
    var s_type = "";
    s_type = (frm.s_type_name.checked == true)? "1":"0";
    s_type += (frm.s_type_subject.checked == true)? "1":"0";
    s_type += (frm.s_type_content.checked == true)? "1":"0";
    div_update("main_lyr", "board/list.php?BID="+frm.BID.value+"&s_type="+s_type+"&keyword="+escape(frm.keyword.value));
    return false;
}

function board_write( bid, no, keyword, page, stat) {
	if(stat=='1') div_update("main_lyr", "board.php?mode=write&BID="+bid+"&keyword="+keyword+"&no="+no+"&page="+page);
	else div_update("main_lyr", "board/write.php?BID="+bid+"&keyword="+keyword+"&no="+no+"&page="+page);
}

function chk_write_frm( frm ) {
	if(frm.subject.value == "" || frm.subject.value.length < 1) {
		alert("Please enter the Subject");
		return false;
	} else if(frm.content.value == "") {
		alert("Please enter the Content");
		return false;
	} else {
		return true;
	}
	return false;
}

function chk_comment_frm( frm ) {
	if(frm.BID.value < 1) {
		alert('Á¤»óÀûÀ¸·Î ÀÌ¿ëÇØ ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.');
		return false;
	} else if(frm.no.value < 1) {
		alert('Á¤»óÀûÀ¸·Î ÀÌ¿ëÇØ ÁÖ½Ã±â ¹Ù¶ø´Ï´Ù.');
		return false;
	} else if(frm.member_key.value < 1) {
		alert('You need log-in');
		return false;
	} else if(frm.comment.value.length < 10) {
		alert('Please enter more than 10 words');
		frm.comment.focus();
		return false;
	} else {
		div_update("inside_lyr", "board/comment.php?mode=write&BID="+frm.BID.value+"&no="+frm.no.value+"&comment="+escape(frm.comment.value));
		return false;
	}
	return false;
}

function comment_del( bid, no, cid ) {
	if( confirm("Do you really want to delete?") ) div_update("inside_lyr", "board/comment.php?mode=delete&BID="+bid+"&no="+no+"&CID="+cid);
}

