# -*-s2-*-

layerinfo type = "layout";
layerinfo name = "Notepad";
layerinfo redist_uniq = "notepad/layout";
layerinfo previews = "notepad/notepad.jpg";
layerinfo des = "A layout resembling a tabbed notebook.";

propgroup presentation {
  property string content_width {
    des = "Content area width";
    note = "Don't forget to include units; e.g. px, %";
  }
  property string content_alignment {
    des = "Alignment of the content area";
    values = "left|Left|center|Center|right|Right";
  }
  property string content_top_margin {
    des = "Margin size on the top of the content area";
    note = "You can use this to shift your journal contents down in order to display a background image at the top of your journal.  Don't forget to include units; e.g. px, %";
  }
  property string entryborder_size {
    des = "Size of borders around entries";
    note = "Don't forget to include the units, e.g. px";
  }
  property string entryborder_style {
    des = "Style of borders around entries";
    values = "solid|Solid|dashed|Dashed|dotted|Dotted|double|Double|hidden|Invisible";
  }
  property bool transparent {
    des = "Make journal content transparent instead of using given background colors";
  }
  property bool show_entry_userpic {
    des = "Display your userpic with your entries";
  }
  property bool show_website {
    des = "Show your defined website on your journal";
  }
  property use page_recent_items;
  property use page_friends_items;
  property use use_shared_pic;
  property use view_entry_disabled;
  property bool show_entrynav_icons {
    des = "Toggle to show the next, memory, edit, etc icons on the entry view page";
  }
  property use linklist_support;
  property string counter_code {
    des = "If you have an external web counter, you can enter the HTML for it here";
    note = "Your counter will above the header at the top of your journal.";
    maxlength = 2000;
    string_mode = "html-oneline";
  }
  property use external_stylesheet;
  property use custom_control_strip_colors;
}
set content_width = "70%";
set content_alignment = "left";
set content_top_margin = "0";
set entryborder_size = "";
set entryborder_style = "hidden";
set transparent = false;
set show_entry_userpic = false;
set show_website = false;
set view_entry_disabled = false;
set show_entrynav_icons = true;
set counter_code = "";

propgroup colors {
  property Color body_bgcolor {
    des = "Body background color";
  }
  property Color text_color {
    des = "Text color";
  }
  property Color subject_color {
    des = "Text color of subjects";
  }
  property Color link_color {
    des = "Link color";
  }
  property Color vlink_color {
    des = "Visited link color";
  }
  property Color alink_color {
    des = "Active link color";
  }
  property Color border_color {
    des = "Color of borders around entries";
    note = "If you don't set a border size and style in the \"Presentation\" section, this won't have any effect.";
  }
  property Color comment_bar_one_bgcolor {
      des = "Alternating background color for comment bars (one)";
  }
  property Color comment_bar_two_fgcolor {
      des = "Text color on alternating comment bars (one)";
  }
  property Color comment_bar_two_bgcolor {
      des = "Alternating background color for comment bars (two)";
  }
  property Color comment_bar_one_fgcolor {
      des = "Text color on alternating comment bars (two)";
  }
  property Color comment_bar_screened_bgcolor {
      des = "Background bar color for screened comments";
  }
  property Color comment_bar_screened_fgcolor {
      des = "Text color on background bar for screened comments";
  }
  property use control_strip_bgcolor;
  property use control_strip_fgcolor;
  property use control_strip_bordercolor;
  property use control_strip_linkcolor;
}
set body_bgcolor = "#8cd5fe";
set text_color = "#000000";
set subject_color = "#ff0000";
set link_color = "#000050";
set vlink_color = "#500050";
set alink_color = "#ff00c0";
set border_color = "#000000";
set comment_bar_one_bgcolor = "#c0c0ff";
set comment_bar_one_fgcolor = "#000000";
set comment_bar_two_bgcolor = "#eeeeff";
set comment_bar_two_fgcolor = "#000000";
set comment_bar_screened_bgcolor = "#dddddd";
set comment_bar_screened_fgcolor = "#000000";

