// JavaScript Document
// Privides Common Functions for the Office of Development website
// Copyright 2008 Office of Development, Old Dominion University
// Corey Wilkes '09

var PageName;

//// List of Main Image Options				***********************************
//// Add or change images for the main page HERE (Pictures must be gif to be supported in all browsers)
var ImgArray = new Array();
// Images
	
function Search(str){
	if (str == "Search" || str == "") return false;
	var sStr = new Array();
	sStr = str.split(" ");
	str=sStr[0];
	for (var i=1;i<sStr.length;i++)
		str += "+"+sStr[i];
	window.open("http://www.odu.edu/oduhome/search/?q="+str);

	//window.location="SearchPage"
}

function returnObjById(id) {
// Returns an object by it's ID
    if (document.getElementById)
        var returnVar = document.getElementById(id);
    else if (document.all)
        var returnVar = document.all[id];
    else if (document.layers)
        var returnVar = document.layers[id];
    return returnVar;
}


//Find browsertype and adjust stylesheet
function StyleRef() {
	if (navigator.appName == "Microsoft Internet Explorer" && navigator.appVersion >= "4.0") return "Styles-IE.css";
	else return "Styles-NetMoz.css";
}


////Popout Menu Functions
var timeout	= 500;
var Timer	= 0;
var MenuObj	= null;


function OpenMenu(id) {	//Open Menu
	StopTimer();
	if(MenuObj) CloseMenu();

	MenuObj = returnObjById(id);
	MenuObj.style.visibility = 'visible';
}

function CloseMenu() { //Closes Open Menu
	if(MenuObj) MenuObj.style.visibility = 'hidden';
}

function StartTimer() { //Menu Closing Timer
	Timer = window.setTimeout(CloseMenu, timeout);
}

function StopTimer() { //Stop Menu Closing Timer
	if(Timer) {
		window.clearTimeout(Timer);
		Timer = null;
	}
}

// Close Menu if a click occurs elsewhere on the page
document.onclick = CloseMenu;

//Check for passed data in URL
function URLCheck(URL){
	var array = URL.split("?");
	if (array.length <=1)
		return "";
	//alert(array[1]);
	return array[1];
}

