var resPath = "http://appstore.show.co.kr/board/res";

var SearchBox = {
	setKeyword : function(keyword){
		var box = document.getElementById("search_keyword");
		box.value = keyword;
	}
}

var Common = {
	// input ÇÊµå ±æÀÌ Ã¼Å©
	lengthCheck : function(obj, max){
		var thisId = obj.id; 
		selfPageFnc.limitCharactersByte3(thisId, max);				
	},
	// ¹®ÀÚ¿­ ±æÀÌ
	stringLength : function(str){
		var size = 0;
		var ch = "";
		for(var i = 0; i < str.length; i++){
			ch = str.charAt(i);
			if (escape(ch).length > 4){
				size += 2;
			}else{
				size++;
			}
		}
		return size;
	},
	// ¹®ÀÚ¿­ ÀÚ¸£±â
	subString : function(str, max){
		var length = Common.stringLength(str);
		if(length < max){
			return str;
		}
		var size = 0;
		var ch = "";
		var subStr = "";
		for(var i = 0; i < str.length; i++){
			ch = str.charAt(i);
			if (escape(ch).length > 4){
				size += 2;
			}else{
				size++;
			}
			if(size > max){
				break;
			}
			subStr += ch;
		}
		return subStr + "..";
	}
}
/* :: °øÁö»çÇ× ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
var BoardNotice = {
	url : "boardNotice.do",
	// °Ë»ö
	searchNoticeSubmit : function(){
		var form = document.getElementById("notice_search_form");
		var keyword = document.getElementById("search_keyword");
		if(keyword.value.trim().length >= 2){
			form.submit();
		}else{
			alert("µÎ±ÛÀÚ ÀÌ»ó ÀÔ·Â ÇÏ¼¼¿ä.");
			return;
		}
	},
	// ÆäÀÌÁö ÀÌµ¿
	goPage : function(pg, searchType, searchKeyword){
		var fullUrl = "";
		if(searchKeyword == ""){
			fullUrl = this.url + "?method=list&pg=" + pg;
		}else{
			fullUrl = this.url + "?method=search&pg=" + pg + "&searchType=" + searchType + "&searchKeyword=" + searchKeyword;
		}
		location.href = fullUrl;
	},
	// º¸±â
	view : function(method, idx, pg, searchType, searchKeyword){
		var fullUrl = "";
		if(searchKeyword == ""){
			fullUrl = this.url + "?method=" + method + "&idx=" + idx + "&pg=" + pg;
		}else{
			fullUrl = this.url + "?method=" + method + "&idx=" + idx + "&pg=" + pg + "&searchType=" + searchType + "&searchKeyword=" + searchKeyword;
		}
		location.href = fullUrl;
	}
}

/* :: FAQ :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
var BoardFAQ = {
	url : "boardFAQ.do",
	goFAQ : function(type){
		location.href = this.url + "?method=list&type=" + type;
	},
	openReply : function(faqIdx){
		var reply = document.getElementById("faq_" + faqIdx);
		reply.style.display = (reply.style.display == "none") ? "block" : "none";
		var faqTitle = document.getElementById("faq_title_" + faqIdx);
		faqTitle.className = (faqTitle.className == "") ? "current" : "";
	}
}

/* :: QNA :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
var BoardQNA = {
	url : "boardQNA.do",
	// °Ë»ö
	searchQNASubmit : function(){
		var form = document.getElementById("qna_search_form");
		var keyword = document.getElementById("search_keyword");
		if(keyword.value.trim().length >= 2){
			form.submit();
		}else{
			alert("µÎ±ÛÀÚ ÀÌ»ó ÀÔ·Â ÇÏ¼¼¿ä.");
			return;
		}
	},
	// ÆäÀÌÁö ÀÌµ¿
	goPage : function(pg, searchType, searchKeyword){
		var fullUrl = "";
		if(searchKeyword == ""){
			fullUrl = this.url + "?method=list&pg=" + pg;
		}else{
			fullUrl = this.url + "?method=search&pg=" + pg + "&search_type=" + searchType + "&search_keyword=" + searchKeyword;
		}
		location.href = fullUrl;
	},
	// ¾²±â ÃÊ±âÈ­
	resetQNA : function(){
		document.getElementById("qna_write_form").reset();
	},
	// ¾²±â
	writeQNASubmit : function(){
		var form = document.getElementById("qna_write_form");
		var title = document.getElementById("title");
		var content = document.getElementById("content");
		if(title.value.trim().length == 0){
			alert("Á¦¸ñÀ» ÀÔ·Â ÇÏ¼¼¿ä.");
			title.focus();
			return;
		}
		if(noWordCheck(title.value)){
			alert("Á¦¸ñ¿¡ ±ÝÄ¢¾î°¡ Æ÷ÇÔµÇ¾î ÀÖ½À´Ï´Ù.");
			return;
		}
		if(content.value.trim().length == 0){
			alert("³»¿ëÀ» ÀÔ·Â ÇÏ¼¼¿ä.");
			content.focus();
			return;
		}
		if(noWordCheck(content.value)){
			alert("³»¿ë¿¡ ±ÝÄ¢¾î°¡ Æ÷ÇÔµÇ¾î ÀÖ½À´Ï´Ù.");
			return;
		}
		form.target = "submit_frame";
		form.submit();
	},
	// º¸±â
	view : function(idx, pg, searchType, searchKeyword){
		var fullUrl = "";
		if(searchKeyword == ""){
			fullUrl = this.url + "?method=view&idx=" + idx + "&pg=" + pg;
		}else{
			fullUrl = this.url + "?method=view&idx=" + idx + "&pg=" + pg + "&search_type=" + searchType + "&search_keyword=" + searchKeyword;
		}
		location.href = fullUrl;
	}
}

/* :: ¹¯°í ´äÇÏ±â ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
var BoardFree = {
	url : "boardFree.do",
	// °Ë»ö
	searchSubmit : function(){
		var form = document.getElementById("free_search_form");
		var keyword = document.getElementById("search_keyword");
		if(keyword.value.trim().length >= 2){
			form.submit();
		}else{
			alert("µÎ±ÛÀÚ ÀÌ»ó ÀÔ·Â ÇÏ¼¼¿ä.");
			return;
		}
	},
	// ÆäÀÌÁö ÀÌµ¿
	goPage : function(pg, searchType, searchKeyword){
		var fullUrl = "";
		if(searchKeyword == ""){
			fullUrl = this.url + "?method=list&pg=" + pg;
		}else{
			fullUrl = this.url + "?method=search&pg=" + pg + "&search_type=" + searchType + "&search_keyword=" + searchKeyword;
		}
		location.href = fullUrl;
	},
	// ¾²±â ÃÊ±âÈ­
	writeReset : function(){
		document.getElementById("free_write_form").reset();
	},
	// ¾²±â
	writeSubmit : function(){
		var form = document.getElementById("free_write_form");
		var title = document.getElementById("title");
		var content = document.getElementById("content");
		if(title.value.trim().length == 0){
			alert("Á¦¸ñÀ» ÀÔ·Â ÇÏ¼¼¿ä.");
			title.focus();
			return;
		}
		if(noWordCheck(title.value)){
			alert("Á¦¸ñ¿¡ ±ÝÄ¢¾î°¡ Æ÷ÇÔµÇ¾î ÀÖ½À´Ï´Ù.");
			title.focus();
			return;
		}
		if(content.value.trim().length == 0){
			alert("³»¿ëÀ» ÀÔ·Â ÇÏ¼¼¿ä.");
			content.focus();
			return;
		}
		if(noWordCheck(content.value)){
			alert("³»¿ë¿¡ ±ÝÄ¢¾î°¡ Æ÷ÇÔµÇ¾î ÀÖ½À´Ï´Ù.");
			content.focus();
			return;
		}
		form.target = "submit_frame";
		form.submit();
	},
	// º¸±â
	view : function(idx, pg, searchType, searchKeyword){
		var fullUrl = "";
		if(searchKeyword == ""){
			fullUrl = this.url + "?method=view&idx=" + idx + "&pg=" + pg;
		}else{
			fullUrl = this.url + "?method=view&idx=" + idx + "&pg=" + pg + "&search_type=" + searchType + "&search_keyword=" + searchKeyword;
		}
		location.href = fullUrl;
	},
	// ´ñ±Û ¾²±â
	replyWriteSubmit : function(){
		var form = document.getElementById("reply_form");
		var content = document.getElementById("content");
		if(content.value.trim().length == 0){
			alert("´ñ±Û ³»¿ëÀ» ÀÔ·Â ÇÏ¼¼¿ä.");
			content.focus();
			return;
		}
		if(noWordCheck(content.value)){
			alert("´ñ±Û ³»¿ë¿¡ ±ÝÄ¢¾î°¡ Æ÷ÇÔµÇ¾î ÀÖ½À´Ï´Ù.");
			return;
		}
		form.target = "submit_frame";
		form.submit();
	},
	// ´ñ±Û »èÁ¦
	replyDeleteSubmit : function(replyIdx){
		if(confirm("´ñ±ÛÀ» »èÁ¦ ÇÏ½Ã°Ú½À´Ï±î?")){
			var form = document.getElementById("reply_form");
			form.target = "submit_frame";
			form.action = "boardFree.do?method=reply_delete_ok&reply_idx=" + replyIdx;
			form.submit();
		}
	},
	// ´ñ±Û ¼öÁ¤ Æû
	replyModify : function(replyIdx){
		var replyView = document.getElementById("reply_view_form_" + replyIdx);
		var replyModify = document.getElementById("reply_modify_form_" + replyIdx);
		var replyHiddenContent = document.getElementById("reply_hidden_content_" + replyIdx);
		var replyModifyContent = document.getElementById("reply_modify_content_" + replyIdx);
		replyView.style.display = "none";
		replyModify.style.display = "";
		replyModifyContent.value = replyHiddenContent.value;
	},
	// ´ñ±Û ¼öÁ¤ Ãë¼Ò
	replyModifyCancel : function(replyIdx){
		var replyView = document.getElementById("reply_view_form_" + replyIdx);
		var replyModify = document.getElementById("reply_modify_form_" + replyIdx);
		var replyModifyContent = document.getElementById("reply_modify_content_" + replyIdx);
		replyView.style.display = "";
		replyModify.style.display = "none";
		replyModifyContent.value = "";
	},
	// ´ñ±Û ¼öÁ¤
	replyModifySubmit : function(replyIdx){
		var form = document.getElementById("view_form");
		var replyContent = document.getElementById("reply_modify_content_" + replyIdx);
		if(replyContent.value.trim().length == 0){
			alert("´ñ±Û ³»¿ëÀ» ÀÔ·ÂÇÏ¼¼¿ä.");
			replyContent.focus();
			return;
		}
		if(noWordCheck(replyContent.value)){
			alert("´ñ±Û ³»¿ë¿¡ ±ÝÄ¢¾î°¡ Æ÷ÇÔµÇ¾î ÀÖ½À´Ï´Ù.");
			return;
		}
		form.action = this.url + "?method=reply_modify_ok";
		form.reply_idx.value = replyIdx;
		form.reply_content.value = replyContent.value;
		form.submit();
	},
	// ¹¯°í ´äÇÏ±â ¼öÁ¤ Æû
	boardModify : function(idx, pg, searchType, searchKeyword){
		var fullUrl = "";
		if(searchKeyword == ""){
			fullUrl = this.url + "?method=modify_form&idx=" + idx + "&pg=" + pg;
		}else{
			fullUrl = this.url + "?method=modify_form&idx=" + idx + "&pg=" + pg + "&search_type=" + searchType + "&search_keyword=" + searchKeyword;
		}
		location.href = fullUrl;
	},
	// ¹¯°í ´äÇÏ±â ¼öÁ¤
	modifySubmit : function(){
		var form = document.getElementById("free_modify_form");
		var title = document.getElementById("title");
		var content = document.getElementById("content");
		if(title.value.trim().length == 0){
			alert("Á¦¸ñÀ» ÀÔ·Â ÇÏ¼¼¿ä.");
			title.focus();
			return;
		}
		if(noWordCheck(title.value)){
			alert("Á¦¸ñ¿¡ ±ÝÄ¢¾î°¡ Æ÷ÇÔµÇ¾î ÀÖ½À´Ï´Ù.");
			return;
		}
		if(content.value.trim().length == 0){
			alert("³»¿ëÀ» ÀÔ·Â ÇÏ¼¼¿ä.");
			content.focus();
			return;
		}
		if(noWordCheck(content.value)){
			alert("³»¿ë¿¡ ±ÝÄ¢¾î°¡ Æ÷ÇÔµÇ¾î ÀÖ½À´Ï´Ù.");
			return;
		}
		form.target = "submit_frame";
		form.submit();
	},
	// »èÁ¦
	deleteSubmit : function(){
		if(confirm("±ÛÀ» »èÁ¦ ÇÏ½Ã°Ú½À´Ï±î?")){
			var form = document.getElementById("view_form");
			form.action = this.url + "?method=delete_ok";
			form.target = "submit_frame";
			form.submit();
		}
	}
}

/* :: Àå¾Ö½Å°í ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
var BoardAppError = {
	url : "boardAppError.do",
	// ÆäÀÌÁö ÀÌµ¿
	goPage : function(pg){
		location.href = this.url + "?method=list&pg=" + pg;
	},
	// ´äº¯³»¿ë º¸ÀÌ±â, °¨Ãß±â
	replyShowHide : function(idx){
		var errorObject = document.getElementById("error_" + idx);
		var replyObject = document.getElementById("reply_" + idx);
		
		jQuery(function(){
			(function($){						
				$(function(){
					var errorGroup = $('tr[id^=error_]');
					for(var i = 0; i < errorGroup.length; i++){
						errorGroup[i].className = "";
					}
					
					var layerGroup = $('div[id^=gradeLayer]');
					for(var i = 0; i < layerGroup.length; i++){
						layerGroup[i].style.display = "none";
					}
					
					var replyGroup = $('div[id^=reply_view_]');
					for(var i = 0; i < replyGroup.length; i++){
						replyGroup[i].style.display = "none";
					}
					
					if(replyObject.style.display == "none"){
						var replyGroup = $('tr[id^=reply_]');
						for(var i = 0; i < replyGroup.length; i++){
							replyGroup[i].style.display = "none";
						}
					}
					
					replyObject.style.display = (replyObject.style.display == "none") ? "" : "none";
					if(replyObject.style.display == ""){
						errorObject.className = "answer";
						var replyGroup = $('div[id^=reply_view_' + idx + ']');
						for(var i = 0; i < replyGroup.length; i++){
							replyGroup[i].style.display = "";
						}
					}else{
						errorObject.className = "";
					}
				});		
			})(jQuery);
		});
	},
	// ´äº¯Æò°¡ º¸ÀÌ±â, °¨Ãß±â
	replyLayerShowHide : function(id){
		var agreeLayer = document.getElementById(id);
		if(agreeLayer.style.display == "none"){
			var layerGroup = document.getElementsByName("layer_group");
			for(var i = 0; i < layerGroup.length; i++){
				layerGroup[i].style.display = "none";
			}
		}
		agreeLayer.style.display = (agreeLayer.style.display == "none") ? "block" : "none";
		
		var gradeGroup = document.getElementsByName("grade");
		for(var i = 0; i < gradeGroup.length; i++){
			gradeGroup[i].checked = false;
		}
	},
	// ´äº¯ Æò°¡
	replyAgreeSubmit : function(errorIdx, replyIdx, cpNo){
		var grade = null;
		var gradeGroup = document.getElementsByName("grade");
		for(var i = 0; i < gradeGroup.length; i++){
			if(gradeGroup[i].checked == true){
				grade = gradeGroup[i].value;
			}
		}
		if(grade == null){
			alert("Æò°¡¸¦ ¼±ÅÃ ÇÏ¼¼¿ä.");
			return;
		}
		var form = document.getElementById("reply_agree_form");
		form.target = "submit_frame";
		form.error_idx.value = errorIdx;
		form.reply_idx.value = replyIdx;
		form.agree.value = grade;
		form.cp_no.value = cpNo;
		form.submit();
	}
}

/* :: ¾îÇÃ¹®ÀÇ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
var BoardAppQNA = {
	url : "boardAppQNA.do",
	// ÆäÀÌÁö ÀÌµ¿
	goPage : function(pg){
		location.href = this.url + "?method=list&pg=" + pg;
	},
	// ´äº¯³»¿ë º¸ÀÌ±â, °¨Ãß±â
	replyShowHide : function(idx){
		var qnaObject = document.getElementById("qna_" + idx);
		var replyObject = document.getElementById("reply_" + idx);
		
		jQuery(function(){
			(function($){						
				$(function(){
					var errorGroup = $('tr[id^=qna_]');
					for(var i = 0; i < errorGroup.length; i++){
						errorGroup[i].className = "";
					}
					
					var layerGroup = $('div[id^=gradeLayer]');
					for(var i = 0; i < layerGroup.length; i++){
						layerGroup[i].style.display = "none";
					}
					
					var replyGroup = $('div[id^=reply_view_]');
					for(var i = 0; i < replyGroup.length; i++){
						replyGroup[i].style.display = "none";
					}
					
					if(replyObject.style.display == "none"){
						var replyGroup = $('tr[id^=reply_]');
						for(var i = 0; i < replyGroup.length; i++){
							replyGroup[i].style.display = "none";
						}
					}
					
					replyObject.style.display = (replyObject.style.display == "none") ? "" : "none";
					if(replyObject.style.display == ""){
						qnaObject.className = "answer";
						var replyGroup = $('div[id^=reply_view_' + idx + ']');
						for(var i = 0; i < replyGroup.length; i++){
							replyGroup[i].style.display = "";
						}
					}else{
						qnaObject.className = "";
					}
				});		
			})(jQuery);
		});
		/*
		var qnaGroup = document.getElementsByName("qna_group");
		for(var i = 0; i < qnaGroup.length; i++){
			qnaGroup[i].className = "";
		}
		
		if(replyObject.style.display == "none"){
			var replyGroup = document.getElementsByName("reply_group");
			for(var i = 0; i < replyGroup.length; i++){
				replyGroup[i].style.display = "none";
			}
		}
		
		qnaObject.className = "answer";
		replyObject.style.display = (replyObject.style.display == "none") ? "" : "none";
		*/
	}
}

