function fill_in_comment_example()
{
    var body = document.getElementById("commentbody");
    if (body)
    {
        var examplelines = [
            "Here's a [link to mr-edd.co.uk -> http://www.mr-edd.co.uk]. Code blocks look like this:",
            "",
            "{{{",
            "#include <iostream>",
            "int main()",
            "{",
            "    std::cout << \"Hello, world\\n\";",
            "    return 0;",
            "}",
            "}}}",
            "",
            "You can also write smaller code snippets {{{inline}}}."
        ];
        var example = examplelines.join("\n");
        body.appendChild(document.createTextNode(example));
    }
}

function add_comment_example_link()
{
    var hint = document.getElementById("commenthint");
    if (hint)
    {
        hintlink = document.createElement("a");
        hintlink.setAttribute("href", "javascript:fill_in_comment_example();");
        hintlink.appendChild(document.createTextNode("Fill in an example, below"));
        hint.appendChild(hintlink);
        hint.appendChild(document.createTextNode("."));
    }
}

window_onload = window.onload
window.onload = function() 
{ 
    if (window_onload) window_onload();
    add_comment_example_link(); 
};
