(function(){

/*
	Class: ListViewCommentView 
	The class for a making comments tree
*/
function ListViewCommentView() { }

//ListViewCommentView extends CommentView.  
YAHOO.lang.extend( ListViewCommentView, window['SB']['ui']['CommentView']);

ListViewCommentView.prototype.toString = function() { return "[SB.ui.ListViewCommentView]"; };

ListViewCommentView.prototype.setConfig = function( inObj )
{
	this.listitemview = inObj.listitemview;

	SBui.ListViewCommentView.superclass.setConfig.call(this, { comment_obj:inObj.comment_obj, template:"listview_comment", depth:0, noreply:inObj.noreply } );

	//Got to force the width for IE
	YUIDom.setStyle( this.htmlObj, "width", "622px" );

	var color = "0";
	if( inObj.comment_obj.color )
		color = inObj.comment_obj.color;

	var bgcolor = "bgcolor"+color;
	/*var pointer = "pointer"+color;*/

	//Set the color of the bubble
	YUIDom.addClass( YUIDom.getElementsByClassName("bb1","b",this.htmlObj) , bgcolor);
	YUIDom.addClass( YUIDom.getElementsByClassName("bb2","b",this.htmlObj) , bgcolor);	
	YUIDom.addClass( YUIDom.getElementsByClassName("bb3","b",this.htmlObj) , bgcolor);	
	YUIDom.addClass( YUIDom.getElementsByClassName("bb4","b",this.htmlObj) , bgcolor);	
	YUIDom.addClass( YUIDom.getElementsByClassName("bb5","b",this.htmlObj) , bgcolor);	
	YUIDom.addClass( YUIDom.getElementsByClassName("bb6","b",this.htmlObj) , bgcolor);	
	YUIDom.addClass( YUIDom.getElementsByClassName("bb7","b",this.htmlObj) , bgcolor);
	YUIDom.addClass( YUIDom.getElementsByClassName("bb8","b",this.htmlObj) , bgcolor);	
	YUIDom.addClass( YUIDom.getElementsByClassName("sb_box_list_view_comment_item","div",this.htmlObj) , bgcolor);	
	/* YUIDom.addClass( YUIDom.getElementsByClassName("pointerarrow","div",this.htmlObj) , pointer); */

	if( inObj.noreply )
	{
		YUIDom.getElementsByClassName("reply_button", "div", this.htmlObj, function(el) { YUIDom.setStyle( el, "display","none" ); } );	
	}

};

ListViewCommentView.prototype.deleteComment = function()
{
	SBui.ListViewCommentView.superclass.deleteComment.call(this);
}

ListViewCommentView.prototype.showAdd = function( ev )
{
	SBui.ListViewCommentView.superclass.showAdd.call(this, ev);

	var comblock = YUIDom.get("comment_entry");
	comblock.listitemview = this.listitemview;

	YUIDom.getElementsByClassName( "sb_box_list_view_comments_area", "div", this.listitemview.htmlObj,
		function(el) { YUIDom.setStyle( el, "max-height", "none"); });
};
	
ListViewCommentView.prototype.hideAdd = function( ev )
{
	var comblock = YUIDom.get("comment_entry");

	YUIDom.getElementsByClassName( "sb_box_list_view_comments_area", "div", this.listitemview.htmlObj,
		function(el) { YUIDom.setStyle( el, "max-height", "300px"); });

	if( comblock ) { comblock.listitemview = null; }

	SBui.ListViewCommentView.superclass.hideAdd.call(this, ev);
};

window['SB']['ui']['ListViewCommentView'] = ListViewCommentView;


})();