/* :: ¾îÇÃ ¹®ÀÇÇÏ±â, ¾îÇÃ Àå¾Ö½Å°í ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
var Popup = {
	// ¾îÇÃ ¹®ÀÇÇÏ±â ÆË¾÷
	openAppQNA : function(serviceNo){
		var win = window.open("boardAppQNA.do?method=write_form&service_no=" + serviceNo, "pop_app_qna", "width=510,height=384");
		if(win != null){
			win.focus();
		}
	},
	// ¾îÇÃ ¹®ÀÇÇÏ±â
	appQNASubmit : function(){
		var form = document.getElementById("app_qna_form");
		var title = document.getElementById("title");
		var content = document.getElementById("content");
		if(title.value.trim().length == 0){
			alert("Á¦¸ñÀ» ÀÔ·Â ÇÏ¼¼¿ä.");
			title.focus();
			return;
		}
		if(noWordCheck(title.value)){
			alert("Á¦¸ñ¿¡ ±ÝÄ¢¾î°¡ Æ÷ÇÔµÇ¾î ÀÖ½À´Ï´Ù.");
			return;
		}
		if(content.value.trim().length == 0){
			alert("³»¿ëÀ» ÀÔ·Â ÇÏ¼¼¿ä.");
			content.focus();
			return;
		}
		if(noWordCheck(content.value)){
			alert("³»¿ë¿¡ ±ÝÄ¢¾î°¡ Æ÷ÇÔµÇ¾î ÀÖ½À´Ï´Ù.");
			return;
		}
		form.submit();
	},
	// ¾îÇÃ ¿À·ù½Å°í ÆË¾÷
	openAppError : function(serviceNo){
		var win = window.open("boardAppError.do?method=write_form&service_no=" + serviceNo, "pop_app_error", "width=510,height=384");
		if(win != null){
			win.focus();
		}
	},
	// ¾îÇÃ ¿À·ù½Å°í
	appErrorSubmit : function(){
		var form = document.getElementById("app_error_form");
		var device = document.getElementById("device");
		var code = document.getElementById("error_code");
		var title = document.getElementById("title");
		var content = document.getElementById("content");
		if(device.value == ""){
			alert("´Ü¸»±â´Â ¼±ÅÃÇØ ÁÖ¼¼¿ä.");
			return;
		}
		if(code.value == ""){
			alert("¿À·ùÇ×¸ñÀ» ¼±ÅÃÇÏ¼¼¿ä.");
			code.focus();
			return;
		}
		if(title.value.trim().length == 0){
			alert("Á¦¸ñÀ» ÀÔ·Â ÇÏ¼¼¿ä.");
			title.focus();
			return;
		}
		if(noWordCheck(title.value)){
			alert("Á¦¸ñ¿¡ ±ÝÄ¢¾î°¡ Æ÷ÇÔµÇ¾î ÀÖ½À´Ï´Ù.");
			return;
		}
		if(content.value.trim().length == 0){
			alert("³»¿ëÀ» ÀÔ·Â ÇÏ¼¼¿ä.");
			content.focus();
			return;
		}
		if(noWordCheck(content.value)){
			alert("³»¿ë¿¡ ±ÝÄ¢¾î°¡ Æ÷ÇÔµÇ¾î ÀÖ½À´Ï´Ù.");
			return;
		}
		form.submit();
	}
}

/* :: °­ÁÂ ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
var BoardLecture = {
	url : "boardLecture.do",
	// °Ë»ö
	searchLectureSubmit : function(){
		var form = document.getElementById("lecture_search_form");
		var keyword = document.getElementById("search_keyword");
		if(keyword.value.trim().length >= 2){
			form.submit();
		}else{
			alert("µÎ±ÛÀÚ ÀÌ»ó ÀÔ·Â ÇÏ¼¼¿ä.");
			return;
		}
	},
	// ÆäÀÌÁö ÀÌµ¿
	goPage : function(pg, searchType, searchKeyword){
		var fullUrl = "";
		if(searchKeyword == ""){
			fullUrl = this.url + "?method=list&pg=" + pg;
		}else{
			fullUrl = this.url + "?method=search&pg=" + pg + "&search_type=" + searchType + "&search_keyword=" + searchKeyword;
		}
		location.href = fullUrl;
	},
	// »ó¼¼ º¸±â
	view : function(idx, pg, searchType, searchKeyword){
		var fullUrl = "";
		if(searchKeyword == ""){
			fullUrl = this.url + "?method=view&idx=" + idx + "&pg=" + pg;
		}else{
			fullUrl = this.url + "?method=view&idx=" + idx + "&pg=" + pg + "&search_type=" + searchType + "&search_keyword=" + searchKeyword;
		}
		location.href = fullUrl;
	},
	// ´ñ±Û ¾²±â
	replyWriteSubmit : function(){
		var content = document.getElementById("reply_content");
		if(content.value.trim().length == 0){
			alert("´ñ±Û ³»¿ëÀ» ÀÔ·Â ÇÏ¼¼¿ä.");
			content.focus();
			return;
		}
		if(noWordCheck(content.value)){
			alert("´ñ±Û ³»¿ë¿¡ ±ÝÄ¢¾î°¡ Æ÷ÇÔµÇ¾î ÀÖ½À´Ï´Ù.");
			return;
		}
		var form = document.getElementById("view_form");
		form.content.value = content.value.trim();
		form.action = this.url + "?method=reply_write_ok";
		form.target = "submit_frame";
		form.submit();
	},
	// ´ñ±Û »èÁ¦
	replyDeleteSubmit : function(replyIdx){
		if(confirm("´ñ±ÛÀ» »èÁ¦ ÇÏ½Ã°Ú½À´Ï±î?")){
			var form = document.getElementById("view_form");
			form.action = this.url + "?method=reply_delete_ok";
			form.reply_idx.value = replyIdx;
			form.target = "submit_frame";
			form.submit();
		}
	},
	// ´ñ±Û ¼öÁ¤ Æû
	replyModifyForm : function(replyIdx){
		var replyView = document.getElementById("reply_view_form_" + replyIdx);
		var replyModify = document.getElementById("reply_modify_form_" + replyIdx);
		var replyHiddenContent = document.getElementById("reply_hidden_content_" + replyIdx);
		var replyModifyContent = document.getElementById("reply_modify_content_" + replyIdx);
		replyView.style.display = "none";
		replyModify.style.display = "";
		replyModifyContent.value = replyHiddenContent.value;
	},
	// ´ñ±Û ¼öÁ¤ Ãë¼Ò
	replyModifyCancel : function(replyIdx){
		var replyView = document.getElementById("reply_view_form_" + replyIdx);
		var replyModify = document.getElementById("reply_modify_form_" + replyIdx);
		var replyModifyContent = document.getElementById("reply_modify_content_" + replyIdx);
		replyView.style.display = "";
		replyModify.style.display = "none";
		replyModifyContent.value = "";
	},
	// ´ñ±Û ¼öÁ¤
	replyModifySubmit : function(replyIdx){
		var form = document.getElementById("view_form");
		var replyContent = document.getElementById("reply_modify_content_" + replyIdx);
		if(replyContent.value.trim().length == 0){
			alert("´ñ±Û ³»¿ëÀ» ÀÔ·ÂÇÏ¼¼¿ä.");
			replyContent.focus();
			return;
		}
		if(noWordCheck(replyContent.value)){
			alert("´ñ±Û ³»¿ë¿¡ ±ÝÄ¢¾î°¡ Æ÷ÇÔµÇ¾î ÀÖ½À´Ï´Ù.");
			return;
		}
		form.action = this.url + "?method=reply_modify_ok";
		form.reply_idx.value = replyIdx;
		form.reply_content.value = replyContent.value;
		form.submit();
	},
	// °­ÁÂ ÃßÃµ
	recommendSubmit : function(idx){
		var form = document.getElementById("view_form");
		form.action = this.url + "?method=recommend_ok";
		form.idx.value = idx;
		form.submit();
	},
	// ÆÄÀÏ ´Ù¿î·Îµå
	fileDownload : function(idx){
		var form = document.getElementById("submit_frame");
		form.src = this.url + "?method=download&idx=" + idx;
	}
}

/* :: ÆÄ¿ö¸®ºä ::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: */
var BoardReview = {
	url : "boardReview.do",
	// ÆäÀÌÁö ÀÌµ¿
	goPage : function(pg, searchType, searchKeyword){
		var fullUrl = "";
		if(searchKeyword == ""){
			fullUrl = this.url + "?method=list&pg=" + pg;
		}else{
			fullUrl = this.url + "?method=search&pg=" + pg + "&search_type=" + searchType + "&search_keyword=" + searchKeyword;
		}
		location.href = fullUrl;
	},
	// °Ë»ö
	searchReviewSubmit : function(){
		var keyword = document.getElementById("search_keyword");
		if(keyword.value.trim().length < 2){
			alert("µÎ±ÛÀÚ ÀÌ»ó ÀÔ·Â ÇÏ¼¼¿ä.");
			return;
		}
		document.getElementById("review_search_form").submit();
	},
	// º¸±â
	view : function(idx, pg, searchType, searchKeyword){
		var fullUrl = "";
		if(searchKeyword == ""){
			fullUrl = this.url + "?method=view&idx=" + idx + "&pg=" + pg;
		}else{
			fullUrl = this.url + "?method=view&idx=" + idx + "&pg=" + pg + "&search_type=" + searchType + "&search_keyword=" + searchKeyword;
		}
		location.href = fullUrl;
	},
	// ¾²±â Æû
	writeForm : function(pg, searchType, searchKeyword){
		var fullUrl = "";
		if(searchKeyword == ""){
			fullUrl = this.url + "?method=write_form&pg=" + pg;
		}else{
			fullUrl = this.url + "?method=write_form&pg=" + pg + "&search_type=" + searchType + "&search_keyword=" + searchKeyword;
		}
		location.href = fullUrl;
	},
	// ´Ù½Ã ¾²±â
	writeReset : function(){
		document.getElementById("write_form").reset();
	},
	// ¾²±â
	writeSubmit : function(){
		var form = document.getElementById("write_form");
		var appName = document.getElementById("app_name");
		var title = document.getElementById("title");
		var content = document.getElementById("content");
		var file = document.getElementById("file_1");
		if(appName.value.trim().length == 0){
			alert("¾îÇÃ¸íÀ» ÀÔ·Â ÇÏ¼¼¿ä.");
			appName.focus();
			return;
		}
		if(noWordCheck(appName.value)){
			alert("¾îÇÃ¸í¿¡ ±ÝÄ¢¾î°¡ Æ÷ÇÔµÇ¾î ÀÖ½À´Ï´Ù.");
			return;
		}
		if(title.value.trim().length == 0){
			alert("Á¦¸ñ ³»¿ëÀ» ÀÔ·Â ÇÏ¼¼¿ä.");
			title.focus();
			return;
		}
		if(noWordCheck(title.value)){
			alert("Á¦¸ñ¿¡ ±ÝÄ¢¾î°¡ Æ÷ÇÔµÇ¾î ÀÖ½À´Ï´Ù.");
			return;
		}
		if(content.value.trim().length == 0){
			alert("³»¿ëÀ» ÀÔ·Â ÇÏ¼¼¿ä.");
			content.focus();
			return;
		}
		if(noWordCheck(content.value)){
			alert("³»¿ë¿¡ ±ÝÄ¢¾î°¡ Æ÷ÇÔµÇ¾î ÀÖ½À´Ï´Ù.");
			return;
		}
		if(file.value.trim().length > 0){
			var name = file.value.toUpperCase();
			if(name.indexOf(".GIF") == -1 && name.indexOf(".JPG") == -1 && name.indexOf(".PNG") == -1){
				alert("ÀÌ¹ÌÁö Çü½Ä¸¸ ¾÷·Îµå °¡´É ÇÕ´Ï´Ù.");
				return;
			}
		}
		form.target = "submit_frame";
		form.submit();
	},
	// »èÁ¦
	deleteSubmit : function(){
		if(confirm("±ÛÀ» »èÁ¦ ÇÏ½Ã°Ú½À´Ï±î?")){
			var form = document.getElementById("view_form");
			form.action = this.url + "?method=delete_ok";
			form.target = "submit_frame";
			form.submit();
		}
	},
	// ¼öÁ¤ Æû
	modifyForm : function(idx, pg, searchType, searchKeyword){
		var fullUrl = "";
		if(searchKeyword == ""){
			fullUrl = this.url + "?method=modify_form&idx=" + idx + "&pg=" + pg;
		}else{
			fullUrl = this.url + "?method=modify_form&idx=" + idx + "&pg=" + pg + "&search_type=" + searchType + "&search_keyword=" + searchKeyword;
		}
		location.href = fullUrl;
	},
	modifyReset : function(){
		
	},
	// ¼öÁ¤
	modifySubmit : function(){
		var form = document.getElementById("modify_form");
		var appName = document.getElementById("app_name");
		var title = document.getElementById("title");
		var content = document.getElementById("content");
		var file = document.getElementById("file_1");
		if(noWordCheck(appName.value)){
			alert("¾îÇÃ¸í¿¡ ±ÝÄ¢¾î°¡ Æ÷ÇÔµÇ¾î ÀÖ½À´Ï´Ù.");
			return;
		}
		if(title.value.trim().length == 0){
			alert("Á¦¸ñ ³»¿ëÀ» ÀÔ·Â ÇÏ¼¼¿ä.");
			title.focus();
			return;
		}
		if(noWordCheck(title.value)){
			alert("Á¦¸ñ¿¡ ±ÝÄ¢¾î°¡ Æ÷ÇÔµÇ¾î ÀÖ½À´Ï´Ù.");
			return;
		}
		if(content.value.trim().length == 0){
			alert("³»¿ëÀ» ÀÔ·Â ÇÏ¼¼¿ä.");
			content.focus();
			return;
		}
		if(noWordCheck(content.value)){
			alert("³»¿ë¿¡ ±ÝÄ¢¾î°¡ Æ÷ÇÔµÇ¾î ÀÖ½À´Ï´Ù.");
			return;
		}
		if(file.value.trim().length > 0){
			var name = file.value.toUpperCase();
			if(name.indexOf(".GIF") == -1 && name.indexOf(".JPG") == -1 && name.indexOf(".PNG") == -1){
				alert("ÀÌ¹ÌÁö Çü½Ä¸¸ ¾÷·Îµå °¡´É ÇÕ´Ï´Ù.");
				return;
			}
		}
		form.target = "submit_frame";
		form.submit();
	},
	// ´ñ±Û ¾²±â
	replyWriteSubmit : function(){
		var content = document.getElementById("reply_content");
		if(content.value.trim().length == 0){
			alert("´ñ±Û ³»¿ëÀ» ÀÔ·Â ÇÏ¼¼¿ä.");
			content.focus();
			return;
		}
		if(noWordCheck(content.value)){
			alert("´ñ±Û ³»¿ë¿¡ ±ÝÄ¢¾î°¡ Æ÷ÇÔµÇ¾î ÀÖ½À´Ï´Ù.");
			return;
		}
		var form = document.getElementById("view_form");
		form.content.value = content.value.trim();
		form.action = this.url + "?method=reply_write_ok";
		form.target = "submit_frame";
		form.submit();
	},
	// ´ñ±Û »èÁ¦
	replyDeleteSubmit : function(replyIdx){
		if(confirm("´ñ±ÛÀ» »èÁ¦ ÇÏ½Ã°Ú½À´Ï±î?")){
			var form = document.getElementById("view_form");
			form.action = this.url + "?method=reply_delete_ok";
			form.reply_idx.value = replyIdx;
			form.target = "submit_frame";
			form.submit();
		}
	},
	// ´ñ±Û ¼öÁ¤ Æû
	replyModifyForm : function(replyIdx){
		var replyView = document.getElementById("reply_view_form_" + replyIdx);
		var replyModify = document.getElementById("reply_modify_form_" + replyIdx);
		var replyHiddenContent = document.getElementById("reply_hidden_content_" + replyIdx);
		var replyModifyContent = document.getElementById("reply_modify_content_" + replyIdx);
		replyView.style.display = "none";
		replyModify.style.display = "";
		replyModifyContent.value = replyHiddenContent.value;
	},
	// ´ñ±Û ¼öÁ¤ Ãë¼Ò
	replyModifyCancel : function(replyIdx){
		var replyView = document.getElementById("reply_view_form_" + replyIdx);
		var replyModify = document.getElementById("reply_modify_form_" + replyIdx);
		var replyModifyContent = document.getElementById("reply_modify_content_" + replyIdx);
		replyView.style.display = "";
		replyModify.style.display = "none";
		replyModifyContent.value = "";
	},
	// ´ñ±Û ¼öÁ¤
	replyModifySubmit : function(replyIdx){
		var form = document.getElementById("view_form");
		var replyContent = document.getElementById("reply_modify_content_" + replyIdx);
		if(replyContent.value.trim().length == 0){
			alert("´ñ±Û ³»¿ëÀ» ÀÔ·ÂÇÏ¼¼¿ä.");
			replyContent.focus();
			return;
		}
		if(noWordCheck(replyContent.value)){
			alert("´ñ±Û ³»¿ë¿¡ ±ÝÄ¢¾î°¡ Æ÷ÇÔµÇ¾î ÀÖ½À´Ï´Ù.");
			return;
		}
		form.action = this.url + "?method=reply_modify_ok";
		form.reply_idx.value = replyIdx;
		form.reply_content.value = replyContent.value;
		form.submit();
	},
	// °­ÁÂ ÃßÃµ
	recommendSubmit : function(idx){
		var form = document.getElementById("view_form");
		form.action = this.url + "?method=recommend_ok";
		form.idx.value = idx;
		form.submit();
	}
}


String.prototype.trim = function(){
	return this.replace(/(^\s*)|(\s*$)/g, "");
}

/**
 * ±ÝÄ¢¾î Ã¼Å©
 * @param {Object} text
 */
function noWordCheck(text){
	for(var i = 0; i < noword.length; i++){
		var reg = new RegExp(noword[i]);
		if(reg.test(text)){
			return true;
		}
	}
	return false;
}
