/*
 * Edge Hill University JavaScript functions
 * Created: 2006-11-15
 * Version: 0.1
*/

/*
 * Popup links in a new window.  To use set the class of a link to be popup.
*/
function doPopups() {
  if (!document.getElementsByTagName) return false;
  var links=document.getElementsByTagName("a");
  var h = 600;
  var w = 600;
  var l = (screen.width - w) / 2;
  var t = (screen.height - h) / 2;
  for (var i=0; i < links.length; i++) {
    if (links[i].className.match("popup")) {
      links[i].title = "Opens in new window";
      links[i].onclick=function() {
        window.open(this.href, "", "resizable=yes,top="+t+",left="+l+",width="+w+",height="+h);
        return false;
      }
    }
  }
}

/*
 * At the moment the only function we need to run is doPopups().  When we have more unobtrusive JavaScript we may
 * need to wrap this in a custom onload function.
*/
window.onload=doPopups;

