/**
 *  ======================================================================  *
 *  Biblioteca de Funções 
 *  ======================================================================  *
 *  arquivo: CLdo.lib.js
 *  versão: 1.00
 *  revisão: 012
 *  data criação: 14/02/2007
 *  data atualização: 02/02/2008
 *  dependencia: ECMAScript 1.3
 *  categoria:  biblioteca JavaScript
 *  modulo: CORE 
 *  since: 0.00.001
 *  autor: Ricardo Othuki           <ricardoothuki@phpage.com.br>
 *  copyLeft: Zaes Tecnologia
 *  @versao:
 *  ----------------------------------------------------------------------  *
 */
 
/**
 *  ----------------------------------------------------------------------  *
 *  definição das variáveis Globais
 *  ----------------------------------------------------------------------  *
 */


/**
 *  ----------------------------------------------------------------------  *
 *  CLdo - Controle de carga Dinamica de Script JS
 *  ----------------------------------------------------------------------  *
 *  o CLdo utiliza 3 (três) array´s globais para o controle de carga dinamica
 *  de arquivos. Cada array funciona como uma fila do tipo FIFO
 *
 *  _load_    =>  nome dos arquivos carregados
 *  _loading_ =>  nome dos arquivos em carga (carga não completada)
 *  _dinamic_ =>  nome dos objetos com carga tipo dinamica
 *  _readOBJ_ =>  nome dos objetos com carga tipo dinamica ja carregados
 *  ----------------------------------------------------------------------  *
 *  loadSearch()
 *  loadAdd()
 *  loadEnd()
 *  setSCRIPT_JS()
 *  getSCRIPT_JS()
 *  readSCRIPT_JS()
 *  getReadObj()
 */

/**
 *  ----------------------------------------------------------------------  *
 *  loadSearch()
 *  ----------------------------------------------------------------------  *
 *  verifica se um arquivo esta registrado na fila de Carga dinamica
 *
 *  verifica se o arquivo "_file_" esta cadastrado na fila "_s_" de arquivos
 *  carregados dinamicamenteno no CLdo - Controle de Carga completado
 *
 *  _s_ deve ser uma das duas filas disponíveis:
 *    _load_    = fila com os arquivos que devem ser carregados
 *    _loading_ = fila com os arquivos que iniciaram a carga mais ainda
 *                não foram completamente carregados
 *  ----------------------------------------------------------------------  *
 *  @param string _file_    nome do arquivo
 *  @param string _s_       nome da fila (array)
 *  ----------------------------------------------------------------------  *
 */
function loadSearch( _file_, _s_ )
{
  var ret_ = false;
  
  for( var _i = 0; _i < this.load.length; _i ++ )
  {
    if( _s_ == null || _s_ == 'load' )
    {
      if( this.load[ _i ] == _file_ )
      {
        ret_ = true;
        break;
      }// End if( this.load[ _i ] == _file_ )
    }else
    {
      if( this.loading.length >= _i )
      {
        if( this.loading[ _i ] == _file_ )
        {
          ret_ = true;
          break;
        }// End if( this.loading[ _i ] == _file_ )
      }// End if( this.loading.length >= _i )
    }// End if( _s_ == null || _s_ == 'load' )
  }// End for( var _i = 0; _i < this.load.length; _i ++ )
  
  
  return( ret_ );
}// End function loadSeach( _file_ )

/**
 *  ----------------------------------------------------------------------  *
 *  loadAdd()
 *  ----------------------------------------------------------------------  *
 *  cadastra o arquivo '_file_' na fila de controle do CLdo
 *  ----------------------------------------------------------------------  *
 */
function loadAdd( _file_, _fila_ )
{
//  _load_.push( _file_ );
  this.loading.push( _file_ );
  
  _fila_.push( _file_ );
  
}// End function loadAdd( _file_ )

/**
 *  ----------------------------------------------------------------------  *
 *  setReadObj()
 *  ----------------------------------------------------------------------  *
 *  cadastra o objeto "_objID_" na fila "_readOBJ_"
 *
 *  cadastra um objeto na fila "_readOBJ_" de objetos com 
 *  carga dinamica ja carregados
 *  ----------------------------------------------------------------------  *
 */
function setReadObj( _objID_ )
{
  _readOBJ_.push( _objID_ );
}// End function setReadObj( _objID_ )

