function ChatCore() {
	this.currentPage = Object();
	//this.formHTML = 'abcd';
	this.currentReplyForm = 0;
	
	this.Post = function(eventid,content) {	
	
	 
		var data = new Object();	
		data['content'] = encodeURIComponent(content);
		data['eventid'] = eventid;
		data['action'] = 'post';
		data['widget'] = 'chat';
		$('msg').value="";
		this.InitializeRequest('POST', '/ajax.php');
        this.Commit(postquery(data));
	}
	
	this.DeleteRealUser = function(eventid,onlineid) {
		var data = new Object();	
		
		data['onlineid'] = onlineid;
		data['eventid'] = eventid;
		data['action'] = 'deleterealuser';
		data['widget'] = 'chat';
		

		this.InitializeRequest('POST', '/ajax.php');
        this.Commit(postquery(data));
	}
	
	this.AddRealUser = function(eventid,usertitle,userid) {
		var data = new Object();	
		
		data['usertitle'] =encodeURIComponent(usertitle);
		data['userid'] = userid;
		data['eventid'] = eventid;
		data['action'] = 'addrealuser';
		data['widget'] = 'chat';
		

		this.InitializeRequest('POST', '/ajax.php');
        this.Commit(postquery(data));
	}
	
	this.Delete = function(msgid) {
		var data = new Object();	
		
		data['msgid'] = msgid;
		data['action'] = 'delete';
		data['widget'] = 'chat';
		

		this.InitializeRequest('POST', '/ajax.php');
        this.Commit(postquery(data));
		
	}
	
	this.Refresh = function(eventid) {
		var data = new Object();	
		data['eventid'] = eventid;
		data['action'] = 'refresh';
		data['widget'] = 'chat';
		data['lastmsg'] = window.lastMsg;
		

		this.InitializeRequest('POST', '/ajax.php');
        this.Commit(postquery(data));
		
	}
	
	this.Scroll = function() {
		$('chatwindow').scrollTop=$('chatwindow').scrollHeight-$('chatwindow').clientHeight;
		
	}
	
	this.PostByAdmin = function(eventid,content,onlineid) {	
		
	
		var data = new Object();	
		data['content'] = encodeURIComponent(content);
		data['eventid'] = eventid;
		data['onlineid'] = onlineid;
		data['action'] = 'postbyadmin';
		data['widget'] = 'chat';
$('msg').value="";
		this.InitializeRequest('POST', '/ajax.php');
        this.Commit(postquery(data));
	}
	this.OnSuccess = function() {
      	//alert(this.GetResponseText());
      	eval(this.GetResponseText());
    
    }
	
}
ChatCore.prototype = new ajax();
Chat = new ChatCore();

