// 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 Quick Links box is malnipulated
function displayQuickLinks() {
	quickLinksObj = document.getElementById("quickLinksBox");
	if(quickLinksObj.style.visibility == "visible") {
		quickLinksObj.style.visibility = "hidden";
	} else {
		quickLinksObj.style.visibility = "visible";
		quickLinksObj.style.left = getInsideWindowWidth() / 2 + 130;
	}
}
// 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;
		}
	}
}
// 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;
}
// if the user clicks inside the search box, it will remain on
function setSearchStatus(value) {
	searchBoxHasFocus = value;
}
// used to create a clickable hidden DIV tag over the Sesquicentennial title
function goToSesquicentennial() {
  this.location.href = "http://www.auburn.edu/150";
 }
// prevent the main Auburn web site from showing up
// in frames on other web sites.  -jcm Feb. 2005
if ( window.parent != window.self ) { window.open(document.location,'_top');
}