/**
 *  ----------------------------------------------------------------------  *
 *  getReadObj()
 *  ----------------------------------------------------------------------  *
 *  verifica se o objeto "_objID_" esta cadastrado na fila "_readOBJ_"
 *
 *  verifica um objeto na fila "_readOBJ_" de objetos com
 *  carga dinamica ja carregados
 *  ----------------------------------------------------------------------  *
 */
function getReadObj( _objID_ )
{
  var ret_ = false;
  for( var _i in _readOBJ_ )
  {
    if( _readOBJ_[ _i ] == _objID_ )
    {
      ret_ = true;
      break;
    }// End if( _readOBJ_[ _i ] == _objID_ )
  }// End for( var _i = 0; _i < _readOBJ_.length; _i ++ )
  
  return ret_;
}// End function getReadObj( _objID_ )


/**
 *  ----------------------------------------------------------------------  *
 *  loadEnd()
 *  ----------------------------------------------------------------------  *
 */
function loadEnd( _file_ )
{
//  alert( _file_ );
  for( var _i = 0; _i < this.load.length; _i ++)
  {
    if( this.loading[ _i ] == _file_ )
    {
      //var ar_ = _loading_.splice( _i, 1 );
      var ar_ = this.loading.splice( _i, 1 );
      
      //alert('del: '+_file_+' ['+_loading_+'] ['+ar_+']');
    }// End if( _load_[ _i ] == _file_ )
  }// End for( var _i = 0; _i < _load_.length; _i ++)
}// End function loadEnd( _file_ )

 
/**
 *  ======================================================================  *
 *  Funções para os arquivos tipo JavaScript
 *  ======================================================================  *
 */
/**
 *  ----------------------------------------------------------------------  *
 *  setSCRIPT_JS()
 *  ----------------------------------------------------------------------  *
 *  Registra um objeto como carga tipo dinamica
 *  ----------------------------------------------------------------------  *
 *  @param  string    _objID_
 *  ----------------------------------------------------------------------  *
 */
function setSCRIPT_JS( _objID_ )
{
  _dinamic_.push( _objID_ );
}// End function setSCRIPT_JS( nFile_ )

/**
 *  ----------------------------------------------------------------------  *
 *  getSCRIPT_JS()
 *  ----------------------------------------------------------------------  *
 *  Verifica se o objeto esta registrado como carga tipo dinamica
 *  ----------------------------------------------------------------------  *
 *  @param  string    _objID_
 *  ----------------------------------------------------------------------  *
 */
function getSCRIPT_JS( _objID_ )
{
  var ret_ = false;
  
  for( var _d_ in _dinamic_ )
  {
    if( _dinamic_[ _d_ ] == _objID_ )
    {
      ret_ = true;
      break;
    }// End if( _dinamic_[ _d_ ] == _objID_ )
  }// End for( var _d_ in _dinamic_ )
  
  return ret_;
}// End function getSCRIPT_JS( nFile_ )

/**
 *  ----------------------------------------------------------------------  *
 *  readSCRIPT_JS()
 *  ----------------------------------------------------------------------  *
 *  Carrega um arquivo de Script JS do Servidor para o Client da Aplicação
 *  ----------------------------------------------------------------------  *
 *  @param  string    nFile_  nome do arquivo a ser carregado
 *  @param  string    nPath_  nome do Path
 *  @param  string    nFila_  nome da Fila de controle de carga
 *  ----------------------------------------------------------------------  *
 */
function readSCRIPT_JS( nFile_, nPath_, nFila_ )
{
  var _head    = document.getElementsByTagName( 'head' );
  var _nodeDOM = document.getElementById( 'script_' + nFile_ );
  var _nPath   = appWeb.dirRoot + ( ( nPath_ == null ) ? appWeb.dirLib : nPath_ );
  var _nFila   = ( nFila_ == null ) ? appWeb.load : nFila_;
    
  
  if( _nodeDOM == null )
  {
    var _tag  = document.createElement('script');
    
    _tag.setAttribute( 'type', 'text/javascript' );
    _tag.setAttribute( 'src', _nPath + nFile_ + '.js?_r=' + Math.random() );
    _tag.setAttribute( 'id', 'script_' + nFile_ );
    
//alert(_nPath + nFile_);
    _head[0].appendChild( _tag );
  }else
  {
    _nodeDOM.setAttribute( 'src', _nPath + nFile_ + '.js?_r=' + Math.random() );
  }// End if()
  
/**
 *  ----------------------------------------------------------------------  *
 *  cadastra o arquivo no CLdo - Control Loaded (controle de carga completado)
 *  ----------------------------------------------------------------------  *
 */
  this.loadAdd( nFile_, _nFila );
}// End function readSCRIPT_JS( nFile_, nPath_ )

