function CommentListController()
{
	this.reqWidgetQueue= new Array();//queue with the widgets that made a request through this controller object
	var self=this;
	this.localWidgetReff = null;
	this.ref=null;
	this.intr_id;
	this.getCommentsList=function(banc_id)
	{
		this.ref=document.getElementById('posted_comm');
		var rqid=RequestManager.getInstance().createRequest(CommentListController.getInstance(),URL+"index.php?page=show_comments&banc_id="+banc_id);
		RequestManager.getInstance().startRequest(rqid);
	}
	this.getPozeCommentsList=function(poza_id)
	{
		this.ref=document.getElementById('posted_comm');
		var rqid=RequestManager.getInstance().createRequest(CommentListController.getInstance(),URL+"index.php?page=show_poze_comments&poza_id="+poza_id);
		RequestManager.getInstance().startRequest(rqid);
	}
	this.getFilmeCommentsList=function(film_id)
	{
		this.ref=document.getElementById('posted_comm');
		var rqid=RequestManager.getInstance().createRequest(CommentListController.getInstance(),URL+"index.php?page=show_filme_comments&film_id="+film_id);
		RequestManager.getInstance().startRequest(rqid);
	}
	this.getDeseneCommentsList=function(desen_id)
	{
		this.ref=document.getElementById('posted_comm');
		var rqid=RequestManager.getInstance().createRequest(CommentListController.getInstance(),URL+"index.php?page=show_desene_comments&desen_id="+desen_id);
		RequestManager.getInstance().startRequest(rqid);
	}
	this.getJocuriCommentsList=function(joc_id)
	{
		this.ref=document.getElementById('posted_comm');
		var rqid=RequestManager.getInstance().createRequest(CommentListController.getInstance(),URL+"index.php?page=show_jocuri_comments&joc_id="+joc_id);
		RequestManager.getInstance().startRequest(rqid);
	}

	this.getResponsesList=function(intrebare_id)
	{
		this.intr_id=intrebare_id;
		this.ref=document.getElementById('posted_rasp'+intrebare_id);
		var rqid=RequestManager.getInstance().createRequest(CommentListController.getInstance(),URL+"index.php?page=show_raspunsuri&intrebare_id="+intrebare_id);
		RequestManager.getInstance().startRequest(rqid);
	}
	this.getResponsesListAll=function(intrebare_id)
	{
		this.intr_id=intrebare_id;
		this.ref=document.getElementById('posted_rasp'+intrebare_id);
		var rqid=RequestManager.getInstance().createRequest(CommentListController.getInstance(),URL+"index.php?page=show_raspunsuri_all&intrebare_id="+intrebare_id);
		RequestManager.getInstance().startRequest(rqid);
	}

	/**
	 * @param The manager index of the request 
	 * @desc This method is a handler for the completition of one request
	 */
	this.handleResponse=function (managerIndex)
	{	
		var respContent=RequestManager.getInstance().getRequestObj(managerIndex).getResponseContent();
		if(this.intr_id)
		{
			document.forms['add_comment'+this.intr_id].comment.value="";
		}
		else
		{
			document.forms['add_comment'].comment.value="";
		}
		this.ref.innerHTML=respContent;
		return true;					
	}
}

CommentListController.__instance__=null;

CommentListController.getInstance=function()
{
	if(CommentListController.__instance__==null)
	{
		CommentListController.__instance__=new CommentListController();
	}
	return CommentListController.__instance__;
}
