Topic: Xajax class embed lose session values

Hi everybody.

I need some help from the community about a problem of how to embed xajax functions in a class.

Firstly I'm going to show a script working fine:

[php code]

ejemplo.php

<?php
    require_once("prueba.class.php");

    session_start();

    require_once('../xajax/xajax_core/xajax.inc.php');

    $xajax = new xajax;

    function xincrementar_variable(){

        $respuesta = new xajaxResponse();

        $_SESSION['objeto']->incrementar();

        $respuesta->alert($_SESSION['objeto']->devolver_valor());

        return $respuesta;

    }

    $xajax->register(XAJAX_FUNCTION, 'xincrementar_variable');

    $xajax->processRequest();

    $_SESSION['objeto'] = new prueba();

?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Gestión de Sustituciones</title>
<?php $xajax->printJavascript('../xajax'); ?>
</head>
<body>
<span onclick="xajax_xincrementar_variable()">Incrementar variable</div>
</body>
</html>

[php code]

prueba.class.php

class prueba
{

    private $_variable = 1;

    function prueba(){}

    public function incrementar(){ $this->_variable++; }

    public function devolver_valor(){ return $this->_variable; }


}

This script is very simple. It only increase by one the value of $_variable and show it with $respuesta->alert($_SESSION['objeto']->devolver_valor()). My problem appears when y embed xajax inside the class:

[php code]

ejemplo.php

<?php
    require_once("prueba.class.php");

    session_start();

    $objeto = new prueba();
?>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Gestión de Sustituciones</title>
<?php echo $objeto->_xajax_js; ?>
</head>
<body>
<span onclick="xajax_xincrementar_variable()">Incrementar variable</div>
</body>
</html>

[php code]

prueba.class.php

class prueba
{

    private $_xajax;               

    public $_xajax_js;               

    private $_variable = 1;

    public function __construct()
    {

        require_once('../xajax/xajax_core/xajax.inc.php');

        $this->_xajax = new xajax;

        $this->_xajax->register(XAJAX_FUNCTION, array('xincrementar_variable',$this,'xincrementar_variable'));

        $this->_xajax->processRequest();

        $this->_xajax_js = $this->_xajax->getJavascript('../xajax');

    }

    public function xincrementar_variable(){

        $respuesta = new xajaxResponse();

        $this->_variable++;

        $respuesta->alert($this->_variable);

        return $respuesta;

    }

}

Each time I click on "incrementar variable", $respuesta->alert always show me the value "2". I don't know why xajax restarts the session values. ¿Is there any solution? I need to use classes stored in $_SESSION due to the characteristics of my project.

Thanks in advance.

(Sorry about my poor english)