// HTML &#47196; &#45336;&#50612;&#50728; <img ... > &#53468;&#44536;&#51032; &#54253;&#51060; &#53580;&#51060;&#48660;&#54253;&#48372;&#45796; &#53356;&#45796;&#47732; &#53580;&#51060;&#48660;&#54253;&#51012; &#51201;&#50857;&#54620;&#45796;.
function resizeBoardImage(imageWidth, borderColor) {
    /*
    var content = document.getElementById("writeContents");
    if (content) {
        var target = content.getElementsByTagName("img");
        if (target) {
            var imageHeight = 0;

            for(i=0; i<target.length; i++) { 
                // &#50896;&#47000; &#49324;&#51060;&#51592;&#47484; &#51200;&#51109;&#54644; &#45459;&#45716;&#45796;
                target[i].tmpWidth  = target[i].width;
                target[i].tmpHeight = target[i].height;

                //alert(target[i].width);

                // &#51060;&#48120;&#51648; &#54253;&#51060; &#53580;&#51060;&#48660; &#54253;&#48372;&#45796; &#53356;&#45796;&#47732; &#53580;&#51060;&#48660;&#54253;&#50640; &#47582;&#52632;&#45796;
                if(target[i].width > imageWidth) {
                    imageHeight = parseFloat(target[i].width / target[i].height)
                    target[i].width = imageWidth;
                    target[i].height = parseInt(imageWidth / imageHeight);

                    // &#49828;&#53440;&#51068;&#50640; &#51201;&#50857;&#46108; &#51060;&#48120;&#51648;&#51032; &#54253;&#44284; &#45458;&#51060;&#47484; &#49325;&#51228;&#54620;&#45796;
                    target[i].style.width = '';
                    target[i].style.height = '';
                }

                if (borderColor) {
                    target[i].style.borderWidth = '1px';
                    target[i].style.borderStyle = 'solid';
                    target[i].style.borderColor = borderColor;
                }
            }
        }
    }
    */

    var target = document.getElementsByName('target_resize_image[]');
    var imageHeight = 0;

    if (target) {
        for(i=0; i<target.length; i++) { 
            // &#50896;&#47000; &#49324;&#51060;&#51592;&#47484; &#51200;&#51109;&#54644; &#45459;&#45716;&#45796;
            target[i].tmp_width  = target[i].width;
            target[i].tmp_height = target[i].height;
            // &#51060;&#48120;&#51648; &#54253;&#51060; &#53580;&#51060;&#48660; &#54253;&#48372;&#45796; &#53356;&#45796;&#47732; &#53580;&#51060;&#48660;&#54253;&#50640; &#47582;&#52632;&#45796;
            if(target[i].width > imageWidth) {
                imageHeight = parseFloat(target[i].width / target[i].height)
                target[i].width = imageWidth;
                target[i].height = parseInt(imageWidth / imageHeight);
                target[i].style.cursor = 'pointer';

                // &#49828;&#53440;&#51068;&#50640; &#51201;&#50857;&#46108; &#51060;&#48120;&#51648;&#51032; &#54253;&#44284; &#45458;&#51060;&#47484; &#49325;&#51228;&#54620;&#45796;
                target[i].style.width = '';
                target[i].style.height = '';
            }

            if (borderColor) {
                target[i].style.borderWidth = '1px';
                target[i].style.borderStyle = 'solid';
                target[i].style.borderColor = borderColor;
            }
        }
    }
}

function getFontSize() {
    var fontSize = parseInt(get_cookie("ck_fontsize")); // &#54256;&#53944;&#53356;&#44592; &#51312;&#51208;
    if (isNaN(fontSize)) { fontSize = 12; }
    return fontSize;
}

function scaleFont(val) {
    var fontSize = getFontSize();
    var fontSizeSave = fontSize;
    if (val > 0) {
        if (fontSize <= 18) {
            fontSize = fontSize + val; 
        }
    } else {
        if (fontSize > 12) {
            fontSize = fontSize + val; 
        }
    }
    if (fontSize != fontSizeSave) {
        drawFont(fontSize);
    }
    set_cookie("ck_fontsize", fontSize, 30, g4_cookie_domain); 
}

function drawFont(fontSize) {
    if (!fontSize) {
        fontSize = getFontSize();
    }

    var subject=document.getElementById("writeSubject"); 
    var content=document.getElementById("writeContents"); 
    var comment=document.getElementById("commentContents");
    var wr_subject=document.getElementById("wr_subject");
    var wr_content=document.getElementById("wr_content");

    if (comment) {
        var commentDiv = comment.getElementsByTagName("div");
        var lineHeight = fontSize+Math.round(1.1*fontSize); 
    }

    fontSize = fontSize + "px";

    if (subject)
        subject.style.fontSize=fontSize;
    if (content)
        content.style.fontSize=fontSize; 
    if (wr_subject)
        wr_subject.style.fontSize=fontSize; 
    if (wr_content)
        wr_content.style.fontSize=fontSize; 
    if (commentDiv) {
        for (i=0;i<commentDiv.length;i++) {
            commentDiv[i].style.fontSize=fontSize;
        }
    }
}
