function initGlobals()
{
	g_currentBranchIndex	= 0;
	g_menuSystem 		= new Array();
	g_imageDir		= "images/";
	g_movieDir		= "video/";
	g_navImageDir 		= "images/navigation/";
	g_thumbImageDir 	= "images/thumbnails/";
	g_galleryImageDir 	= "images/gallery/";
	g_galleryTitleDir 	= "images/titles/";
	g_zoomImageDir		= "images/zoom/";
	g_zoomUrlDir		= "popups/";
	g_pageLogoLgSrc 	= "images/header/header_logo_lg.jpg";
	g_galleryEmptySrc 	= "images/spacer.gif";
	g_loadingImageSrc 	= "images/loading.gif";
	g_popupDir		= "popups/";
	g_semitransImageSrc	= "url(images/white_20p.png)";
	
	g_bodyNode		= document.getElementById("bodyNode");
	g_outerFrame 		= document.getElementById("outerFrame");
	g_headerFrame		= document.getElementById("headerFrame");
	g_contentBox		= document.getElementById("contentBox");
	g_menuNode 		= document.getElementById("menuFrame");
	g_galleryItemNode 	= document.getElementById("centerFrame");
	g_contentNode 		= document.getElementById("contentNode");
	g_sidebarNode 		= document.getElementById("sidebarNode");
	g_dockImg1Node 		= document.getElementById("dockImg1");
	g_dockImg2Node 		= document.getElementById("dockImg2");
	g_dockImg3Node 		= document.getElementById("dockImg3");
	g_contentLeftBox 	= document.getElementById("contentLeftBox");
	g_contentRightBox 	= document.getElementById("contentRightBox");
	g_controlPanel		= document.getElementById("controlPanel");
	g_footerNode		= document.getElementById("footerNode");
	g_cleverTagline		= document.getElementById("cleverTagline");
	g_cleverResumeTagline	= document.getElementById("cleverResumeTagline");
	g_debugWindow 		= document.getElementById("debugWindow");
	g_dynamicContent	= document.getElementById("dynamicContent");
	g_fontSizeWidget	= document.getElementById("fontSizeWidget");
	g_tip			= document.getElementById("tip");
	g_tipTitle		= document.getElementById("tipTitle");
	g_tipSubtitle1		= document.getElementById("tipSubtitle1");
	g_tipSubtitle2		= document.getElementById("tipSubtitle2");
	g_updates		= document.getElementById("updates");
	
	g_popWindow		= "";
	g_galleryWidth 		= 428;
	g_galleryHeight 	= 368;
	
	g_bkgImageOffset	= 396;
	
	g_panelToggle 		= new Array(false, false, false);
	g_panelHilite		= new Array(false, false, false);
	
	g_panelHeaderNode	= new Array();
	g_panelHeaderNode[0]	= document.getElementById("panelHeader0");
	g_panelHeaderNode[1]	= document.getElementById("panelHeader1");
	g_panelHeaderNode[2]	= document.getElementById("panelHeader2");
	
	g_panelNode		= new Array();
	g_panelNode[0]		= document.getElementById("about");
	g_panelNode[1]		= document.getElementById("resume");
	g_panelNode[2]		= document.getElementById("storage");
	
	g_caretUp		= "url(images/caret-up.gif)";
	g_caretUpOver		= "url(images/caret-up_o.gif)";
	g_caretDown		= "url(images/caret-down.gif)";
	g_caretDownOver		= "url(images/caret-down_o.gif)";
	
	g_origWidth		= getWindowX();
	g_origHeight		= getWindowY();
	g_scrollEnable		= false;
	g_scrollDirection 	= 1;
	g_isFirstRun		= true;
	g_transparencyFlag	= false;
	g_tipTimer		= 9999;
	g_tipEnabled		= false;
	
	g_sortKey		= -1;
	g_sortTimer		= 999;
	
	g_updateLimit 		= 1;
	g_sidebarFadeDuration = 1000.0;
	
	g_contentHeaderStyle	= ["aboutHeader","resumeHeader","archiveHeader"];
	
	/* DEBUG */
	g_debugConsole = document.getElementById("debugConsole");
	g_debugWindow = document.getElementById("debugWindow");
	initDebug(false);
	
	/* START PRESENTATION MANAGER */
	//var loadIndicator = createNode("div","loadIndicator","",g_dockImg1Node);
	theSpiceMustFlow();
}


/* DEBUG */
function initDebug(bDebug)
{
	if(!bDebug) return;
	g_bDebug = bDebug;
	g_debugCounter=0;
	g_debugWindow.style.display = "block";
}

function debugPrint(inputString)
{
	var outputString = formatNumber(g_debugCounter) + inputString;
	var buffer = g_debugConsole.value + "\r" + outputString;
	g_debugConsole.value = buffer;
	g_debugConsole.scrollTop = g_debugConsole.scrollHeight;
	g_debugCounter ++;
	
	function formatNumber(numValue)
	{
		var padding = 3;
		var leading = "";
	
		while(padding>0)
		{
			if(Math.pow(10,padding) > numValue){leading += "0"};
			padding --;
		}
		
		leading += numValue + "| ";
		return leading;
	}
}

function debugPrintLine()
{
	for(var i=0;i<arguments.length/2;i++)
	{
		var outputString = arguments[2*i]+": "+arguments[2*i+1];
		debugPrint(outputString);
	}
}

function debugPrintLines()
{
	var outputString="";
	for(var i=0;i<arguments.length/2;i++)
	{
		outputString += (i==0)?"":" |  ";
		outputString += arguments[2*i]+": "+arguments[2*i+1];
	}
	debugPrint(outputString);
}

