function openWindow(url, name, width, height, toolbar, scroll) {
	var screenWidth = (screen.width - width) / 2;
	var screenHeight = (screen.height - height) / 2;
	newWindow = window.open(url,name,'width=' + width + ',height=' + height + ',toolbar=' + toolbar + ',scrollbars=' + scroll + ',resize=no,left=' + screenWidth + ',top=' + screenHeight + '');
	newWindow.focus();
}

function tellFriendsWindow(ID) {
	openWindow('/popups/tellFriends.php?ID=' + ID, 'tellFriendsWindow', '300', '450', 'no', 'yes');
}

function galleryTellFriendsWindow(ID) {
	openWindow('/popups/galleryTellFriends.php?ID=' + ID, 'galleryTellFriendsWindow', '300', '450', 'no', 'yes');
}

function printerFriendlyWindow(ID) {
	openWindow('/article.php?ID=' + ID +'&print=true', 'printerFriendlyWindow', '750', '550', 'yes', 'yes');
}

function galleryWindow(photographer) {
	openWindow('/popups/gallery.php?photographer=' + photographer, 'galleryWindow', '520', '585', 'no', 'yes');
}

function changePassword() {
	openWindow('/popups/changePassword.php','changePassword','250','310', 'no', 'yes');
}

function passwordReminder() {
	openWindow('/popups/passwordReminder.php','passwordReminder','220','250', 'no', 'yes');
}

function viewJobDescription(job) {
	openWindow('/jobs/descriptions/' + job + '.php','viewJobDescription','620','530', 'yes', 'yes');
}

function discussTerms(terms) {
	openWindow('/popups/terms.php?terms=' + terms,'discussTerms','320','370', 'no', 'yes');
}

function showJobDetails(URL) {
	openWindow(URL,'showJobDetails', '780', '580', 'yes', 'yes');
}

function showQuiz() {
	openWindow('/quiz/quiz.php', 'showQuiz', '580', '580', 'yes', 'yes');
}

function quizAnswers() {
	openWindow('/popups/quizAnswerRequest.php','quizAnswers','220','270','yes','yes');
}

function quizTellFriends() {
	openWindow('/popups/quizTellFriends.php','quizTellFriends','220','270','yes','yes');
}
		
function testTellFriends() {
	openWindow('/popups/testTellFriends.php','testTellFriends','220','270','yes','yes');
}
		
function showHide(show, hide) {
	if (document.getElementById(show).style.display=='none') {
		document.getElementById(show).style.display='';
		if (hide != '') {
			document.getElementById(hide).style.display='none';
		}
	}
}

function switchtab(newtab, oldtab) {
	if (document.getElementById)
	{
		document.getElementById(newtab).style.display = "inline";
		document.getElementById(oldtab).style.display = "none";
		return false;
	}
	else if (document.all)
	{
		document.all[oldtab].style.display = "none";
		document.all[newtab].style.display = "inline";
		return false;
	}
	else {
		return true;
	}
}

$(function() {
	$("table#tablesorter")
		.tablesorter({widthFixed: true, widgets: ['zebra']})
		.tablesorterPager({container: $("#pager")});
});
