function showTip( elem, message, right )
{
  try
  {
    var box = jQuery( '#box-tooltip' );
    var offset = jQuery( elem ).offset();

    box.find( 'div' ).find( 'div' ).html( message );

    if ( !right )
    {
      box.css( { display: 'block',
                 top:     ( offset.top + 5 ) + 'px',
                 left:    ( offset.left - box.width() - 10 ) + 'px' } );
    }
    else
    {
      box.css( { display: 'block',
                 top:     ( offset.top + 5 ) + 'px',
                 left:    ( offset.left + right ) + 'px' } );
    }
  }
  catch ( e )
  {
//    alert( e );
  }
}

function hideTip()
{
  try
  {
    jQuery( '#box-tooltip' ).hide();
  }
  catch ( e )
  {
//    alert( e );
  }
}

function showInfo( elem, infoid )
{
  try
  {
    var box = jQuery( '#box-extrainfo' );
    var offset = jQuery( elem ).offset();

    box.find( 'div' ).find( 'div' ).html( jQuery( '#' + infoid ).html() );

    box.css( { display: 'block',
               width:   'auto',
               top:     ( offset.top - box.height() + 10 ) + 'px' } );

    if ( ( offset.left - box.width() ) < 10 )
    {
      box.css( { left: ( offset.left + jQuery( elem ).width() - 10 ) + 'px' } );
    }
    else
    {
      box.css( { left: ( offset.left - box.width() + 10 ) + 'px' } );
    }
  }
  catch ( e )
  {
//    alert( e );
  }
}

function showVideoInfo( elem, infoid )
{
  try
  {
    var box = jQuery( '#box-extrainfo' );
    var offset = jQuery( elem ).offset();

    box.find( 'div' ).find( 'div' ).html( jQuery( '#' + infoid ).html() );

    // catching hover display probs inside videoplayer scrollingpane
    if ( ( jQuery( '#scroll-pane' ).position().top + jQuery( elem ).position().top ) >= 0 )
    {
      box.css( { display: 'block',
                 width:   'auto',
                 top:     ( offset.top - box.height() + 10 ) + 'px' } );

      if ( ( offset.left - box.width() ) < 10 )
      {
        box.css( { left: ( offset.left + jQuery( elem ).width() - 10 ) + 'px' } );
      }
      else
      {
        box.css( { left: ( offset.left - box.width() + 10 ) + 'px' } );
      }
    }
  }
  catch ( e )
  {
//    alert( e );
  }
}

function hideInfo()
{
  try
  {
    var box = jQuery( '#box-extrainfo' );
    box.css( { display:'none' } );
  }
  catch ( e )
  {
//    alert( e );
  }
}

function showEvents( elem, infoid )
{
  try
  {
    var box = jQuery( '#box-extrainfo' );
    var offset = jQuery( elem ).offset();

    box.find( 'div' ).find( 'div' ).html( jQuery( '#' + infoid ).html() );

    box.css( { display: 'block',
               top:     ( offset.top - box.height() ) + 'px' } );

    if ( ( offset.left - box.width()) < 10 )
    {
      box.css( { left: ( offset.left + jQuery( elem ).width() + 4 ) + 'px' } );
    }
    else
    {
      box.css( { left: ( offset.left - box.width() - 2 ) + 'px' } );
    }
  }
  catch ( e )
  {
//    alert( e );
  }
}

function hideEvents()
{
  try
  {
    hideInfo();
  }
  catch ( e )
  {
//    alert( e );
  }
}