
//*******	Artware Button Management		*******//
//*******		Intelligarde Web Site		*******//
//*******		Top Window Code				*******//
//*******		Included in home.html		*******//

//***	Main Menu Constants
var MAIN				= 0;		
var ABOUT 			= 1;
var SERVICES 		= 2;
var CAREERS 		= 3;
var MEDIA 			= 4;
var STORE 			= 5;
var EMPLOYEES 		= 6;
var CONTACT 		= 7;
var MENU = 0;//To specify the source of events.
var PAGE = 1;
//***	Main Menu Constants

//***	Variables for Sticky Buttons		***//
var applyWindow = null;  	//Window for opening application form.

var POSTEDApplyPath = "apply/WebApplicants.asp";		//POSTING of 1Feb04 on public site.
var TESTApplyPath = "../../../apply/WebApplicants.asp";	//PRE POSTING of 1Feb04.
var applyWindowPath = POSTEDApplyPath;

var POSTEDJobDescPath = "../careersJobDescriptions.html";
var TESTJobDescPath = "../test/careersJobDescriptions.html";
var jobDescriptionsPath = POSTEDJobDescPath;

var POSTEDInfoPath = "careersInfoSessions.htm";
var TESTInfoPath = "../test/careersInfoSessions.html";
var infoWindowPath = POSTEDInfoPath;

var postingsWindowPath = "careersJobPostings.htm";

var applyWindowJustOpened = false;
var trainingSessionsWindow = null; 	// For displaying careersTraining page.
var ttcMapWindow = null; 				// For displaying TTC map.
var infoSessionsWindow = null;		// For displaying careersInfoSessions page.
var postingsWindow = null;				// For displaying recent job postings.
var windowSUNKen = null;				// Plain windows for pictures.
var windowSUNNelson = null;
var windowSUNRobert = null;
var windowSUNSanto = null;

var numberOfSubmenus = 8;//Submenus in main menu.
var subMenuPage = new Array(numberOfSubmenus);
var subMenuNotLoaded = new Array(numberOfSubmenus); // Keeps track of whether a submenu is loaded
var menuChangeSource = new Array(numberOfSubmenus);// Is this needed????????????????????????
var menuSelection = new Array(numberOfSubmenus);
var defaultSelection = new Array(numberOfSubmenus);
//***	Variables for Sticky Buttons		***//

//***	Functions for Sticky Buttons		***//
function initializeSite()
{
//alert("Enter initializeSite\n");
	setSubMenuPages();
	setDefaultMenuSelections();
	resetSubmenuLoadStatus(0);
	resetMenuSelections();
	resetMenuSources();	// Is this needed????????????????????????
//alert("Exit initializeSite\n");
}//function initializeSite()

function setSubMenuPages()
{
//alert("Enter setSubMenuPages\n");
	subMenuPage[MAIN] 		= "homeMain.html";
//alert("subMenuPage[MAIN] set to " + subMenuPage[MAIN] + "\n");
	subMenuPage[ABOUT] 		= "aboutMenu.html";
//alert("subMenuPage[ABOUT] set to " + subMenuPage[ABOUT] + "\n");
	subMenuPage[SERVICES] 	= "servicesMenu.html";
//alert("subMenuPage[SERVICES] set to " + subMenuPage[SERVICES] + "\n");
	subMenuPage[CAREERS] 	= "careersMenu.html";
//alert("subMenuPage[CAREERS] set to " + subMenuPage[CAREERS] + "\n");
	subMenuPage[MEDIA] 		= "mediaMenu.html";
//alert("subMenuPage[MEDIA] set to " + subMenuPage[MEDIA] + "\n");
	subMenuPage[STORE] 		= "storeMenu.html";
//alert("subMenuPage[STORE] set to " + subMenuPage[STORE] + "\n");
	subMenuPage[EMPLOYEES] 	= "employeesMenu.html";
//alert("subMenuPage[EMPLOYEES] set to " + subMenuPage[EMPLOYEES] + "\n");
	subMenuPage[CONTACT] 	= "contactMenu.html";
//alert("subMenuPage[CONTACT] set to " + subMenuPage[CONTACT] + "\n");
//alert("Exit setSubMenuPages\n");
}//function setSubMenuPages()

