/*global-block-begin*/


function tagSearchFoundIn(args, nestedHtmlGetter) {
    var artifact = args.artifact,
        relationPath = artifact.getRelationPath(),
        foundInHtml = null,
        foundOnHtml = null;
    
    if (relationPath != null) {
        var segments = relationPath.getSegments();
        if (segments.length > 1) {
            foundInHtml = getHtmlBreadCrumbingSegments(relationPath, true, true);
        }
        if (relationPath.urlPrefix) {
            foundOnHtml = barrique.base.getHtmlExternalLink(relationPath.urlPrefix, relationPath.serverName);
        } else if (relationPath.serverName) {
            foundOnHtml = relationPath.serverName;
        }
    }
    return getHtmlSearchFoundIn(artifact, foundInHtml, foundOnHtml);
}


/*global-block-end*/
/*function-begin (getHeadHtml2u) */
function getHeadHtml2u() {
    var html = '';
    html += '\n\n\n\n\n';
    return html;
}
/*function-end (getHeadHtml2u) */
/*function-begin (getBodyHtml2u) */
function getBodyHtml2u() {
    var html = '';
    html += '\n\n';
    html += '\n\n';
    html += '\n\n\n\n';
    return html;
}
/*function-end (getBodyHtml2u) */
/*function-begin (getHtmlSearchHitDefault) */
function getHtmlSearchHitDefault(artifact, className, context) {
    var html = '';
    html += '\n    ';
    if (context != null && typeof(context.getHtmlSearchHitBegin) != 'undefined') { 
    html += '\n        ';
    var scriptlet = context.getHtmlSearchHitBegin(artifact); if (scriptlet != null) html += scriptlet;
    html += '\n    ';
    }
    html += '\n    \n    \<div class=\"search-hit-artifact-class\" title=\"';
    scriptlet = context ; if (scriptlet != null) html += scriptlet;
    html += '\"\>\n        ';
    scriptlet = className != null ? className : artifact.getClassName(); if (scriptlet != null) html += scriptlet;
    html += '\n    \<\/div\>\n    \n    ';
    if (typeof(artifact.getTitle) != 'undefined') { 
    html += '\n        \<div class=\"search-hit-title\"\>\n            ';
    var tagargs0 = new Object();
    tagargs0['artifact'] = artifact;
    html += tagContextMenu(tagargs0, function() {
    var html = '';
    var tagargs1 = new Object();
    tagargs1['href'] = artifact.getHref();
    html += tagHref(tagargs1, function() {
    var html = '';
    html += '\<b\>';
    var scriptlet = artifact.getTitle(); if (scriptlet != null) html += scriptlet;
    html += '\<\/b\>';
    return html;
}
    );
    return html;
}
    );
    html += '\n        \<\/div\>\n    ';
    }
    html += '\n    \n    ';
    if (typeof(artifact.getDescription) != 'undefined') { 
    html += '\n        \<div class=\"search-hit-description\"\>';
    scriptlet = artifact.getDescription(); if (scriptlet != null) html += scriptlet;
    html += '\<\/div\>\n    ';
    }
    html += '\n    \n    ';
    var tagargs2 = new Object();
    tagargs2['artifact'] = artifact;
    html += tagSearchFoundIn(tagargs2, function() {
    var html = '';
    return html;
}
    );
    html += '\n    \n    ';
    if (context != null && typeof(context.getHtmlSearchHitEnd) != 'undefined') { 
    html += '\n        ';
    scriptlet = context.getHtmlSearchHitEnd(artifact); if (scriptlet != null) html += scriptlet;
    html += '\n    ';
    }
    html += '\n';
    return html;
}
/*function-end (getHtmlSearchHitDefault) */
/*function-begin (getHtmlSearchFoundIn) */
function getHtmlSearchFoundIn(artifact, foundInHtml, foundOnHtml) {
    var html = '';
    html += '\n    ';
    if (barrique.date.getDefaultDate(artifact)) { 
    html += '\n        ';
    var dateDiff = barrique.date.getDateDiff(barrique.date.getDefaultDate(artifact));
    html += '\n        \<div class=\"search-hit-relations\"\>\n            \<span class=\"relation-type\"\>Published:\<\/span\>\n            \<ul title=\"';
    var scriptlet = barrique.date.toString(barrique.date.getDefaultDate(artifact)); if (scriptlet != null) html += scriptlet;
    html += '\"\>\<a href=\"';
    scriptlet = barrique.contextPath; if (scriptlet != null) html += scriptlet;
    html += '\/sx\/search\/Search?query=PublishedDate:&quot;';
    scriptlet = encodeURIComponent(dateDiff); if (scriptlet != null) html += scriptlet;
    html += '&quot;\"\>';
    scriptlet = dateDiff; if (scriptlet != null) html += scriptlet;
    html += '\<\/a\>\<\/ul\> \n        \<\/div\>\n    ';
    }
    html += '\n    ';
    if (artifact.getAuthorName()) { 
    html += '\n        ';
    var authorName = artifact.getAuthorName();
    html += '\n        \<div class=\"search-hit-relations\"\>\n            \<span class=\"relation-type\"\>Author:\<\/span\>\n            \<ul\>\<a href=\"';
    scriptlet = barrique.contextPath; if (scriptlet != null) html += scriptlet;
    html += '\/sx\/search\/Search?query=Author:&quot;';
    scriptlet = encodeURIComponent(authorName); if (scriptlet != null) html += scriptlet;
    html += '&quot;\"\>';
    scriptlet = authorName; if (scriptlet != null) html += scriptlet;
    html += '\<\/a\>\<\/ul\>\n        \<\/div\>\n    ';
    }
    html += '\n    ';
    if (foundInHtml != null && foundInHtml.length > 0) { 
    html += '\n        \<div class=\"search-hit-relations \"\>\n            \<span class=\"relation-type\"\>Found In:\<\/span\>\n            \<ul\>';
    scriptlet = foundInHtml; if (scriptlet != null) html += scriptlet;
    html += '\<\/ul\>\n        \<\/div\>\n    ';
    }
    html += '\n    ';
    if (foundOnHtml != null && foundOnHtml.length > 0) { 
    html += '\n        \<div class=\"search-hit-relations \"\>\n            \<span class=\"relation-type\"\>Found On:\<\/span\>\n            \<ul\>';
    scriptlet = foundOnHtml; if (scriptlet != null) html += scriptlet;
    html += '\<\/ul\>\n        \<\/div\>\n    ';
    }
    html += '\n';
    return html;
}
/*function-end (getHtmlSearchFoundIn) */
/*global-block-begin*/