// FLOW //
function theSpiceMustFlow()
{
	window.onresize = resizeHandler;
	updateWindowHeight();
	g_bodyNode.style.visibility="visible";
	g_dockImg1Node.style.backgroundImage ="url(images/home/dock_left01.jpg)";
	asyncPreload();
	
	defineMenuSystem();
	updateDisplayConfig(g_currentBranchIndex);
	cleverTagLine();
	initContent();
	defineContentPanelBehavior();
	createMenu(g_currentBranchIndex);
}

/* ASYNCHRONOUS PRELOAD */
function asyncPreload()
{
	var imageArray = new Array();
	
	//preload animation + logo
	imageArray.push(g_imageDir  + "indicator.gif");
	imageArray.push(g_imageDir  + "home/dock_left01.jpg");
	
	// beauty
	imageArray.push(g_imageDir  + "home/body_left01.jpg");
	imageArray.push(g_imageDir  + "home/body_mid01.jpg");
	imageArray.push(g_imageDir  + "home/body_right01.jpg");
	imageArray.push(g_imageDir  + "home/dock_mid01.jpg");
	
	// icons
	imageArray.push(g_imageDir  + "imageicon.gif");
	imageArray.push(g_imageDir  + "movieicon.gif");
	imageArray.push(g_imageDir  + "pdficon.gif");
	imageArray.push(g_imageDir  + "flashicon.gif");
	imageArray.push(g_imageDir  + "wordicon.gif");

	// menu system
	var navAsset = ["images","design","motion"];
	for(var i=0;i<navAsset.length;i++)
	{
		imageArray.push(g_navImageDir  + navAsset[i] + "_active_down.gif");
		imageArray.push(g_navImageDir  + navAsset[i] + "_active_header.gif");
		imageArray.push(g_navImageDir  + navAsset[i] + "_active_out.gif");
		imageArray.push(g_navImageDir  + navAsset[i] + "_active_over.gif");
		imageArray.push(g_navImageDir  + navAsset[i] + "_select_down.gif");
	}
	// back menu item
	imageArray.push(g_navImageDir  + "back_select_down.gif");
	imageArray.push(g_navImageDir  + "back_select_out.gif");
	imageArray.push(g_navImageDir  + "back_select_over.gif");
	
	// sort arrow icons
	imageArray.push(g_navImageDir  + "sort_arrow_up.gif");
	imageArray.push(g_navImageDir  + "sort_arrow_down.gif");
	
	// prev/next
	imageArray.push(g_navImageDir  + "prev_down.gif");
	imageArray.push(g_navImageDir  + "prev_out.gif");
	imageArray.push(g_navImageDir  + "prev_over.gif");
	imageArray.push(g_navImageDir  + "next_down.gif");
	imageArray.push(g_navImageDir  + "next_out.gif");
	imageArray.push(g_navImageDir  + "next_over.gif");
	
	// carets
	imageArray.push(g_imageDir  + "caret-down.gif");
	imageArray.push(g_imageDir  + "caret-down_o.gif");
	imageArray.push(g_imageDir  + "caret-up.gif");
	imageArray.push(g_imageDir  + "caret-up_o.gif");
	
	// bkg image
	imageArray.push(g_imageDir  + "treeoflife_dark.jpg");
	imageArray.push(g_imageDir  + "treeoflife_light.jpg");
	
	// asset thumbnails
	imageArray.push(g_thumbImageDir  + "selected.jpg");
	imageArray.push(g_thumbImageDir  + "empty.jpg");
	
	// transparent panes
	imageArray.push(g_imageDir  + "contentHeader20p01.png");
	imageArray.push(g_imageDir  + "contentHeader20p02.png");
	imageArray.push(g_imageDir  + "contentHeader20p03.png");
	imageArray.push(g_imageDir  + "white_20p.png");
	
	// call the preloader
	g_preloader = new ImagePreloader(imageArray, onPreload);
}


// callback function for when all images have been preloaded
function onPreload(imageArray,numLoaded)
{
	//debugPrint(g_preloader.nImages+" images in cache");
	//clearChildNodes(g_dockImg1Node);
}

function ImagePreloader(imageArray, callback)
{
	// store the call-back
	this.callback = callback;
	
	// initialize internal state.
	this.nLoaded = 0;
	this.nProcessed = 0;
	this.nImages = imageArray.length; // record the number of images
	this.aImages = new Array;
	
	// for each image, call preload()
	for ( var i = 0; i < imageArray.length; i++ )
	{
		this.preload(imageArray[i]); // send each image to preload function
	}
}

ImagePreloader.prototype.preload = function(image)
{
	var oImage = new Image;
	this.aImages.push(oImage);
	
	oImage.onload = ImagePreloader.prototype.onload;
	oImage.onerror = ImagePreloader.prototype.onerror;
	oImage.onabort = ImagePreloader.prototype.onabort;
	
	oImage.oImagePreloader = this;
	oImage.bLoaded = false;
	oImage.src = image;
}

ImagePreloader.prototype.onComplete = function()
{
	this.nProcessed++;
	if ( this.nProcessed == this.nImages )
	{
		this.callback(this.aImages, this.nLoaded);
	}
}

ImagePreloader.prototype.onload = function()
{
	this.bLoaded = true;
	this.oImagePreloader.nLoaded++;
	this.oImagePreloader.onComplete();
}

ImagePreloader.prototype.onerror = function()
{
	this.bError = true;
	this.oImagePreloader.onComplete();
}

ImagePreloader.prototype.onabort = function()
{
	this.bAbort = true;
	this.oImagePreloader.onComplete();
}