<script language="javascript">
<?php
  include( create_dbText_control( $modo_RAD ) );
?>
/**
 *  dbText_mouseClick()
 */
function dbText_mouseClick( objID )
{
  if( objID.indexOf('dbText') != -1 )
  {

  }// End if( objID.indexOf('dbText') != -1 )
}// End function dbText_mouseClick( objID )

/**
 *   dbText_mouseDown()
 */
  function dbText_mouseDown( objID )
  {
    if( objID.indexOf('dbText') != -1 )
    {

    }// End if( objID.indexOf('dbText') != -1 )
  }// End function dbText_mouseDown( objID )

/**
 *  dbText_mouseUp()
 */
  function dbText_mouseUp( objID )
  {
    if( objID.indexOf('dbText') != -1 )
    {

    }// End if( objID.indexOf('dbText') != -1 )
  }// End function dbText_mouseUp( objID )

/**
 *  dbText_mouseOver()
 */
  function dbText_mouseOver( objID )
  {
    if( objID.indexOf('dbText') != -1 )
    {
      
    }
  }// End function dbText_mouseOver( objID )

/**
 *  dbText_mouseOut()
 */
  function dbText_mouseOut( objID )
  {
    if( objID.indexOf('dbText') != -1 )
    {

    }
  }// End function dbText_mouseOut( objID )

/**
 *  dbText_mouseMove()
 */
  function dbText_mouseMove( objID )
  {
    if( objID.indexOf('dbText') != -1 )
    {

    }
  }// End function dbText_mouseMove( objID )


//  ------------------------------------------------------------  //
//  Lista de Métodos do Componente                                //
//  Conjunto de funções para manipular as propriedades do Objeto  //
//  ------------------------------------------------------------  //

/**
 * retorna o numero do dbText
 */
	function get_dbText( objID )
	{
  	ix = objID.indexOf('_');
  	if ( ix == -1 )
  	{
    	ix = objID.length;
  	}//End if ( ix == -1 )

  	if ( objID.substr( ix -2, 1 ) == 't' )
  	{
    	nx = 1;
  	}else
  	{
    	nx = 2;
  	}// End   if ( ix == -1 )
  	alert( objID.substr( ix -nx, nx ) );

    return objID.substr( ix -nx, nx );

	}// End function get_dbText( objID )

function setDBtext_value( dbtext, value )
{
  nField = dbtext + '_Texto';
  var objDOM = findDOM( nField, 0 );
  objDOM.innerHTML = value;
  //alert( nField );
}

	function getTexto_dbText( obj )
	{
  	ret = "";
  	if( obj.indexOf( 'dbText' ) != -1 )
  	{
	//    cmd = "ret = " + obj + "_Texto.innerHTML";
  	}// End if( obj.indexOf( 'dbText' ) != -1 )

	  return ret;
	}// End function getTexto_dbText( obj )



