function CommentsCore() {
	this.currentPage = Object();
	this.ident ='';
	//this.formHTML = 'abcd';
	this.currentReplyForm = 0;
	
	this.openReplyForm  = function(ident,_commentid) {
		if(this.currentReplyForm!=0) $('replyform_'+this.currentReplyForm).innerHTML = '';
		tmp = $('formcontainer').innerHTML;
		tmp = tmp.replace(/{commentid}/, _commentid);	
		$('replyform_'+_commentid).innerHTML = tmp;
		$('form_'+ident).innerHTML = '';
		this.currentReplyForm = _commentid;
	}
	
	this.Del  = function(_commentid) {		
		$("coment_"+_commentid).style.display = 'none';
		var data = new Object();	
		data['commentid'] = _commentid;
		data['action'] = 'del';
		data['widget'] = 'comments';

		this.InitializeRequest('POST', '/ajax.php');
        this.Commit(postquery(data));
	}
	
	this.Post = function(ident,namefull,nickname,email,content,captcha,parentid,target) {	
		this.ident = ident;
	    setFade(0,"form_"+ident);
		$("loading_"+this.ident).style.display = 'block';
		var data = new Object();	
		data['content'] = encodeURIComponent(content);
		data['nickname'] = encodeURIComponent(nickname);
		data['email'] = encodeURIComponent(email);
		data['captcha'] = encodeURIComponent(captcha);
		data['ident'] = ident;
		data['parentid'] = parentid;
		data['namefull'] = namefull;
		data['target'] = encodeURIComponent(target);
		data['action'] = 'post';
		data['widget'] = 'comments';

		this.InitializeRequest('POST', '/ajax.php');
        this.Commit(postquery(data));
	}
	
	this.OnSuccess = function() {
      	//alert(this.GetResponseText());
      	eval(this.GetResponseText());
      	fade(0,"form_"+this.ident);
      	$("loading_"+this.ident).style.display = 'none';
    }
	
}
CommentsCore.prototype = new ajax();
Comments = new CommentsCore();