if(typeof(barrique.module.tag.TagInstanceAspect)=='undefined'){barrique.module.tag.TagInstanceAspect={};}

barrique.module.tag.TagInstanceAspect.getHtmlSearchHit = function(context) { 
    return getHtmlTagInstanceAspectSearchHit(this, context); 
}
barrique.module.tag.TagInstanceAspect.isinstanceof = function(artifact) {
    return typeof(artifact.getTags) != 'undefined';
}


/*global-block-end*/
/*function-begin (getHeadHtml17) */
function getHeadHtml17() {
    var html = '';
    html += '\n\n\n\n';
    return html;
}
/*function-end (getHeadHtml17) */
/*function-begin (getBodyHtml17) */
function getBodyHtml17() {
    var html = '';
    html += '\n\n';
    html += '\n\n';
    return html;
}
/*function-end (getBodyHtml17) */
/*function-begin (getHtmlTagInstanceAspectSearchHit) */
function getHtmlTagInstanceAspectSearchHit(tagInstanceAspect, context) {
    var html = '';
    html += '\n    ';
    if (tagInstanceAspect.getTags().length != 0) { 
    html += '\n        \<div class=\"search-hit-relations\"\>\n            \<span class=\"relation-type\"\>Tags: \<\/span\>\n            \<ul\>\n            ';
    var list0 = barrique.array.map(tagInstanceAspect.getTags(), barrique.base.targetFunctor);
    var len0 = list0.length;
    for (var i0 = 0; i0 < len0; i0++) {
        var target = list0[i0];
    html += '\n                ';
    if (target != null && typeof(target.getTitle) != 'undefined') { 
    html += '\n                    \<li\>';
    var tagargs1 = new Object();
    tagargs1['href'] = target.getHref();
    html += tagHref(tagargs1, function() {
    var html = '';
    html += '';
    var scriptlet = target.getTitle(); if (scriptlet != null) html += scriptlet;
    html += '';
    return html;
}
    );
    html += '\<\/li\>\n                ';
    }
    html += '\n            ';
    }
    html += '\n            \<\/ul\>\n        \<\/div\>\n    ';
    }
    html += '\n';
    return html;
}
/*function-end (getHtmlTagInstanceAspectSearchHit) */
/*global-block-begin*/


