function comment_del( form )
{
	msg = "정말로 삭제 하시겠습니까?";

	if( !confirm( msg ) )
	{
		return false;
	}

        form.mode.value = 'del';
        return true;
}

function board_read_mileage_pop( user_id, tmp )
{
	
	if( !user_id )
	{
		alert( '적립금바로주기는 회원에게만 가능합니다.' );

		return false;
	}

	href = '/admin/php/c/member_admin_d_f.php';
	href += '?user_id=' + user_id + '&mode=3&comment_tmp=' + tmp;

	option = 'toolbar=no location=no scrollbars=yes resizable=yes width=680 height=780';

	window.open( href, '', option  );

}

function comment_submit_check( form, used_name )
{
    var max_length = 256;
    var comment = get_string_trim(form.comment.value);
    form.comment.value = comment;

    if(used_name == 'block')
    {
        form.comment_name.value = get_string_trim(form.comment_name.value);
        form.comment_passwd.value = get_string_trim(form.comment_passwd.value);

        if(form.comment_name.value == '') {
            alert('이름을 입력하세요');
            form.comment_name.focus();
            return false;
        }

        if(form.comment_passwd.value == '') {
            alert('비밀번호를 입력하세요');
            form.comment_passwd.focus();
            return false;
        }
    }
    
    /*
    if(comment == '')
    {
        alert('댓글 내용을 입력하세요');
        form.comment.focus();
        return false;
    }

    var comment_size = get_string_length(comment);

    if(comment_size > max_length)
    {
        alert('댓글은 ' + max_length + '자 이상 작성할 수 없습니다.');
        form.comment.value = comment.substr(0, max_length);
        form.comment.focus();
        return false;
    }
    */

    return true;
}

function get_string_trim( string )
{
    return string.replace(/(^\s*)|(\s*$)/g, "");
}

function get_string_length( string )
{
    var count = 0;

    var tmp_str = new String(string);
    var temp = tmp_str.length;

    var onechar;

    for ( k=0; k<temp; k++ )
    {
        onechar = tmp_str.charAt(k);

        if (escape(onechar).length > 4)
        {
            count += 2;
        }
        else
        {
            count += 1;
        }
    }

    return count;
}

function str_limit_check( obj )
{
	comment = obj.value;
	max_len = 256;

	content_length = get_string_length( comment );

	if( typeof( document.all['cbyte_span'] ) == "object" )
	{
		document.all['cbyte_span'].innerHTML = content_length;
	}

	if( content_length > max_len )
	{
		msg = '메시지는 ' + max_len + ' Byte 이하로 입력해주세요.';
		alert( msg );
		obj.value = comment.substr(0, max_len);

		if( typeof( document.all['cbyte_span'] ) == "object" )
		{
			document.all['cbyte_span'].innerHTML = max_len;
		}
	}

}


function board_copy( form )
{
    msg = "글 복사시 첨부파일 및 이미지는 원본글과 같이 사용하게 되므로 글삭제시 주의하시기 바랍니다. \r\r복사하시겠습니까?";

    if( !confirm( msg ) )
    {
         return false;
    }
    else
    {
        form.mode.value = 'copy_board';
        return true;
    }
}

