function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


function category_change(board_id,val){
	document.location = "board.php?bid="+board_id+"&cate="+val;
}

function check_comment_form(form,type){
	if(!comment_form.name.value){
		alert("ÀÌ¸§À» ÀÔ·ÂÇÏ¼¼¿ä");
		comment_form.name.focus();
		return;
	}
	if(!comment_form.passwd.value){
		alert("ÆÐ½º¿öµå¸¦ ÀÔ·ÂÇÏ¼¼¿ä");
		comment_form.passwd.focus();
		return;
	}
	if(!comment_form.comment.value){
		alert("³»¿ëÀ» ÀÔ·ÂÇÏ¼¼¿ä");
		comment_form.comment.focus();
		return;
	}

	if(type=="no" || !type)
		comment_form.mode.value = "comment_insert";
	else 
		comment_form.mode.value = "comment_modify";
	comment_form.action = "/board/board_action.php?" + comment_form.get_var.value;
	comment_form.submit();
}

function article_delete_form(form){
	form.mode.value = "article_delete_form";
	form.action = "/board/board_action.php?"+form.bid.value+"&"+ form.get_var.value;
	document.form.submit();
}

function rec(board){
	form.mode.value = "rec_rej";
	form.rec_rej.value = "rec";
	form.action = "/board/board_action.php?" + form.get_var.value;
	document.form.submit();
}

function rej(board,no){
	form.mode.value = "rec_rej";
	form.rec_rej.value = "rej";
	form.action = "/board/board_action.php?" + form.get_var.value;
	document.form.submit();
}

function comment_delete(form,no,c_pwd){
	var tmp = eval("comment_form."+c_pwd);
	if(!tmp.value){
		alert("ºñ¹Ð¹øÈ£¸¦ ÀÔ·ÂÇÏ¼¼¿ä");
		comment_form.tmp.focus();
		return;
	}

	comment_form.mode.value = "comment_delete";
	comment_form.comment_no.value = no;
	comment_form.cm_passwd.value = tmp.value;
	comment_form.action = "/board/board_action.php?" + comment_form.get_var.value;
	comment_form.submit();
}

function secret_process(form){
	form.action = "board.php?" + form.get_var.value + "&job=" + form.job.value;
	document.form.submit();
}

function passwd_process(form,which){
	if(form.mode.value == "article_modify")	{
		if(form.filename.value!="{filefilefilefile}") {
			form.action = "board.php?" + form.get_var.value + "&job=modify";
		}
		else {
			form.action = "news_view.php?" + form.get_var.value + "&job=modify";			
		}
	}
	else {
		form.action = "/board/board_action.php?bid="+form.bid.value+"&"+form.get_var.value;
//		form.action = "/board/board_action.php?"+form.get_var.value;
	}
	document.form.submit();
}

function comment_rec(form,no){
	form.mode.value = "comment_rec_rej";
	form.rec_rej.value = "c_rec";
	form.comment_no.value = no;
	form.action = "/board/board_action.php?" + form.get_var.value;
	form.submit();
}

function comment_rej(form,no){
	form.mode.value = "comment_rec_rej";
	form.rec_rej.value = "c_rej";
	form.comment_no.value = no;
	form.action = "/board/board_action.php?" + form.get_var.value;
	form.submit();
}

function detail_onoff(cid,size){

	for(i=0;i<size;i++)
	{
		simple = eval("document.all.comment"+i+".style");
		detail = eval("document.all.comment"+i+"_detail.style");

		if(cid != i){
			simple.display = "";
			detail.display = "none";
		}
		else {
			simple.display = "none";
			detail.display = "";
		}
	} 
}

var pass_flag = 0;

function show_passwd(cid){
	var passwd = eval("document.all."+cid+".style");
	if(pass_flag==0){
		passwd.display = "";
		pass_flag = 1;
	} else {
		passwd.display = "none";
		pass_flag = 0;
	}
}

function comment_mod(idx){
	comment_form.name.value = eval("comment_form.writer_"+idx+".value");
	comment_form.comment.value = eval("comment_form.comment_"+idx+".value");
	comment_form.comment_no.value = idx;
	document.all.comment_button.href = "javascript:check_comment_form(this.form,'modify')";
}

var article_pass_flag = 0;

