var netk_board = function() {

	this.form = '';
	this.passwd_form='';
	//:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// : 댓글 관련
	this.reply_content = ''
	this.reply_rdate = '';
	this.reply_new_msg = '';
	this.reply_count = '';
	this.table_width = '';
	//:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	this.detail_reply_count = '';
	this.put_number = ''; //이동박스, 등급박스 보이는 번호값.
	//:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	this.board_url = ''; // : 게시판 경로
	this.code_url = ''; // : 게시판 스킨 상세 경로
	this.skin_url = ''; // : 게시판 스킨 경로
	//:~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	this.update_page = ''; // : 회원 수정페이지
	// : ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	this.readEL = ''; // : el을 외부변수로 받기


// : 그룹 ajax
	this.select_group = function(el) {
		util.ajax_func('get', 'xml', "./multiProcess.php", "mode=select_group&no="+el.value, 'netk_board.select_group_regist(data)');
	};
	this.select_group_regist = function(data) {
		var count = 0;
		var group_move = document.getElementsByName("group_move[]");
		group_move[1].options.length = 1;
		$(data).find("board_obj").each(function(){
			var option_value = $(this).find('option').text();
			var no_value = $(this).find('no').text();
			var option_obj = new Option(option_value, no_value);
			group_move[1].options[count] = option_obj;
			count++;
		});
		
		return false;
	}


// : 체크박스 체크관련 값.
	this.chk_checked = function() {
		var chk = document.getElementsByName("chk[]");
		var count = -1;
		var chk_count = -1;
		var check_no = new Array();

		while(count<chk.length) {
			count++;
			if(chk[count] && chk[count].checked==true && chk[count].value) {
				chk_count++;
				check_no[chk_count] = chk[count].value;
			}
		}
		var check_no_value = check_no.join(",");

		return check_no_value;
	}


// : object의 값 알아보기 [ 사용방법 : this.object_tag(obj값, div아이디); - div가 있어야합니다. ] 
	this.object_tag = function(obj, id) {
		var table = '<table border="0" cellspacing="1" cellpadding="3" style="background-color:#dddddd">';
		for(x in obj) {
			table += '<tr style="background-color:#ffffff"><td>'+x+'</td><td>'+obj[x]+'</td></tr>';
		}
		table += '</table>';
		document.getElementById(id).innerHTML = table;
	}


// : 비밀번호 div창 열기
	this.passwd_div = function(type, code, no) {
		var form = document.forms['f'+type];
		var passwdBox = document.getElementById("passwdBox");
		var reply_passwd = document.getElementsByName('reply_passwd[]');
		var count=-1;
		this.form = form;
		form.code.value = code;
		form.type.value = type;
		form.rno.value = no;
		form.mode.value = 'passwd_action';
		while(count<reply_passwd.length-1) {
			count++;
			var passwd_no = reply_passwd[count].getAttribute("no");
			reply_passwd[count].innerHTML = '';
			if(passwd_no==no) {
				this.passwd_form = reply_passwd[count];
				this.passwd_form.innerHTML = passwdBox.innerHTML;
			}
		}
	}
// : 비밀번호 창 닫기
	this.passwd_close = function() {
		this.passwd_form.innerHTML = '';
	}


// : 비밀번호 확인하기
	this.passwd_confirm = function(fname) {
		try
		{
			if(this.form.code.value=='delete' && !confirm("삭제하시겠습니까?")) {
				return;
			}
			var url = "./index.php";
			var get_para = '';
			if(fname) get_para = util.form_parameters(fname);
			else get_para = util.form_parameters(this.form.name);
			util.ajax_func('post', 'xml', "index.php", get_para, 'netk_board.passwd_confirm_regist(data)');
			return;
		} catch(e) {
			alert(e.message);
			return;
		}
	};
	this.passwd_confirm_regist = function(data) {
		var detail_reply_count = document.getElementById("reply_count");
		var reply_content = document.getElementsByName("reply_content[]");
		$(data).find("ROOT").each(function(){
			var message = $(this).find("message").text();
			var reply_tag = $(this).find("reply_tag").text();
			var textarea = $(this).find("textarea").text();
			var rno = $(this).find("rno").text();
			var total = $(this).find("total").text();

			if(message) alert(message);
			if(reply_tag) document.getElementById("reply_list").innerHTML = reply_tag;
			if(rno) var rno = rno;
			if(textarea) {
				netk_board.reply_update_tag('', '', rno);
			}
			if(this.form.code.value=='delete' && total) {
				detail_reply_count.innerHTML = total; //:삭제시에 댓글수 수정하기
				$(".reply_count").html(total);
			}
		});
		return;
	}


// : 댓글 내용 새로 고치기
	this.reply_replace = function(data, sort) {
		var detail_reply_count = document.getElementById("reply_count");
		var member_point = document.getElementsByName("member_point[]");
		var point_value = $(data).find("member_point").text();
		var reply_tag = $(data).find("reply_tag").text();
		var total = $(data).find("total").text();

		// : 포인트 수정
		if(member_point.length>0) {
			var count=0;
			while(count<member_point.length) {
				if(point_value) member_point[count].innerHTML = point_value;
				count++;
			}
		}
		// : 댓글 리스트, 페이지정보 수정
		if(reply_tag) document.getElementById("reply_list").innerHTML = reply_tag;
		else if(sort=='my' || total<=0) document.getElementById("reply_list").innerHTML = '<div class="_not_reply ta_center community_reviews_list">내가 등록한 댓글이 없습니다.</div>';
		detail_reply_count.innerHTML = total; //:삭제시에 댓글수 수정하기
		$(".reply_count").html(total);
	}


// : 댓글 수정버튼 누를때 테그 나타내기 [ 회원용 ]
	this.reply_update_tag = function(type, code, no) {
		if(type) {
			var form = document.forms['f'+type];
			this.form = form;
		}
		var reply_content = document.getElementsByName("reply_content[]");
		var reply_content_textarea = document.getElementById("reply_content_textarea");
		var count = -1;
		var len = reply_content.length;
		while(count<len) {
			count++;
			if(reply_content[count]) {
				var rno2 = reply_content[count].getAttribute("rno");
				var textarea_info = reply_content[count].getElementsByTagName("textarea")[0];
				if(textarea_info) {
					reply_content[count].innerHTML = '<span>'+this.content+'</span><span>'+this.new_msg+'</span> <span class="board_txt1">'+this.rdate+'</span>';
				}
				if(no==rno2) {
					this.reply_count = count;
					this.content = $(reply_content[count]).find("span").eq(0).html();
					//this.new_msg = $(reply_content[count]).find("span").eq(1).html();
					this.rdate = $(reply_content[count]).find("span").eq(2).html();
					reply_content[count].innerHTML = '<textarea id="reply_content_textarea" name="reply_content_textarea" rno="'+no+'" rdate="'+encodeURIComponent(this.rdate)+'" new_msg="'+encodeURIComponent(this.new_msg)+'" style="width:90%;height:50px;">'+this.content+'</textarea><a class="point_check" onClick="netk_board.reply_update(\''+no+'\', this)"><img src="'+this.board_url+'skin/basic/images/btn_reply_edit.gif" valign="bottom" alt="수정"></a>';
					if(netk_board.passwd_form) netk_board.passwd_form.innerHTML = '';
				}
			}
		}
	}



// : 삭제 클릭시 테그 나타내기 [ 회원용 ]
	this.reply_delete_tag = function(type, code, no) {
		
		if(type) {
			var form = document.forms['f'+type];
			this.form = form;
			this.form.type.value = type;
			this.form.code.value = code;
			this.form.rno.value = code=='delete' ? no : this.chk_checked();
			this.form.mode.value = 'reply_action';
		}
		if(in_array(code, ['delete']) && !confirm("삭제하시겠습니까")) {
			return;
		}
		var url = root+"module/netk_board/index.php";
		var get_para = util.form_parameters('f'+type);
		var _type = mobile_is=='1' ? 'json' : 'xml';
		if(code=='delete') _type = 'json';
		if(code=='select_delete') _type = 'xml';
		util.ajax_func('post', _type, root+'module/netk_board/index.php', get_para, 'netk_board.reply_delete_tag_regist(data, \''+code+'\')');
	};
	this.reply_delete_tag_regist = function(data, code) {
		if(data.msg) {
			if(data.msg) alert(data.msg);
			if(data.move) location.href = data.move;
			netk_board.reply_regist(document.forms['freply'],'list');
			return;
		}
		var detail_reply_count = document.getElementById("reply_count");
		try{
			$(data).find("ROOT").each(function(){
				var total = $(this).find("total").text();
				if(in_array(code, ['delete','select_delete']) && total) {
					detail_reply_count.innerHTML = total; //:삭제시에 댓글수 수정하기
					$(".reply_count").html(total);
				}

				var reply_tag = $(this).find("reply_tag").text();
				//alert(reply_tag);
				var paging = $(this).find("paging").text();
				var q = $(this).find("q").text();
				var total = $(this).find("total").text();
				netk_board.reply_replace(data);

				if(reply_tag) document.getElementById("reply_list").innerHTML = reply_tag;
				document.getElementById("reply_paging").innerHTML = paging;
				detail_reply_count.innerHTML = total; //:삭제시에 댓글수 수정하기
				$(".reply_count").html(total);
			});
		}catch(e){
			alert(e.message);
		}
	}



// : 댓글 수정하기 [ 댓글 수정후 수정버튼 누를때 ]
	this.reply_update = function(rno, el) {

		var _textarea = $(el).closest(".reply_list_tr").find("textarea");
		if(!_textarea.val()) {
			alert("내용을 입력해주시기 바랍니다.");
			_textarea[0].focus();
			return;
		}
		
		if(confirm("수정하시겠습니까?")) {
			this.form.rno.value = rno;
			this.form.up_content.value = encodeURIComponent(document.getElementById('reply_content_textarea').value);
			this.form.mode.value = "reply_update";
			var para_value = util.form_parameters('freply');
			util.ajax_func('post', 'xml', './index.php', para_value, 'netk_board.reply_update_regist(data)');
		}
	};
	this.reply_update_regist = function(data) {
		var reply_content = document.getElementsByName("reply_content[]");
		$(data).find("ROOT").each(function(){
			var message = $(this).find("message").text();
			var rdate = $(this).find("rdate").text();
			var new_msg = $(this).find("new_msg").text();
			reply_content[netk_board.reply_count].innerHTML = '<span>'+message+'</span><span>'+new_msg+'</span> <span class="board_txt1">'+rdate+'</span>';
		});
	}



// : 댓글 등록하기 [ ajax방식으로 - post ]
	this.reply_regist = function(el, code, sort) {
		try
		{
			el.code.value = code;
			el.mode.value = 'reply_regist';
			if(el.sort) el.sort.value = sort;
			var para_values = util.form_parameters('freply');
			el.reset();
			this.readEL = el;
			util.ajax_func('post', 'xml', root+'module/netk_board/index.php', para_values, "netk_board.reply_regist_regist(data, '"+code+"', '"+sort+"')");
			return false;
		} catch(e) {
			alert(e.message);
			return false;
		}
	};
	this.reply_regist_regist = function(data, code, sort) {
		var detail_reply_count = document.getElementById("reply_count");
		$(data).find("ROOT").each(function(){
			var reply_tag = $(this).find("reply_tag").text();
			var paging = $(this).find("paging").text();
			var q = $(this).find("q").text();$(this).find("total").text();
			netk_board.reply_replace(data, sort);

			document.getElementById("reply_paging").innerHTML = paging;
			detail_reply_count.innerHTML = total; //:삭제시에 댓글수 수정하기
			$(".reply_count").html(total);
			if(code=='join') alert("글 등록이 완료되었습니다.");
			netk_board.readEL.reset();
		});
		return false;
	}


// : 댓글 페이지 이동.
	this.reply_move_func = function(page) {
		// url_parameters --> reply.php에서 불러옵니다.
		netk_board.reply_regist(document.forms['freply'], 'list', page);
	}


// : 파일 백업 삭제하기
	this.backup_delete = function(file1, file2) {
		if(confirm("삭제하시겠습니까?")) {
			location.href = "./multiProcess.php?mode=backup_delete&file[]="+file1+"&file[]="+file2;
		}
	}


// : 카테고리 이동
	this.category_move = function() {
		var group_move = document.getElementsByName('group_move[]');
		if(group_move[0].value) location.href = './index.php?pno='+group_move[0].value;
		if(group_move[1].value) location.href = './board_index.php?pno='+group_move[1].value;
	}

// : 게시판 선택삭제
	this.select_board_delete = function() {
		if(confirm("삭제하시겠습니까?")) {
			var form = document.forms['fgroup'];
			form.mode.value = "select_board_delete";
			form.submit();
		}
	}

// : 게시판 선택수정
	this.select_board_update = function() {
		if(confirm("수정하시겠습니까?")) {
			var form = document.forms['fgroup'];
			form.mode.value = "board_total_update";
			form.submit();
		}
	}


// : 그룹 선택삭제
	this.select_group_delete = function() {
		if(confirm("삭제하시겠습니까?")) {
			var form = document.forms['fgroup'];
			form.mode.value = "select_group_delete";
			form.submit();
		}
	}


// : 게시판 삭제
	this.board_delete = function(no) {
		if(confirm("게시판을 삭제하시겠습니까?")) {
			location.href = "./multiProcess.php?mode=board_delete&no="+no;
		}
	}

// : 그룹 삭제
	this.group_delete = function(no) {
		if(confirm("그룹을 삭제하시겠습니까?")) {
			location.href = "./multiProcess.php?mode=group_delete&no="+no;
		}
	}


// : 순위조정
	this.rank_change = function(code, rank, no) {
		var chk = document.getElementsByName("chk[]");
		switch(code) {
			case "up":
				if(rank==1) {
					alert("현재 최고순위입니다.");
					return;
				}
				break;

			default:
				if(rank==(chk.length)) {
					alert("현재 최하순위입니다.");
					return;
				}
				break;
		}
		location.href = './multiProcess.php?mode=category_rank&type='+code+'&no='+no;
	}


// : 중복체크
	this.dupl_check = function(type, code) {
		var type_name = document.getElementById(type);
		if(!type_name.value && code!='onkey') {
			alert(type_name.getAttribute("HNAME")+'값을 입력해주시기 바랍니다.');
			return;
		}
		util.ajax_func('get', 'xml', './multiProcess.php', "mode=dupl_check&type="+type+"&code="+code+"&type_name="+type_name.value, "netk_board.dupl_check_ajax_part(data, '"+code+"')");
	};
	this.dupl_check_ajax_part = function(data, code) {
		var dupl_check = document.getElementById("dupl_check");
		var dupl_check_span = document.getElementById("dupl_check_span");

		var resultData = $(data).find("resultData").text();
		var msg = resultData=='no' ? '사용할 수 있는 테이블명입니다.' : '중복된 테이블명입니다.'; 
		
		if(dupl_check_span && dupl_check) {
			dupl_check.value = (resultData=='no') ? 'no' : '';
			dupl_check_span.style.color = (resultData=='no' && code!='onkey') ? 'blue' : 'red';
			dupl_check_span.innerHTML = (resultData=='no' && code!='onkey') ? '중복되지 않았습니다.' : '중복체크요망';
			if(code!='onkey') alert(msg);
		}
	}



// : 레코드 추가하기 [ 등급 ]
	this.record_appendChild = function(code, msg) {
		var add_tr = document.getElementById("add_tr");
		var chk = document.getElementsByName("chk[]");
		var lv_text = document.getElementsByName("lv_text[]");
		var lv_name = document.getElementsByName("lv_name[]");
		var lv_content = document.getElementsByName("lv_content[]");
		switch(code) {
			case "add":
				var tr = document.getElementById("tr_copy").cloneNode(true);
				add_tr.insertAdjacentElement('beforeEnd',tr.cloneNode(true));
				var count = 0;
				while(count<lv_text.length) {
					lv_text[count].innerHTML = 'Lv.'+count;
					chk[count].value = count;
					lv_name[count].setAttribute("hname", "Lv."+count+"의 별칭");
					lv_name[count].setAttribute("needed", "needed");
					count++;
				}
				break;
			case "delete":
				var check_count = 0;
				var msg_txt = msg ? msg : "선택한 레코드들을 삭제하시겠습니까?";
				for(var i=1; i<chk.length; i++) if(chk[i].checked===true) check_count++;
				if(check_count<=0) {
					alert("최소한 한개 이상 선택후 삭제해주시기 바랍니다.");
					return;
				} else {
					if(confirm(msg_txt)) {
						for(var i=1; i<chk.length; i++) {
							if(chk[i].checked===true) {
								add_tr.removeChild(add_tr.childNodes[i-1]);
								i--;
							}
						}
					}
					var count = 0;
					while(count<lv_text.length) {
						lv_text[count].innerHTML = 'Lv.'+count;
						chk[count].value = count;
						lv_name[count].setAttribute("hname", "Lv."+count+"의 별칭");
						lv_name[count].setAttribute("needed", "needed");
						count++;
					}
				}
				break;
		}
	}




// : 게시판 삭제버튼 누를시
	this.user_board_delete = function(id, no) {
		if(confirm("게시물을 삭제하시겠습니까?")) {
			location.href = root+"module/netk_board/index.php?mode=user_board_delete&id="+id+"&no="+no;
		}
	}


	// : 게시판 선택 삭제버튼 누를시
	this.user_board_select_delete = function() {
		var check_no_value = this.chk_checked();
		if(!check_no_value) {
			alert("게시물을 선택해주시기 바랍니다.");
			return;
		}

		if(confirm("게시물을 삭제하시겠습니까?")) {
			util.ajax_func('get', 'xml',  root+"module/netk_board/index.php", "mode=user_board_select_delete&id="+this.id+"&check_no="+check_no_value, 'netk_board.user_board_select_delete_regist(data)');
		}
	}
	this.user_board_select_delete_regist = function(data) {
		var ROOT = $(data).find("ROOT").text();
		alert(ROOT);
		location.replace(location.href);
	}


// : 게시판 추천버튼 누를시
	this.user_recommend_regist = function(no, code) {
		util.ajax_func('get', 'json',  root+"module/netk_board/index.php", "mode=user_recommend_regist&code="+code+"&id="+this.id+"&no="+no, 'netk_board.user_recommend_regist_regist(data)');
	};
	this.user_recommend_regist_regist = function(data) {
		//data = $.parseJSON(data);
		if(data.msg) alert(data.msg);
		if(data.count) {
			$(".board_detail").find("._chu").find("._count").html(data.count);
		}
	}



// : 게시판 스크랩 누를시
	this.user_scrap_regist = function(no, kind) {
		kind = kind ? kind : 'netk_board';
		var id = this.id ? this.id : '';
		util.ajax_func('get', 'xml',  root+"module/netk_board/index.php", "mode=user_scrap_regist&id="+id+"&no="+no+"&kind="+kind, 'netk_board.user_scrap_regist_regist(data)');
	};
	this.user_scrap_regist_regist = function(data) {
		var scrap_count_span = document.getElementById("scrap_count");
		$(data).find("ROOT").each(function(){
			var message = $(this).find("message").text();
			var scrap_count = $(this).find("scrap_count").text();
			alert(message);
			if(scrap_count) scrap_count_span.innerHTML = scrap_count;
		});
	}



// : 게시물 카테고리 이동폼 보기
// : bno : 게시판 주키
	this.div_box = function(el, code, type, bno) {
		var board_put = document.getElementsByName('board_put[]');
		var board = document.getElementsByName('board_box[]');
		var fboard_passwd_code = document.getElementById("fboard_passwd_code");
		var fboard_passwd_passwd = document.getElementById("fboard_passwd_passwd");

		var count = 0;
		while(count<board.length) {
			var box_code = board[count].getAttribute("code");
			if(box_code==code) var get = count;
			board[count].style.display = 'none';
			count++;
		}

		var form = document.forms["fboard_passwd"];
		form.code.value = type;

		var count = 0;
		switch(type) {
			case "read":
				form.no.value = bno;
				board[0].style.display = '';
				form.passwd.focus();
				util.divBox_site(board[get], 10, 10, el);
				return;
				/*
				board[get].style.left = util.getPageX(el);
				board[get].style.top = util.getPageY(el)+22;*/
				break;
			default:
				if(board_put.length>0) {
					
					while(count<board_put.length) {
						var put_code = board_put[count].getAttribute("code");
						var put_type = board_put[count].getAttribute("type");
						var chk_count = board_put[count].getAttribute("chk_count");
						if(fboard_passwd_code) {
							fboard_passwd_passwd.value = '';
							fboard_passwd_code.value = type;
						}

						switch(code) {
							case "passwd_box":
								board[0].style.display = '';
								break;
							case "board_move":
								board[0].style.display = '';
								break;
							case "level_update":
								board[1].style.display = '';
								break;
						}

						if((put_code==code && !type) || (put_code==code && put_type==type)) var put = count;
						board_put[count].innerHTML = '';
						count++;
					}
				}
				if(board[get]) util.divBox_site(board[get], 5, 5, el);
				this.put_number = put;
				return;
				/*
				board[get].style.left = util.getPageX(board_put[put]);//innerHTML = board[get].innerHTML;
				board[get].style.top = util.getPageY(board_put[put])+22;//innerHTML = board[get].innerHTML;
				*/
				break;
		}
		if(type=='read') return;
	}




// : 게시물 이동하기
	this.board_move_regist = function(id) {
		var check_no_value = this.chk_checked();
		if(!check_no_value) {
			alert("게시물을 선택해주시기 바랍니다.");
			return;
		}
		if(confirm("선택한 게시물을 이동하시겠습니까?")) {
			util.ajax_func('get', 'xml',  "index.php", "mode=board_move_regist&id="+this.id+"&move_no="+check_no_value+"&move_id="+id, 'netk_board.board_move_regist_regist(data)');
		}
	};
	this.board_move_regist_regist = function(data) {
		var ROOT = $(data).find("ROOT").text();
		alert(ROOT);
		location.replace(location.href);
	}



// : 게시물의 회원 등급 변경 저장
	this.board_level_regist = function(level) {
		var check_no_value = this.chk_checked();
		if(!check_no_value) {
			alert("게시물을 선택해주시기 바랍니다.");
			return;
		}

		if(confirm("선택한 게시물에 작성자의 등급을 변경하시겠습니까?")) {
			util.ajax_func('get', 'xml',  "index.php", "mode=board_level_regist&id="+this.id+"&check_no="+check_no_value+"&level="+level, 'netk_board.board_level_regist_regist(data)');
		}
	};
	this.board_level_regist_regist = function(data) {
		var ROOT = $(data).find("ROOT").text();
		alert(ROOT);
		location.replace(location.href);
	}



// : 패스워드박스에서 패스워드 입력시 맞는지 확인하기
	this.passwd_box_confirm = function(el) {
		var get_para = util.form_parameters('fboard_passwd');
		util.ajax_func('post', 'xml',  root+"module/netk_board/index.php", get_para, 'netk_board.passwd_box_confirm_regist(data)');
		return false;
	}
	this.passwd_box_confirm_regist = function(data) {
		$(data).find("ROOT").each(function(){
			var message = $(this).find('message').text();
			var move = $(this).find('move').text();
			var action = $(this).find('action').text();
			if(message) alert(message);
			if(move) location.href = move;
			if(action) eval(action);
			return false;
		});
	}


// : 회원 수정페이지로 이동
	this.member_update = function() {
		opener.location.href = root+'mypage/member_modify.php';
	}


// : 회원정보 보기
// : 관리자페이지의 회원리스트의 이메일에도 사용합니다.
// : important/js/util.class.js페이지의 email_send함수
	this.member_box_view = function(uid, no) {
		window.open('./index.php?code=member_info&uid='+uid+'&id='+this.id+'&no='+no, 'member_'+uid, 'width=500,height=330,status=yes,scrollbars=yes');
	}


// : 프린트
	this.print = function(no) {
		var table_size = parseInt(this.table_width)+18;
		window.open('./index.php?code=print&id='+this.id+'&no='+no, 'print', 'width='+table_size+',height=600,status=yes,scrollbars=yes');
	}



// : 나의 스크랩 리스트로 이동
	this.my_scrap = function(type, id) {
		switch(type) {
			case "opener":
				opener.location.href = domain+'module/netk_board/index.php?code=my_scrap&id='+id;
				break;
			default:
				location.href = domain+'module/netk_board/index.php?code=my_scrap&id='+id;
				break;
		}
	}


// : 나의 메시지 리스트로 이동
	this.my_message = function(type, id) {
		switch(type) {
			case "opener":
				opener.location.href = domain+'module/netk_board/index.php?code=my_message&id='+id;
				break;
			default:
				location.href = domain+'module/netk_board/index.php?code=my_message&id='+id;
				break;
		}
	}


// : 게시판 선택하기 [ 스크랩, 쪽지에서 게시판 선택시 사용합니다. ]
	this.select_board = function(el, tailvalue) {
		location.href = location.pathname+'?id='+el.value+'&'+tailvalue;
	}

// : 게시판 선택하기2 [ 댓글관리 ]
	this.select_board2 = function(el, tailvalue) {
		location.href = location.pathname+'?table='+el.value+'&'+tailvalue;
	}


// : 쪽지 보내기 폼
	this.message_send = function(el, uid, no, id) {
		id = id ? id : this.id;
		var mno = el.getAttribute("mno");
		window.open(root+"module/netk_board/index.php?code=message_send&uid="+uid+'&mno='+mno+'&id='+id+'&no='+no, "message_"+uid, "width=420,height=370,status=yes,scrollbars=yes");
	}


// : 쪽지 종류에 맞게 리스트 보이기
	this.message_view_type = function(el) {
		var list_type = el.getAttribute("list_type");
		location.href = location.pathname+'?type=message_list_search&code='+el.value+'&list_type='+list_type;
	}


// : 게시판 상세페이지의 이미지가 상세사이즈보다 크면 자동으로 줄어지도록 하는 작업입니다.
// : 상세페이지를 hidden시켜놓고 자동조절후 보이는 방식입니다.
	this.content_img_resizs = function() {
		var count = 0;
		var board_detail_div = document.getElementById("board_detail_div");
		var board_detail = document.getElementById("board_detail");
		if(board_detail_div) {
			var img = board_detail.getElementsByTagName("img");
			while(count<img.length) {
				if(img[count].width>netk_board.table_width-20) {
					img[count].width = netk_board.table_width-20;
				}
				count++;
			}
			board_detail_div.style.visibility = "";
		}
	}
// : 게시판 상세의 링크들은 모두 새창으로 이동이 되도록 수정하기 [ onClick들은 제외 ]
	this.content_a_target = function() {
		var count = 0;
		var board_detail_div = document.getElementById("board_detail_div");
		var board_detail = document.getElementById("board_detail");
		if(board_detail_div) {
			var a_arr = board_detail.getElementsByTagName("a");
			while(count<a_arr.length) {
				var a_obj = a_arr[count];
				a_obj.setAttribute("target", "_blank");
				count++;
			}
		}
	}



// : 글쓸때 공지로 지정 선택시.
/*
공지로 지정하면 말머리는 비활성화합니다.
*/
	this.notice_check = function(el) {
		var bunru = document.getElementById("fwrite_bunru");
		if(bunru && el) {
			bunru.disabled = (el.checked===true) ? true : false;
			if(el.checked===true) {
				bunru.selectedIndex=0;
			}
		}
	}




// : 메일 보내기
	this.send_email = function(el, uid, email, from, from_email) {
		var mno = el.getAttribute("mno");
		window.open(this.board_url+"index.php?code=send_email&uid="+uid+'&mno='+mno+'&email='+email+'&from='+from+'&from_email='+from_email, "email_send_"+uid, "width=500, height=420, status=yes, scrollbars=yes");
	}



// : 그룹 공개여부 수정하기
	this.gong_group_change = function(el) {
		location.href = "./multiProcess.php?mode=group_gong_change&no="+el.value;
	}


// : 글쓰기
	this.write = function(el) {
		return false;
	}


// : 글읽기
	this.board_read_func = function(el, target) {
		var no = el.getAttribute("no");
		var tid = el.getAttribute("tid");
		$.get(root+"module/netk_board/index.php", "mode=board_read&id="+tid+"&no="+no, function(data){
			var check = '';
			$(data).find("ROOT").each(function(){
				var tag = $(this).find('tag').text();
				var msg = $(this).find('msg').text();
				var confirms = $(this).find('confirms').text();
				var move = $(this).find('move').text();

				if(msg) {
					alert(msg);
					check = true;
				} else {
					if(tag) {
						eval(tag);
						return false;
					}
					if(confirms) check = confirm(confirms);
					else check = true;
				}

				location.href = move;
			});
		});
	};


	this.message_regist = function(el) {
		if(validate(el)) {
			var form_para = $("form[name='fmessage']").serialize();
			$.post(root+"module/netk_board/index.php", form_para, function(data){
				alert("쪽지작성이 완료되었습니다.");
				if(location.href.indexOf("mypage/message.php")>=0) location.href = location.href;
				else $('.js_message_div').css('visibility','hidden');
			});
		}
		return false;
	}
}


var netk_board = new netk_board();