// JavaScript Document
$(document).ready(function(){
	//bind to click event
	$(":input[name='ckAll']").click(function(){
		$('#pubs input:checkbox').each( 
			function() {this.checked = $(":input[name='ckAll']").attr('checked');}				
		);	
	});
	
	//validate form
	$("#pub_form").submit(function(){
		if ( $('#pub_form :checked').length )
			return true;
		else
		{
			alert('No publications selected. Please select the publication(s) you are interested in.'); 		
			return false;
		}		
	});
	
	//bind togglepubs to click event
	if ($(".togglepubs").length)
	{
		$(".togglepubs").click(function(){
			$("#pubs").slideToggle("slow");
		});
	}
});

function newWindow(mypage, myname, w, h, scroll) {
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >=4) { win.window.focus(); }
}