propgroup images {
  property string page_background_image {
      des = "Background image URL";
  }
  property string page_background_repeat {
    des = "Background image repeat";
    values = "repeat|Repeat|no-repeat|Don't repeat|repeat-x|Repeat across only|repeat-y|Repeat down only";
  }
  property string page_background_position {
    des = "Background image position";
    note = "Does not apply if Background Image Repeat is set to 'Repeat'.";
    values = "top|Top|top left|Top-left|top right|Top-right|center|Center|center left|Center-left|center right|Center-right|bottom|Bottom|bottom left|Bottom-+left|bottom right|Bottom-right|left|Left|right|Right";
  }
  property string page_background_scrolling {
    des = "Background image scrolling";
    note = "Not supported in all browsers, but allows for the background image to be in a fixed position when scrolling.";
    values = "scroll|Scroll|fixed|Fixed";
  }
  property string img_btwn_comments {
    des = "URL to an image to be used between your comment links";
    note = "If you specify an image to use, it will replace any text between the comment links.";
  }
  property string imguri {
    noui = 1;
    des = "URI to notepad images (no trailing slash)";
  }
}
set page_background_image = "";
set page_background_repeat = "repeat";
set page_background_position = "center";
set page_background_scrolling = "scroll";
set img_btwn_comments = "";
set imguri = "";

propgroup text {
  property use text_post_comment;
  property use text_read_comments;
  property use text_post_comment_friends;
  property use text_read_comments_friends;
  property string text_left_comments {
        des = "Text to be used in front of your comment links";
  }
  property string text_btwn_comments {
        des = "Text to be used between your comment links";
        note = "If you specified an image to be used between your comments links in the \"Images\" section, then this option will not have any effect.";
  }
  property string text_right_comments {
        des = "Text to be used at the end of your comment links";
  }
  property string datetime_format {
        des = "Date and time format for entries";
  }
  property string datetime_comments_format {
        des = "Date and time format for comments";
  }
}
set text_left_comments = "";
set text_btwn_comments = " - ";
set text_right_comments = "";
set datetime_format = "%%mon%%. %%dayord%%, %%yyyy%% %%hh%%:%%min%% %%a%%m";
set datetime_comments_format = "%%month%% %%dayord%%, %%yyyy%% %%hh%%:%%min%% %%a%%m";

propgroup customcss {
  property use include_default_stylesheet;
  property use linked_stylesheet;
  property use custom_css;
}

function prop_init()
{
    if ($*imguri == "") { $*imguri = "$*SITEROOT/img/style/notepad"; }

    if ($*control_strip_bgcolor.as_string == "") {
        $*control_strip_bgcolor = "#fff8e8"; # A color in the background image
    }
    if ($*control_strip_fgcolor.as_string == "") {
        $*control_strip_fgcolor = $*text_color;
    }
    if ($*control_strip_bordercolor.as_string == "") {
        $*control_strip_bordercolor = $*border_color;
    }
    if ($*control_strip_linkcolor.as_string == "") {
        $*control_strip_linkcolor = $*link_color;
    }

    $*theme_bgcolor = "#fff8e8"; # A color in the background image
    $*theme_fgcolor = $*text_color;
    $*theme_bordercolor = $*border_color;
    $*theme_linkcolor = $*link_color;
}

function Page::lay_bottom_navigation() { }

