function only_number(){
	if ((event.keyCode>=48 && event.keyCode<=57) || event.keyCode==13){
		event.returnValue = true;
	}else{
		event.returnValue = false;
	}
}


//-------------------------------------------------------------------------
// STR : 게시판 사용
//-------------------------------------------------------------------------
function trShow(na)
{		
	document.getElementById(na).style.display = "block";
}
function chkDeleteLink(frm)
{
	if (confirm("정말 삭제하시겠습니까?")) {
		frm.mode.value = "LDP";
		frm.submit();
	}
}
// 링크URL 입력창 오픈
function setLinkURL()
{	
	if (document.getElementById("cBLink").checked == true) {
		document.getElementById("tdLinkURL").style.display = "block";
		document.getElementById("attachfile1").disabled = true;
		document.getElementById("attachfile2").disabled = true;
		document.getElementById("attachfile3").disabled = true;				
		document.getElementById("tdLinkTxt").style.padding = "5 0 0 0";
		document.getElementById("tdLinkTxt").innerHTML = "<font color=\"#FF0000\">* 링크글은 첨부추가 또는 내용을 입력하실 필요가 없습니다</font>";
	} else {
		document.getElementById("tdLinkURL").style.display = "none";
		document.getElementById("sBLinkURL").value = "";
		document.getElementById("attachfile1").disabled = false;
		document.getElementById("attachfile2").disabled = false;
		document.getElementById("attachfile3").disabled = false;
		document.getElementById("tdLinkTxt").style.padding = "0 0 0 0";
		document.getElementById("tdLinkTxt").innerHTML = "";
	}	
}
// 체크박스 전체 선택
var checkflag = "false";
function checkBoxAll(fv)
{	
	if (fv == undefined) return;

	if (checkflag == "false") {
		if (!fv.length) { fv.checked = true; }
		
		for (i = 0; i < fv.length; i++) { fv[i].checked = true;}
		checkflag = "true";
		} else {
		if (!fv.length) { fv.checked = false; }
		
		for (i = 0; i < fv.length; i++) { fv[i].checked = false; }
		checkflag = "false";				
	}
}
// 체크박스 선택 삭제
function chkLDelete(frm, f_value, f_mode, f_msg, f_action)
{
	if (f_value == undefined) return;
	//if (mode == "LD") { sMsg = "삭제(복구불가)"; }
	
	var num = 0;
	//var frm = document.frmList;
	if (!f_value.length) {
		if ( f_value.checked ) { num = 1; }
	}
	
	for ( var x=0; x< f_value.length; x++ ) if ( f_value[x].checked ) { num++; }
	
	if ( num < 1 ) {
		alert(f_msg+"할 항목을 선택하세요.");
		return;
	}
	
	if (confirm("선택한 "+f_msg+"하시겠습니까?")) {
		frm.mode.value = f_mode;
		frm.action = f_action;
		frm.submit();
	}
}
// END : 게시판 사용
//-------------------------------------------------------------------------


//-------------------------------------------------------------------------
// STR : 이노디터 : view 사용
//-------------------------------------------------------------------------
function HTMLDecode(str)
{
	str = str.replace(/&lt;/gi,"<");
	str = str.replace(/&amp;/gi,"&");
	return str;
}

function fnLoadContent()
{
/*
	// 이노디터에서 작성된 내용을 가져올 때 fnGetEditorHTMLCode(false, 에디터번호)에서
	// 매개변수를 false로 특수문자 처리를 하지 않고 DB상에 내용을 저장한 경우
	// View 페이지에서 DB 내용 그대로 보여주면 됨
	var strContent = document.frmView["txtaContent"].value;
*/

	// 이노디터에서 작성된 내용을 가져올 때 fnGetEditorHTMLCode(true, 에디터번호)에서
	// 매개변수를 true로 특수문자 처리를 하여 DB상에 내용을 저장한 경우
	// View 페이지에서 특수문자를 다시 변환하여 보여주어야 함
	var strContent = HTMLDecode(document.frmView["txtaContent"].value);

	var objView = document.getElementById("divView");
	objView.innerHTML = strContent;

	////////////////////////////////////////////////////////////////////////////////////////////////////
	// 이 부분은 배경색 또는 배경이미지 버튼을 사용하는 경우에만 해당
	var strBackgroundColor = document.frmView["hdnBackgroundColor"].value;
	if("" != strBackgroundColor)
	{
		objView.style.backgroundColor = strBackgroundColor;
	}

	var strBackgroundImage = document.frmView["hdnBackgroundImage"].value;
	if("" != strBackgroundImage)
	{
		var strCopyBackgroundImage = strBackgroundImage.toUpperCase();

		if("none" == strCopyBackgroundImage)
		{
			objView.style.backgroundImage = strBackgroundImage;
		}
		else
		{
			objView.style.backgroundImage = "url(" + strBackgroundImage + ")";
		}
	}

	var strBackgroundRepeat = document.frmView["hdnBackgroundRepeat"].value;
	if("" != strBackgroundRepeat)
	{
		objView.style.backgroundRepeat = strBackgroundRepeat;
	}
	////////////////////////////////////////////////////////////////////////////////////////////////////
}

