
$(document).ready(function(){ 
	
	$('input.selectme').click(function() {
		this.select();
	});

	$('form.submit-with-ajax').submit(function() {
		$(this).load(this.action, $(this).serializeArray());
		return(false);
	});


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

}); 


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(); }
}

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 + '&amp;id=' + article_id;
	NewWindow(curlocation + params,'print','630','400','yes');
	return(false);
}