function print_stylesheet ()
{
    if(clean_url($*page_background_image) != "") {
"""body {
    background-image: url("$*page_background_image");
    background-position: $*page_background_position;
    background-repeat: $*page_background_repeat;
    background-attachment: $*page_background_scrolling;
}""";
    }

    """body {
    background-color: $*body_bgcolor;
}
td,body,p,div {
    color: $*text_color;
    text-decoration: none;
    font-family: verdana,arial,helvetica;
    font-size: 12px;
}
a:link {
    color: $*link_color;
    text-decoration: underline;
    font-family: verdana,arial,helvetica;
    font-size: 12px;
}
a:visited {
    color: $*vlink_color;
    text-decoration: underline;
    font-family: verdana,arial,helvetica;
    font-size:12px;
}
a:active {
    color: $*alink_color;
    text-decoration: underline;
    font-family: verdana,arial,helvetica;
    font-size: 12px;
}
a:hover {
    color: $*alink_color;
    text-decoration: underline;
    font-family: verdana,arial,helvetica;
    font-size:12px;
}
.entry {
    border: $*entryborder_size $*entryborder_style $*border_color;
}
""";
if ($*transparent) {
"""
td {
    background: transparent !important;
}
""";
}

print_custom_control_strip_css();
}

function Page::print_linklist() {
    if (size $.linklist <= 0) {
        return;
    }

    var bool section_open = false;

    println "<span style='font-size: 115%'>";
    foreach var UserLink l ($.linklist) {
        if ($l.title) {
            if ($l.is_heading) {
                if ($section_open) {
                    println "<br />";
                }
                println """<span style="font-weight: bold;">$l.title:</span> """;
                $section_open = true;
            } else {
                println """<a href="$l.url">$l.title</a> | """;
                $section_open = true;
            }
        }
    }
    if ($section_open) {
        println "</span>";
    }
}

