function createObject() {

    this.DelayTime = 12000;

    this.DelayCount = 1;

    this.ActivePageName = "Start";

    this.objPerson = new Object();

    this.objPerson.LoginStatus = false;

    this.objPerson.VisitorsId = false;

    this.objPerson.MessageSendUser = "";

    this.objPerson.Id = false;

    this.DelayControl = null;

    this.FirstCommunication = true;

    this.StartQueue = 1;

    if (this.FirstCommunication) {
	this.FirstCommunication = true;
	xajax_StartClient();
    }
}

var objPage = new createObject();

objPage.setactivePage = function(Page) {
    
    if(this.ActivePageName == "AvatarPage" && Page != "AvatarPage"){
	$('div[class^=imgareaselect]').remove();
	swfu = null;
	this.onchangeAvatarPage = function(){};
    }

    this.ActivePageName = Page;
}

objPage.setloadingMessage = function(Status) {
    if (Status) {
	xajax.callback.global.onRequest = function() {
	    xajax.$('ajaxContainer').style.display = 'block';
	    $('#garbage').html("1");
	};

	xajax.callback.global.onComplete = function() {
	    xajax.$('ajaxContainer').style.display = 'none';
	    document.title = 'www.keyfichat.com';
	};
    } else {
	xajax.callback.global.onRequest = function() {
	};
	xajax.callback.global.onComplete = function() {
	};

    }
}

objPage.startServerCommunication = function() {
    this.DelayControl = setInterval('objPage.ClientControl()', this.DelayTime);
}

objPage.stopServerCommunication = function() {
    clearInterval(this.DelayControl);
}

objPage.DomClear = function(DomId) {
    $("#" + DomId + "").html("");
}

objPage.ClientControl = function() {
    this.setloadingMessage(false);
    xajax_ClientControl(objPage.objPerson.Id, objPage.ActivePageName,
	    objPage.DelayCount);
    this.DelayCount = this.DelayCount + 1;
    this.setloadingMessage(true);
}

objPage.objPerson.setId = function(Id) {
    if (Id > 0) {
	objPage.objPerson.Id = Id;
	objPage.objPerson.LoginStatus = true;
    } else {
	objPage.objPerson.Id = null;
	objPage.objPerson.LoginStatus = false;
	objPage.objPerson.VisitorsId = false;
    }
}

objPage.objPerson.setVisitorsId = function(Id) {
    if (objPage.objPerson.LoginStatus) {
	objPage.objPerson.VisitorsId = Id;
    } else {
	objPage.objPerson.Id = null;
	objPage.objPerson.VisitorsId = null;
	objPage.DomClear("VisitorsHeader");
    }
};

objPage.firstLoginControl = function() {
    if (objPage.ActivePageName != 'firstLogin') {
	//xajax_Profile_FirstLoginProcess();
    }
}