function setDefaultMenuSelections()
{
//alert("Enter setDefaultMenuSelections\n");
	defaultSelection[MAIN] 			= 0;
	defaultSelection[ABOUT] 		= 1;
	defaultSelection[SERVICES]		= 1;
	defaultSelection[CAREERS] 		= 0;
	defaultSelection[MEDIA] 		= 1;
	defaultSelection[STORE] 		= 1;
	defaultSelection[EMPLOYEES] 	= 0;
	defaultSelection[CONTACT] 		= 0;
//alert("Exit setDefaultMenuSelections\n");
}//function setDefaultMenuSelections()

function resetMenuSelections()
{
//alert("Enter resetMenuSelections\n");
	for (var i=0; i<numberOfSubmenus; i++)
		menuSelection[i] = defaultSelection[i];
//alert("Exit resetMenuSelections\n");
}//function resetMenuSelections()

function resetSubmenuLoadStatus(loadedSubmenu)
{//Sets state of all submenus to NOT loaded.
//alert("Enter resetSubmenuLoadStatus: " + loadedSubmenu + "\n");
	for (var i=0; i<numberOfSubmenus; i++)
	{
		if (loadedSubmenu == i)
			subMenuNotLoaded[i] = false;
		else
			subMenuNotLoaded[i] = true;
	}
//alert("Exit resetSubmenuLoadStatus\n");
}//function resetSubmenuLoadStatus()

function resetMenuSources()	
{
//alert("Enter resetMenuSources \n");
	for (var i=0; i<numberOfSubmenus; i++)
	{
//alert("i= " + i + "\n");
		menuChangeSource[i] = PAGE;
//alert("menuChangeSource[i]= " + menuChangeSource[i] + "\n");
	}
//alert("Exit resetMenuSources \n");
}//function resetMenuSources()

function loadSubMenuPage(pageIndex)
{
//alert("Enter loadSubMenuPage\n");
	replaceFrameContent(window.submenuFrame, subMenuPage[pageIndex]);
	resetSubmenuLoadStatus(pageIndex);//Now in submenu.loadClick.
//alert("Exit loadSubMenuPage\n");
}//function loadSubMenuPage(pageIndex)

function setButtonStateImage(buttonName, buttonStateImage)
{
//alert("Enter setButtonStateImage: " + buttonName + "  " + buttonStateImage + "\n");
	document[buttonName].src = buttonStateImage;
//alert("Exit setButtonStateImage: " + buttonStateImage + "\n");
}//function setButtonStateImage(buttonName, buttonStateImage)

function changeFrameContent(theFrame, theContents)
{// Fills  theFrame  with  theContents.  Puts in history.
//alert("Enter changeFrameContent\n" + "theFrame: " + theFrame + "\n" + "theContents: " + theContents + "\n");

	theFrame.location.href = theContents;
//alert("Exit changeFrameContent\n");
}//function changeFrameContent(theFrame, theContents)

function replaceFrameContent(theFrame, theContents)
{// Fills  theFrame  with  theContents.  Does NOT put in history.
//alert("Enter replaceFrameContent\n" + "theFrame: " + theFrame + "\n" + "theContents: " + theContents + "\n");

	theFrame.location.replace(theContents);
//alert("Exit replaceFrameContent\n");
}//function replaceFrameContent(theFrame, theContents)
//***	Functions for Sticky Buttons		***//

//***	External Frame Control				***//???????????????????????????????????//
//***	External Frame Control				***//

//***	Plain Window Opener					***//
function openPlainWindow(theWindow, theContents, theWidth, theHeight)
{
	if (!theWindow || theWindow.closed)
	{
		var browserName = window.navigator.appName;
		if (browserName == "Netscape")
		{
			theWindow = window.open(theContents, "",
				"height=" + theHeight + ",width=" + theWidth + ",resizable");
		}
		else if (browserName == "Microsoft Internet Explorer")
		{
			theWindow = window.open(theContents, "",
				"height=" + theHeight + ",width=" + theWidth + ",resizable,top=23,left=5");
		}
		else
		{
			theWindow = window.open(theContents, "",
				"height=" + theHeight + ",width=" + theWidth + ",resizable");
		}
	}
	}//function openPlainWindow()
//***	Plain Window  Opener					***//