function Page::print()
{
    var string margin = "";
    var string margin2 = "";
    if ($*content_top_margin != "0") {
        $margin = """<table width="100%" height="100%" style="margin-top: $*content_top_margin;">""";
        $margin2 = """<table width="$*content_width" border="0" cellpadding="0" cellspacing="0" align="$*content_alignment" style="margin-top: $*content_top_margin;">""";
    }

    var string website_name = $.journal.website_name ? $.journal.website_name : $*text_website_default_name;
    var string website = ($*show_website and $.journal.website_url != "" ?
        """<td width="120" height="18" style="background-image: url($*imguri/tab.jpg)">&nbsp;&nbsp;
           <a href="$.journal.website_url">$website_name</a>
           </td>""" : "");

    var string title = $this->title();
    """<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">\n<html>\n<head>\n""";

    $this->print_head();
    $this->print_stylesheets();

    print safe """<title>$title</title>
 </head>
 <body>
 """;
 $this->print_control_strip();
 if (viewer_sees_vbox() or viewer_sees_hbox_top() or viewer_sees_hbox_bottom()) {
    if ($margin == "") {
        """<table width="100%" height="100%">""";
    } else {
        print safe $margin;
    }
 }
 if (viewer_sees_hbox_top()) {
    """<tr><td align="$*content_alignment">""";
    """<div style="width: 738px; margin-bottom: 5px;">""";
    $this->print_hbox_top();
    "</div></td>";
    if (viewer_sees_vbox()) { "<td>&nbsp;</td>"; }
    "</tr>";
 }
 if (viewer_sees_vbox() or viewer_sees_hbox_top() or viewer_sees_hbox_bottom()) {
    """<tr><td valign="top">""";
 }
 if (viewer_sees_vbox()) {
     print safe """<table width=\"$*content_width\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" align=\"$*content_alignment\">""";
 } else {
     if ($margin2 == "") {
         print safe """<table width=\"$*content_width\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\" align=\"$*content_alignment\">""";
     } else {
         print safe $margin2;
     }
 }
"""
   <tr>
    <td colspan="2">
     <table border="0" cellpadding="0" cellspacing="0">
      <tr>
       <td width="30"><img src="$*imguri/spacer.gif" width="30" height="10" alt='' /></td>
       <td width="120" height="18" style="background-image: url($*imguri/tab.jpg)">&nbsp;&nbsp;
         <a href="$.base_url/">Journal</a>
       </td>
       <td width="120" height="18" style="background-image: url($*imguri/tab.jpg)">&nbsp;&nbsp;
         <a href="$.base_url/friends">Friends</a>
       </td>
       <td width="120" height="18" style="background-image: url($*imguri/tab.jpg)">&nbsp;&nbsp;
         <a href="$.base_url/calendar">Archive</a>
       </td>
       <td width="120" height="18" style="background-image: url($*imguri/tab.jpg)">&nbsp;&nbsp;
         <a href="$.base_url/info">User Info</a>
       </td>
       <td width="120" height="18" style="background-image: url($*imguri/tab.jpg)">&nbsp;&nbsp;
         <a href="$*SITEROOT/tools/memories.bml?user=$.journal.username">Memories</a>
       </td>
       $website
      </tr>
     </table>
    </td>
   </tr>
   <tr>
    <td width="80" height="38" style="background-image: url($*imguri/top-left.jpg)">
      <img src="$*imguri/spacer.gif" width="80" height="10" alt='' />
    </td>
    <td height="38" style="background-image: url($*imguri/middle.jpg)">
      <img src="$*imguri/spacer.gif" width="10" height="10" alt='' />
    </td>
    <td width="10" height="38" style="background-image: url($*imguri/top-right.jpg)">
      <img src="$*imguri/spacer.gif" width="10" height="10" alt='' />
    </td>
   </tr>
   <tr>
    <td width="80" height="38" style="background-image: url($*imguri/side-left.jpg)">
     &nbsp;
    </td>
    <td width="100%" height="38" style="background-image: url($*imguri/middle.jpg)">
""";
if (size $.linklist > 0 and $*linklist_support) {
$this->print_linklist();
}
if ($*counter_code != "") {
    """$*counter_code""";
}
print safe """
     <h1>$title</h1>
     <p align="center"><img src="$*imguri/hr.gif" width="345" height="23" alt='' /></p>
    """;

    $this->print_body();

    "<p style='text-align: center; font-size: 115%'>"; $this->lay_bottom_navigation(); "</p>";
    """
    </td>
    <td width="8" height="38" style="background-image: url($*imguri/side-right.jpg)">
     &nbsp;
    </td>
   </tr>
   <tr>
    <td width="80" height="12" style="background-image: url($*imguri/bottom-left.jpg)">
      <img src="$*imguri/spacer.gif" width="70" height="12" alt='' />
    </td>
    <td height="12" style="background-image: url($*imguri/bottom-line.jpg)">
      <img src="$*imguri/spacer.gif" width="10" height="12" alt='' />
    </td>
    <td width="8" height="12" style="background-image: url($*imguri/bottom-right.jpg)">
      <img src="$*imguri/spacer.gif" width="8" height="12" alt='' />
    </td>
   </tr>
  </table>
  """;
  if (viewer_sees_vbox()) {
    "</td>";
    """<td valign="top" align="right" width="20%">""";
    """<div style="margin-right: 10px;">""";
    $this->print_vbox();
    "</div>";
  }
  if (viewer_sees_vbox() or viewer_sees_hbox_top() or viewer_sees_hbox_bottom()) {
    "</td></tr>";
  }
  if (viewer_sees_hbox_bottom()) {
    """<tr><td align="$*content_alignment">""";
    """<div style="width: 738px;">""";
    $this->print_hbox_bottom();
    "</div></td>";
    if (viewer_sees_vbox()) { "<td>&nbsp;</td>"; }
    "</tr>";
  }
  if (viewer_sees_vbox() or viewer_sees_hbox_top() or viewer_sees_hbox_bottom()) {
    "</table>";
  }
  """
 </body>
</html>
    """;
}

