//
// Javscript code that you want accessible to all pages can go in this file.
// It is referenced by main_template.
//
function changeLoc(select) {
    var href = select.options[select.selectedIndex].value;
    if (href != " ") {
        document.location = href;
    }
}

function popupWindow(url, width, height) {
  if(width == undefined) {
      width = 400;
  }
  if(height == undefined) {
      height = 400;
  }
  var popup = window.open(url, "popup", "toolbar=0,scrollbars=0,status=0,resizable=1,width="+width+",height="+height);
  popup.focus();
}

// If the element doesn't have the named class, add it.
// Otherwise remove it.  Useful for css hovers and such.
// (Note: originally named this toggleClassName (with a capital N)
// but that conflicted with Prototype!)
function toggleClassname(element_id, classname) {
  var el = document.getElementById(element_id);
  if(el) {
      if(el.className.indexOf(classname) == -1) {
          el.className += " " + classname;
      } else {
          el.className = el.className.replace(classname, "");
      }
  }
}