function fnLoadContent_multi(n)
{
	var nContentLength = n;

	for(var i=0; i<nContentLength; i++)
	{
/*
		// 이노디터에서 작성된 내용을 가져올 때 fnGetEditorHTMLCode(false, 에디터번호)에서
		// 매개변수를 false로 특수문자 처리를 하지 않고 DB상에 내용을 저장한 경우
		// View 페이지에서 DB 내용 그대로 보여주면 됨
		var strContent = document.frmView["txtaContent" + i].value;
*/

		// 이노디터에서 작성된 내용을 가져올 때 fnGetEditorHTMLCode(true, 에디터번호)에서
		// 매개변수를 true로 특수문자 처리를 하여 DB상에 내용을 저장한 경우
		// View 페이지에서 특수문자를 다시 변환하여 보여주어야 함
		// php 에서 변환되어 js 에서 변환하지 않아도 됨
		//var strContent = HTMLDecode(document.frmView["txtaContent_" + i].value);
		var strContent = document.frmView["txtaContent_" + i].value;

		var objView = document.getElementById("divView_" + i);
		objView.innerHTML = strContent;

		////////////////////////////////////////////////////////////////////////////////////////////////////
		// 이 부분은 배경색 또는 배경이미지 버튼을 사용하는 경우에만 해당
		var strBackgroundColor = document.frmView["hdnBackgroundColor_" + i].value;
		if("" != strBackgroundColor)
		{
			objView.style.backgroundColor = strBackgroundColor;
		}

		var strBackgroundImage = document.frmView["hdnBackgroundImage_" + i].value;
		if("" != strBackgroundImage)
		{
			var strCopyBackgroundImage = strBackgroundImage.toUpperCase();

			if("none" == strCopyBackgroundImage)
			{
				objView.style.backgroundImage = strBackgroundImage;
			}
			else
			{
				objView.style.backgroundImage = "url(" + strBackgroundImage + ")";
			}
		}

		var strBackgroundRepeat = document.frmView["hdnBackgroundRepeat_" + i].value;
		if("" != strBackgroundRepeat)
		{
			objView.style.backgroundRepeat = strBackgroundRepeat;
		}
		////////////////////////////////////////////////////////////////////////////////////////////////////
	}
}
// END : 이노디터 : // END : 이노디터 : View 사용iew 사용
//-------------------------------------------------------------------------
// STR : 이노디터 : modify 사용
//-------------------------------------------------------------------------
function fnSetEditorHTML()
{
	var strHTMLCode = document.frmWrite["sBContent"].value;	

	// 첫번째 매개변수 => 이노디터에 넘겨줄 HTMLCode 내용
	// 두번째 매개변수 => true : < & 특수문자를 editor 내부에서 처리,  false : 처리안하고 넘겨진 Data 그대로 Loading
	// 세번째 매개변수 => 이노디터 번호
	fnSetEditorHTMLCode(strHTMLCode, true, 0); 

	////////////////////////////////////////////////////////////////////////////////////////////////////
	// 이 부분은 배경색 또는 배경이미지 버튼을 사용하는 경우에만 해당
	fnSetBodyStyleValue(1, document.frmWrite["hdnBackgroundColor"].value, 0);// 배경색, Value, 이노디터 번호
	fnSetBodyStyleValue(2, document.frmWrite["hdnBackgroundImage"].value, 0);// 배경이미지, Value, 이노디터 번호
	fnSetBodyStyleValue(3, document.frmWrite["hdnBackgroundRepeat"].value, 0);// 배경이미지 반복옵션, Value, 이노디터 번호
	////////////////////////////////////////////////////////////////////////////////////////////////////
}
// END : 이노디터 : modify 사용
//-------------------------------------------------------------------------