//***	Postings Window:  Opener			***//
function openPostingsWindow()
{
		var theScreenHeight = screen.availHeight;
		var theWindowHeight = theScreenHeight - 65;
	if (!postingsWindow || postingsWindow.closed)
	{
		var browserName = window.navigator.appName;
//alert("Browser Name: " + browserName +"\n");
		if (browserName == "Netscape")
		{
			postingsWindow = window.open(postingsWindowPath, "Job Postings",
				"height=" + theWindowHeight + ",resizable,scrollbars,width=500");
		}//if
		else if (browserName == "Microsoft Internet Explorer")
		{
			postingsWindow = window.open(postingsWindowPath, "",
				"height=" + theWindowHeight + ",resizable,scrollbars,width=500,top=23,left=5");
		}//else if
		else
		{
			postingsWindow = window.open(postingsWindowPath, "Job Postings",
				"height=" + theWindowHeight + ",resizable,scrollbars,width=590");
		}//else
		postingsWindow.focus();
	}//if
	else
	{
		postingsWindow.focus();
	}//else
}//function openPostingsWindow()
//***	Postings Window:  Opener			***//

//***	Info Window:  Opener			***//
function openInfoSessionsWindow()
{
//alert("FROM home.html:  entering openInfoSessionsWindow\n");
	if (!infoSessionsWindow || infoSessionsWindow.closed)
	{
		var browserName = window.navigator.appName;
//alert("Browser Name: " + browserName +"\n");
		if (browserName == "Netscape")
		{
			infoSessionsWindow = window.open(infoWindowPath, "Information Sessions",
				"height=368,width=497");
		}//if
		else if (browserName == "Microsoft Internet Explorer")
		{
			infoSessionsWindow = window.open(infoWindowPath, "",
				"height=368,width=497");
		}//else if
		else
		{
			infoSessionsWindow = window.open(infoWindowPath, "Information Sessions",
				"height=368,width=497");
		}//else
	}//if
	else
	{
		infoSessionsWindow.focus();
	}//else
}//function openInfoSessionsWindow()
//***	Info Window:  Opener			***//

//***	Info Window:  Pull Up Job Descriptions			***//
function pullUpJobDesc()
{//Called from WebApplicants.asp
//alert("Entering  pullUpJobDescriptions\n");
//alert("Before  doMainClick\n");
//	doMainClick(3);
//alert("Before  setSubMenu\n");
//	setSubMenu("careersMenu", 0);
//alert("Before  displayMain\n");
	changeFrameContent(mainFrame, 'careersJobDescriptions.html');
if (infoSessionsWindow) infoSessionsWindow.close();	
window.focus();
//alert("Leaving   pullUpJobDescriptions\n");
}//function pullUpJobDesc()
//***	Info Window:  Pull Up Job Descriptions			***//

//***	Application Form:  Opener			***//
function openApplicationForm()
{
//alert("FROM home.html:  entering openApplicationForm\n");
	if (!applyWindow || applyWindow.closed)
	{
		var browserName = window.navigator.appName;
//alert("Browser Name: " + browserName +"\n");
		var theScreenHeight = screen.availHeight;
//alert("Screen Height: " + theScreenHeight +"\n");
		var theWindowHeight = theScreenHeight - 65;
//alert("theWindowHeight: " + theWindowHeight +"\n");

		if (browserName == "Netscape")
		{
//alert("Netscape before open window\n");
			applyWindow = window.open(applyWindowPath, "Job Application",
				"height=" + theWindowHeight + ",resizable,scrollbars,width=590");
		}
		else if (browserName == "Microsoft Internet Explorer")
		{
//alert("IE before open window\n");
			applyWindow = window.open(applyWindowPath, "",
				"height=" + theWindowHeight + ",resizable,scrollbars,width=590,top=23,left=5");
		}
		else
		{
//alert("OtherBrowser before open window\n");
			applyWindow = window.open(applyWindowPath, "Job Application",
				"height=" + theWindowHeight + ",resizable,scrollbars,width=590");
		}
		applyWindowJustOpened = true;
//alert("after open window\n");
	}//if
	else
	{
		applyWindow.focus();
	}//else
}//function openApplicationForm()
//***	Application Form:  Opener			***//

//***	Application Form:  Pull Up Job Descriptions			***//
function pullUpJobDescriptions()
{//Called from WebApplicants.asp
//alert("Entering  pullUpJobDescriptions\n");
//alert("Before  doMainClick\n");
//	doMainClick(3);
//alert("Before  setSubMenu\n");
//	setSubMenu("careersMenu", 0);
//alert("Before  displayMain\n");
	changeFrameContent(mainFrame, jobDescriptionsPath);//Because function is called from Application Form.
	//As a result, the file careersJobDescriptions.html had to be put in intelligade.com for now.
if (applyWindow) applyWindow.blur();	
if (postingsWindow) postingsWindow.blur();	
window.focus();
//alert("Leaving   pullUpJobDescriptions\n");
}//function pullUpJobDescriptions()
//***	Application Form:  Pull Up Job Descriptions			***//


