/**
@ program			: javascript ui framework;
@ auth				: ksyun
@ desc				: board_manage
**/
th.board=function(actionfrm){
	this.actionfrm = actionfrm; 
}

th.board.prototype = {



	//************************************************************************
	// Function : boardList
	// Description : °Ô½ÃÆÇ ¸®½ºÆ®
	// Argument : f (form.frm)
	//************************************************************************
	boardList:function(f) {
		try { 
			if (!th.Regular("" , f.boardCd , "ÇÊ¼öÀÔ·Â »çÇ×ÀÌ ¾ø½À´Ï´Ù..")) return;
			//if (!th.Regular("" , f.deptCd , "ÇÊ¼öÀÔ·Â »çÇ×ÀÌ ¾ø½À´Ï´Ù.")) return;
			f.action='Board_List.php';
			f.submit();
		} catch (e) {
			th.Error(e); 
		}
	},

	//************************************************************************
	// Function : boardSearch
	// Description : ±âº»°Ë»ö
	// Argument : f (form.frm)
	//************************************************************************
	boardSearch:function(f) {
		try { 
			if (!th.Regular("" , f.SearchKeyValue , "°Ë»ö¾î¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä.")) return;
			if (!th.Regular("" , f.SearchKey , "°Ë»ö±¸ºÐÀ» ¼±ÅÃÇØÁÖ¼¼¿ä.")) return;
			f.action='Board_List.php';
			f.submit();
		} catch (e) {
			th.Error(e); 
		}
	},


	//************************************************************************
	// Function : boardWrite
	// Description : °Ô½ÃÆÇ ¾²±â
	// Argument : f (form.frm)
	//************************************************************************
	boardWrite:function(f) {
		try { 
			f.action='Board_Write.php';
			f.submit();
		} catch (e) {
			th.Error(e); 
		}
	},
	//************************************************************************
	// Function : boardInsert
	// Description : °Ô½ÃÆÇ DBµî·Ï
	// Argument : f (form.frm)
	//************************************************************************
	boardInsert:function(f) {
		try {
			
			// ÀÌ¹ÌÁö ÆÄÀÏÀÇ À¥°æ·Î
			f.jw.imgFileReadUrl="http://www.hcf.or.kr/JwEditor/img/";		
			
			if (f.jw.HttpSendImg("/JwEditor/imgfile.php")<0) {
				alert(f.jw.GetHTTPErrText()+'\n\n\¿¡·¯ÄÚµå : '+f.jw.GetHTTPErrCode());
				return false;
			}
        	
			//f.content.value= f.jw.AllHtml;
			f.content.value = f.jw.BodyOuterHtml;
			 
			f.action='Board_Write_DB.php';
			this.boardRegular(f); 
			//f.submit();
		} catch (e) {
			th.Error(e); 
		}
	},


	boardInsert_jw_no:function(f) {
		try {
			f.action='Board_Write_DB.php';
			this.boardRegular(f); 
			//f.submit();
		} catch (e) {
			th.Error(e); 
		}
	},



	//************************************************************************
	// Function : boardInsert
	// Description : °Ô½ÃÆÇ DBµî·Ï
	// Argument : f (form.frm)
	//************************************************************************
	boardInsertUser:function(f) {
		try {
			
			// ÀÌ¹ÌÁö ÆÄÀÏÀÇ À¥°æ·Î
			 
			f.action='Board_Write_DB.php';
			this.boardRegular(f); 
			//f.submit();
		} catch (e) {
			th.Error(e); 
		}
	},

	//************************************************************************
	// Function : boardRegular
	// Description : Á¦Ç°µî·Ï½Ã Ã¼Å© »çÇ×
	// Argument : f (form.name)
	//************************************************************************
	boardRegular:function(f) {
		try {
			if (!th.Regular("" , f.boardCd , "ÇÊ¼öÀÔ·Â »çÇ×ÀÌ ¾ø½À´Ï´Ù..")) return;
			if (!th.Regular("" , f.deptCd , "ÇÊ¼öÀÔ·Â »çÇ×ÀÌ ¾ø½À´Ï´Ù.")) return;
			f.submit();
		}
		catch (e) {
			th.Error(e);
		}
	},

	//************************************************************************
	// Function : boardDel
	// Description : °Ô½ÃÆÇ DB¼öÁ¤
	// Argument : f (form.frm)
	//************************************************************************
	boardDel:function(f) {
		try { 
			if(confirm("Á¤¸»·Î »èÁ¦ÇÏ½Ã°Ú½À´Ï±î?") == true) {
				f.action='Board_Delete_DB.php';
				f.submit();
			}
			//this.boardTypeRegular(f); 
		} catch (e) {
			th.Error(e); 
		}
	},
	//************************************************************************
	// Function : boardDataDel
	// Description : °Ô½ÃÆÇ DB¼öÁ¤
	// Argument : f (form.frm)
	//************************************************************************
	boardDataDel:function(f) {
		try { 
			if(confirm("µ¥ÀÌÅ¸°¡ ¿ÏÀü½Ã »èÁ¦µË´Ï´Ù. \n\nÁ¤¸»·Î »èÁ¦ÇÏ½Ã°Ú½À´Ï±î?") == true) {
				f.action='Board_Data_Delete_DB.php';
				f.submit();
			}
			//this.boardTypeRegular(f); 
		} catch (e) {
			th.Error(e); 
		}
	},

	//************************************************************************
	// Function : boardView
	// Description : °Ô½ÃÆÇ DBµî·Ï
	// Argument : f (form.frm)
	//************************************************************************
	boardView:function(f, varWritingNo) {
		try { 
			f.writingNo.value = varWritingNo;
			f.action='Board_View.php';
			f.submit();
		} catch (e) {
			th.Error(e); 
		}
	},
	
	//************************************************************************
	// Function : boardView
	// Description : °Ô½ÃÆÇ DBµî·Ï
	// Argument : f (form.frm)
	//************************************************************************
	boardView2:function(f, varMidUrl, varWritingNo) {
		try { 
			f.writingNo.value = varWritingNo;
			f.action= varMidUrl +'Board_View.php';
			f.submit();
		} catch (e) {
			th.Error(e); 
		}
	},	
	
	//************************************************************************
	// Function : boardView
	// Description : °Ô½ÃÆÇ DBµî·Ï
	// Argument : f (form.frm)
	//************************************************************************
	boardView3:function(f, varMidUrl, varBoardCd, varWritingNo) {
		try { 
			f.boardCd.value = varBoardCd;
			f.writingNo.value = varWritingNo;
			f.action= varMidUrl +'Board_View.php';
			f.submit();
		} catch (e) {
			th.Error(e); 
		}
	},		

	//************************************************************************
	// Function : boardEdit
	// Description : °Ô½ÃÆÇ DB¼öÁ¤
	// Argument : f (form.frm)
	//************************************************************************
	boardEdit:function(f) {
		try { 
			f.action='Board_Edit.php';
			f.submit();
			//this.boardTypeRegular(f); 
		} catch (e) {
			th.Error(e); 
		}
	},

	//************************************************************************
	// Function : fileDelete
	// Description : board Type fileDelete
	// Argument : f (form.name)
	//************************************************************************
	fileDelete:function(f, varFileNo) {
		try { 
			if(confirm("Á¤¸»·Î »èÁ¦ÇÏ½Ã°Ú½À´Ï±î?") == true) {
				f.fileNo.value = varFileNo;
				f.action='Board_File_Delete.php';
				f.submit();
			}
		} catch (e) {
			th.Error(e); 
		}
	},
	//************************************************************************
	// Function : skinDelete
	// Description : board Type fileDelete
	// Argument : f (form.name)
	//************************************************************************
	skinDelete:function(f) {
		try { 
			if(confirm("Á¤¸»·Î »èÁ¦ÇÏ½Ã°Ú½À´Ï±î?") == true) {
				f.action='Board_Skin_Delete.php';
				f.submit();
			}
		} catch (e) {
			th.Error(e); 
		}
	},


	//************************************************************************
	// Function : boardUpdate
	// Description : °Ô½ÃÆÇ DB¼öÁ¤
	// Argument : f (form.frm)
	//************************************************************************
	boardUpdate:function(f) {
		try { 
			
			// ÀÌ¹ÌÁö ÆÄÀÏÀÇ À¥°æ·Î
			f.jw.imgFileReadUrl="http://www.hcf.or.kr/JwEditor/img/";		
			
			if (f.jw.HttpSendImg("/JwEditor/imgfile.php")<0) {
				alert(f.jw.GetHTTPErrText()+'\n\n\¿¡·¯ÄÚµå : '+f.jw.GetHTTPErrCode());
				return false;
			}
        	
			//f.content.value= f.jw.AllHtml;
			f.content.value = f.jw.BodyOuterHtml;
			
			f.action='Board_Edit_DB.php';
			this.boardRegular(f); 
		} catch (e) {
			th.Error(e); 
		}
	},

	boardUpdate_jw_no:function(f) {
		try { 
			
			f.action='Board_Edit_DB.php';
			this.boardRegular(f); 
		} catch (e) {
			th.Error(e); 
		}
	},

	boardUpdateUser:function(f) {
		try { 
			
		
			f.action='Board_Edit_DB.php';
			this.boardRegular(f); 
		} catch (e) {
			th.Error(e); 
		}
	},


	//************************************************************************
	// Function : boardResponse
	// Description : °Ô½ÃÆÇ 
	// Argument : f (form.frm)
	//************************************************************************
	boardResponse:function(f) {
		try { 
			f.action='Board_Response.php';
			f.submit();
		} catch (e) {
			th.Error(e); 
		}
	},


	//************************************************************************
	// Function : boardReply
	// Description : °Ô½ÃÆÇ ´ä±Ûµî·Ï
	// Argument : f (form.frm)
	//************************************************************************
	boardReply:function(f) {
		try { 
			f.action='Board_Reply.php';
			f.submit();
		} catch (e) {
			th.Error(e); 
		}
	},

	//************************************************************************
	// Function : boardReplyInsert
	// Description : °Ô½ÃÆÇ ´ä±Û insert
	// Argument : f (form.frm)
	//************************************************************************
	boardReplyInsert:function(f) {
		try { 
			if (!th.Regular("" , f.boardCd , "ÇÊ¼öÀÔ·Â »çÇ×ÀÌ ¾ø½À´Ï´Ù..")) return;
			if (!th.Regular("" , f.deptCd , "ÇÊ¼öÀÔ·Â »çÇ×ÀÌ ¾ø½À´Ï´Ù..")) return;
			if (!th.Regular("" , f.writingNo , "ÇÊ¼öÀÔ·Â »çÇ×ÀÌ ¾ø½À´Ï´Ù..")) return;
			if (!th.Regular("" , f.email , "¸ÞÀ×À» ÀÔ·ÂÇØÁÖ¼¼¿ä.")) return;
			if (!th.Regular("" , f.subject , "´ä±ÛÁ¦¸ñÀ» ÀÔ·ÂÇØÁÖ¼¼¿ä..")) return;
			f.action='Board_Reply_DB.php';
			f.submit();
		} catch (e) {
			th.Error(e); 
		}
	},

	//************************************************************************
	// Function : boardReplyEdit
	// Description : °Ô½ÃÆÇ ´ä±Ûµî·Ï
	// Argument : f (form.frm)
	//************************************************************************
	boardReplyEdit:function(f) {
		try { 
			f.action='Board_Reply_Edit.php';
			f.submit();
		} catch (e) {
			th.Error(e); 
		}
	},


	//************************************************************************
	// Function : commentInsert
	// Description : ÄÚ¸àÆ® insert
	// Argument : f (form.frm)
	//************************************************************************
	commentInsert:function(f) {
		try { 
			if (!th.Regular("" , f.boardCd , "ÇÊ¼öÀÔ·Â »çÇ×ÀÌ ¾ø½À´Ï´Ù..")) return;
			if (!th.Regular("" , f.deptCd , "ÇÊ¼öÀÔ·Â »çÇ×ÀÌ ¾ø½À´Ï´Ù..")) return;
			if (!th.Regular("" , f.writingNo , "ÇÊ¼öÀÔ·Â »çÇ×ÀÌ ¾ø½À´Ï´Ù..")) return;
			if (!th.Regular("" , f.comment , "ÄÚ¸àÆ®¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä.")) return;
			f.action='in_Comment_Insert_DB.php';
			f.submit();
		} catch (e) {
			th.Error(e); 
		}
	},


	//************************************************************************
	// Function : commentDelete
	// Description : ÄÚ¸àÆ® »èÁ¦
	// Argument : f (form.frm)
	//************************************************************************
	commentDelete:function(f, varCommentNo) {
		try { 
			if (!th.Regular("" , f.boardCd , "ÇÊ¼öÀÔ·Â »çÇ×ÀÌ ¾ø½À´Ï´Ù..")) return;
			if (!th.Regular("" , f.deptCd , "ÇÊ¼öÀÔ·Â »çÇ×ÀÌ ¾ø½À´Ï´Ù..")) return;
			if (!th.Regular("" , f.writingNo , "ÇÊ¼öÀÔ·Â »çÇ×ÀÌ ¾ø½À´Ï´Ù..")) return;
			f.commentNo.value = varCommentNo;

			f.action='in_Comment_Delete_DB.php';
			f.submit();
		} catch (e) {
			th.Error(e); 
		}
	},










































	//************************************************************************
	// Function : updateSubmit
	// Description : board Type updateSubmit
	// Argument : f (form.name)
	//************************************************************************
	updateSubmit:function(f) {
		try { 
			f.Process_flag.value = "dbUpdate";
			this.boardTypeRegular(f); 
		} catch (e) {
			th.Error(e); 
		}
	},

	//************************************************************************
	// Function : deleteSubmit
	// Description : board Type deleteSubmit
	// Argument : f (form.name)
	//************************************************************************
	deleteSubmit:function(f) {
		try { 
			f.Process_flag.value = "dbDelete";
			if(confirm("Á¤¸»·Î »èÁ¦ÇÏ½Ã°Ú½À´Ï±î?") == true) {
				f.submit();
			}
		} catch (e) {
			th.Error(e); 
		}
	},





	//************************************************************************
	// Function : updateSubmit
	// Description : °Ô½ÃÆÇ Å¸ÀÔ ¼öÁ¤
	// Argument : f (document.frm2)
	//************************************************************************
	boardTypeEdit:function(f, varTypeNo,varBoardName,varUseFileFlag,varUseReplyFlag,varUseCommentFlag,varUseOpenFlag,varUseSmsSynchFlag) {
		try { 
			f.typeNo.value =               varTypeNo;             
			f.boardName.value = 		   varBoardName;          
			f.useFileFlag.value = 		   varUseFileFlag;        
			f.useReplyFlag.value = 		   varUseReplyFlag;       
			f.useCommentFlag.value = 	   varUseCommentFlag;     
			f.useOpenFlag.value = 		   varUseOpenFlag;        
			f.useSmsSynchFlag.value = 	   varUseSmsSynchFlag;    
			f.submit();
		} catch (e) {
			th.Error(e); 
		}
	},



	//************************************************************************
	// Function : insertSubmitManage
	// Description : °Ô½ÃÆÇ °ü¸® µî·Ï
	// Argument : f (form.frm)
	//************************************************************************
	insertSubmitManage:function(f) {
		try { 
			f.Process_flag.value = "dbInsert";
			this.boardTypeRegularManage(f); 
		} catch (e) {
			th.Error(e); 
		}
	},

	//************************************************************************
	// Function : updateSubmitManage
	// Description : board Type updateSubmitManage
	// Argument : f (form.frm2)
	//************************************************************************
	updateSubmitManage:function(f) {
		try { 
			f.Process_flag.value = "dbUpdate";
			this.boardTypeRegularManage(f); 
		} catch (e) {
			th.Error(e); 
		}
	},

	//************************************************************************
	// Function : boardTypeRegularManage
	// Description : °Ô½ÃÆÇ µî·Ï½Ã Ã¼Å© »çÇ×
	// Argument : f (form.frm)
	//************************************************************************
	boardTypeRegularManage:function(f) {
		try {
			if (!th.Regular("" , f.typeNo           , "°Ô½ÃÆÇ Å¸ÀÔÀ» ¼±ÅÃÇØÁÖ¼¼¿ä.")) return;
			if (!th.Regular("" , f.boardCd          , "°Ô½ÃÆÇ ÄÚµå¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä.")) return;
			if (!th.Regular("" , f.boardName        , "°Ô½ÃÆÇ¸íÀ» ÀÔ·ÂÇØÁÖ¼¼¿ä.")) return;
			//if (!th.Regular("" , f.stylePath        , "°Ô½ÃÆÇ ½ºÅ¸ÀÏ½ÃÆ® ÆÄÀÏ¸íÀ» ÀÔ·ÂÇØÁÖ¼¼¿ä.")) return;
			//if (!th.Regular("" , f.boardTop         , "°Ô½ÃÆÇ Å¸ÀÌÆ² ÀÌ¹ÌÁö¸íÀ» ÀÔ·ÂÇØÁÖ¼¼¿ä.")) return;
			if (!th.Regular("" , f.useFileCount     , "Ã·ºÎ ÆÄÀÏ ¼ö·®À» ¼±ÅÃÇØÁÖ¼¼¿ä.")) return;
			if (!th.Regular("" , f.useFileType      , "Ã·ºÎ ÆÄÀÏ Å¸ÀÔÀ» ¼±ÅÃÇØÁÖ¼¼¿ä.")) return;
			if (!th.Regular("" , f.useFileSize  , "Ã·ºÎ ÆÄÀÏ ¿ë·®À» ¼±ÅÃÇØ ÁÖ¼¼¿ä.")) return;
			if (!th.Regular("" , f.newImgDate       , "°Ô½Ã¹° NEW Ç¥½Ã ±â°£À» ¼±ÅÃÇØÁÖ¼¼¿ä.")) return;
			if (!th.Regular("" , f.useListImg       , "list ½ºÅ²ÀÌ¹ÌÁö »ç¿ëÀ¯¹«¸¦ ¼±ÅÃÇØÁÖ¼¼¿ä.")) return;
			if (!th.Regular("" , f.useReplyScore    , "´ä±Û¿¡ ´ëÇÑ Æò°¡±â´É »ç¿ëÀ¯¹«¸¦ ¼±ÅÃÇØÁÖ¼¼¿ä.")) return;
			if (!th.Regular("" , f.useMailSend      , "´ä±Û¿¡ ´ëÇÑ ¸ÞÀÏ¾Ë¸² »ç¿ë±â´ÉÀ» ¼±ÅÃÇØÁÖ¼¼¿ä.")) return;
			if (!th.Regular("" , f.listType         , "°Ô½ÃÆÇ list Å¸ÀÔÀ» ¼±ÅÃÇØÁÖ¼¼¿ä.")) return;
			if (!th.Regular("" , f.viewType         , "°Ô½ÃÆÇ view Å¸ÀÔÀ» ¼±ÅÃÇØÁÖ¼¼¿ä.")) return;
			f.submit();
		}
		catch (e) {
			th.Error(e);
		}
	},



	//************************************************************************
	// Function : proposalRegular
	// Description : °í°´Á¦¾È ¾²±â Ã¼Å© »çÇ×
	// Argument : f (form.frm)
	//************************************************************************
	proposalRegular:function(f) {
		try {
			if (!th.Regular("" , f.boardCd          , "°Ô½ÃÆÇ ÄÚµå¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä.")) return;
			if (!th.Regular("" , f.phone        , "¿¬¶ôÃ³¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä.")) return;
			if (!th.Regular("" , f.subject     , "Á¦¸ñÀ» ÀÔ·ÂÇØÁÖ¼¼¿ä.")) return;
			if (!th.Regular("" , f.contents      , "Á¦¾È°³¿ä¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä.")) return;
			if (!th.Regular("" , f.contents2  , "Çö½ÇÅÂ ¹× ¹®Á¦Á¡À» ÀÔ·ÂÇØÁÖ¼¼¿ä.")) return;
			if (!th.Regular("" , f.contents3       , "°³¼±¹æ¾ÈÀ» ÀÔ·ÂÇØÁÖ¼¼¿ä.")) return;
			if (!th.Regular("" , f.contents4       , "±â´ëÈ¿°ú¸¦ ÀÔ·ÂÇØÁÖ¼¼¿ä.")) return;
			f.submit();
		}
		catch (e) {
			th.Error(e);
		}
	},




	//************************************************************************
	// Function : boardTypeEditManage
	// Description : °Ô½ÃÆÇ Å¸ÀÔ ¼öÁ¤
	// Argument : f (document.frm2)
	//************************************************************************
	boardTypeEditManage:function(f, varBoardNo,varTypeNo,varBoardCd,varBoardName,varStylePath,varBoardTopImg,varUseFileCount,varUseFileType,varUseFileSize,varNewImgDate,varUseListImg,varUseReplyScore,varUseMailSend,varListType,varViewType) {
		try { 
			f.boardNo.value =               varBoardNo;
			f.typeNo.value =               varTypeNo;
			f.boardCd.value =               varBoardCd;
			f.boardName.value =               varBoardName;
			f.stylePath.value =               varStylePath;
			f.boardTopImg.value =               varBoardTopImg;
			f.useFileCount.value =              varUseFileCount;
			f.useFileType.value =               varUseFileType;
			f.useFileSize.value =           varUseFileSize;
			f.newImgDate.value =               varNewImgDate;
			f.useListImg.value =               varUseListImg;
			f.useReplyScore.value =             varUseReplyScore;
			f.useMailSend.value =               varUseMailSend;
			f.listType.value =               varListType;
			f.viewType.value =               varViewType;
			f.submit();
		} catch (e) {
			th.Error(e); 
		}
	},

	//************************************************************************
	// Function : deleteSubmitManage
	// Description : board Type deleteSubmitManage
	// Argument : f (form.name)
	//************************************************************************
	deleteSubmitManage:function(f) {
		try { 
			f.Process_flag.value = "dbDelete";
			if(confirm("Á¤¸»·Î »èÁ¦ÇÏ½Ã°Ú½À´Ï±î?") == true) {
				f.submit();
			}
		} catch (e) {
			th.Error(e); 
		}
	},



	//************************************************************************
	// Function : changeSubmit
	// Description : changeSubmit
	// Argument : from
	//************************************************************************
	changeSubmit:function(f) {
		try { 
			f.action='BoardManager_List.php';
			f.submit();
		}
		catch (e) {
			th.Error(e);
		}
	}


};