/**
 *  ----------------------------------------------------------------------  *
 *  loadEvento()
 *  ----------------------------------------------------------------------  *
 *  realiza a carga dinamica dos arquivos de eventos de ação do objeto
 *  ----------------------------------------------------------------------  *
 *  @param  string  _nComp_   Nome do componente
 *  @param  string  _objID_   ID do objeto
 *
 *  @return
 */
function loadEvento( _nComp_, _objID_ )
{
  if( arguments.length == 2 )
  {
    var _nV_  = _nTentativas_;
    var _cmd_ = 'this.loadEvento( "' + _nComp_ + '", "' + _objID_ + '", ' + _nV_ + ' );';
    setTimeout( _cmd_, _nWait_ );
  }else
  {
    _nV_ = arguments.length[ 2 ] - 1;
  }// End if( arguments.length == 2 )

  if( _nV_ >= 0 )
  {
    var n_Lib_ = _nComp_ + '.lib';
    
    if( this.loadSearch( n_Lib_, 'loading' ) )
    {
      var _cmd_ = 'this.loadEvento( "' + _nComp_ + '", "' + _objID_ + '", ' + _nV_ + ' );';
      setTimeout( _cmd_, _nWait_ );
    }else
    {
      var _cmd_obj = 'this.loadEvento_' + _nComp_ + '( "' + _objID_ + '" );';
      eval( _cmd_obj );
    }// End if( this.loadSearch( n_Lib_, 'loading' ) )
  }else
  {
    // seta controle de erro
  }// End if( _nV_ >= 0 )
}// End function loadEvento( objID )

/**
 *  ======================================================================  *
 *  Funções para os arquivos tipo CSS
 *  ======================================================================  *
 */
/**
 *  ----------------------------------------------------------------------  *
 *  readCSS_()
 *  ----------------------------------------------------------------------  *
 *  Carrega um arquivo CSS
 *
 *  faz uma chamada dinamica a "nFile_" para o Head do Browser
 *  ----------------------------------------------------------------------  *
 *  @param  string  nFile_   nome do arquivo CSS
 *  @param  string  nPath_   caminho do arquivo
 *
 *  @return null
 */
function readCSS_( nFile_, nPath_ )
{
  if( _in_RAD_ )
  {
    var _nHead_ = 'head_PhPage';
  }else
  {
    var _tmp_   = _status_[0].split( ':' );
    var _nPrj_  = _tmp_[ 1 ];
    var _nHead_ = 'head_' + _nPrj_;
  }// End if( _in_RAD_ )
//alert( _in_RAD_+' : '+ _nHead_ + ' = ' +_nPrj_+'   '+nPath_+' :: '+nFile_);

//  var headDOM = findDOM( _nHead_ );
  var _hRef_  = new String( nPath_ + nFile_ + '.css?_r=' + Math.random() );
  
  var _link_  = document.createElement( 'link' );

  _link_.setAttribute( 'rel' , 'stylesheet');
  _link_.setAttribute( 'type', 'text/css');
  _link_.setAttribute( 'href', _hRef_ );
  _link_.setAttribute( 'media', 'all' );
  _link_.setAttribute( 'id', 'head_' + nFile_ );
  
  //headDOM.appendChild( _link_ );
  this.nodeHead.appendChild( _link_ );
}// End function readCSS_( nFile_, nPath )

/**
 *  ----------------------------------------------------------------------  *
 *  loadFileCSS()
 *  ----------------------------------------------------------------------  *
 *  Carrega os arquivos CSS dos objetos incluidos no projeto
 *  ----------------------------------------------------------------------  *
 */
function loadFileCSS()
{
  for( var i_ = 0; i_ < _objetos_.length; i_ ++ )
  {
    var _arr = _objetos_[ i_ ].split( ';' );
    for( var ii_ = 0; ii_ < _arr.length; ii_ ++ )
    {
      if( _arr[ ii_ ] != '' )
      {
        //readCSS( _arr[ ii_ ], 'styles/' );
      }// End if( _arr[ ii_ ] != '' )
    }// End for( var ii_ = 0; ii_ < _arr.length; ii_ ++ )
  }// End for( var i_ = 0; i_ < _objetos_.length; i_ ++ )
}// End function loadFileCSS()

/**
 *  ----------------------------------------------------------------------  *
 *  mainGaugeOn()
 *  ----------------------------------------------------------------------  *
 */