barrique.module.docs.Document.prototype.isCompleteSearchHit = function() {
    return this.getParents() != null && this.getParents().length > 0 &&
           this.getParents()[0].getSource() != null;
}
barrique.module.docs.MultiPartDocument.prototype.getHtmlSearchHit = function(context) { return getHtmlMultiPartDocumentRecentlyModified(this, context); }
barrique.module.docs.MultiPartDocument.prototype.getHtmlRecentlyModified = function(context) { return getHtmlMultiPartDocumentRecentlyModified(this, context); }

barrique.module.docs.DocumentCategory.prototype.getHtmlSearchHit = function(context) { return getHtmlSearchHitDefault(this, 'Document Category', context); }

barrique.module.docs.photo.Photo.prototype.getHtmlSearchHit = function(context) { return getHtmlPhotoSearchHit(this, context); }
barrique.module.docs.video.Video.prototype.getHtmlSearchHit = function(context) { return getHtmlPhotoSearchHit(this, context); }
barrique.module.docs.photo.Photo.prototype.getHtmlRecentlyModified = function(context) { return getHtmlPhotoRecentlyModified(this, context); }
barrique.module.docs.video.Video.prototype.getHtmlRecentlyModified = function(context) { return getHtmlPhotoRecentlyModified(this, context); }

barrique.module.docs.photo.Photo.prototype.getBoundingBox = function(size, margin) {
    var photoWidth = this.getWidth(),
        photoHeight = this.getHeight(),
        marginVertical = margin,
        marginHorizontal = margin;
    var ratio = photoWidth / photoHeight;
    if (photoWidth > photoHeight) {
        photoWidth = size;
        photoHeight = Math.round(photoWidth / ratio);
        marginVertical += Math.round((size-photoHeight)/2);
    } else {
        photoHeight = size;
        photoWidth = Math.round(photoHeight * ratio);
        marginHorizontal += Math.round((size-photoWidth)/2);
    }
    return {width:photoWidth, height:photoHeight, marginHorizontal:marginHorizontal, marginVertical:marginVertical};
}