function print_entry (Page p, Entry e, Color bgcolor, Color fgcolor, bool hide_text)
{
    "<table border='0' class='entry'><tr>";

    if ($p.view == "friends" or
        $*show_entry_userpic == true or
        $e.journal.username != $e.poster.username)
    {
        var string userpic = defined $e.userpic ? "<img src='$e.userpic.url' /><br />" : "";
        "<td valign='top' width='100' align='center'>";
        if ($p.view == "friends" or $*show_entry_userpic == true) { print $userpic; }
        if ($p.view == "friends") { "<strong><a href='"; print $e.journal->base_url(); "/'>$e.journal.username</a></strong>"; }
        if ($e.journal.username != $e.poster.username)
        {
            print ($p.view == "friends" ?
            "<br />[ <a href='" + $e.poster->base_url() + "/'>$e.poster.username</a> ]" :
            "<strong><a href='" + $e.poster->base_url() + "/'>$e.poster.username</a></strong>");
        }
        "</td>";
    }
    """<td valign="top" width='100%'><font size="+1">"""; print $e.time->date_format($*datetime_format);
    if ($e.subject) { " <span style='color: $*subject_color'>$e.subject</span>"; }
    " $e.security_icon</font>";

    if (not $hide_text)
    {
        print "<p>";
        $e->print_text();
        print "</p>";
        if (size $e.metadata) {
            "<p>";
            foreach var string k ($e.metadata) {
                var string key = $k;
                var string val = $e.metadata{$k};
                if ($k == "mood") {
                    $key = $*text_meta_mood;
                } elseif ($k == "music") {
                    $key = $*text_meta_music;
                } elseif ($k == "location") {
                    $key = $*text_meta_location;
                }
                if ($k == "mood" and defined $e.mood_icon) {
                    var Image i = $e.mood_icon;
                    $val = "<img src='$i.url' width='$i.width' height='$i.height' align='absmiddle' alt='' /> $val";
                }
                "<strong>$key:</strong> $val<br />";
            }
            "</p>";
        }
    }
    $e.comments->print();
    if ($p.view == "entry" and $*show_entrynav_icons)
    {
        $e->print_linkbar();
    }
    """</td></tr><tr><td colspan="2"></td></tr></table>""";
    """<p align="center"><img src="$*imguri/hr.gif" width="345" height="23" alt='' /></p>""";
}

function Page::print_entry (Entry e)
{
    print_entry($this, $e, null Color, null Color, false);
}

function RecentPage::print_body ()
{
    foreach var Entry e ($.entries) {
        $this->print_entry($e);
        if ($e->viewer_sees_ebox()) {
            """<div align="center">""";
            $e->print_ebox();
            "</div>";
            """<p align="center"><img src="$*imguri/hr.gif" width="345" height="23" alt='' /></p>""";
        }
    }
}

function FriendsPage::print_entry (Entry e) {
    var Friend f = $.friends{$e.journal.username};
    print_entry($this, $e, $f.bgcolor, $f.fgcolor, false);
}

function RecentPage::lay_bottom_navigation ()
{
    var string nav = "";
    if ($.nav.backward_url != "") {
        $nav = """<a href="$.nav.backward_url">Back a Page</a>""";
    }
    if ($.nav.forward_url != "" and $.nav.backward_url != "") {
        $nav = "$nav - ";
    }
    if ($.nav.forward_url != "") {
        $nav = """$nav<a href="$.nav.forward_url">Forward a Page</a>""";
    }
    if ($nav != "") { print $nav; }
}

function CommentInfo::print() {
    if ($.show_readlink or $.show_postlink) {
        print safe "$*text_left_comments";
        if ($.show_readlink) {
            $this->print_readlink();
        }
        if ($.show_postlink and $.show_readlink) {
            if (clean_url($*img_btwn_comments) != "") {
                """ <img src="$*img_btwn_comments" alt="" /> """;
            } else {
                print safe "$*text_btwn_comments";
            }
        }
        if ($.show_postlink) {
            $this->print_postlink();
        }
        print safe "$*text_right_comments";
    }
}

