// show/hides an element
function showElement(e, b) {
   e.style.display = b ? "inline" : "none";
   e.style.visibility = b ? "visible" : "hidden";
}

// popups a window for provided file
function popWindowFile(file, width, height) {
   newWindow = window.open(file,'newWindow','toolbar=no,menubar=no,resizable=yes,scrollbars=yes,status=no,dependent=yes,width='+width+',height='+height+',top='+(screen.height-height)/2+',left='+(screen.width-width)/2);
  // set location in case window is reused
   newWindow.moveTo((screen.width-width)/2, (screen.height-height)/2);
   newWindow.resizeTo(width, height);
    newWindow.focus();
}

// bookmarks the page as best as possible
function bookmarkPage() {
   agent = navigator.userAgent.toLowerCase();
   title = document.title;
   url = window.location.href;
   if (window.sidebar)  // Mozilla Firefox Bookmark
      window.sidebar.addPanel(title, url, "");
   else if (window.opera && window.print) {  // Opera
/*
      var elem = document.createElement('a');
      elem.setAttribute('href', url);
      elem.setAttribute('title', title);
      elem.setAttribute('rel', 'sidebar');
      elem.click();
*/
      alert("Press CTRL+D to bookmark our site.");
   }
   else if (document.all)  // IE Favorite
      window.external.AddFavorite(url, title);
   else if (agent.indexOf('webkit') != -1)
      alert("Press " + (agent.indexOf('mac') != -1 ? "Command" : "CTRL") + "+D to bookmark our site.");
   else  // other?
      alert("You must bookmark this page manually through your browser.");
}

// email this page to a friend script
function emailFriend() {
   url = "mailto:?subject=Check out " + document.title;
   url += "&body=I thought you might be interested in " + document.title;
   url += ". You can view it at " + escape(location.href);
   location.href = url;
}
