

var Comments = {
    formTemplate: null,
	sort: null,

	_replyOpen: false,

    openReply: function(id) {
		Comments.closeReply();
		
		var el = $$('.comment' + id + ' .comment-replies').first();
		var t = new Template(Comments.formTemplate);

		if(this.sort == 'DESC') {
			new Insertion.Top(el, t.evaluate({id: id}));
		}
		else {
			new Insertion.Bottom(el, t.evaluate({id: id}));
		}
		
		Form.focusFirstElement(document.commentreply);
		Comments._replyOpen = true;
	},

    closeReply: function() {
		if(Comments._replyOpen) {
			Element.remove(document.commentreply);
			Comments._replyOpen = false;
		}
	},

    onSubmit: function(form) {
		if(form.email) {
			form.email.value = 'pass_test1';
		}
	}

};