function mainGaugeOn()
{
  mainDOM = findDOM( 'page1' );
}// End 
/**
 *  ----------------------------------------------------------------------  *
 *  mainGaugeOff()
 *  ----------------------------------------------------------------------  *
 */
function mainGaugeOff()
{
  //mainDOM.style.visibility = 'visible';
}// End 

/**
 *  ----------------------------------------------------------------------  *
 *  sayLoadingSplash()
 *  ----------------------------------------------------------------------  *
 */
function sayLoadingSplash()
{
  var _width  = 300;
  var _height = 160;
//  var _top  = __disp_Y__ / 2 - _height;
//  var _left = __disp_X__ / 2 - _height;

  if( this.showSplash )
  {
    var _top  = 350 - _height;
    var _left = 450 - _height;
  }else
  {
    var _top  = -500;
    var _left = -500;
  }
  
/**
 *  ----------------------------------------------------------------------  *
 *  cria a windPage do Splash
 *  ----------------------------------------------------------------------  *
 */
  this.nodeSplash = document.createElement( 'div' );
  var _style = 'position: absolute;'                                      +
               'top:' + _top + 'px;'                                      +
               'left:' + _left + 'px;'                                    +
               'width:' + _width + 'px;'                                  +
               'height:' + _height + 'px;'                                +
               'padding:4px;'                                             +
               'font-size: '               + appWeb.FontSize + 'px;'      +
               'background-color:'         + appWeb.ActiveBorder + ';'    +
               'border-top:1px solid '     + appWeb.ButtonHighlight + ';' +
               'border-bottom:1px outset ' + appWeb.ButtonShadow + ';'    +
               'border-left:1px solid '    + appWeb.ButtonHighlight + ';' +
               'border-right:1px outset '  + appWeb.ButtonShadow + ';'    +
               'color:#000000;'                                           +
               'visibility:visible;'                                      +
               'z-index:500;'                                             ;
               
  this.setAttribute( this.nodeSplash, 'id', 'splashDiv' );
  this.setAttribute( this.nodeSplash, 'style', _style );
  
//  insere a logomarca
  var _logoDom = document.createElement( 'img' );
  var _style = 'position: absolute;' +
               'top: 20px;'          +
               'left: 20px;'         ;
  this.setAttribute( _logoDom, 'id', "splashLogo" );
  this.setAttribute( _logoDom, 'src', this.logoImg.src );
  this.setAttribute( _logoDom, 'style', _style );
  
  this.nodeSplash.appendChild( _logoDom );
  
// insere o gauge
  var _gaugeDom = document.createElement( 'img' );
  var _style = 'position: absolute;' +
               'top: 70px;'          +
               'left: 250px;'         ;
  this.setAttribute( _gaugeDom, 'id', "splashGauge" );
  this.setAttribute( _gaugeDom, 'src', appWeb.gaugeImg.src );
  this.setAttribute( _gaugeDom, 'style', _style );
  
// insere o Texto 1  
  var _waitDom = document.createElement( 'div' );
  var _txt1Dom = document.createTextNode( 'Carregando Aplicativo WEB 2.0...' );
  var _style = 'position: absolute;' +
               'top:80px;'           +
               'left:50px;'          +
               'font-size:10px;'     +
               'color:#606060;'      ;
  this.setAttribute( _waitDom, 'id', "splashWait" );
  this.setAttribute( _waitDom, 'style', _style );
  
  _waitDom.appendChild( _txt1Dom );
  
//  inserindo Texto 2
  var _statusDom = document.createElement( 'div' );
  var _style = 'position: absolute;' +
               'top:120px;'          +
               'left:20px;'          +
               'width:' + (_width - 40) + 'px;' +
               'height:30px;' +
//               'background-color:#FFFFFF;'+
               'font-size:12px;'     +
               'color:#333366;'      ;
  this.setAttribute( _statusDom, 'id', "splashStatus" );
  this.setAttribute( _statusDom, 'style', _style );

  this.nodeSplash.appendChild( _gaugeDom );
  this.nodeSplash.appendChild( _waitDom );
  this.nodeSplash.appendChild( _statusDom );
  
  //_bodyDom.insertBefore( _splashDom, _bodyDom.firstChild );
  this.nodeBody.insertBefore( this.nodeSplash, this.nodeBody.firstChild );

}// End function sayLoadingSplash()

/**
 *  ----------------------------------------------------------------------  *
 *  sayLoadingStatus()
 *  ----------------------------------------------------------------------  *
 */