function YearPage::lay_bottom_navigation ()
{
    $this->print_year_links();
}

function YearPage::print_year_links ()
{
    if (size $.years <= 0) { return; }
    foreach var YearYear y ($.years)
    {
        if ($y.displayed) {
            "$y.year&nbsp;";
        } else {
            "<a href='$y.url'>$y.year</a>&nbsp;";
        }
    }
}

function YearPage::print_body ()
{
    "<h2>$.year</h2>";
    foreach var YearMonth m ($.months)
    {
        $this->print_month($m);
    }
}

function YearPage::print_month(YearMonth m)
{
    if (not $m.has_entries) { return; }
    "<p align='center'><table border='1' cellpadding='4' width='80%'>";

    # Month Header
    "<tr align=center><th colspan='7'>"; print $m->month_format(); "</th></tr>";

    # Weekdays
    "<tr align='center'>";
    foreach var int d (weekdays())
    {
        "<td>" + $*lang_dayname_short[$d] + "</td>\n";
    }
    "</tr>";

    # Weeks
    foreach var YearWeek w ($m.weeks)
    {
        $w->print();
    }
    "<tr align='center'><td colspan='7'>";
    "<a href='$m.url'>$*text_view_month</a>";
    "</td></tr></table></p>";
}

function YearWeek::print()
{
    "<tr>";
    if ($.pre_empty) { "<td colspan='$.pre_empty'>&nbsp;</td>"; }
    foreach var YearDay d ($.days)
    {
        "<td valign='top'><b><font size='-1'>$d.day</font></b><div align='center'>";
        if ($d.num_entries)
        {
            "<a href='$d.url'>$d.num_entries</a>";
        } else {
            "&nbsp;";
        }
        "</div></td>";
    }
    if ($.post_empty) { "<td colspan='$.post_empty'>&nbsp;</td>"; }
}

function DayPage::lay_bottom_navigation()
{
    if (not $.has_entries) { "<img src='$*imguri/hr.gif' alt='' /><br />"; }
    print "<a href='$.prev_url'>Back a Day</a> - <a href='$.next_url'>Forward a Day</a>";
}

function DayPage::print_body()
{
    if (not $.has_entries) {
        "<p>No journal entries for this day.</p>";
    } else {
        foreach var Entry e ($.entries) {
            $this->print_entry($e);
            if ($e->viewer_sees_ebox()) {
                """<div align="center">""";
                $e->print_ebox();
                "</div>";
                """<p align="center"><img src="$*imguri/hr.gif" width="345" height="23" alt='' /></p>""";
            }
        }
    }
}

function EntryPage::print_body ()
{
        set_handler("unscreen_comment_#", [
                                           [ "style_bgcolor", "cmtbar#", "$*comment_bar_one_bgcolor", ],
                                           [ "style_color", "cmtbar#", "$*comment_bar_one_fgcolor", ],
                                           ]);
        set_handler("screen_comment_#", [
                                         [ "style_bgcolor", "cmtbar#", "$*comment_bar_screened_bgcolor", ],
                                         [ "style_color", "cmtbar#", "$*comment_bar_screened_fgcolor", ],
                                         ]);


    print_entry($this, $.entry, null Color, null Color, $.viewing_thread);
    if ($.entry.comments.enabled and $.comment_pages.total_subitems > 0)
    {
        $this->print_multiform_start();
        print "<h2>Comments:</h2>";
        if ($.comment_pages.total_subitems > 0) {
            $.comment_pages->print();
            $this->print_comments($.comments);
        }
        if ($this.multiform_on) {
            "<h2>Mass Action:</h2>";
             $this->print_multiform_actionline();
             $this->print_multiform_end();
        }
    }
}