/*global-block-end*/
/*function-begin (getHeadHtml1n) */
function getHeadHtml1n() {
    var html = '';
    html += '\n\n\n\n\n';
    return html;
}
/*function-end (getHeadHtml1n) */
/*function-begin (getBodyHtml1n) */
function getBodyHtml1n() {
    var html = '';
    html += ' \n\n';
    html += '\n\n';
    html += '\n\n';
    html += '\n\n\n';
    return html;
}
/*function-end (getBodyHtml1n) */
/*function-begin (getHtmlMultiPartDocumentRecentlyModified) */
function getHtmlMultiPartDocumentRecentlyModified(doc, context) {
    var html = '';
    html += '\n    \<div class=\"';
    var scriptlet = !context || !context.isDocumentTeaser ? 'recently-modified-entry-div' : ''; if (scriptlet != null) html += scriptlet;
    html += '\"\>\n    \n    ';
    if (context == null || typeof(context.isDocumentTeaser) == 'undefined') { 
    html += ' \n        \<div class=\"search-hit-artifact-class\"\>Document\<\/div\>\n        \<div class=\"search-hit-title\"\>\n            ';
    var tagargs0 = new Object();
    tagargs0['artifact'] = doc;
    html += tagContextMenu(tagargs0, function() {
    var html = '';
    var tagargs1 = new Object();
    tagargs1['href'] = doc.getHref();
    html += tagHref(tagargs1, function() {
    var html = '';
    html += '';
    var scriptlet = doc.getTitle(); if (scriptlet != null) html += scriptlet;
    html += '';
    return html;
}
    );
    return html;
}
    );
    html += '\n            ';
    if (doc.getPublishedDate() == null) { 
    html += '\<i\> - Draft\<\/i\>';
    }
    html += '\n        \<\/div\>\n    ';
    }
    html += '\n    \n    \<div class=\"search-hit-description\"\>';
    scriptlet = doc.getDescription(); if (scriptlet != null) html += scriptlet;
    html += '\<\/div\>\n\n    ';

        var hasMoreHtml = '<br/>', 
            paragraphCount = 0;
        if (doc.getPrunedPartCount() > 0) {
            hasMoreHtml = '<a href="'+doc.getHref()+'">[more]</a><br/>';
        }
        html += '\n    \n    ';
    var list2 = doc.getParts();
    var len2 = list2.length;
    for (var i2 = 0; i2 < len2; i2++) {
        var hasPart = list2[i2];
    html += '\n        ';
    if (barrique.isinstanceof(hasPart.getTarget(), 'barrique.module.docs.text.Paragraph')) { 
    html += '\n            ';
    if (hasPart.getTarget().getContent() != null && typeof(hasPart.getTarget().getContent().getValue) != 'undefined') { 
    html += '\n                ';
paragraphCount++;    html += '\n                \<span class=\"docs-paragraph-text\"\>';
    scriptlet = hasPart.getTarget().getContentValue(); if (scriptlet != null) html += scriptlet;
    html += '\<\/span\>\n            ';
    }
    html += '\n        ';
    }
    html += ' \n    ';
    }
    html += '\n    \n    ';
    var list3 = doc.getParts();
    var len3 = list3.length;
    for (var i3 = 0; i3 < len3; i3++) {
        var hasPart = list3[i3];
    html += '\n        ';
    if (barrique.isinstanceof(hasPart.getTarget(), 'barrique.module.docs.photo.Photo') || barrique.isinstanceof(hasPart.getTarget(), 'barrique.module.docs.video.Video')) { 
    html += '\n            ';
    if (paragraphCount != 0) { 
    html += '\<br\>';
paragraphCount = 0;    }
    html += '\n            ';
    var tagargs4 = new Object();
    tagargs4['href'] = hasPart.getTarget().getHref();
    html += tagHref(tagargs4, function() {
    var html = '';
    html += '\<img src=\"';
    var scriptlet = hasPart.getTarget().getContentHref('iconImage'); if (scriptlet != null) html += scriptlet;
    html += '\" class=\"docs-photo-preview\" title=\"';
    scriptlet = hasPart.getTarget().getDescription(); if (scriptlet != null) html += scriptlet;
    html += '\"\>';
    return html;
}
    );
    html += '\n        ';
    }
    html += '\n    ';
    }
    html += '\n    \n    ';
    scriptlet = hasMoreHtml; if (scriptlet != null) html += scriptlet;
    html += '\n    \n    ';
    scriptlet = getHtmlAttachmentAspectSearchHit(doc); if (scriptlet != null) html += scriptlet;
    html += '\n\n    ';

        var commentCount = 0;
        if (doc.getComments().length > 0 && doc.getComments()[0].getTarget() != null) {
            commentCount = doc.getComments()[0].getTarget().getCommentCount();
        }
        html += '\n    ';
    if (commentCount != 0) { 
    html += '\n        \<div class=\"search-hit-relations \"\>\n            \<span class=\"relation-type\"\>Comments:\<\/span\>\n            \<ul\>';
    var tagargs5 = new Object();
    tagargs5['href'] = doc.getHref()+'#comments';
    html += tagHref(tagargs5, function() {
    var html = '';
    html += '';
    var scriptlet = commentCount; if (scriptlet != null) html += scriptlet;
    html += '';
    return html;
}
    );
    html += '\<\/ul\>\n        \<\/div\>\n    ';
    }
    html += '\n    \n    ';
    var tagargs6 = new Object();
    tagargs6['artifact'] = doc;
    html += tagSearchFoundIn(tagargs6, function() {
    var html = '';
    return html;
}
    );
    html += '\n    \n    ';
    scriptlet = barrique.module.tag.TagInstanceAspect.getHtmlSearchHit.apply(doc, [context]); if (scriptlet != null) html += scriptlet;
    html += '\n    \n    \<br\>\n    \<\/div\>\n';
    return html;
}
/*function-end (getHtmlMultiPartDocumentRecentlyModified) */
/*function-begin (getHtmlPhotoRecentlyModified) */
function getHtmlPhotoRecentlyModified(photo, context) {
    var html = '';
    html += '\n    ';
var box = photo.getBoundingBox(160, 10);    html += '\n    \<p class=\"docs-view-photo\"\>\n        \<span class=\"docs-view-photo-span\"\>\n            \<span style=\"padding:';
    var scriptlet = box.marginVertical; if (scriptlet != null) html += scriptlet;
    html += 'px ';
    scriptlet = box.marginHorizontal; if (scriptlet != null) html += scriptlet;
    html += 'px; display:table-cell; text-align:left;\"\>\n            \<a href=\"';
    scriptlet = photo.getHref(); if (scriptlet != null) html += scriptlet;
    html += '\"\>\<img src=\"';
    scriptlet = photo.getContentHref('previewImage'); if (scriptlet != null) html += scriptlet;
    html += '\" width=\"';
    scriptlet = box.width; if (scriptlet != null) html += scriptlet;
    html += '\" height=\"';
    scriptlet = box.height; if (scriptlet != null) html += scriptlet;
    html += '\" title=\"';
    scriptlet = photo.getTitle(); if (scriptlet != null) html += scriptlet;
    html += '\"\>\<\/a\>\<\/span\>\n            \<span class=\"docs-view-photo-description\"\>';
    scriptlet = photo.getDescription(); if (scriptlet != null) html += scriptlet;
    html += '\<\/span\>\n        \<\/span\>\n    \<\/p\>\n';
    return html;
}
/*function-end (getHtmlPhotoRecentlyModified) */
/*function-begin (getHtmlPhotoSearchHit) */
function getHtmlPhotoSearchHit(photo, context) {
    var html = '';
    html += '\n    \<div style=\"float:right\"\>\n        ';
    var tagargs7 = new Object();
    tagargs7['href'] = photo.getHref();
    html += tagHref(tagargs7, function() {
    var html = '';
    html += '\<img src=\"';
    var scriptlet = photo.getContentHref('iconImage'); if (scriptlet != null) html += scriptlet;
    html += '\" title=\"';
    scriptlet = photo.getTitle(); if (scriptlet != null) html += scriptlet;
    html += '\"\>';
    return html;
}
    );
    html += '\n    \<\/div\>\n\n    \<div\>\n        \<div class=\"search-hit-artifact-class\"\>';
    var scriptlet = photo.getClassName(); if (scriptlet != null) html += scriptlet;
    html += '\<\/div\>\n        \<div class=\"search-hit-title\"\>\n            ';
    var tagargs8 = new Object();
    tagargs8['artifact'] = photo;
    html += tagContextMenu(tagargs8, function() {
    var html = '';
    var tagargs9 = new Object();
    tagargs9['href'] = photo.getHref();
    html += tagHref(tagargs9, function() {
    var html = '';
    html += '';
    var scriptlet = photo.getTitle(); if (scriptlet != null) html += scriptlet;
    html += '';
    return html;
}
    );
    return html;
}
    );
    html += '\n        \<\/div\>\n        \<div class=\"search-hit-description\"\>';
    scriptlet = photo.getDescription(); if (scriptlet != null) html += scriptlet;
    html += '\<\/div\>\n        ';
    var tagargs10 = new Object();
    tagargs10['artifact'] = photo;
    html += tagSearchFoundIn(tagargs10, function() {
    var html = '';
    return html;
}
    );
    html += '\n        ';
    scriptlet = barrique.module.tag.TagInstanceAspect.getHtmlSearchHit.apply(photo, [context]); if (scriptlet != null) html += scriptlet;
    html += '    \n    \<\/div\> \n    \n    \<br\>\n';
    return html;
}
/*function-end (getHtmlPhotoSearchHit) */
/*global-block-begin*/