function article_passwd_confirm(type){
	form.mode.value = "article_"+type;
	var passwd = eval("document.all.article_pass.style");

	if(article_pass_flag==0){
		passwd.display = "";
		article_pass_flag = 1;
	} else {
		passwd.display = "none";
		article_pass_flag = 0;
	}
}

function passwd_self(act){
	if(act == "modify"){
		form.action = "board.php?" + form.get_var.value + "&job="+act;
	} 
	else if(act == "delete"){
		if(confirm('Á¤¸» »èÁ¦ÇÏ½Ã°Ú½À´Ï±î?')){
			form.mode.value = "article_delete";
			form.action = "/board/board_action.php?" + form.get_var.value;
		}
		else {
			return;
		}
	}
	form.submit();	
}

// º¸µå WRITE 
function attach_file(){
	var tmp = body_form.file_num.value;
	if(tmp != 0){
		if(multiupload.filelist.length > tmp){
			alert("´õÀÌ»ó ¾÷·Îµå ÇÏ½Ç ¼ö ¾ø½À´Ï´Ù");
			return;
		}
	}
	multiupload.upload_mode.value = "up";
	multiupload.action = "/board/upload_process.php";
	multiupload.submit();
}

function remove_file(){
	if(!multiupload.filelist.value){
		alert("»èÁ¦ÇÒ ÆÄÀÏÀ» ¼±ÅÃÇÏ¼¼¿ä");
		return;
	}
	multiupload.upload_mode.value = "remove";
	multiupload.submit();
}

function form_write_check(mode){
	var tmp;
	var new_option;
	// ±Û¾´ ³»¿ëÀ» º¸³»±â Àü¿¡ Ã·ºÎÆÄÀÏ¸ñ·ÏÀ» È÷µç¹Ú½º¿¡ Ä«ÇÇÇØ ³Ö´Â´Ù
	//<!-- BEGIN FILE_SCRIPT -->
	if(mode==1){
		for(i=0;i<multiupload.filelist.length;i++){
			if(multiupload.filelist.options[i].value){
				tmp = multiupload.filelist.options[i].value;
				if(!body_form.file_name.value)
					body_form.file_name.value = tmp;
				else
					body_form.file_name.value = body_form.file_name.value + "," + tmp;
			}
		}
	}
	//<!-- END FILE_SCRIPT -->

	if(!body_form.name.value){
		alert("ÀÌ¸§À» ÀÔ·ÂÇÏ¼¼¿ä");
		body_form.name.focus();
		return;
	}
	if(!body_form.subject.value){
		alert("Á¦¸ñÀ» ÀÔ·ÂÇÏ¼¼¿ä");
		body_form.subject.focus();
		return;
	}
	if(!body_form.content.value){
		alert("³»¿ëÀ» ÀÔ·ÂÇÏ¼¼¿ä");
		body_form.content.focus();
		return;
	}

	document.all.okbutton.href = "#";
	document.body_form.action = document.body_form.action +"?"+body_form.get_var.value;
	document.body_form.submit();
}

function secret_yn(){
	if(body_form.secret.checked == true)
		body_form.secret_passwd.disabled = false;
	else
		body_form.secret_passwd.disabled = true;
}

// ·Î±×ÀÎ Ã¢
function login_window(bid){
	var w = 390;
	var h = 190;
	var left = screen.width/2 - w/2 ;
	var top = screen.height/2 - h/2 ;	
	window.open("http://service.seoul.co.kr/board/login_.php?bid="+bid,"login","width="+w+",height="+h+",top="+top+",left="+left+",scrollbars=no,status=no");
}

function logout(){
	document.location = "/board/member/logout.php";
}

// È¸¿øÁ¤º¸ ¼öÁ¤ Ã¢
function member_modify_window(id){
	var w = 620;
	var h = 670;
	var left = screen.width/2 - w/2 ;
	var top = screen.height/2 - h/2 ;	
	window.open("/board/member/member_modify.php?mode=modify_form&id="+id,"member","width="+w+",height="+h+",top="+top+",left="+left+",scrollbars=no,status=yes");
}

//	¿£ÅÍÅ°°¡ ´­·Á Á³´ÂÁö È®ÀÎÇÏ´Â ÇÔ¼ö
function entercheck_form(){
	if(event.keyCode==13){ 
	   passwd_process(this.form,'article')
	}
}

