function NewWindow(mypage, myname, w, h, props)
{
  var winl = (screen.width - w) / 2;
  var wint = (screen.height - h) / 2;
  var winprops = 'scrollbars=1,height='+h+',width='+w+',top='+wint+',left='+winl+','+props
  var win = window.open(mypage, myname, winprops)
  if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

var qs = location.search.substring(1);
var nv = qs.split('&');
var url = new Object();
for(i = 0; i < nv.length; i++)
{
  eq = nv[i].indexOf('=');
  url[nv[i].substring(0,eq).toLowerCase()] = unescape(nv[i].substring(eq + 1));
}
//url['foo']: bar // url.foo: bar

function showArticlePrintWindow(article_id)
{
var curlocation = document.location.href;
var params = '?page=21';
//probably should be done with string.replace and a regexp..
var qpos = curlocation.indexOf('?');
if(qpos==-1) qpos = curlocation.indexOf('#');
	
	if(qpos>=0)
	{
	curlocation = curlocation.substr(0,qpos);
	}

if(article_id!=undefined && article_id!='') params = params + '&id=' + article_id;
NewWindow(curlocation + params,'print','630','400','yes');
return(false);
}

/* DOM READY */
$(function() {

	// fades out and removes the parent table
	$('a.remove-table').click(function() {
		var target = $(this).parents('table:first');
		target.fadeOut('medium', function () {
			target.remove();
		});
		return(false);
	});

	// open links in a new window
	$('a.new-window').click(function() {
		window.open(this.href);
		return(false);
	});

});

