<script language="javascript"> 
<?php
  include( create_comboBox_control( $modo_RAD ) );
?>

/**  
 *  comboBox_mouseClick() --------------------------------------------------  //
 */  
function comboBox_mouseClick( objID )  
{
  if( objID.indexOf('comboBox') != -1 )
  {
    nrCombo = get_comboBox( objID );
    comboBox_selected = nrCombo;

    if( objID.indexOf('Icone') != -1 )
    {
      arr    = comboBox_lista[ nrCombo -1 ];
      ind    = comboBox_itens[ nrCombo -1 ];
      texto  = '<table border="0" width="100%">';
      nCombo = "comboBox"+nrCombo;
      for( iix=0; iix < ind; iix++ )
      {
        if( arr[nrCombo -1][iix] == '' )
        {
          _txt_ = '&nbsp;';
        }else
        {
          _txt_ = arr[iix];
        }// End if( arr[nrCombo -1][iix] == '' )
        texto += '<tr>';
        texto += '<td id="' + nCombo + '_label' + (iix +1) +
                 '" class="' + nCombo + '_Label">' + _txt_  + '</td>';
        texto += '</tr>';
      }// End for( iix=0; iix < ind; iix++ )
      texto += "</table>";

      comboBox1_Box.innerHTML = texto;

      nObj = "comboBox" + nrCombo + "_Box";
      comboDOM = findDOM( nObj, 1 );

      if ( comboBox_aberto[ nrCombo -1 ] )
      {
        comboDOM.visibility = "hidden";
        comboBox_aberto[ nrCombo -1 ] = false;

        nObj = "comboBox" + nrCombo;
        objDOM = findDOM( nObj, 1 );
        objDOM.zIndex = '150';
      }else
      {
        comboDOM.visibility = 'inherit';
        comboBox_aberto[ nrCombo -1 ] = true;

        nObj = "comboBox" + nrCombo;
        objDOM = findDOM( nObj, 1 );
        objDOM.zIndex = '250';
      }// End if ( comboBox_aberto[ nrCombo -1 ] )
    }// End if( objID.indexOf('Icone') != -1 )

/*
 */
    if ( objID.indexOf('label') != -1 )
    {
      cmd  = 'cod = ' + objID + '.innerHTML;';
      eval( cmd );

      if ( cod != '&nbsp;')
      {
        nObj = 'comboBox' + nrCombo;
        setComboBox_value( nObj, cod );
        objSELECTED = cod;
        
        //winPage2.setGrid_off();
        
        if( cod != 'page1' )
        {
          //alert('1');
          //winPage2.setGrid_on( cod );
        }// End if()
      
        //comboBox_onChange[nrCombo -1] = true;
      }// End if()
//alert('label');

//alert( 'comboBox' + nrCombo + '_Icone.focus();' );
      //comboBox_onChange[nrCombo-1] = cod;
//alert('new['+(nrCombo-1)+']: '+comboBox_onChange[nrCombo-1]);

      nObj = "comboBox" + nrCombo + "_Box";
      comboDOM = findDOM( nObj, 1);
      comboDOM.visibility = "hidden";
      comboBox_aberto[ nrCombo -1 ] = false;
    }// End if ( objID.indexOf('label') != -1 )
  }// End if( objID.indexOf('comboBox') != -1 )
}// End function comboBox_mouseClick( objID )
  
/**
 *  comboBox_mouseDown()  --------------------------------------------------  //
 */
  function comboBox_mouseDown( objID )
  {
    if( objID.indexOf('comboBox') != -1 )
    {

    }
  }// End

/**
 *  comboBox_mouseUp()  ----------------------------------------------------  //
 */
  function comboBox_mouseUp( objID )
  {
    if( objID.indexOf('comboBox') != -1 )
    {

    }
  }// End

/**
 *  comboBox_mouseOver()  --------------------------------------------------  //
 */
  function comboBox_mouseOver( objID )
  {
    if( objID.indexOf('comboBox') != -1 )
    {
      if( objID.indexOf('label') != -1 )
      {
        labelDOM = findDOM(objID,1);
        labelDOM.backgroundColor="#E1E1E1";
        labelDOM.cursor="default";
      }
    }
  }// End

/**
 *  comboBox_mouseOut()  ---------------------------------------------------  //
 */
  function comboBox_mouseOut( objID )
  {
    if( objID.indexOf('comboBox') != -1 )
    {
      if( objID.indexOf('label') != -1 )
      {
        labelDOM = findDOM(objID,1);
        labelDOM.backgroundColor="#FAFAFF";
        //alert(objID);
      }
    }
  }// End

/**
 *  comboBox_mouseMove()  --------------------------------------------------  //
 */
  function comboBox_mouseMove( objID )
  {
    if( objID.indexOf('comboBox') != -1 )
    {

    }
  }// End


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

  if ( objID.substr( ix -2, 1 ) == 'x' )
  {
    nx = 1;
  }else
  {
    nx = 2;
  }// Endif
  //alert( 'comboBox: '+ ret );
  
  return objID.substr( ix -nx, nx );
}// End function()


/**
 *  setTexto_comboBox()  ---------------------------------------------------  //
 */
function setTexto_comboBox( obj, txt )
{
  if( obj.indexOf( 'comboBox' ) != -1 )
  {
    nrCombo = get_comboBox( obj );

    cmd = obj + '_Texto.innerHTML = "' + txt +'"';
    eval( cmd );

//    comboBox_selected = nrCombo;
  }// end if()
}// End function

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

  return ret;
}// End function()



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

function setComboBox_reset( objID )
{
  if( objID.indexOf( 'comboBox' ) != -1 )
  {
//alert(objID);
    var nrCombo = get_comboBox( objID );
//alert( comboBox_itens[ nrCombo -1 ] );
    for( ix_combo=0; ix_combo < comboBox_itens[ nrCombo -1 ]; ix_combo++ )
    {
      comboBox_lista[ nrCombo -1 ][ ix_combo ] = '';
    }// End for()

    comboBox_itens[ nrCombo -1 ] = 1;
    setComboBox_value( objID, ' ' );
  }// End if()
}// End function()

function setComboBox_value( objID, txt )
{
  //alert('SetCombo: '+txt);
  if( objID.indexOf( 'comboBox' ) != -1 )
  {
    var nObj_ = objID + '_Texto';

    comboDOM = findDOM( nObj_, 0 );
    
    old = comboDOM.value;
    if( old != txt )
    {
      if( txt == '')
      {
        txt = ' ';
      }
      comboDOM.focus();
      comboDOM.value = txt;
      comboDOM.blur();
    
      nrCombo = get_comboBox( objID );
      comboBox_onChange[nrCombo -1] = true;
    }// End if()
    
  }// End if()

}// End function()

function getComboBox_value( objID )
{
  if( objID.indexOf( 'comboBox' ) != -1 )
  {
    nObj = objID + '_Texto';

    comboDOM = findDOM( nObj, 0 );
    return comboDOM.value;
  }// End if()

}// End function()




</script> 
