<script language="javascript">
<?php 
  include( create_toolBar_config( $modo_RAD ) );  
  // include( CFG . "toolBar.config.php" );  
?> 
/**
 *  toolBar_mouseClick()
 */  
function toolBar_mouseClick( objID )
{
  //alert('clik');
  if( objID.indexOf('toolBar') != -1 &&
      objID.indexOf('button') != -1
     )
  {
    
    nrToolBar = getToolBar( objID );
    nrButton  = getButton( objID );
//alert(toolBar_select[ nrToolBar -1 ]);    
    if ( toolBar_select[ nrToolBar -1 ] )
    {
      if( toolBar_selected[ nrToolBar -1 ] > 0 &&
          toolBar_selected[ nrToolBar -1 ] != nrButton )
      {
        n_obj = 'toolBar' + nrToolBar + '_button' + toolBar_selected[ nrToolBar -1 ];
//alert(n_obj);          
        objSTYLE = findDOM( n_obj, 1 );
        objSTYLE.borderTop    = "0px solid #FFFFFF";
        objSTYLE.borderLeft   = "0px solid #FFFFFF";
        objSTYLE.borderBottom = "0px solid #FFFFFF";
        objSTYLE.borderRight  = "0px solid #FFFFFF";
      }
        
      toolBar_selected[ nrToolBar -1 ] = nrButton;
    }// End if()
  }// End if()
  //alert('toolBar ['+nrToolBar+'] Selected: ' + toolBar_selected[ nrToolBar -1 ]  );
 
}// End function   


function toolBar_mouseDblClick( objID )
{
//alert('dBclik');
  if( objID.indexOf('toolBar') != -1 &&
      objID.indexOf('button') != -1
     )
  {
    //alert('dbClick');
  }// End if()
}// End toolBar_mouseDblClick( objID )

  
/**
 *  toolBar_mouseDown()
 */  
function toolBar_mouseDown( objID )
{
//alert('down');
  if( objID.indexOf('toolBar') != -1 &&
      objID.indexOf('button') != -1
     )
  {
    var nrToolBar = getToolBar( objID );
    var nrButton  = getButton(  objID );
    var nObj      = getNomeObj( objID )

    if( toolBar_status[ nrToolBar -1 ][ nrButton -1 ] >= 1 )
    {
      objSTYLE = findDOM( nObj, 1 );
      objSTYLE.borderTop    = "1px outset #808080";
      objSTYLE.borderLeft   = "1px outset #808080";
      objSTYLE.borderBottom = "1px solid #FFFFFF";
      objSTYLE.borderRight  = "1px solid #FFFFFF";
    }// End if()
    //alert( 'down' );
  }
}// End   

/**
 *  toolBar_mouseUp()
 */  
function toolBar_mouseUp( objID )
{
  if( objID.indexOf('toolBar') != -1 &&
      objID.indexOf('button') != -1
     )
  {
//alert('Up');
    var nrToolBar = getToolBar( objID );
    var nrButton  = getButton(  objID );
    var nObj      = getNomeObj( objID )
    if( toolBar_status[ nrToolBar -1 ][ nrButton -1 ] >= 1 )
    {
      objSTYLE = findDOM( nObj, 1 );
      objSTYLE.borderTop    = "1px solid #FFFFFF";
      objSTYLE.borderLeft   = "1px solid #FFFFFF";
      objSTYLE.borderBottom = "1px outset #FFFFFF";
      objSTYLE.borderRight  = "1px outset #FFFFFF";
    }// End if()
  }// End if()
}// End   

/**
 *  toolBar_mouseOver()
 */  
function toolBar_mouseOver( objID )
{
  if( objID.indexOf('toolBar') != -1 &&
      objID.indexOf('button') != -1
     )
  {
    var nrToolBar = getToolBar( objID );
    var nrButton  = getButton(  objID );
    var nObj      = getNomeObj( objID )

//alert( 'toolBar: ' + nrToolBar );
//alert( 'Button: '  + nrButton );

    if( toolBar_status[ nrToolBar -1 ][ nrButton -1 ] >= 1 )
    {
      objSTYLE = findDOM( nObj, 1 );
      objSTYLE.borderTop    = "1px solid #FFFFFF";
      objSTYLE.borderLeft   = "1px solid #FFFFFF";
      objSTYLE.borderBottom = "1px outset #FFFFFF";
      objSTYLE.borderRight  = "1px outset #FFFFFF";
    }// End if()
  }//End if()
}// End function()   

/**
 *  toolBar_mouseOut()
 */  
function toolBar_mouseOut( objID )
{
  if( objID.indexOf('toolBar') != -1 &&
      objID.indexOf('button') != -1
     )
  {
    var nrToolBar = getToolBar( objID );
    var nrButton  = getButton(  objID );
    var nObj      = getNomeObj( objID )
      
    if( !toolBar_select[ nrToolBar -1] ||
        toolBar_selected[ nrToolBar -1] != nrButton )
    {
      objSTYLE = findDOM( nObj, 1 );
      objSTYLE.borderTop    = "0px solid #FFFFFF";
      objSTYLE.borderLeft   = "0px solid #FFFFFF";
      objSTYLE.borderBottom = "0px solid #FFFFFF";
      objSTYLE.borderRight  = "0px solid #FFFFFF";
    }// End if()
  }// End if()
}// End function   

/**
 *  toolBar_mouseMove()
 */  
function toolBar_mouseMove( objID )
{
    if( objID.indexOf('toolBar') != -1 &&
        objID.indexOf('button') != -1
       )
    {
    }
}// End   

  
/**
 *  getToolBar()
 *
 *  retorna o numero da toolBar 
 */  
function getToolBar( objID )
{
  var ix  = objID.indexOf( '_' );
  if ( ix == -1 )
  {
    ix = objID.length;
  }
  ret = objID.substr( ix-1, 1 );

  return ret;      
}
/**
 *  getButton()
 *
 *  retorna o numero do Button
 */  
function getButton( objID )
{
  var ix   = objID.indexOf( '_' );
  var comp = objID.substr( ix+1 );

  ix = comp.indexOf( '_' ); 
  if ( ix == -1 )
  {
    ix = comp.length;
    //alert(comp+' : '+ix);
  }else
  {
    //alert(comp.slice( 6, ix )+' ix: ' +ix);
  }// End if()
  ret = comp.slice( 6, ix );
//alert(objID+':'+ret);

  return ret;      
}
/**
 *  getNomeObj()
 *
 *  retorna o nome do objeto toolBar
 */  
function getNomeObj( objID )
{
  if (objID.indexOf('img') != -1)
  {
    var len = objID.indexOf('_img');
    var nObj = objID.substr(0, len);
  }else
  {
    var nObj = objID;
  }
  
  return nObj;      
}
  
  



//  Conjunto de funções para manipular as propriedades do Objeto  //
//  ------------------------------------------------------------  //
function setToolBar_status( objID, nrButton, newStatus )
{
  nrToolBar = getToolBar( objID );

  toolBar_status[ nrToolBar -1 ][ nrButton -1 ] = newStatus;
  
  if ( newStatus == 0 )
  {
    nObj = objID + '_Button' + nrButton;
    objSTYLE = findDOM( nObj, 1 );
    objSTYLE.borderTop    = "0px solid #FFFFFF";
    objSTYLE.borderLeft   = "0px solid #FFFFFF";
    objSTYLE.borderBottom = "0px solid #FFFFFF";
    objSTYLE.borderRight  = "0px solid #FFFFFF";

    //alert( nObj );
  }
}// End function()

</script>
