// Stop silly error messages!!!
window.onerror=null

function flipDisplay(objID) {
	var obj = window.document.getElementById(objID);
	if (obj.style.display == "none") obj.style.display = "inline";
	else obj.style.display = "none";
}

function popupNewsWindow(index) {
	// Give this window a name first
	window.name = "KeyworthHome";
	var windowFeatures = "height=700";
	windowFeatures += ",width=700";
	var xx = window.screenX + window.outerWidth/2 - 150;
	windowFeatures += ",screenX=" + xx;
	var yy = window.screenY + window.outerHeight/2 - 200;
	windowFeatures += ",screenY=" + yy;
	windowFeatures += ",location=no";		// no input for URLs
	windowFeatures += ",menubar=no";
	windowFeatures += ",resizable=yes";
	windowFeatures += ",scrollbars=yes";
	windowFeatures += ",status=no";			// don't display the statusbar
	windowFeatures += ",toolbar=no";		// don't display the toolbar
	popupWindow("news.php?"+index, windowFeatures);
}

function popupProfileWindow(index, staff) {
	// Give this window a name first
	window.name = "KeyworthHome";
	var windowFeatures = "height=500";
	windowFeatures += ",width=500";
	var xx = window.screenX + window.outerWidth/2 - 250;
	windowFeatures += ",screenX=" + xx;
	var yy = window.screenY + window.outerHeight/2 - 250;
	windowFeatures += ",screenY=" + yy;
	windowFeatures += ",location=no";		// no input for URLs
	windowFeatures += ",menubar=no";
	windowFeatures += ",resizable=yes";
	windowFeatures += ",scrollbars=yes";
	windowFeatures += ",status=no";			// don't display the statusbar
	windowFeatures += ",toolbar=no";		// don't display the toolbar
	if (staff == 1)
		popupWindow("staffProfile.php?"+index, windowFeatures);
	else
		popupWindow("postgraduateProfile.php?"+index, windowFeatures);
}

function popupEventWindow(key, type) {
	// Give this window a name first
	window.name = "KeyworthHome";
	var windowFeatures = "height=700";
	windowFeatures += ",width=700";
	var xx = window.screenX + window.outerWidth/2 - 250;
	windowFeatures += ",screenX=" + xx;
	var yy = window.screenY + window.outerHeight/2 - 350;
	windowFeatures += ",screenY=" + yy;
	windowFeatures += ",location=no";		// no input for URLs
	windowFeatures += ",menubar=no";
	windowFeatures += ",resizable=yes";
	windowFeatures += ",scrollbars=yes";
	windowFeatures += ",status=no";			// don't display the statusbar
	windowFeatures += ",toolbar=no";		// don't display the toolbar
	if (type == 1)
		popupWindow("keyworthEvent.php?"+key, windowFeatures);
	else
		popupWindow("otherEvent.php?"+key, windowFeatures);
}

function popupRMcaseStudyWindow(index) {
	// Give this window a name first
	window.name = "KeyworthHome";
	var windowFeatures = "height=700";
	windowFeatures += ",width=700";
	var xx = window.screenX + window.outerWidth/2 - 250;
	windowFeatures += ",screenX=" + xx;
	var yy = window.screenY + window.outerHeight/2 - 350;
	windowFeatures += ",screenY=" + yy;
	windowFeatures += ",location=no";		// no input for URLs
	windowFeatures += ",menubar=no";
	windowFeatures += ",resizable=yes";
	windowFeatures += ",scrollbars=yes";
	windowFeatures += ",status=no";			// don't display the statusbar
	windowFeatures += ",toolbar=no";		// don't display the toolbar
	popupWindow("RMcaseStudy.php?"+index, windowFeatures);
}

function popupCourseWindow(index) {
	// Give this window a name first
	window.name = "KeyworthHome";
	var windowFeatures = "height=700";
	windowFeatures += ",width=500";
	var xx = window.screenX + window.outerWidth/2 - 250;
	windowFeatures += ",screenX=" + xx;
	var yy = window.screenY + window.outerHeight/2 - 350;
	windowFeatures += ",screenY=" + yy;
	windowFeatures += ",location=no";		// no input for URLs
	windowFeatures += ",menubar=no";
	windowFeatures += ",resizable=yes";
	windowFeatures += ",scrollbars=yes";
	windowFeatures += ",status=no";			// don't display the statusbar
	windowFeatures += ",toolbar=no";		// don't display the toolbar
	popupWindow("course.php?"+index, windowFeatures);
}

function popupProjectWindow(index) {
	// Give this window a name first
	window.name = "KeyworthHome";
	var windowFeatures = "height=700";
	windowFeatures += ",width=500";
	var xx = window.screenX + window.outerWidth/2 - 250;
	windowFeatures += ",screenX=" + xx;
	var yy = window.screenY + window.outerHeight/2 - 350;
	windowFeatures += ",screenY=" + yy;
	windowFeatures += ",location=no";		// no input for URLs
	windowFeatures += ",menubar=no";
	windowFeatures += ",resizable=yes";
	windowFeatures += ",scrollbars=yes";
	windowFeatures += ",status=no";			// don't display the statusbar
	windowFeatures += ",toolbar=no";		// don't display the toolbar
	popupWindow("project.php?"+index, windowFeatures);
}

function popupInfoWindow(index) {
	// Give this window a name first
	window.name = "KeyworthHome";
	var windowFeatures = "height=300";
	windowFeatures += ",width=300";
	var xx = window.screenX + window.outerWidth/2 - 150;
	windowFeatures += ",screenX=" + xx;
	var yy = window.screenY + window.outerHeight/2 - 150;
	windowFeatures += ",screenY=" + yy;
	windowFeatures += ",location=no";		// no input for URLs
	windowFeatures += ",menubar=no";
	windowFeatures += ",resizable=yes";
	windowFeatures += ",scrollbars=yes";
	windowFeatures += ",status=no";			// don't display the statusbar
	windowFeatures += ",toolbar=no";		// don't display the toolbar
	popupWindow("info.php?"+index, windowFeatures);
}

function popupWindow(url, features) {
	window.open(url, "_blank", features);
}