function comments() {  }
comments.prototype=new penumbra();
chatter=new comments();

comments.prototype.submit=function(collectionID, displayType) {

	this.collectionID=collectionID

	o={requestType:'submitComment', displayType:displayType, commentText:$(collectionID + "_commentText").value};
	o.collectionID=this.collectionID;
	o.commentRevID=$(collectionID + "_commentRevID").value

	this.irequest(o,'chatter', 'submitReturn')

	this.submitWait(collectionID)

}

comments.prototype.submitWait=function(collectionID) {

	var myContainer=$(collectionID + "_input")

	if ($(collectionID + "_confirm")) {	$(this.collectionID + "_input").removeChild($(collectionID + "_confirm")); 	}

	this.commentEntryFormHTML=$(collectionID + "_input").innerHTML
	$(collectionID + "_input").innerHTML=translations['saving'];

}

comments.prototype.restore=function(myStatus, collectionID) {

	this.collectionID=collectionID

	$(this.collectionID + "_input").innerHTML=''
	var notification=document.createElement("div")
	notification.setAttribute("class", "box")
	notification.setAttribute("id", this.collectionID + "_confirm")
	var messageText=(myStatus==100) ? document.createTextNode("Comment saved!") : document.createTextNode("Did not save.(" + myStatus + ")")
	notification.appendChild(messageText)

	$(this.collectionID + "_input").insertBefore(notification, $(this.collectionID + "_form"))

}

comments.prototype.submitReturn=function(obj) {

	var myStatus=obj.responseText
	this.collectionID=obj.getResponseHeader("collectionID");
	var displayType=obj.getResponseHeader("displayType");

	chatter.restore(myStatus,this.collectionID )
	chatter.refreshComments(displayType)

}

comments.prototype.refreshComments=function(displayType) {

	o=[];
	o.requestType='refreshComments';
	o.displayType=displayType;
	o.collectionID=this.collectionID;
	this.irequest(o,'chatter', 'restoreComments');
	this.refreshWait();

}

comments.prototype.restoreComments=function(obj) {	$(this.collectionID + "_comments").innerHTML=obj.responseText; }

comments.prototype.refreshWait=function() {	$(this.collectionID + "_comments").innerHTML+="<div>Updating...</div>"; }