function EntryPage::print_comment (Comment c) {
    var Color barlight = $*color_comment_bar->clone();
    $barlight->lightness(($barlight->lightness() + 255) / 2);
    var Color barc = $c.depth % 2 ? $*color_comment_bar : $barlight;
    if ($c.screened) {
        $barc = $*comment_bar_screened_bgcolor;
    }
    var string poster = defined $c.poster ? $c.poster->as_string() : "<i>(Anonymous)</i>";

    "<a name='$c.anchor'></a><div id='cmtbar$c.talkid' style='background-color: $barc; margin-top: 10px; width: 100%'>";
    "<table cellpadding='2' cellspacing='0' summary='0' style='width: 100%'><tr valign='top'>";
    if (defined $c.userpic and $*comment_userpic_style != "off") {
        var int w = $c.userpic.width;
        var int h = $c.userpic.height;
        # WARNING: this will later be done by the system (it'll be a
        # constructional property), so don't copy this hack into your
        # layout layers or you'll be messed up later.
        if ($*comment_userpic_style == "small") {
            $w = $w / 2;
            $h = $h / 2;
        }
        print "<td style='width: 102px'><img src='$c.userpic.url' width='$w' height='$h' alt='' /></td>";
    }
    "<td><table style='width: 100%'><tr>";

    "<td align='left' style='width: 50%'>";
      print "<table>";
      print "<tr><th align='right'>$*text_comment_from</th><td>$poster</td></tr>\n";
      print "<tr><th align='right'>$*text_comment_date</th><td style='white-space: nowrap'>";
        print $c->time_display($*datetime_comments_format, "none") + "</td></tr>";
      if ($c.metadata{"poster_ip"}) { print "<tr><th align='right'>$*text_comment_ipaddr</th><td>(" + $c.metadata{"poster_ip"} + ")</td></tr>"; }
    "</table></td>";

    print "<td align='right' style='width: 50%'>";
    if ($this.multiform_on) {
        " <label for='ljcomsel_$c.talkid'>$*text_multiform_check</label> ";
        $c->print_multiform_check();
    }
    $c->print_linkbar();
    "</td></tr>";

    print "<tr valign='top'><td style='width: 50%'>";
    if (defined $c.subject_icon or $c.subject != "") { "<h3>$c.subject_icon $c.subject</h3>\n"; }
    print "</td>";

    print "<td style='width:50%;' align='right'><strong>(<a href='$c.permalink_url'>$*text_permalink</a>)</strong></td></tr>\n";
    print "</table></td></tr></table></div>";

    print "<div style='margin-left: 5px'>"; $c->print_text(); "</div>\n";
    print "<div style='margin-top: 3px; font-size: smaller'>";
    if ($c.frozen) {
        print "($*text_comment_frozen) ";
    } else {
        print "(<a href='$c.reply_url'>$*text_comment_reply</a>) ";
    }
    if ($c.parent_url != "") { "(<a href='$c.parent_url'>$*text_comment_parent</a>) "; }
    if ($c.thread_url != "") { "(<a href='$c.thread_url'>$*text_comment_thread</a>) "; }
    "</div>\n";
}

function ReplyPage::print_body ()
{
    if (not $.entry.comments.enabled)
    {
        print "<h2>$*text_reply_nocomments_header</h2><p>$*text_reply_nocomments</p>";
        return;
    }
    "<table border='0'><tr>";
    "<td valign='top' width='100' align='center'>";
    print defined $.replyto.userpic ? "<img src='$.replyto.userpic.url' alt='' /><br />" : "";
    print defined $.replyto.poster ? $.replyto.poster->as_string() : "<i>(Anonymous)</i>";
    "</td>";

    """<td valign="top"><font size="+1">"""; print $.replyto.time->date_format($*datetime_format);
    if ($.replyto.subject) { " <span style='color: $*subject_color'>$.replyto.subject</span>"; }
    "</font>";
    "<p>"; $.replyto->print_text(); "</p>";


    "<a href='$.entry.comments.read_url'>Read Comments</a>";
    """</td></tr>""";
    """<tr><td colspan="2"><p align="center"><img src="$*imguri/hr.gif" width="345" height="23" alt='' /></p>""";
    "</td></tr></table>\n";
    print "<h2>Reply</h2>";
    $.form->print();
}