function sayLoadingStatus( _mod_, _txt_ )
{
  var _statusDom = findDOM( 'splashStatus' );
  _statusDom.innerHTML = _mod_ + ' : ' + _txt_;
}// End function sayLoadingStatus( _mod_, _txt_ )

/**
 *  ----------------------------------------------------------------------  *
 *  sayLoadingOff()
 *  ----------------------------------------------------------------------  *
 */
function sayLoadingOff()
{
//var _bodyDom   = findDOM( 'bodyID' );
/*  
  var _bodyDom = window.document.getElementsByTagName( 'body' )[ 0 ];
  
  var _mainDom   = findDOM( 'page1' );
  var _splashDom = findDOM( 'splashDiv' );
  
  _splashDom.style.visibility = 'hidden';
  
  if( _mainDom != null )
  {
    _mainDom.style.visibility = 'visible';
  }// End 
*/
  this.setAttribute( this.nodeSplash, 'visibility', 'hidden' );

}// End function sayLoadingOff()

/**
 *  ----------------------------------------------------------------------  *
 *  startOnLoad()
 *  ----------------------------------------------------------------------  *
 *  inicia a carga da aplicação
 *
 *  esta função verifica se o navegador ja esta pronto para iniciar a 
 *  carga dos arquivos da aplicação, e executa o procedimento onLoad 
 *  do client da appWeb.
 */
var _idx_ = 0;
function startOnLoad()
{
  _idx_ ++;
  if( _idx_ < 1000 )
  {
/**
 *  ----------------------------------------------------------------------  *
 *  aguarda a criação do node "body" na arvore do DOM pelo Browser
 *  caso positivo:
 *  1º captura o evento onLoad do Browser
 *  2º cria a page principal da aplicação (page0)
 *  3º mostra a tela de apresentação (splash) 
 *  4º instancia a aplicação WEB 2.0
 *  ----------------------------------------------------------------------  *
 */
    this.nodeBody = document.getElementsByTagName( 'body' )[0];
//alert(_idx_);    
    if( this.nodeBody == null )
    {
      setTimeout( 'appWeb.startOnLoad();', 10 );
    }else
    {
/**
 *  ----------------------------------------------------------------------  *
 *  1º Passo - captura e redireciona o evento onLoad do Browser
 *  ----------------------------------------------------------------------  *
 */
      appWeb.setEvento( window, "load", onLoadPage );
/**
 *  ----------------------------------------------------------------------  *
 *  2º Passo - cria a page principal da appWeb (page0)
 *  ----------------------------------------------------------------------  *
 */
      this.nodeHead = document.getElementsByTagName( 'head' )[0];
      
      if( document.getElementById('page0') == null )
      {
        this.nodePage = document.createElement( 'div' );
        this.setAttribute( this.nodePage, 'id', 'page0' );
        
        this.nodeBody.insertBefore( this.nodePage, this.nodeBody.firstChild );
      }else
      {
        this.nodePage = document.getElementById('page0');
      }// End if()
      
      
/**
 *  ----------------------------------------------------------------------  *
 *  3º Passo - apresenta a tela de Splash
 *  ----------------------------------------------------------------------  *
 */
      appWeb.sayLoadingSplash();
/**
 *  ----------------------------------------------------------------------  *
 *  4º Passo - instancia uma nova sessão no servidor de aplicação (appServer)
 *
 *  solicita permissão para executar a aplicação
 *  o retorno deste Webservice é em formato JSON
 *  ----------------------------------------------------------------------  *
 */
      var _url = appWeb.dirRoot + appWeb.dirAppServer + 'RPC_instanceAppWeb.php'
//alert( _url );      
      appWeb.ajax = new classAjax();
			appWeb.ajax.setURL( _url );
			appWeb.ajax.setReturnTo( appWeb.startApp );
			appWeb.ajax.conectar();
      
    }// End if( this.nodeBody == null )
  }// End if( _idx_ < 1000 )
  
  //alert('node: '+ appWeb.nodePage.id );
}// End function startOnLoad()

/**
 *  ----------------------------------------------------------------------  *
 *  sayErrorLoad()
 *  ----------------------------------------------------------------------  *
 */
function sayErrorLoad( step )
{
  //alert( _loading_ );
  alert('log de erro[' + step + '] : ' + this.nV );
}// End metodo

/**
 *  ----------------------------------------------------------------------  *
 *  saveErrorLoad()
 *  ----------------------------------------------------------------------  *
 *  cadastra o arquivo na fila de Erro de Carga do CLdo.
 */
