var width = 795
var height = 400

//* This function takes in configuration variables for a pop up window
//* and prints the appropriate pop up.  User input variables include:

//*		url			[URL of document]
//*		name		[Name of window]
//*		navBar		[Determines if window has nav bar.  0 = no, 1 = yes]
//*		scrolling	[Determines if window has scroll bars.  0 = no, 1 = yes]
//*		resizable	[Determines if window is resizable.  0 = no, 1 = yes]
//*		userHeight	[This value will override the default resolution height, if not empty]
//*		userWidth	[This value will override the default resolution width, if not empty]

function popUpWindow(url, name, navBar, scrolling, resizable, userHeight, userWidth) {
	if (scrolling == 1) { var scrollBars = 'yes'; }
	if (navBar == 1) { var navBar = 'yes'; }
	if (resizable == 1) { var changeSize = 'yes';}
	if ((userHeight) && (userWidth)) {
		var height = userHeight;
		var width = userWidth;
	} else {
		if ((screen.width <= 640) && (screen.height <= 480)) {
			var height = '360';
			var width = '625';
		} else if ((screen.width == 800) && (screen.height == 600)) {
			var height = '450';
			var width = '670';
		} else {
			var height = '600';
			var width = '670';
		}
	}
	var popUpWindow = window.open(url, name, 'height='+height+',width='+width+',scrollbars='+scrollBars+',toolbar='+navBar+',resizable='+changeSize+',left=1,top=1');
}

//* This function prints the calendar window on the OTF homepage based on the screen resolution
//* the user is implementing.

function openCalendar() {
  if (screen.width < 800) {
	window.open('http://www.outpost10f.com/cgi-bin/calendar/calendar.pl', 'calendar', "width='+screenHeight+',height='+screenWidth+',scrollbars=yes,resizable=yes,toolbar=no,left=1,top=1");
  } else {
	window.open('http://www.outpost10f.com/cgi-bin/calendar/calendar.pl', 'calendar', "width=800,height=640,scrollbars=yes,resizable=yes,toolbar=no,left=1,top=1");
  }
}

function openDossier(dossierID) {
	var dossierWindow = window.open('http://www.outpost10f.com/cgi-bin/dossiers.fcgi?id=' + dossierID, 'dossierPopUp', 'height=500,width=700,scrollbars=yes,resizable=yes,toolbar=yes');
}

function openDossierByUsername(userID) {
	var dossierWindow = window.open('http://www.outpost10f.com/cgi-bin/dossiers.fcgi?usr=' + userID, 'dossierPopUp', 'height=500,width=700,scrollbars=yes,resizable=yes,toolbar=yes');
}

function openAccessRight(genreID, keyID) {
	var accessRight = window.open('http://www.outpost10f.com/cgi-bin/view_access_rights.pl?genreID='+genreID+'&keyID='+keyID, 'accessRight', 'height=350,width=600,scrollbars=yes');
}
		
function openOTFHQ() {
	var otfhq=window.open('http://www.outpost10f.com/otfhq/otfhq.html', 'otfhq','width=775,height=442,scrollbars=no,resizable=yes');
}

function openSchematics() {
	var otfhq=window.open('http://www.outpost10f.com/schematics/', 'schematics','width=700,height=550,scrollbars=no,resizable=yes');
}

function openDeptRoster(deptID) {
	var deptRoster = window.open('http://www.outpost10f.com/cgi-bin/roster.pl?deptID=' + deptID, "Dept_Roster", 'height=' + height + ',width=' + width + ',toolbar=yes,menubar=yes,location=yes,resizable=yes,top=0,left=0,scrollbars=yes');
}

function openGroupRoster(groupID) {
	var groupRoster = window.open('http://www.outpost10f.com/cgi-bin/roster.pl?groupID=' + groupID, "Group_Roster", 'height=' + height + ',width=' + width + ',toolbar=yes,menubar=yes,location=yes,resizable=yes,top=0,left=0,scrollbars=yes');
}

function openProjectRoster(projectID) {
	var projectRoster = window.open('http://www.outpost10f.com/cgi-bin/roster.pl?projectID=' + projectID, "Project_Roster", 'height=' + height + ',width=' + width + ',toolbar=yes,menubar=yes,location=yes,resizable=yes,top=0,left=0,scrollbars=yes');
}

function viewDatabase(index) {
	var database = window.open("http://www.outpost10f.com/cgi-bin/info.pl?mode=display&infoID=" + index, "Database", "width=450,height=320,scrollbars=yes");
}