//-------------------------------------------------------------------------
// STR : 댓글 글자수 제한 사용
//-------------------------------------------------------------------------
//입력 Byte 체크
function input_cal_byte(frm, fname, max_byte){
	var fname_str, byte_count=0, fname_length=0, one_str, ext_byte;
		
	fname_str = new String(fname.value);
	fname_length = fname_str.length;
	
	for (i=0;i<fname_length;i++){
	  one_str=fname_str.charAt(i);
	  
	  if (escape(one_str).length > 4){
			byte_count+=2;
	  } else if (one_str != '\r'){
			byte_count++;
	  }
	}
	frm.iTxtByte.value = byte_count;
	
	if (byte_count > max_byte){
		ext_byte = byte_count - max_byte;
	  alert(max_byte+'Byte 이상 입력하실수 없습니다.\n\n입력하신 내용 중 초과 '+ext_byte+'Byte는 자동 삭제 됩니다.\n');	
	  input_cut_text(fname,max_byte);
	}
}
//입력창 byte대로 자르기
function input_cut_text(fname, max_byte){
    var fname_str, byte_count=0, fname_length=0, one_str;
    
    fname_str = new String(fname.value);
    fname_length = fname_str.length;
    
    for (i=0;i<fname_length;i++){

        if (byte_count < max_byte){
            one_str=fname_str.charAt(i);
        
            if (escape(one_str).length > 4){
                byte_count+=2;
            }
            else if (one_str != '\r'){
                byte_count++;
            }
        }               
        else{
            fname_str = fname_str.substring(0,i);
            break;
        }
    }
    
    if ((max_byte%2) ==1){
        fname_length = (fname_str.length-1);
        if (escape(fname_str.charAt(fname_length)).length > 4){
            fname_str = fname_str.substring(0,fname_length);
        }
    }
    
    fname.value = fname_str;
    return fname_str;
}
// END : 댓글 글자수 제한 사용
//-------------------------------------------------------------------------


//-------------------------------------------------------------------------
//-------------------------------------------------------------------------
// 게시글 삭제
/*
function chkBoardDelete(frm,f_mode,f_act)
{
	if (confirm("삭제하시겠습니까?")) {
		frm.mode.value = f_mode;
		frm.action = f_act;
		frm.submit();
	} else {
		return false;
	}
}
// 게시글 첨부파일 삭제
function chkBoardFileDelete(f_mode,f_board,f_seq,f_name,f_Logtype)
{
	if (confirm("삭제하시겠습니까?")) {
		var param = $H({mode:f_mode,board:f_board,iSeq:f_seq,sFile:f_name,sLogType:f_Logtype}).toQueryString();
		//location.href = "/board/file_proc.asp?"+param
		//return false;		
		new Ajax.Request( '/board/file_proc.asp', {asynchronous: false, method:'get', parameters: param,
			onSuccess: function(transport){
				var rtn=transport.responseText.evalJSON();
				if (rtn.result === true) { location.reload(); }
				else { alert(rtn.reason); }
			},
			onFailure: function() { alert("error"); }
		});			
	} else {
		return false;
	}
}
*/

/*

// 윈도우 생성 위치인 left, top의 값이 0 보다 작을 경우 마우스 위치로 자동 출력
function open_window(url, name, left, top, width, height, toolbar, menubar, statusbar, scrollbar, resizable)
{
	var param;
	
  toolbar_str = toolbar ? 'yes' : 'no';
  menubar_str = menubar ? 'yes' : 'no';
  statusbar_str = statusbar ? 'yes' : 'no';
  scrollbar_str = scrollbar ? 'yes' : 'no';      
  resizable_str = resizable ? 'yes' : 'no';
  
  if(left < 0) left = event.screenX - (width / 2);
  if(top < 0) top = event.screenY - (height / 2);

  param = 'left='+left+',top='+top+',width='+width+',height='+height+',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+',scrollbars='+scrollbar_str+',resizable='+resizable_str;  

  window.open(url, name, param);
}
// 이메일 자동 선택
function setEmail(frm, va1)
{
	if (va1 == "") {
		frm.sEmail2.readOnly = false;
		frm.sEmail2.value = "";
		frm.sEmail2.focus();
	} else {
		frm.sEmail2.readOnly = true;
		frm.sEmail2.value = va1;
	}
}

*/

