button_mouseClick( objectID );

if( objectID.indexOf('button') != -1 )
{
  button1_mouseClick( objectID );
  button2_mouseClick( objectID );
  button3_mouseClick( objectID );
  button4_mouseClick( objectID );

  //alert(objectID);
}// End if( objectID.indexOf('button') != -1 )


function button1_mouseClick( objID )
{
  if( objID.indexOf( 'button1' ) != -1 )
  {
    idx = getButton_index( objID );
    if( button_enabled[ idx ] )
    {
    //incDBgrid_nova_linha( 'dbgrid3' );
    //setDBgrid_visible( 'dbgrid3', false );
    //resetDBgrid( 'dbgrid3' );
    alert('click button1');
    }// End
  }// End
}// End function button1_mouseClick( objID )

function button2_mouseClick( objID )
{
  if( objID.indexOf( 'button2' ) != -1 )
  {
    Caption = getButton_caption( getButton_name(objID) );
    if( Caption == 'Nova Formula' )
    {
//alert( Caption );
      incDBgrid_nova_linha( 'dbgrid1' );
    
      setButton_caption( objID, 'Gravar Formula' );
      setButton_visible( 'button3', true );
    }// End
  
    if( Caption == 'Gravar Formula' )
    {
      incDBgrid_post( 'dbgrid1' );
    }// End
  
  //dataAccess.getFields( 'dbgrid2' );
  //dataAccess.getResult( 'dbgrid2:3' );
  }// End if( objID.indexOf( 'button1' ) != -1 )
}// End function button2_mouseClick( objID )

function button3_mouseClick( objID )
{
  if( objID.indexOf( 'button3' ) != -1 )
  {
    setButton_caption( 'button2', 'Nova Formula' );
    delDBgrid_nova_linha( 'dbgrid1' );
    setButton_visible( 'button3', false );
  }// End
}// End

function button4_mouseClick( objID )
{
  if( objID.indexOf( 'button4' ) != -1 )
  {
    var qtd = getEdit_value( 'edit1' );
    var option = getComboBox_option( "comboBox1" );
    var vEmb = 0;
//alert(option);
    if( option.indexOf( 'Galao' ) != -1 )
      vEmb = 4.4928;
    if( option.indexOf( '1 Quarto' ) != -1 )
      vEmb = 2.0864;
    if( option.indexOf( '2 Quarto' ) != -1 )
      vEmb = 1.0432;
    if( vEmb > 0 )
    {
      vEmb = vEmb * qtd;
      var tot = getDBgrid_col_sum_by_name( "dbgrid2", "custo" );
      var imp = tot * 28 /100;
      var sTotal = ( tot + imp );
      sTotal = sTotal.toFixed(4);
      vTotal = parseFloat(sTotal) + vEmb;
      vTotal = vTotal.toFixed(4);
    }else
    {
      sTotal = '';
      vTotal = '';
    }
    setEdit_value( "edit2", vEmb );
    setEdit_value( "edit3", sTotal );
    setEdit_value( "edit4", vTotal );

  }// End
}// End