barrique.module.tag.Tag.prototype.isCompleteSearchHit = function() { 
    return this.getParents() != null && this.getParents().length > 0 &&
           this.getParents()[0].getSource() != null;
}
barrique.module.tag.Tag.prototype.getHtmlSearchHit = function(context) {
    return getHtmlTagSearchHitContextDiv(this, context);
}
barrique.module.tag.TagCategory.prototype.getHtmlSearchHit = function(context) { return getHtmlSearchHitDefault(this, 'Tag Category', context); }


/*global-block-end*/
/*function-begin (getHeadHtml18) */
function getHeadHtml18() {
    var html = '';
    html += '\n\n\n\n';
    return html;
}
/*function-end (getHeadHtml18) */
/*function-begin (getBodyHtml18) */
function getBodyHtml18() {
    var html = '';
    html += '\n\n';
    html += '\n\n';
    return html;
}
/*function-end (getBodyHtml18) */
/*function-begin (getHtmlTagSearchHitContextDiv) */
function getHtmlTagSearchHitContextDiv(tag, context) {
    var html = '';
    html += '\n    ';
    if (typeof(tag.getIcon) != 'undefined' && tag.getIcon() != null) { 
    html += '\n        \<div style=\"float:right\"\>\n            ';
    if (typeof(tag.getUrl) != 'undefined') { 
    html += '\n                ';
    var tagargs0 = new Object();
    tagargs0['href'] = tag.getUrl();
    html += tagHref(tagargs0, function() {
    var html = '';
    html += '\<img src=\"';
    var scriptlet = tag.getIcon().getUrl(tag.getTitle()); if (scriptlet != null) html += scriptlet;
    html += '\" title=\"';
    scriptlet = tag.getTitle(); if (scriptlet != null) html += scriptlet;
    html += '\"\>';
    return html;
}
    );
    html += '\n            ';
    } else { 
    html += '\n                ';
    var tagargs1 = new Object();
    tagargs1['href'] = tag.getHref();
    html += tagHref(tagargs1, function() {
    var html = '';
    html += '\<img src=\"';
    var scriptlet = tag.getIcon().getUrl(tag.getTitle()); if (scriptlet != null) html += scriptlet;
    html += '\" title=\"';
    scriptlet = tag.getTitle(); if (scriptlet != null) html += scriptlet;
    html += '\"\>';
    return html;
}
    );
    html += '\n            ';
    }
    html += '\n        \<\/div\>\n    ';
    }
    html += '\n\n    \<div class=\"search-hit-artifact-class\" title=\"';
    var scriptlet = ''+(context.score ? (100*context.score).toFixed(4)+'% - ' : '') +  (100*tag.getWeight()).toFixed(4)+'%'; if (scriptlet != null) html += scriptlet;
    html += '\"\>\n        ';
    scriptlet = tag.getClassName(); if (scriptlet != null) html += scriptlet;
    html += '\n    \<\/div\>\n    \n    \<div class=\"search-hit-title\"\>';
    var tagargs2 = new Object();
    tagargs2['artifact'] = tag;
    html += tagContextMenu(tagargs2, function() {
    var html = '';
    var tagargs3 = new Object();
    tagargs3['href'] = tag.getHref();
    html += tagHref(tagargs3, function() {
    var html = '';
    html += '';
    var scriptlet = tag.getTitle(); if (scriptlet != null) html += scriptlet;
    html += '';
    return html;
}
    );
    return html;
}
    );
    html += '\n    \<\/div\>\n    \n    \<div class=\"search-hit-description\"\>';
    scriptlet = tag.getDescription(); if (scriptlet != null) html += scriptlet;
    html += '\<\/div\>\n\n    ';
    var tagargs4 = new Object();
    tagargs4['artifact'] = tag;
    html += tagSearchFoundIn(tagargs4, function() {
    var html = '';
    return html;
}
    );
    html += '\n    \n    ';
    scriptlet = barrique.module.tag.TagInstanceAspect.getHtmlSearchHit.apply(tag, [context]); if (scriptlet != null) html += scriptlet;
    html += '\n    \n    ';
    if (typeof(tag.getUrl) != 'undefined' && tag.getUrl() != null) { 
    html += '\n        \<div class=\"search-hit-relations\"\>\n        \<span class=\"relation-type\"\>External Link: \<\/span\>\n        ';
    scriptlet = barrique.base.getHtmlExternalLink(tag.getUrl()); if (scriptlet != null) html += scriptlet;
    html += '\n        \<\/div\>\n    ';
    }
    html += '\n';
    return html;
}
/*function-end (getHtmlTagSearchHitContextDiv) */
/*global-block-begin*/