function saveErrorLoad( _var )
{
  appWeb.errLoad.push( _var ); 
  //alert( document.getElementById( _var ).src );
}// End metodo

/**
 *  ----------------------------------------------------------------------  *
 *  saveErrorCodi()
 *  ----------------------------------------------------------------------  *
 *  cadastra o arquivo na fila de Erro de Codificação (sintaxe).
 */
function saveErrorCodi( _var, _func )
{
  appWeb.errCode.push( _var );
  
  if( _func != null )
  {
  appWeb.errFunc.push( _func ); 
  }// End if()
  alert( document.getElementById( _var ) );
}// End metodo

/**
 *  ----------------------------------------------------------------------  *
 *  recoverErrorLoad()
 *  ----------------------------------------------------------------------  *
 *  tenta recuperar um erro de Carga dinamica de um Objeto
 */
function recoverErrorLoad()
{ 
  if( appWeb.errLoad.length > 0 )
  {
/**
 *  ----------------------------------------------------------------------  *
 *  percorre a fila:  appWeb.errLoad   (erro de Carga) 
 *  ----------------------------------------------------------------------  *
 */
    for( var _ix in appWeb.errLoad )
    {
      if( appWeb.nTrecover == 0 )
      {
        alert('erro Fatal em: ' + appWeb.errLoad[_ix] );
        appWeb.errLoad.splice( _ix, 1 );
      }else
      {
        appWeb.nTrecover --;
/**
 *  ----------------------------------------------------------------------  *
 *  verifica se existe erro de Sintaxe no arquivo
 *  ----------------------------------------------------------------------  *
 */
        if( appWeb.errCode.length > 0 )
        {
          alert( "erro de sintaxe em[ " + appWeb.errFunc[0] + "]\n\n" + _err.description );
          appWeb.errLoad.splice( _ix, 1 );
        }else
        {
/**
 *  ----------------------------------------------------------------------  *
 *  recarrega novamente o arquivo
 *  ----------------------------------------------------------------------  *
 */
        var _nodeDOM = appWeb.findDOM( 'script_' + appWeb.errLoad[ _ix ] );
        var _src = _nodeDOM.src.replace( /\?_r\=[^&]+|$/, "?_r=" + Math.random() );
        
        _nodeDOM.src = _src;
        
        appWeb.errLoad.splice( _ix, 1 );
      //alert( 'err: '+appWeb.errLoad );
        
        appWeb.startPage( 0, appWeb.nTentativas );
        }// End if()
      }// End if()
    }// End for()
  }// End if()
}// End metodo



/**
 *  ----------------------------------------------------------------------  *
 *  extend a classe classAppWeb
 *  ----------------------------------------------------------------------  *
 *  adiciona os metodos do Módulo de controle de carga
 */
  classAppWeb.prototype.loadSearch       = loadSearch;
  classAppWeb.prototype.loadAdd          = loadAdd;
  classAppWeb.prototype.loadEnd          = loadEnd;
  classAppWeb.prototype.loadEvento       = loadEvento;
  classAppWeb.prototype.readSCRIPT_JS    = readSCRIPT_JS;
  classAppWeb.prototype.sayLoadingSplash = sayLoadingSplash;
  classAppWeb.prototype.sayLoadingStatus = sayLoadingStatus;
  classAppWeb.prototype.sayLoadingOff    = sayLoadingOff;
  classAppWeb.prototype.sayErrorLoad     = sayErrorLoad;
  classAppWeb.prototype.saveErrorLoad    = saveErrorLoad;
  classAppWeb.prototype.recoverErrorLoad = recoverErrorLoad;
  classAppWeb.prototype.saveErrorCodi    = saveErrorCodi;
  classAppWeb.prototype.startOnLoad      = startOnLoad;
  
/**
 *  ----------------------------------------------------------------------  *
 *  instancia o Client da appWeb
 *  ----------------------------------------------------------------------  *
 */
  var appWeb = new classAppWeb( 'euphonos' );

/**
 *  ----------------------------------------------------------------------  *
 *  Inicializa a carga dinamica da startLib
 *  ----------------------------------------------------------------------  *
 *
 *  carrega e executa a biblioteca  start.lib.js
 */
  var _head = document.getElementsByTagName( 'head' )[ 0 ];
  var _tag  = document.createElement('script');
  _tag.setAttribute( 'type', 'text/javascript' );
  _tag.setAttribute( 'src', appWeb.startLib );
  _head.appendChild( _tag );

//alert( appWeb.FontSize +' : '+appWeb.browser );  
//alert('cldo');