function print_theme_preview ()
{
    """
<div style="color: $*text_color; background-color: $*body_bgcolor">
  <table width="70%" border="0" cellpadding="0" cellspacing="0">
   <tr>
    <td colspan="2">
     <table border="0" cellpadding="0" cellspacing="0">
      <tr>
       <td width="30"><img src="$*imguri/spacer.gif" width="30" height="10" alt='' /></td>
       <td width="120" height="18" style="background-image: url($*imguri/tab.jpg)">&nbsp;&nbsp;
         <a href="#" style="color: $*link_color">Tab</a>
       </td>
       <td width="120" height="18" style="background-image: url($*imguri/tab.jpg)">&nbsp;&nbsp;
         <a href="#" style="color: $*link_color">Tab</a>
       </td>
       <td width="120" height="18" style="background-image: url($*imguri/tab.jpg)">&nbsp;&nbsp;
         <a href="#" style="color: $*link_color">Tab</a>
       </td>
       <td width="120" height="18" style="background-image: url($*imguri/tab.jpg)">&nbsp;&nbsp;
         <a href="#" style="color: $*link_color">Tab</a>
       </td>
       <td width="120" height="18" style="background-image: url($*imguri/tab.jpg)">&nbsp;&nbsp;
         <a href="#" style="color: $*link_color">Tab</a>
       </td>
      </tr>
     </table>
    </td>
   </tr>
   <tr>
    <td width="80" height="38" style="background-image: url($*imguri/top-left.jpg)">
      <img src="$*imguri/spacer.gif" width="80" height="10" />
    </td>
    <td height="38" style="background-image: url($*imguri/middle.jpg)">
      <img src="$*imguri/spacer.gif" width="10" height="10" />
    </td>
    <td width="10" height="38" style="background-image: url($*imguri/top-right.jpg)">
      <img src="$*imguri/spacer.gif" width="10" height="10" />
    </td>
   </tr>
   <tr>
    <td width="80" height="38" style="background-image: url($*imguri/side-left.jpg)">
     &nbsp;
    </td>
    <td width="100%" height="38" style="background-image: url($*imguri/middle.jpg)">
     <h1>John Doe</h1>
     <p align="center"><img src="$*imguri/hr.gif" width="345" height="23"></p>
    <p align='center'>
      <table border='0'><tr><td valign="top">
        <h1>Dec. 16th, 2002 06:39 pm <span style='color: $*subject_color'>Neque porro quisquam est qui dolorem ipsum quia dolor sit amet&hellip;</span></h1>
        <p>
Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit
Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit
Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit
Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit
Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit
Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit
        </p>
        <p><a href="#" style="color: $*vlink_color; font-weight: bold">2 Comments</a> | <a href="#" style="color: $*link_color">Leave a comment</a></p></td></tr>
        <tr><td colspan="2"><p align="center"><img src="$*imguri/hr.gif" width="345" height="23"></p></td></tr>
      </table>
    </p>
    </td>
    <td width="8" height="38" style="background-image: url($*imguri/side-right.jpg)">
     &nbsp;
    </td>
   </tr>
   <tr>
    <td width="80" height="12" style="background-image: url($*imguri/bottom-left.jpg)">
     <img src="$*imguri/spacer.gif" width="70" height="12" alt='' />
    </td>
    <td height="12" style="background-image: url($*imguri/bottom-line.jpg)">
      <img src="$*imguri/spacer.gif" width="10" height="12" alt='' />
    </td>
    <td width="8" height="12" style="background-image: url($*imguri/bottom-right.jpg)">
      <img src="$*imguri/spacer.gif" width="8" height="12" alt='' />
    </td>
   </tr>
  </table>
</div>
    """;
}