// Global .js File for the AU Website
// Author: Daniel Dixon
// Created: 12/16/05
// Last Modified: N/A

// global variables
var searchBoxHasFocus = false;
// this function gets the width of the viewer's screen
// so the popup boxes can be placed accordingly
function getInsideWindowWidth() {
	// if a Netscape-compatible browser
	if (window.innerWidth) {
		return window.innerWidth;
	// if IE6 with CSS support
	} else if (document.compatMode && document.compatMode.indexOf("CSS1") >= 0) {
		return document.body.parentElement.clientWidth;
	// if IE 5.5 or earlier
	} else if (document.body && document.body.clientWidth) {
		return document.body.clientWidth;
	}
	return 0;
}
// called everytime the Search Box is malnipulated
function displaySearchBox() {
	searchBoxObj = document.getElementById("searchBox");
	if (searchBoxHasFocus != true) {
		if(searchBoxObj.style.visibility == "visible") {
			searchBoxObj.style.visibility = "hidden";
		} else {
			searchBoxObj.style.visibility = "visible";
			searchBoxObj.style.left = getInsideWindowWidth() / 2 + 60;
		}
	}
}
function displayDepartmentsBox() {
	deptBoxObj = document.getElementById("deptBox");
	if(deptBoxObj.style.visibility == "visible") {
		deptBoxObj.style.visibility = "hidden";
	} else {
		deptBoxObj.style.visibility = "visible";
		deptBoxObj.style.left = getInsideWindowWidth() / 2 - 125; // + 100;
	}
}
// used to place the Quick Links and Search Box in the middle of the screen
// and +/- some (notice the calls to getInsideWindowWidth)
function positionBoxes() {
//	quickLinksObj = document.getElementById("quickLinksBox");
//	quickLinksObj.style.left = getInsideWindowWidth() / 2 + 100;
//	quickLinksObj.style.top = 16;
	searchBoxObj = document.getElementById("searchBox");
	searchBoxObj.style.left = getInsideWindowWidth() / 2 + 60;
	searchBoxObj.style.top = 26;
	deptBoxObj = document.getElementById("deptBox");
	deptBoxObj.style.left = getInsideWindowWidth() / 2 - 125; // + 60;
	deptBoxObj.style.top = 26;
}
// if the user clicks inside the search box, it will remain on
function setSearchStatus(value) {
	searchBoxHasFocus = value;
}
