function openNewWindow(url, width, height, name)
{
  width  = width  ? width  : 600;
  height = height ? height : 500;
  name   = name   ? name : "popup";
  var left = (screen.width - width) / 2;
  var top  = (screen.height - height) / 2;
  var popupWindow = window.open(url,name,"width="+width+",height="+height+",left="+left+",top="+top+",scrollbars=yes");
  popupWindow.focus();
}

/*
 * Link Tabs - common way to show and hide tables
 */
window.LAST_TAB_NAME = '';
function setActiveLinkTab(tab_name)
{
  window.LAST_TAB_NAME = tab_name;
  switchTab(tab_name);
}

function switchTab(tab_name)
{
	var last_tab = document.getElementById(window.LAST_TAB_NAME);
	var last_tab_label = document.getElementById(window.LAST_TAB_NAME + '_label');
	var this_tab = document.getElementById(tab_name);
	var this_tab_label = document.getElementById(tab_name + '_label');
	if (last_tab != null)
	{
		last_tab.style.display = 'none';
		last_tab_label.className = '';
	}
	if (this_tab != null)
	{
		this_tab.style.display = 'block';
		this_tab_label.className = 'selected';
	}
	window.LAST_TAB_NAME = tab_name;
}