function getCommentHref(comment) {
    if (comment == null) { return null; }
    if (typeof comment.getCommentHolders != 'undefined') {
        if (comment.getCommentHolders().length > 0) {
            alert(comment);
            var commentsHolder = comment.getCommentHolders()[0].getSource();
            if (commentsHolder != null) {
                return commentsHolder.getHref();
            }
        }
    } else if (comment.getParentComments().length > 0) {
        return getCommentHref(comment.getParentComments()[0].getSource());
    }
    return null;
}

function getEmailAddress(comment) {
    if (comment.getEmailAddress() == null || comment.getEmailAddress().length == 0) return '';
    return ' <i>&lt;'+comment.getEmailAddress()+'&gt;</i>';
}

barrique.module.comment.Comment.prototype.getHtmlSearchHit = function() { return getHtmlCommentSearchHitContextDiv(this); }


/*global-block-end*/
/*function-begin (getHeadHtml22) */
function getHeadHtml22() {
    var html = '';
    html += '\n\n\n\n\n';
    return html;
}
/*function-end (getHeadHtml22) */
/*function-begin (getBodyHtml22) */
function getBodyHtml22() {
    var html = '';
    html += '\n';
    return html;
}
/*function-end (getBodyHtml22) */
/*function-begin (getHtmlCommentSearchHitContextDiv) */
function getHtmlCommentSearchHitContextDiv(comment) {
    var html = '';
    html += '\n    \<div class=\"search-hit-title\"\>Comment: ';
    var tagargs0 = new Object();
    tagargs0['artifact'] = comment;
    html += tagContextMenu(tagargs0, function() {
    var html = '';
    html += '\<a href=\"';
    var scriptlet = comment.getHref(); if (scriptlet != null) html += scriptlet;
    html += '\"\>';
    scriptlet = barrique.string.placeholder(comment.getTitle(), '<i>No Subject</i>'); if (scriptlet != null) html += scriptlet;
    html += '\<\/a\>';
    return html;
}
    );
    html += '\<\/div\>\n    \n    By: \<span\>&quot;';
    var scriptlet = comment.getCommonName(); if (scriptlet != null) html += scriptlet;
    html += '&quot; ';
    scriptlet = getEmailAddress(comment); if (scriptlet != null) html += scriptlet;
    html += '\<\/span\>\<br\>\n    Date: \<span\>';
    scriptlet = comment.getLastModified().toLocaleString(); if (scriptlet != null) html += scriptlet;
    html += '\<\/span\>\<br\>\n    ';
    if (comment.getParentComments().length > 0) { 
    html += '\n        ';
var parentComment = comment.getParentComments()[0].getSource();    html += '\n        ';
    if (parentComment != null && parentComment.getClassName() != 'CommentsDomain') { 
    html += '\n                In reply to: ';
    var tagargs1 = new Object();
    tagargs1['artifact'] = parentComment;
    html += tagContextMenu(tagargs1, function() {
    var html = '';
    html += '\<a href=\"';
    var scriptlet = parentComment.getHref(); if (scriptlet != null) html += scriptlet;
    html += '\"\>';
    scriptlet = parentComment.getTitle(); if (scriptlet != null) html += scriptlet;
    html += '\<\/a\>';
    return html;
}
    );
    html += ' from \<b\>&quot;';
    scriptlet = parentComment.getCommonName(); if (scriptlet != null) html += scriptlet;
    html += '&quot; ';
    scriptlet = getEmailAddress(parentComment); if (scriptlet != null) html += scriptlet;
    html += '\<\/b\>\<br\>\n        ';
    }
    html += '\n    ';
    }
    html += '\n    \<br\>\n';
    return html;
}
/*function-end (getHtmlCommentSearchHitContextDiv) */
/*global-block-begin*/