//  Conjunto de funções para manipular as propriedades do Objeto  //
//  ------------------------------------------------------------  //

	function setDbText_reset( objID )
	{
  	if( objID.indexOf( 'dbText' ) != -1 )
	  {
  		nObj = objID + '_Texto';
  	  nObj = findDOM( nObj, 0 );
	//    alert( nObj );
			nObj.innerHTML = '';

  	}// End if( objID.indexOf( 'dbText' ) != -1 )
	}// End function setDbText_reset( objID )

	function setDbText_value( txt, objID )
	{
 		var objTexto = null;

  	if( objID.indexOf( 'dbtext' ) != -1 )
  	{
   		nObj = objID + '_Texto';
    	objTexto = findDOM( nObj, 0 );
    	old = objTexto.innerHTML;

	    if( old != txt )
  	  {
    	  if( txt == '') txt = ' ';
      	objTexto.focus();
      	objTexto.innerHTML = txt;
      	objTexto.blur();

	    }// End if( old != txt )

	  }// End if( objID.indexOf( 'dbText' ) != -1 )

	}// End function setDbText_value( objID, txt )


	/**
 	*  getDbText_value()
 	*/
	function getDbText_value( objID )
	{
		var objTexto = null;

	  if( objID.indexOf( 'dbText' ) != -1 )
  	{
    	nObj = objID + '_Texto';
    	objTexto = findDOM( nObj, 0 );

 	    //alert('nObjt: '+ objTexto.innerHTML );

	    return objTexto.innerHTML;
	  }// End if( objID.indexOf( 'dbText' ) != -1 )

	}// End function getDbText_value( objID )



  /**
   *  Metodo getDbText_caption
   *  retorna o valor atual do Caption
   */
  function getDbText_caption( nObj )
	{
 	  if( nObj.indexOf('_') == -1 )
  	{
    	objID = nObj + '_Caption';
  	}else
  	{
    	objID = nObj;
  	}// End if( nObj.indexOf('_') == -1 )
  	objDOM = findDOM( objID, 0 );

	  // retirar a hotkey
  	nCaption = objDOM.innerHTML;

	  hotkey_ = objDOM.getAttribute('accesskey');
  	if( hotkey_ !== '' && hotkey_ !== null )
  	{
    	ix = nCaption.toLowerCase().indexOf( hotkey_ );
    	if( ix != -1)
    	{
      	if(nCaption.substr(0, 1) == '<')
      	{
					if( get_dbText( nObj ) <= 9 )
					{
        		nCaption = nCaption.substr(23, 1) + nCaption.slice(31);
        		alert( nCaption + " <=<=");
        	}else
        	{
						x = get_dbText( nObj );
						y = x.length;
        	  nCaption = nCaption.substr(23 + ( y - 1 ), 1) + nCaption.slice(31 + ( y - 1 ) );
        		alert( nCaption + " >>>>");

        	}// End if( get_dbText( nObj ) <= 9 )
      	}else
      	{
          if( get_dbText( nObj ) <= 9 )
					{
	        	ini = nCaption.indexOf('<');
	        	//fim = nCaption.indexOf('>');
  	      	nCaption = nCaption.substr(0, ini) + nCaption.substr(ini + 24, 1) + nCaption.slice(ini + 32);
 	        	alert( nCaption + ' Entrou no else');

					}else
					{

						ini = nCaption.indexOf('<');
		        	//fim = nCaption.indexOf('>');
  	      	nCaption = nCaption.substr(0, ini) + nCaption.substr(ini + 24, 1) + nCaption.slice(ini + 32);
 	 	        alert( nCaption + ' Entrou no else');

					}// End if( get_dbText( nObj ) <= 9 )
  	    }// End if( nCaption.substr(0, 1) == '<' )
    	}else
    	{
      	alert( nCaption );
    	}// End if( ix != -1)
  	}// End if( hotkey_ !== '' && hotkey_ !== null )

		return '';
	}// End function getdbText_caption( nObj )




  /**
   *  Metodo setDbText_caption
   *  configura um valor para o Caption
   */
  function setDbText_caption( nObj, nCaption )
  {

		if( nObj.indexOf('_') == -1 )
    {
      objID = nObj + '_Caption';
    }else
    {
      objID = nObj;
    }// End if( nObj.indexOf('_') == -1 )

    objDOM = findDOM( objID, 0 );

    /**
     *  atualiza a Hotkey
     */
    hot_key_ = objDOM.getAttribute('accesskey');

    if( hot_key_ !== '' && hot_key_ !== null )
    {
      /* verifica se hotkey existe no novo caption */
      ix = nCaption.toLowerCase().indexOf( hot_key_ );
      if( ix != -1 )
      {
        nomeObj = nObj.slice(0, nObj.indexOf('_') );
        if( ix == 0 )
        {
          nCaption = '<span id="'+nomeObj+'_key">'+ nCaption.slice(0, 1)+ '</span>' + nCaption.slice(1);
        }else
        {
          nCaption = nCaption.slice(0, ix) + '<span id="'+nomeObj+'_key">'+ nCaption.substr( ix, 1 )+ '</span>' + nCaption.slice(ix + 1);
        }// End if( ix == 0 )
      }// End if( ix != -1 )
    }// End if( hotkey !== '' && hotkey !== null )

//    alert( objDOM.value );
    objDOM.innerHTML = nCaption;
  }// End function setDbText_caption( nObj, nCaption )


  /**
   * Metodo setDbText_enabled
   * configura o valor de habilitação do dbText
   */
  function setDbText_enabled( nObj, status )
  {
    if( nObj.indexOf('_') == -1 )
    {
      objID = nObj + '_Texto';
      objIDCap = nObj + '_Caption';
    }else
    {
      objID = nObj;
      objIDCap = nObj;
    }// End if( nObj.indexOf('_') == -1 )

    objDOM = findDOM( objID, 0 );
    objDOMCap = findDOM( objIDCap, 0 );


    objDOM.disabled = !(status);
    objDOMCap.disabled = !(status);

	}// End function setDbText_enabled( nObj, status )


  /**
   * Metodo setDbText_visible
   * configura o valor de visibilidade do dbText
   */

  function setDbText_visible( nObj, status )
  {
    objID = nObj;
    objDOM = findDOM( objID, 1 );

    if( status == 'true' )
    {
      objDOM.visibility = "inherit";

    }else
    {
      objDOM.visibility = "hidden";
    }// End if( status == 'visible' )


  }// End function setDbText_visible( nObj, status )



 /**
   * Metodo getDbText_index
   * retorna o indice
   */
  function getDbText_index( objID )
  {
    ix = objID.indexOf('_');
    if( ix != -1 )
    {
      idx = objID.slice( 6, ix );
    }else
    {
      idx = objID.slice( 6 );
    }// End if( ix != -1 )
    return (parseInt(idx) - 1);
  }// End function getDbText_index( objID )

</script>
