var xpos=0;
var ypos=0;

var bubblexdistance=10;
var bubbleydistance=12;

function storepos(event) {
  if (document.all) {
    xpos= (document.body.scrollLeft +window.event.clientX) + bubblexdistance;
    ypos= (document.body.scrollTop + window.event.clientY) + bubbleydistance;
  } else {
    xpos= event.pageX + bubblexdistance;
    ypos= event.pageY + bubbleydistance;
  }
}

var ModeChooserId = null;
var d_modec;
var clickTime_modec;

function showModeChooser(id) {
  if(document.all || document.getElementById) {
    if (document.all) {
      document.getElementById(id ).style.pixelLeft = xpos - bubblexdistance-30;
      document.getElementById(id ).style.pixelTop = ypos - bubbleydistance-28;
    } else {
      document.getElementById(id ).style.left = xpos - bubblexdistance-15 + 'px';
      document.getElementById(id ).style.top = ypos - bubbleydistance-65 + 'px';
    }
    document.getElementById(id ).style.visibility="visible";
  } else {
    document.layers[id ].left = xpos - bubblexdistance-15;
    document.layers[id ].top = ypos - bubbleydistance-65;
    document.layers[id ].visibility="show";
  }
  ModeChooserId = id;
  
  d_modec = new Date();
  clickTime_modec = d_modec.getTime();
}

var d_hmodec;
var clickTime_hmodec;

function hideModeChooser() {
  if (ModeChooserId) {
  
    d_hmodec = new Date();
    clickTime_hmodec = d_hmodec.getTime();

    
    if (typeof clickTime_modec != 'undefined') {
      if (clickTime_modec == clickTime_hmodec)
        return false;
    }
    
    if(document.all || document.getElementById) {
      document.getElementById(ModeChooserId ).style.visibility="hidden";
    } else {
      document.layers[ModeChooserId ].visibility="hide";
    }
  }
}


if(document.all || document.getElementById)
  {
    document.onmousemove=storepos;
  } else {
    window.captureEvents(Event.MOUSEMOVE | Event.CLICK);
    window.onMouseMove=storepos;
    window.onClick = hideModeChooser;
  }



