﻿$(function () {
    $(".comments-toggle").click(function (e) {
        var cid = this.id.replace("comments-toggle", "comments-container");
        var pid = this.id.replace("comments-toggle", "comments-placeholder");
        $("#" + pid + ":visible").animate({ opacity: "hide", height: "hide" }, "fast");
        $("#" + cid + ":hidden").animate({ opacity: "show", height: "show" }, "fast");

        return false;
    });

    $(".comment.self textarea").keydown(function () {
        var lines = this.value.split('\n').length + 1;
        if (lines < 3) lines = 3;
        this.rows = lines;
    });

    var updateTime = function () {
        var dt = new Date();
        $(".comment .connected .date").text(dt.getDate() + "/" + (dt.getMonth() + 1) + "/" + dt.getFullYear());
        $(".comment .connected .time").text(dt.getHours() + ":" + dt.getMinutes());
    };
    updateTime();

    setInterval(updateTime, 1000);


});



