var defaultWindowWidth = 250;
var defaultWindowHeight = 120;
var w;

function findCategory(selectObject) {
	if (selectObject.selectedIndex == 0) return;
	if (w == null || w.closed) {
		w = window.open('find-output.php?category_id=' + categoryID[selectObject.selectedIndex - 1], 'findWindow', 'width=' + defaultWindowWidth + ',height=' + defaultWindowHeight + ',resizable=yes,scrollbars=yes');
	} else {
		w.location = 'find-output.php?category_id=' + categoryID[selectObject.selectedIndex - 1];
	}
	selectObject.selectedIndex = 0;
	w.focus();
}

function findExhibitor(fieldContents) {
	if (fieldContents != '') {
		if (w == null || w.closed) {
			w = window.open('find-output.php?exhibitor=' + escape(fieldContents), 'findWindow', 'width=' + defaultWindowWidth + ',height=' + defaultWindowHeight + ',resizable=yes,scrollbars=yes');
		} else {
			w.location = 'find-output.php?exhibitor=' + escape(fieldContents);
		}
		w.focus();
	}
}

function findLine(fieldContents) {
	if (fieldContents != '') {
		if (w == null || w.closed) {
			w = window.open('find-output.php?line=' + escape(fieldContents), 'findWindow', 'width=' + defaultWindowWidth + ',height=' + defaultWindowHeight + ',resizable=yes,scrollbars=yes');
		} else {
			w.location = 'find-output.php?line=' + escape(fieldContents);		
		}
		w.focus();
	}
}

function setWindowSize(numRows) {
	var windowHeight;

	if (numRows < 12) {
		windowHeight = defaultWindowHeight + 28*numRows;
	} else {
		windowHeight = defaultWindowHeight + 336;
	}
	
	window.resizeTo(defaultWindowWidth, windowHeight);
}

function scheduleInstructions() {
	var w;

	w = window.open('../instructions.html', 'instructionsWindow', 'width=600,height=600,resizable=yes,scrollbars=yes');
	w.focus();
}