// Navigation Functions
// Created 2/2/00 Antics Online, Inc.

	// Declare global vars
	gBrowserOK = (((navigator.appName == "Netscape") && (parseInt(navigator.appVersion) >= 3 )) || ((navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4 )))
	gNavObjects = new Array();	// An array of navigation objects
	gNavSelected = "";	// Which navigation object is selected

	// Create our Navigation Objects
	if( gBrowserOK ) {
		createNavObj("nav1", "Home", "images/nav-home-nor87x25.gif", "images/nav-home-hi87x25.gif", "images/nav-home-sel87x25.gif", 87, 25, "index.html");
		createNavObj("nav2", "About Us", "images/nav-about-nor87x25.gif", "images/nav-about-hi87x25.gif", "images/nav-about-sel87x25.gif", 87, 25, "about.html");
		createNavObj("nav3", "Press Room", "images/nav-press-nor87x25.gif", "images/nav-press-hi87x25.gif", "images/nav-press-sel87x25.gif", 87, 25, "press.html");
		createNavObj("nav4", "Jobs", "images/nav-jobs-nor87x25.gif", "images/nav-jobs-hi87x25.gif", "images/nav-jobs-sel87x25.gif", 87, 25, "jobs.html");
	}
	
	// Navigation Object definition
	function navObj(name, status, normal, highlight, selected, width, height, location) {
		this.name = name;
		this.status = status;
		this.normal = new Image(width, height);
		this.normal.src = normal;
		this.highlight = new Image(width, height);
		this.highlight.src = highlight;		 
		this.selected = new Image(width, height);
		this.selected.src = selected;
		this.location = location;
	}
	
	// Create instances of Navigation Objects and store in an array indexed by name
	function createNavObj(name, status, normal, highlight, selected, width, height, location) {
		gNavObjects[name] = new navObj(name, status, normal, highlight, selected, width, height, location);
	}
	
	// Sets the appropriate Navigation item to the selected state 
	function setSelected(name) {
		if( gBrowserOK ) {
			if( name != "") {
				gNavSelected = name;				
				document[name].src = gNavObjects[name].selected.src;
			}
		}
		return(true);			
	}

	// Highlight the navigation item when mouse is over
	function doMouseOver(name){
		if( gBrowserOK ) {
			if( name != "" && name != gNavSelected ) {
				window.status = gNavObjects[name].status;
				document[name].src = gNavObjects[name].highlight.src;
			}
		}	
		return(true);	
	}
	
	// Return the navigation item to the normal state when mouse moves off
	function doMouseOut(name) {
		if( gBrowserOK ) {
			if( name != "" && name != gNavSelected ) {
				window.status = "";
				document[name].src = gNavObjects[name].normal.src;
			}
		}
		return(true);	
	}
	
	// Select the button when the user clicks on it, then go to that location
	function doClick(name) {
		if( gBrowserOK ) {
			if( name != "" && name != gNavSelected ) {
				window.status = "";
				document[name].src = gNavObjects[name].selected.src;
				document.location = gNavObjects[name].location;
			}
		}
		return(true);	
	}
	
	// Writes the page footer with the current page unlinked
	function writeFooter(selected) {
		if( gBrowserOK ) {
			var theFooter = new String('<FONT FACE="arial, helvetica, sans serif" SIZE="-1">');		
			for( i in gNavObjects ) {
				if( i == selected )
					theFooter +=('&nbsp;<FONT COLOR="#003399">' + gNavObjects[i].status + '</FONT>&nbsp;&#124;');
				else
					theFooter += ('&nbsp;<A HREF="' + gNavObjects[i].location + '">' + gNavObjects[i].status + '</A>&nbsp;&#124;');
			}
			end = theFooter.length - 6; // Lop off the last '|'
			theFooter = theFooter.substring(0,end);
			theFooter += "<P><A HREF='javascript:openPopup(\"copyright.html\");'>&#169; 2000</A>, Military.com, Inc.</FONT>";
			document.open(); document.write(theFooter); document.close();
		}
	}
	
	// Open the popup window to the specified URL
	function openPopup(theURL) {
		var winProperties = "resize=no,toolbar=no,directories=no,menubar=no,status=no,noresize,scrollbars=auto,width=400,height=420";
		var mainWin = self;
		if( window.popupWin == null )	   // If the window has never been opened
			popupWin=window.open(theURL,"popupWin", winProperties);
		else {
			if( window.popupWin.closed )	// If the window was open but has been closed
				popupWin=window.open(theURL,"popupWin", winProperties);
			else									   // The window is already open
				popupWin.location.href = theURL;
		}
		popupWin.opener = mainWin;
		popupWin.focus();
	}

	
	

