function reset_sidebar(nav_id, force) {
  //dga- my understanding of this is as follows:
  // nav_id identifies a page to be loaded in the navbar
  // the navbar, as it happens, is parent.frames[0]
  // only load if not already loaded, determined by comparing
  //   nav_name, a canonical version of nav_id, to the name
  //   of the frame, which we set to that name after loading.

  // defensive programming suggested by steve to deal with case
  // of someone opening frame into a stand-alone browser window
  if (!parent.frames || parent.frames.length <= 0) {
    return true;
  }

  var nav_name;
  var dir;
  var i;
  if ( (i = nav_id.lastIndexOf("/")) < 0 ) {
    dir = "/common/";
    nav_name = nav_id;
  } else {
    dir = "";
    nav_name = nav_id.substring(i + 1, nav_id.length);
  }
  if ( parent.frames[0].name != nav_name || force != null ) {
    parent.frames[0].location.replace(dir + nav_id + ".html" );
    parent.frames[0].name = nav_name;
  }
  return true;
}


//dga-
// for discounts sidebar loaded by onload of page gen'd by
// &create_seat_input_map (in ticket_util.pl)
//dga- Is there more work to do here in deriving from reset_sidebar? (c.f. above)

function reset_sidebar_discounts(nav_url) {
  parent.frames[0].location.replace(nav_url);
  return true;
}

function reset_ad(ad_type) {

  // defensive programming suggested by steve to deal with case
  // of someone opening frame into a stand-alone browser window
  if (!parent.frames || parent.frames.length <= 0) {
    return true;
  }

  if ( parent.frames[1].name != ad_type ) {
    parent.frames[1].location.replace("/common/ads_" + ad_type + ".html" );
    parent.frames[1].name = ad_type;
  }
  return true;
}

var select_cookie = "SEATADVISOR_SELECTION";

function reset_selections() {
  // "select_string" is a variable local to "main_frame"
  var select_string = retrieve_cookie(select_cookie);
  if ( document.applets.length > 0 && select_string != "" ) {
    var java_app = document.applets[0];
    var retval = java_app.set_selection(select_string);
  }
}

function retrieve_cookie(name)
{
  var allcookies = document.cookie;
  var start = allcookies.indexOf(name + "=");
  if ( start == -1 ) return "";
  start += name.length + 1;
  var end = allcookies.indexOf(';',start);
  if ( end == -1 ) end = allcookies.length;
  var value = unescape(allcookies.substring(start, end));
  return(value);
}

function get_focus(iobj) {
  if (parseInt(navigator.appVersion) >= 4 ) {
    window.focus();
  }
  iobj.focus();
}
