// function for making accessible popup windows
// specify default width and height below

var _POPUP_FEATURES = "location=0,statusbar=0,menubar=0";

// default positions
var _POPUP_WIDTH = 600;
var _POPUP_HEIGHT = 600;

function raw_popup(url, target, w, h) {
  if (isUndefined(w) || isUndefined(h)) {
    features = _POPUP_FEATURES + ",width="+_POPUP_WIDTH+",height="+_POPUP_HEIGHT;
  } else {
  	features = _POPUP_FEATURES + ",width="+w+",height="+h;
  	
  	// center positions
	if (document.getElementById) {
	   features += ",left="+((screen.availWidth/2)-(w/2));
	   features += ",top="+((screen.availHeight/2)-(h/2));
	}
  }
  
  if (isUndefined(target)) {
    target = '_blank';
  }

  var theWindow = window.open(url, target, features);
  theWindow.focus();
  return theWindow;
}

function link_popup(src, w, h) {
  return raw_popup(src.getAttribute('href'), src.getAttribute('target') || '_blank', w, h);
}

function isUndefined(a) { 
	return typeof a == 'undefined';
}