barrique.base.security.Subject.prototype.getTitle = function() {
    return this.getCommonName();
}
barrique.base.security.Subject.prototype.getHtmlSearchHit = function(context) {
    return getHtmlSearchHitDefault(this, this.getClassName(), context);
    //return getHtmlSubjectSearchHitContextDiv(this, context);
}


/*global-block-end*/
/*function-begin (getHeadHtml28) */
function getHeadHtml28() {
    var html = '';
    html += '\n\n\n\n\n';
    return html;
}
/*function-end (getHeadHtml28) */
/*function-begin (getBodyHtml28) */
function getBodyHtml28() {
    var html = '';
    html += '\n\n';
    html += '\n\n\n';
    return html;
}
/*function-end (getBodyHtml28) */
/*function-begin (getHtmlSubjectSearchHitContextDiv) */
function getHtmlSubjectSearchHitContextDiv(subject, context) {
    var html = '';
    html += '\n    \<div class=\"bold\"\>';
    var scriptlet = subject.getClassName(); if (scriptlet != null) html += scriptlet;
    html += '\<\/div\>\n    \<i\>Name: \<\/i\>';
    var tagargs0 = new Object();
    tagargs0['artifact'] = subject;
    tagargs0['context'] = context;
    html += tagContextMenu(tagargs0, function() {
    var html = '';
    html += '\<span class=\"bold\"\>';
    var tagargs1 = new Object();
    tagargs1['href'] = subject.getHref();
    html += tagHref(tagargs1, function() {
    var html = '';
    html += '';
    var scriptlet = subject.getCommonName(); if (scriptlet != null) html += scriptlet;
    html += '';
    return html;
}
    );
    html += '\<\/span\>';
    return html;
}
    );
    html += '\<br\>\n    ';
    if (context != null && typeof(context.getHtmlSearchHit) != 'undefined') { 
    html += '\n        \<div\>';
    scriptlet = context.getHtmlSearchHit(subject); if (scriptlet != null) html += scriptlet;
    html += '\<\/div\>\n    ';
    }
    html += '\n';
    return html;
}
/*function-end (getHtmlSubjectSearchHitContextDiv) */
