function transformBody(bodyText) {
	return transform(bodyText, curEntry);
}

function transform(bodyText, doc) {
	return com.wrenbeck.util.TransformBody.transform(context.getBaseUrlContextPath(), bodyText, doc.getDatabase().getName(), doc.getId(), session);
	/*
	newText = transformImage(bodyText, doc);
	return transformDownload(newText, doc);
	*/
}

function transformImage(bodyText, doc) {
	return com.wrenbeck.util.TransformBody.transform(context.getBaseUrlContextPath(), bodyText, doc.getDatabase().getName(), doc.getId(), session);
	/*
	// We need to transform the body and insert the images as appropriate
	try {
		done = false;
		while (!done) {
			startTag = bodyText.instr("[[");
			if (startTag < 0) {
				done = true;
			} else {
				endTag = bodyText.instr("]]");
				if (endTag < 0) {
					done = true;
				} else {
					// replace this tag with a reference to the image
					nameStart = startTag + 2;
					nameLen = endTag - nameStart;
					attachmentName = bodyText.mid(nameStart, nameLen);
					stringToReplace = bodyText.mid(startTag, endTag + 2 - startTag);
					url = doc.getXSPAttachment(attachmentName,context.getContextPath());
					if (url != null || url != "") {
						stringToInsert = "<img border=1 src=\"" + url + "\">";
						bodyText = com.wrenbeck.util.ReplaceSubstring.replace(bodyText, stringToReplace, stringToInsert);
					}
				}
			}
		}
	} catch (ex) {
		print ("exception:\n" + ex.toString());
	}
	return bodyText;
	*/
}

function transformDownload(bodyText, doc) {
	return com.wrenbeck.util.TransformBody.transform(context.getBaseUrlContextPath(), bodyText, doc.getDatabase().getName(), doc.getId(), session);
	/*
	// We need to transform the body and insert the images as appropriate
	try {
		done = false;
		while (!done) {
			startTag = bodyText.instr("{{");
			if (startTag < 0) {
				done = true;
			} else {
				endTag = bodyText.instr("}}");
				if (endTag < 0) {
					done = true;
				} else {
					// replace this tag with a reference to the image
					nameStart = startTag + 2;
					nameLen = endTag - nameStart;
					attachmentName = bodyText.mid(nameStart, nameLen);

					// determine if the attachment is an offsite link, which will contain ||
					startBars = attachmentName.instr("!!");
					stringToInsert = "";
					if (startBars<0) {
						url = doc.getXSPAttachment(attachmentName,context.getContextPath());
						stringToInsert = "<a href=\"" + url + "\">" + attachmentName + "</a>";
					} else {
						// the left of the bars is the href, the right the name
						theHref = attachmentName.mid(0, startBars);
						theName = attachmentName.mid((startBars+2), attachmentName.length());
						if (theHref.startsWith("http", true)) {
							stringToInsert = "<a href=\"" + theHref + "\">" + theName + "</a>";
						} else {
							stringToInsert = "<a href=\"" + context.getContextPath() + theHref + "\">" + theName + "</a>";
						}
					}
					stringToReplace = bodyText.mid(startTag, endTag + 2 - startTag);
					bodyText = com.wrenbeck.util.ReplaceSubstring.replace(bodyText, stringToReplace, stringToInsert);
				}
			}
		}
	} catch (ex) {
		print ("exception:\n" + ex.toString());
	}
	return bodyText;
	*/
}