document.write('<div id="box" class="info_box"><div id="box_header" class="info_box_header"></div><div id="box_content" class="info_box_content"></div></div>');
document.write('<div id="inv_box" class="inv_info_box"><div id="inv_box_content" class="inv_info_box_content"></div><div id="inv_box_header" class="inv_info_box_header"></div></div>');

document.onmousemove = move_box;

//is a box being shown
var ib_open=false;
//is an inverted box being shown
var inv_ib_open=false;

function el(id) {
  return document.getElementById(id);
}

function move_box( e ) {

  if ( ib_open ) {

    if ( navigator.appName != 'Microsoft Internet Explorer' ) {

      if ( ( e.pageX > 0 ) && ( e.pageY > 0 ) ) {

        el('box').style.left = (-25) + e.pageX + 'px' ;
        el('box').style.top = 25 + e.pageY + 'px' ;
      }
    } else {

      if ( ( event.x > 0 ) && ( event.y > 0 ) ) {

        el('box').style.left = (-25) + event.x + document.documentElement.scrollLeft + 'px' ;
        el('box').style.top = 25 + event.y + document.documentElement.scrollTop + 'px' ;
      }
    }
  }
  if ( inv_ib_open ) {

    if ( navigator.appName != 'Microsoft Internet Explorer' ) {

      if ( ( e.pageX > 0 ) && ( e.pageY > 0 ) ) {

        el('inv_box').style.left = (-25) + e.pageX + 'px' ;
        el('inv_box').style.top = (-65) + e.pageY + 'px' ;
      }
    } else {

      if ( ( event.x > 0 ) && ( event.y > 0 ) ) {

        el('inv_box').style.left = (-25) + event.x + document.documentElement.scrollLeft + 'px' ;
        el('inv_box').style.top = (-65) + event.y + document.documentElement.scrollTop + 'px' ;
      }
    }
  }

}

function open_box( content ) {

  if ( ib_open == false ) {

    //drop our content in and show the box
    el('box_content').innerHTML = content;
    el('box').style.visibility = "visible";

    //set our flag and move our box on mousemove
    ib_open = true ;
	  move_box( el('box') ) ;
  }
}

function close_box( ) {

  if ( ib_open == true ) {

    //hide the box and set our flag
    el('box').style.visibility = "hidden";
    ib_open = false ;
  }
}

function inv_open_box( content ) {

  if ( inv_ib_open == false ) {

    //drop our content in and show the box
    el('inv_box_content').innerHTML = content;
    el('inv_box').style.visibility = "visible";

    //set our flag and move our box on mousemove
    inv_ib_open = true ;
	  move_box( el('inv_box') ) ;
  }
}

function inv_close_box( ) {

  if ( inv_ib_open == true ) {

    //hide the box and set our flag
    el('inv_box').style.visibility = "hidden";
    inv_ib_open = false ;
  }
}
