function isBrowser () {
  // BROWSER CHECK
  // Note: On IE5, these return 4, so use is.ie5up to detect IE5.
  
  // convert all characters to lowercase to simplify testing 
  var agt=navigator.userAgent.toLowerCase(); 
  
  this.major = parseInt(navigator.appVersion); 
  this.minor = parseFloat(navigator.appVersion); 
  
  this.nav     = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) && (agt.indexOf('webtv')==-1)); 
  this.nav2    = (this.nav && (this.major == 2)); 
  this.nav3    = (this.nav && (this.major == 3)); 
  this.nav4    = (this.nav && (this.major == 4)); 
  this.nav4up  = (this.nav && (this.major >= 4)); 
  this.navonly = (this.nav && ((agt.indexOf(";nav") != -1) || (agt.indexOf("; nav") != -1)) ); 
  this.nav5    = (this.nav && (this.major == 5)); 
  this.nav5up  = (this.nav && (this.major >= 5)); 
  this.nav6    = (this.nav && (this.major == 6)); 
  
  this.ie      = (agt.indexOf("msie") != -1); 
  this.ie3     = (this.ie && (this.major < 4)); 
  this.ie4     = (this.ie && (this.major == 4) && (agt.indexOf("msie 5")==-1) && (agt.indexOf("msie 6")==-1) ); 
  this.ie45    = (this.ie && (this.major == 4) && (agt.indexOf("msie 4.5")==-1) ); 
  this.ie4up   = (this.ie && (this.major >= 4)); 
  this.ie5     = (this.ie && (this.major == 4) && (agt.indexOf("msie 5.0")!=-1) );
  this.ie55    = (this.ie && (this.major == 4) && (agt.indexOf("msie 5.5")!=-1) );  
  this.ie6     = (this.ie && (this.major == 4) && (agt.indexOf("msie 6.0")!=-1) ); 
  this.ie5up   = (this.ie && !this.ie3 && !this.ie4 && !this.ie5); 
}

var isBrowser = new isBrowser();

function addBookmark(path, title) {
  var bookmarkurl   = "http://www.radleys.co.uk" + path;
  var bookmarktitle = "Radleys Discovery Technologies - " + title;
  if (isBrowser.ie4up) {
    window.external.AddFavorite(bookmarkurl,bookmarktitle);
 }
}

function changePage (menu) {
  var page = menu.options[menu.selectedIndex].value;
  
  if (page) {
    document.location.href = page;
  }
}

// popup functions
function open_popup (ref, url, width, height, scroll, resizable) {
  window.open(url,
              ref,
              "menubar=no, " +
              "toolbar=no, " +
              "status=no, " +
              "location=no" + 
              ((width) ? (", width=" + width) : "") + 
              ((height) ? (", height=" + height) : "") +
              ((scroll) ? ", scrollbars=yes " : ", scrollbars=no") +
              ((resizable) ? ", resizable=yes " : ", resizable=no") 
             );
}

// query string function
function getArgs () {
  var args = new Object();
  var query = location.search.substring(1);
  var pairs = query.split(',');

  for (var i = 0; i < pairs.length; i++) {
    var pos = pairs[i].indexOf('=');

    if (pos == -1) {
      continue;
    }

    var argname = pairs[i].substring(0, pos);
    var value   = pairs[i].substring(pos + 1);
    args[argname] = unescape(value);
  }
}