function help_popup(activator, popup_id) {
        if (help_popup.popup === undefined) {
          help_popup.popup = null;
        }
        if (help_popup.activator === undefined) {
          help_popup.activator = null;
        }

        if (typeof(activator) == 'undefined') { // no activator so hide
          help_popup.popup.style.display = 'none';
          help_popup.popup = null;
          return;
        }
        var pop = document.getElementById(popup_id);
        if (pop == help_popup.popup) {
          if (activator == help_popup.activator) {
            //hide popup (as we've already shown it for the current help button)
            help_popup.popup.style.display = 'none';
            help_popup.popup = null;
            return; // toggling complete!
          }
        } else if (help_popup.popup != null) {
          //activating different popup so hide current one
          help_popup.popup.style.display = 'none';
        }
        help_popup.popup = pop;
        help_popup.activator = activator;

        //must make the popup visible to measure it or it has zero width
        pop.style.display = 'block';
        var xy = get_elem_xy(activator);
        var padding = 10;
        var edge_padding = 15;
        var scroll_padding = 15;

        var pop_left = (xy[0] + (activator.offsetWidth / 2)  - (pop.offsetWidth / 2));
        var pop_top = (xy[1] + activator.offsetHeight + padding);

        // ensure the box is not past the top or left of the page
        if (pop_left < 0) pop_left = edge_padding;
        if (pop_top < 0) pop_top = edge_padding;
        // ensure the box does not cause horizontal scroll bars
        var page_width = null;
        if (window.innerWidth) {
          page_width = window.innerWidth;
        } else if (document.body) {
          page_width = document.body.clientWidth;
        }
        if (page_width) {
          if (pop_left + pop.offsetWidth > page_width) {
            pop_left = page_width - pop.offsetWidth - edge_padding - scroll_padding; //account for scrollbars
          }
        }

        pop.style.left = pop_left + "px";
        pop.style.top = pop_top + "px";
      }
/*
       * help_popup
       *
       * Moves around help pop-ups so they appear
       * below an activator.
       */
help_popup
Moves around help pop-ups so they appear
below an activator.
help_popup Moves around help pop - ups so they appear below an activator .
function help_popup(activator, popup_id) {
        if (help_popup.popup === undefined) {
          help_popup.popup = null;
        }
        if (help_popup.activator === undefined) {
          help_popup.activator = null;
        }
        if (typeof(activator) == 'undefined') { 
          help_popup.popup.style.display = 'none';
          help_popup.popup = null;
          return;
        }
        var pop = document.getElementById(popup_id);
        if (pop == help_popup.popup) {
          if (activator == help_popup.activator) {
            help_popup.popup.style.display = 'none';
            help_popup.popup = null;
            return; 
          }
        } else if (help_popup.popup != null) {
          help_popup.popup.style.display = 'none';
        }
        help_popup.popup = pop;
        help_popup.activator = activator;
        pop.style.display = 'block';
        var xy = get_elem_xy(activator);
        var padding = 10;
        var edge_padding = 15;
        var scroll_padding = 15;
        var pop_left = (xy[0] + (activator.offsetWidth / 2)  - (pop.offsetWidth / 2));
        var pop_top = (xy[1] + activator.offsetHeight + padding);
        if (pop_left < 0) pop_left = edge_padding;
        if (pop_top < 0) pop_top = edge_padding;
        var page_width = null;
        if (window.innerWidth) {
          page_width = window.innerWidth;
        } else if (document.body) {
          page_width = document.body.clientWidth;
        }
        if (page_width) {
          if (pop_left + pop.offsetWidth > page_width) {
            pop_left = page_width - pop.offsetWidth - edge_padding - scroll_padding; 
          }
        }
        pop.style.left = pop_left + "px";
        pop.style.top = pop_top + "px";
      }
function help_popup ( activator , popup_id ) { if ( help_popup . popup === undefined ) { help_popup . popup = null ; } if ( help_popup . activator === undefined ) { help_popup . activator = null ; } if ( typeof ( activator ) == 'undefined' ) { help_popup . popup . style . display = 'none' ; help_popup . popup = null ; return ; } var pop = document . getElementById ( popup_id ) ; if ( pop == help_popup . popup ) { if ( activator == help_popup . activator ) { help_popup . popup . style . display = 'none' ; help_popup . popup = null ; return ; } } else if ( help_popup . popup != null ) { help_popup . popup . style . display = 'none' ; } help_popup . popup = pop ; help_popup . activator = activator ; pop . style . display = 'block' ; var xy = get_elem_xy ( activator ) ; var padding = 10 ; var edge_padding = 15 ; var scroll_padding = 15 ; var pop_left = ( xy [ 0 ] + ( activator . offsetWidth / 2 ) - ( pop . offsetWidth / 2 ) ) ; var pop_top = ( xy [ 1 ] + activator . offsetHeight + padding ) ; if ( pop_left < 0 ) pop_left = edge_padding ; if ( pop_top < 0 ) pop_top = edge_padding ; var page_width = null ; if ( window . innerWidth ) { page_width = window . innerWidth ; } else if ( document . body ) { page_width = document . body . clientWidth ; } if ( page_width ) { if ( pop_left + pop . offsetWidth > page_width ) { pop_left = page_width - pop . offsetWidth - edge_padding - scroll_padding ; } } pop . style . left = pop_left + "px" ; pop . style . top = pop_top + "px" ; }
help_popup
 Moves around help pop-ups so they appear
 below an activator.
help_popup Moves around help pop - ups so they appear below an activator .
// no activator so hide //hide popup (as we've already shown it for the current help button) // toggling complete! //activating different popup so hide current one //must make the popup visible to measure it or it has zero width // ensure the box is not past the top or left of the page // ensure the box does not cause horizontal scroll bars //account for scrollbars