ckdd.extend(ckCommonEditObj,articleCommentEditObj);
function articleCommentEditObj() {
	articleCommentEditObj.baseConstructor.call(this,"articleComment");
	
	this.articleID=(arguments.length==1 ? arguments[0] : "");

	this.fwDefaultWidth = 500;
	this.listContainerID = this.varName + ".list";
	
	this.actionURLPrefix = "/ckcommon/article/ajax/";
	this.saveURL = this.actionURLPrefix + "article_action.asp";
	this.deleteURL = this.actionURLPrefix + "article_action.asp";
	
	this.listURL = "/ckcommon/article/ajax/comment_list.htm.asp";

	this.bShowCreateAfterList = false;
		
	return this;
}


/*----- List ---------------------------------------------------------------------------*/

articleCommentEditObj.prototype.list = function() {
	if (arguments.length==1) this.articleID = arguments[0];
	
	this.setParam("articleID",this.articleID); //have to use this way to avoid dups being passed since save function does this way too

	this.listContainerID = this.varName + ".list." + this.articleID
	articleCommentEditObj.superClass.list.call(this);
}

/*----- Delete -------------------------------------------------------------------------*/

articleCommentEditObj.prototype.deleteData = function(cid) {
	this.setParam("articleID",this.articleID);
	this.setParam("actionCode","deleteComment");
	
	var sData = 'commentID=' + cid;
	articleCommentEditObj.superClass.deleteData.call(this,sData,"Comment");
}

/*----- Save ---------------------------------------------------------------------------*/

articleCommentEditObj.prototype.save= function(aid) {
	this.articleID=aid;
	this.setParam("articleID",this.articleID);
	this.setParam("actionCode","saveComment");
	
	articleCommentEditObj.superClass.save.call(this,true,"articleComment.field." + aid,false);
}
articleCommentEditObj.prototype.ajaxReturnHandler_save= function(oAjax) {
	var oResponse,oEl;
	if (oResponse = oAjax.responseObj) {
		this.articleID = oResponse.payload.articleID;
		if (oEl = this.getElement("comment." + this.articleID)) oEl.value="";
	}
	
	articleCommentEditObj.superClass.ajaxReturnHandler_save.call(this,oAjax);
}


/*----- Open/Close ---------------------------------------------------------------------------*/
articleCommentEditObj.prototype.toggleShowCreate = function() {
	var oEl;
	var aid = (arguments.length==1 ? arguments[0] : this.articleID); //pages with multiple comment blocks will pass in articleID
	if (oEl = document.getElementById("newComment." + aid)) oEl.style.display=(oEl.style.display=="none" ? "block" : "none");

}
articleCommentEditObj.prototype.updateAfterList = function(numComments) {
	var oEl;
	if (oEl = document.getElementById("numComments." + this.articleID)) oEl.innerHTML=numComments + " comments";
	if (this.bShowCreateAfterList) this.toggleShowCreate();
}
