SocialEngineAPI.Comments = new Class({
	Implements: [Options],
  Base: {},
  page: 1,
  total: 0,
  cdSize: 0,
  changed: false,
  isEditing: false,
  options: {
    'ajaxURL' : jsBaseUrl+'misc_js.php',
    'ajaxMethod' : 'post',
    'ajaxSecure' : false,
    'canComment' : false,
    'commentHTML' : false,
    'commentCode' : false,
    'originalHeight' : 70,
    'type' : false,
    'typeIdentifier' : false,
    'typeID' : false,
    'paginate' : true,
    'cpp' : false,
    'commentLinks' : {'reply' : false, 'walltowall' : false},
    'object_owner' : false,
    'object_owner_id' : false,
    'typeTab' : false,
    'typeCol' : false,
    'typeTabParent' : false,
    'typeColParent' : false,
    'typeChild' : false,
	'isCached' : false,
	'isFanlala' : false
  },
  initialize: function(options)
  {
    this.setOptions(options);
    
    if( this.options.initialTotal ) this.total = this.options.initialTotal;

    var bind = this;
    window.addEvent('domready', function()
    {
      bind.showPostComment();
      
      bind.options.originalHeight = textarea_autogrow('comment_body');
      bind.getComments(1);
    });
  },
  showPostComment: function()
  {
    var innerHTML = "";
    innerHTML += 
      "<div class='comment_headline'>" +
        this.Base.Language.Translate(854) +
        " (<span class='tc' id='" + this.options.type + '_' + this.options.typeID + '_totalcomments' + "'>" + this.total + "</span>)" +
      "</div>";
      
    if( this.options.canComment )
    {
      innerHTML += "<div class='profile_postcomment'>" +
        "<form action='"+jsBaseUrl+"misc_js.php' method='post' style='padding:0px;' target='ajaxframe'>" +
            "<textarea name='comment_body' id='comment_body' cols='25' class='comment_area'>" + this.Base.Language.Translate(829) + "</textarea>";
      
      if( this.options.commentHTML ) innerHTML += 
            "<div style='margin-top: 5px;'>" +
              this.Base.Language.TranslateFormatted(1034, [this.options.commentHTML]) +
            "</div>";
      
      if( this.options.commentCode ) innerHTML += 
            "<div style='float: left; margin-top: 5px;'>" +
              "<a href='javascript:void(0);' onClick=\"this.blur();$('secure_image').src=$('secure_image').src+'?'+(new Date()).getTime();\">" +
                "<img src='./images/secure.php' id='secure_image' border='0' height='20' width='67' class='signup_code'>" + 
              "</a>" +
              " <input type='text' name='comment_secure' id='comment_secure' class='text' size='6' maxlength='10'> " +
              "<img src='./images/icons/tip.gif' border='0' class='Tips1' style='vertical-align: middle;' title='" + this.Base.Language.Translate(856) + "'>" +
            "</div>";
      
      innerHTML += 
            "<div style='text-align: right; margin-top: 5px;'>" +
			"<input type='image' id='comment_submit' src='./images/post_btn.png' class='button1'>" +
            "<input type='hidden' name='task' value='comment_post'>" +
            "<input type='hidden' name='type' value='" + this.options.type + "'>" +
            "<input type='hidden' name='iden' value='" + this.options.typeIdentifier + "'>" +
			"<input type='hidden' name='isCached' value='" + this.options.isCached + "'>" +
            "<input type='hidden' name='value' value='" + this.options.typeID + "'>";
      
      if( this.options.object_owner && this.options.object_owner_id )
      {
        innerHTML += '<input type="hidden" name="object_owner" value="' + this.options.object_owner + '">' +
		     '<input type="hidden" name="object_owner_id" value="' + this.options.object_owner_id + '">';
      } else {
        innerHTML += '<input type="hidden" name="user" value="' + this.Base.Owner.user_info.user_username + '">';
      }

      if( this.options.typeTab ) innerHTML += 
            "<input type='hidden' name='tab' value='" + this.options.typeTab + "'>";
      
      if( this.options.typeCol ) innerHTML += 
            "<input type='hidden' name='col' value='" + this.options.typeCol + "'>";
      
      if( this.options.typeTabParent ) innerHTML += 
          '<input type="hidden" name="tab_parent" value="' + this.options.typeTabParent + '">';
      
      if( this.options.typeColParent ) innerHTML += 
          '<input type="hidden" name="col_parent" value="' + this.options.typeColParent + '">';
      
      if( this.options.typeChild ) innerHTML += 
          '<input type="hidden" name="child" value="1">';
      
      innerHTML += 
            "</div>" +
            "<div id='comment_error' style='color: #FF0000; display: none;'></div>" +
        "</form>" +
	  "</div>";
    }
	var postCommentContainerElement = $(this.options.type + '_' + this.options.typeID + '_postcomment');
    postCommentContainerElement.innerHTML = innerHTML;
    var bind = this;
    if( this.options.canComment )
    {
      postCommentContainerElement.getElement('form').addEvent('submit', function()    { bind.checkText();       });
      postCommentContainerElement.getElement('textarea').addEvent('focus', function() { bind.removeText(this);  });
      postCommentContainerElement.getElement('textarea').addEvent('blur', function()  { bind.addText(this);     });
    }
    
  },
  getComments: function(direction)
  {

    if( direction=='next' )
      this.page++;
    else if( direction=='previous' )
      this.page--;
    else if( $type(direction) )
      this.page = direction;
    
    if( this.options.paginate ) {
      //window.scroll(0,0);
    } else {
      this.options.cpp = this.total;
    }
    if( this.options.object_owner && this.options.object_owner_id )
    {
      var object_owner = this.options.object_owner;
      var object_owner_id = this.options.object_owner_id;
      var user = '';
    } else {
      var object_owner = '';
      var object_owner_id = '';
      var user = this.Base.Owner.user_info.user_username || this.options._username;
    }
    // AJAX
    var bind = this;
    var request = new Request.JSON({
      'url' : this.options.ajaxURL,
      'method' : this.options.ajaxMethod,
      'secure' : this.options.ajaxSecure,
      'data' : {
        'task'  : 'comment_get',
        'user'  : user,
		'object_owner' : object_owner,
		'object_owner_id' : object_owner_id,
        'type'  : this.options.type,
        'iden'  : this.options.typeIdentifier,
        'value' : this.options.typeID,
        'cpp'   : this.options.cpp,
		'isCached' : this.options.isCached,
        'p'     : this.page
      },
      'onComplete' : function(responseObject, responseText)
      {
        bind.updateComments(responseObject);
      }
    });
    
    request.send();
  },
	getUserTotalComments: function()
  {
	if( this.options.paginate ) {
      //window.scroll(0,0);
    } else {
      this.options.cpp = this.total;
    }
    if( this.options.object_owner && this.options.object_owner_id )
    {
      var object_owner = this.options.object_owner;
      var object_owner_id = this.options.object_owner_id;
      var user = '';
    } else {
      var object_owner = '';
      var object_owner_id = '';
      var user = this.Base.Owner.user_info.user_username || this.options._username;
    }
    var bind = this;
    var request = new Request.JSON({
      'url' : this.options.ajaxURL,
      'method' : this.options.ajaxMethod,
      'secure' : this.options.ajaxSecure,
      'data' : {
        'task'  : 'comment_user_total_item',
        'user'  : user,
		'object_owner' : object_owner,
		'object_owner_id' : object_owner_id,
        'type'  : this.options.type,
        'iden'  : this.options.typeIdentifier,
        'value' : this.options.typeID,
        'cpp'   : this.options.cpp,
		'isCached' : this.options.isCached,
        'p'     : this.page
      },
      'onComplete' : function(responseObject, responseText)
      {
		/* Add Nitro action for user's first Comment & other comments on item */
		var cnt = responseObject.cnt;

			//if(cnt == 1){
				if(responseObject.type == "media" || responseObject.type == "video" || responseObject.type == "blog" || responseObject.type == "news" || responseObject.type == "quiz"){
					nitro.callAPI('method=user.logAction&tags=COMMENT_FIRST','nitronotification');	
				}
			/*}
			else{
				   nitro.callAPI('method=user.logAction&tags=COMMENT','nitronotification');
		    }*/
      }
    });
    
    request.send();
  },
  	updateComments: function(responseObject)
	{

		if($type(responseObject) != "object"){
			return false;
		}
		this.total  = parseInt(responseObject.total_comments) || 0;
		this.page   = responseObject.p;
		var maxpage = responseObject.maxpage;
		var p_start = responseObject.p_start;
		var p_end   = responseObject.p_end;
		var totalCommentElement     = $(this.options.type + '_' + this.options.typeID + '_totalcomments');
		var totalCommentCount       = $(this.options.type + '_' + this.options.typeID + '_commentcount');
		var commentContainerElement = $(this.options.type + '_' + this.options.typeID + '_comments');
		var trackerContainerElement = $(this.options.type + '_' + this.options.typeID + '_tracker');
		var comments = $H(responseObject.comments);
		totalCommentElement.innerHTML = this.total;
		if(totalCommentCount){
			totalCommentCount.set('text', this.total+' comments');
		}
		var commentBodyDiv = document.createElement('div');
		commentContainerElement.empty();
		var bind = this;
		var counter = 0;
		var _totalHeight = 0;
		if(bind.Base.Core.settings.setting_url){
			var querySeparator = '?';
		}
		else{
			var querySeparator = '&';
		}
		comments.each(function(commentObject, commentID)
		{
			var newComment = new Element('div', {
				'id' : 'comment_' + commentID
			});
			
			var newCommentInnerHTML = "<div style='margin-top:0px; margin-bottom:10px;_width:99%;_width:98%;'>";
			newCommentInnerHTML += '<div class="boxbg_white"><a href="'+ commentObject.comment_authoruser_url +'"><img src="'+commentObject.comment_userphoto_url+'" class="tracker_img" alt="'+commentObject.comment_authoruser_displayname+'" hspace="6" vspace="6" /></a></div>';
			newCommentInnerHTML += "<div style='overflow:hidden;'>";
			if(!commentObject.comment_authoruser_id){
				newCommentInnerHTML += "<div class='profile_comment_author'><b>" + bind.Base.Language.Translate(835) + "</b></div>";
			}
			else if(!commentObject.comment_authoruser_exists){
				newCommentInnerHTML += "<div class='profile_comment_author'><b>" + bind.Base.Language.Translate(1071) + "</b></div>";
			}
			else{
				newCommentInnerHTML += "<div class='profile_comment_author'><a href='" + commentObject.comment_authoruser_url + "'><b>" + commentObject.comment_authoruser_displayname + "</b></a></div>";
			} 
			newCommentInnerHTML += "<div class='profile_comment_date'>" + commentObject.comment_date + "</div>";
			newCommentInnerHTML += "<div class='profile_comment_body1' id='profile_comment_body_" + commentID + "'>" + commentObject.comment_body + "</div>";
			newCommentInnerHTML += "<div class='profile_comment_links'>";
			var links = new Array();
			if(bind.Base.Viewer.user_exists && commentObject.comment_authoruser_id && commentObject.comment_authoruser_exists){
				if(commentObject.comment_authoruser_id!=bind.Base.Viewer.user_info.user_id){
					links.push('<div class="post_delete"><a href="javascript:void(0);" class="report_lnk" id="comment_report_link_' + commentID + '">Report</a></div>');
				}
				if(commentObject.comment_authoruser_id==bind.Base.Viewer.user_info.user_id){
					links.push('<div class="post_delete"><a href="javascript:void(0);" class="edit_lnk" id="comment_edit_link_' + commentID + '">Edit</a></div>');
				}
			}
			if((commentObject.comment_authoruser_exists && commentObject.comment_authoruser_id == bind.Base.Viewer.user_info.user_id) || (bind.Base.Viewer.user_exists && bind.Base.Viewer.user_info.user_id == bind.Base.Owner.user_info.user_id)){
				links.push('<div class="post_delete"><a href="javascript:void(0);" class="delete_lnk" id="comment_delete_link_' + commentID + '">Delete</a></div>');
			}
			newCommentInnerHTML += links.join('');
			newCommentInnerHTML += "</div></div>";
			counter++;
			if(counter < bind.options.cpp){
			}
			newCommentInnerHTML += "</div>";
			if(counter == bind.total){
			}
			newComment.setProperty('html', newCommentInnerHTML);
			newComment.inject(commentContainerElement, 'bottom');
			_totalHeight += parseInt($('comment_' + commentID).getSize().y);
			if(newComment.getElement('.report_lnk')){
				newComment.getElement('.report_lnk').addEvent('click', function(){
					bind.sendReport(commentID);
				});
			}
			if(newComment.getElement('.edit_lnk')){
				newComment.getElement('.edit_lnk').addEvent('click', function(){
					bind.editComment(commentID);
				});
			}
			if(newComment.getElement('.delete_lnk')){
				newComment.getElement('.delete_lnk').addEvent('click', function(){
					bind.confirmDelete(commentID);
				});
			}
		});
		if(this.options.isFanlala){
			var _commentScrollHeight = 1098; //910;
		}
		else{
			var _commentScrollHeight = 1000; //500
		}

		fav = new SocialEngineAPI.Favorite();
	
		if(_totalHeight > _commentScrollHeight){
			commentContainerElement.setStyle('height', _commentScrollHeight+'px');
			commentContainerElement.setStyle('overflow', 'auto');
			//$('b_scroller').setStyle('display', 'block');			
			
			//fav.makeScrollbar(commentContainerElement, $('b_scroller'), $('h_scroller'), false, true);
			
		}
		else if(_totalHeight > 300 && _totalHeight < _commentScrollHeight){
			commentContainerElement.setStyle('height', parseInt(_totalHeight+150)+'px');
			//$('b_scroller').setStyle('display', 'none');
			commentContainerElement.top = 0;
		}
		else{
			commentContainerElement.setStyle('height', parseInt(_totalHeight+120)+'px');
			//$('b_scroller').setStyle('display', 'none');
			commentContainerElement.top = 0;
		}
		/*_totaltrackerHeight = $('trackcount').value ;
		
		if(_totaltrackerHeight  > 4){
			$('b_scroller1').setStyle('display', 'block');
			fav.makeScrollbar(trackerContainerElement, $('b_scroller1'), $('h_scroller1'), false, true);
		}
		else{
			trackerContainerElement.setStyle('height', '0px');
		}*/

		// CREATE PAGINATION DIV
		if(this.options.paginate && this.total > this.options.cpp) { 
		  var commentPaginationTop = new Element('div', {'styles': {'text-align' : 'center'}});
		  var commentPaginationBottom = new Element('div', {'styles': {'text-align' : 'center'}});
		  if(this.page > 1) {
			var paginationHTMLTop = "<a href='javascript:void(0);' id='comment_last_page_top'>&#171; " + bind.Base.Language.Translate(182) + "</a>";
			var paginationHTMLBottom = "<a href='javascript:void(0);' id='comment_last_page_bottom'>&#171; " + bind.Base.Language.Translate(182) + "</a>";
		  } else {
			var paginationHTMLTop = "<font class='disabled'>&#171; " + bind.Base.Language.Translate(182) + "</font>";
			var paginationHTMLBottom = "<font class='disabled'>&#171; " + bind.Base.Language.Translate(182) + "</font>";
		  }
		  if(p_start == p_end) {
			paginationHTMLTop += "&nbsp;|&nbsp; " + this.Base.Language.TranslateFormatted(184, [p_start, this.total]) + "&nbsp;|&nbsp;";
			paginationHTMLBottom += "&nbsp;|&nbsp; " + this.Base.Language.TranslateFormatted(184, [p_start, this.total]) + "&nbsp;|&nbsp;";
		  } else {
			paginationHTMLTop += "&nbsp;|&nbsp; " + this.Base.Language.TranslateFormatted(185, [p_start, p_end, this.total]) + "&nbsp;|&nbsp;";
			paginationHTMLBottom += "&nbsp;|&nbsp; " + this.Base.Language.TranslateFormatted(185, [p_start, p_end, this.total]) + "&nbsp;|&nbsp;";
		  }
		  if(this.page != maxpage) {
			paginationHTMLTop += "<a href='javascript:void(0);' id='comment_next_page_top'>" + bind.Base.Language.Translate(183) + " &#187;</a>";
			paginationHTMLBottom += "<a href='javascript:void(0);' id='comment_next_page_bottom'>" + bind.Base.Language.Translate(183) + " &#187;</a>";
		  } else {
			paginationHTMLTop += "<font class='disabled'>" + bind.Base.Language.Translate(183) + " &#187;</font>";
			paginationHTMLBottom += "<font class='disabled'>" + bind.Base.Language.Translate(183) + " &#187;</font>";
		  }
		  commentPaginationTop.setProperty('html', paginationHTMLTop);
		  commentPaginationBottom.setProperty('html', paginationHTMLBottom);
		  commentPaginationTop.inject(commentContainerElement, 'top');
		  commentPaginationBottom.inject(commentContainerElement);

		  // ADD EVENTS
		  if( commentPaginationTop.getElement('a[id=comment_last_page_top]') ) commentPaginationTop.getElement('a[id=comment_last_page_top]').addEvent('click', function()
		  {
			bind.getComments('previous');
		  });

		  if( commentPaginationBottom.getElement('a[id=comment_last_page_bottom]') ) commentPaginationBottom.getElement('a[id=comment_last_page_bottom]').addEvent('click', function()
		  {
			bind.getComments('previous');
		  });
		  
		  if( commentPaginationTop.getElement('a[id=comment_next_page_top]') ) commentPaginationTop.getElement('a[id=comment_next_page_top]').addEvent('click', function()
		  {
			bind.getComments('next');
		  });

		  if( commentPaginationBottom.getElement('a[id=comment_next_page_bottom]') ) commentPaginationBottom.getElement('a[id=comment_next_page_bottom]').addEvent('click', function()
		  {
			bind.getComments('next');
		  });
		}

	},
	addComment: function(is_error, comment_body, comment_date)
	{

		
		if(!this.options.canComment){
			return false;
		}
		if(is_error){
			$('comment_error').style.display = 'block';
			if(!comment_body.trim()){
				this.addText($('comment_body'));
				$('comment_error').innerHTML = this.Base.Language.Translate(831);
			}
			else{
				$('comment_error').innerHTML = this.Base.Language.Translate(832);
			}
			$('comment_submit').value = this.Base.Language.Translate(833);
			$('comment_submit').disabled = false;
		}
		else{
			
			if(this.options.type == "media" || this.options.type == "video" || this.options.type == "blog" || this.options.type == "news" || this.options.type == "quiz"){
				this.getUserTotalComments();
			}
			
			$('comment_error').style.display = 'none';
			$('comment_error').innerHTML = '';
			$('comment_body').value = '';
			$('comment_body').style.height = this.options.originalHeight + 'px';
			this.addText($('comment_body'));
			$('comment_submit').value = this.Base.Language.Translate(833);
			$('comment_submit').disabled = false;
			if($('comment_secure')){
				$('comment_secure').value = '';
				$('secure_image').src = $('secure_image').src + '?' + (new Date()).getTime();
			}
			this.page = 1;
			this.total++;
			this.getComments();
			
		}
	},
	editComment: function(commentID)
	{
		var bind = this;
		/*if(this.isEditing){
			return false;
		}*/
		this.isEditing = true;
		var commentElement = $('profile_comment_body_' + commentID);
		var height = commentElement.offsetHeight + 10;
		var commentText = commentElement.innerHTML.replace(/<br>/gi, '\r\n').replace(/>/gi, '&gt;');
		var innerHTML = '';
		innerHTML += "<form action='user/misc_js' method='post' target='ajaxframe' name='editCommentForm'>";
		innerHTML += "<textarea name='comment_edit' id='comment_edit_" + commentID + "' style='height: " + height +" px; width:98%;'>" + commentText + "</textarea>";
		innerHTML += "<input type='hidden' name='task' value='comment_edit'>";
		innerHTML += "<input type='hidden' name='comment_id' value='" + commentID + "'>";
		innerHTML += "<input type='hidden' name='type' value='" + this.options.type + "'>";
		innerHTML += "<input type='hidden' name='iden' value='" + this.options.typeIdentifier + "'>";
		
		innerHTML += "<input type='hidden' name='isCached' value='" + this.options.isCached + "'>";
		
		innerHTML += "<input type='hidden' name='value' value='" + this.options.typeID + "'>";
		if(this.options.typeTab){
			innerHTML += '<input type="hidden" name="tab" value="' + this.options.typeTab + '">';
		}
		if(this.options.typeCol){
			innerHTML += '<input type="hidden" name="col" value="' + this.options.typeCol + '">';
		}
		if(this.options.typeTabParent){
			innerHTML += '<input type="hidden" name="tab_parent" value="' + this.options.typeTabParent + '">';
		}
		if(this.options.typeColParent){
			innerHTML += '<input type="hidden" name="col_parent" value="' + this.options.typeColParent + '">';
		}
		if(this.options.typeChild){
			innerHTML += '<input type="hidden" name="child" value="1">';
		}
		innerHTML += "</form>";
		commentElement.innerHTML = innerHTML;
		textarea_autogrow('comment_edit_' + commentID);
		$('comment_edit_' + commentID).focus();
		$('comment_edit_' + commentID).addEvent('blur', function(){
			document.editCommentForm.submit();
			bind.isEditing = false;
		});
	},
	confirmDelete: function(commentID)
	{
		this.deleteBox(commentID);
	},
	removeText: function(commentBody)
	{
		if(!this.changed){
			commentBody.value = '';
			commentBody.style.color = '#000000';
			this.changed = true;
		}
	},
	addText: function(commentBody)
	{
		if(!commentBody.value.trim())
		{
			commentBody.value = this.Base.Language.Translate(829);
			commentBody.style.color = '#888888';
			this.changed = false;
		}
	},
	
	checkText: function(commentBody)
	{
		if(!this.changed){
			$('comment_body').value='';
		}
		$('comment_submit').value = this.Base.Language.Translate(830);
		$('comment_submit').disabled = true;
	},
	sendReport: function(commentID)
	{
		var bind = this;
		var _txt = 'Please let us know what is wrong with this comment.';
		var innerHTML = '<div class="frSrhPop_new" id="addFavBlogPop">\
			<div class="poptop-image">\
				<div class="image_report_text" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=\'true\', sizingMethod=\'fixed\', src=\''+jsBaseUrl+'images/notify_fanlala.png\');"><img src="'+jsBaseUrl+'images/spacer.gif" width="167" height="30" /></div>\
				<a href="javascript:void(0);" class="cross_pop_bt" onclick="TB_remove()" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+jsBaseUrl+'images/cross_icon.png\'); float:right; cursor:pointer;"><img src="'+jsBaseUrl+'images/cross_icon.png" alt="cross_icon" width="42" height="42" style="filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" /></a>\
			</div>\
			<div class="popmiddle-image">\
				<div class="frnds_form_report2">Report inappropriate comment</div>\
				<div class="popup_form_report2">\
					<div id="errmsg" class="float_left" style="width:96%;font-size:12px; padding-bottom:5px; padding-top:10px;"><img src="'+jsBaseUrl+'images/spacer.gif"/></div>\
					<form id="reportFrm" action="'+jsBaseUrl+'user/user_report" method="post" target="ajaxframe">\
						<input type="hidden" name="task" value="dosend_report">\
						<input type="hidden" id="rtype" name="rtype" value="'+bind.options.type+'">\
						<input type="hidden" id="rtypeid" name="rtypeid" value="'+bind.options.typeID+'">\
						<input type="hidden" name="comment_id" id="comment_id" value="'+commentID+'">\
						<textarea onClick="if(this.value == \''+_txt+'\'){this.value=\'\';}" onBlur="if(this.value == \'\'){this.value=\''+_txt+'\';}" id="report_details" name="report_details" rows="5" cols="30" class="w415">'+_txt+'</textarea><br />\
						<div class="okbtn_search"><div class="reportBt" id="ok_bt_report"><input type="image" src="'+jsBaseUrl+'images/report_btn.gif" /></div></div>\
					</form>\
				</div>\
			</div>\
			<div class="popbottom-image"><img src="'+jsBaseUrl+'images/spacer.gif"/></div>\
		</div>';
		$('creport').set('html', innerHTML);
		TB_show('', '#TB_inline?height=auto&width=460&inlineId=creport', '', jsBaseUrl+'images/trans.gif');
	},
	
	deleteBox: function(commentID){
		var bind = this;
		var innerHTML = '<div class="frSrhPop_light" id="addFavBlogPop">\
			<div class="poptop-image"><div class="del_com_text" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=\'true\', sizingMethod=\'fixed\', src=\''+jsBaseUrl+'images/delete_comment.png\');"></div>\
			<a href="javascript:void(0);" class="cross_pop_bt" onclick="TB_remove()" style="filter:progid:DXImageTransform.Microsoft.AlphaImageLoader(src=\''+jsBaseUrl+'images/cross_icon.png\'); float:right; cursor:pointer;"><img src="'+jsBaseUrl+'images/cross_icon.png" alt="Close" width="42" height="42" style="filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" /></a></div>\
			<div class="popmiddle-image">\
				<div class="popup_form_search pb10">\
					<div id="errmsg" class="pb5"><img src="'+jsBaseUrl+'images/spacer.gif"/></div>'+bind.Base.Language.Translate(1026)+'<br />\
					<form action="'+jsBaseUrl+'user/misc_js" method="post" target="ajaxframe">\
						<input type="hidden" name="task" value="comment_delete">\
						<input type="hidden" name="comment_id" id="del_comment_id" value="'+commentID+'">\
						<input type="hidden" name="type" value="' + bind.options.type + '">\
						<input type="hidden" name="iden" value="' + bind.options.typeIdentifier + '">\
						<input type="hidden" name="isCached" value="' + this.options.isCached + '">\
						<input type="hidden" name="value" value="' + bind.options.typeID + '">';
						if( bind.options.object_owner && bind.options.object_owner_id ){
							innerHTML += '<input type="hidden" name="object_owner" value="' + bind.options.object_owner + '"><input type="hidden" name="object_owner_id" value="' + bind.options.object_owner_id + '">';
						}
						else {
							innerHTML += '<input type="hidden" name="user" value="' + bind.Base.Owner.user_info.user_username + '">';
						}
						if( bind.options.typeTab){
							innerHTML += '<input type="hidden" name="tab" value="' + bind.options.typeTab + '">';
						}
						if( bind.options.typeCol ){
							innerHTML += '<input type="hidden" name="col" value="' + bind.options.typeCol + '">';
						}
						if( bind.options.typeTabParent ){
							innerHTML += '<input type="hidden" name="tab_parent" value="' + bind.options.typeTabParent + '">';
						}
						if( bind.options.typeColParent ){
							innerHTML += '<input type="hidden" name="col_parent" value="' + bind.options.typeColParent + '">';
						}
						if( this.options.typeChild ){
							innerHTML += '<input type="hidden" name="child" value="1">';
						}
					innerHTML += '<div class="okbtn_search">\
						<div class="yesPopBt cursor"><input type="image" src="'+jsBaseUrl+'images/yes_btn.gif" /></div>\
						<div class="noPopBt cursor" onclick="TB_remove()"><img src="'+jsBaseUrl+'images/spacer.gif"/></div>\
					</div></form>\
				</div>\
			</div>\
			<div class="popbottom-image"><img src="'+jsBaseUrl+'images/spacer.gif"/></div>\
		</div>';
		$('creport').set('html', innerHTML);
		TB_show('', '#TB_inline?height=auto&width=460&inlineId=creport', '', jsBaseUrl+'images/trans.gif');
	}
});