var preloadFlag = false;var itemDestinationLast;var imageList = null;var projectImageThumbnails = null;var currentImage = null;var firstPhoto = null;var lastImageSelector = null;var projectThumbnails;function init() {	preloadImage("images/siteComponents/arrowUpHighlight.png");	preloadImage("images/siteComponents/arrowDownHighlight.png");		document.getElementById("siteLimits").style.opacity="1";	document.getElementById("footer").style.opacity="1";	document.getElementById("headerBar").style.opacity="1";	firstPage = document.getElementById('news');		itemDestinationLast = firstPage;	goContent('news', firstPage);	}function preloadImage(arg) {	if (document.images) {		rslt = new Image();		rslt.src = arg;		preloadFlag = true;		return rslt;		}	}function goContent(itemDestination, itemClicked) {	if (itemClicked != 'inline') { lastNavItemClicked = itemClicked; }	subMenuLists = document.getElementById('navigationTitles').getElementsByTagName('ul');	// CLOSE ALL SUBMENUS		for (var i=0; i < subMenuLists.length; ++i) {			if (i <= subMenuLists.length) {						subMenuLists[i].style.display="none";				}			}	// OPEN RELEVANT SUBMENUS BY IDENTIFYING IF THE ITEM CLICKED HAS A SUBMENU OR ITS PARENT HAS A SUBMENU, AND DISPLAYING THAT MENU		for (var i=0; i < subMenuLists.length; ++i) {			if (i <= subMenuLists.length) {				if (itemClicked.id == subMenuLists[i].id || itemClicked.parentNode.id == subMenuLists[i].id) {					subMenuLists[i].style.display="block"; }				}			}	// SET COLOR OF CLICKED ITEM TO WHITE, REVERT COLOR OF PREVIOUS ITEM	if (itemClicked != 'inline') {		itemClicked.className='navCurrent';			if (itemDestinationLast && (itemClicked.parentNode.className == 'navList') && (itemDestinationLast != itemClicked)) {				if (itemDestinationLast.parentNode.className == 'navList') {						document.getElementById(itemDestinationLast.id).className = 'navLast';					}				else {					document.getElementsByName('navItem').className = 'navLast';					itemClicked.className='navCurrent';					}				itemDestinationLast = itemClicked;						}		}	// HIDE SCROLL BUTTONS		document.getElementById('scrollUp').style.display="none";		document.getElementById('scrollDown').style.display="none";	// SET TARGET URL FOR EXTERNAL PAGE		if (itemDestination == 'projectsOverview' ) {			targetURL = 'pages/projects/' + itemDestination + '.html';			}		else if (itemClicked == 'inline') {			targetURL = 'pages/' + itemDestination + '.html';			}		else if (itemClicked.parentNode.className == "navList" ) {			targetURL = 'pages/' + itemClicked.id + "/" + itemDestination + '.html';			}		else if (itemClicked.parentNode.className == "subNavList") {					targetURL = 'pages/' + itemClicked.parentNode.id + "/" + itemDestination + '.html';			}			// LOAD NECESSARY EXTERNAL PAGE, ANALYZE EXTERNAL CONTENT FOR AND DISPLAYS SCROLL ARROWS IF NECESSARY		document.getElementById('contentWindow').innerHTML=fetchContent(targetURL, itemClicked);			// SETS CONTENT AREA HEIGHT PER BROWSER WINDOW DIMENSIONS		if (typeof window.innerWidth != 'undefined') {			viewportWidth = window.innerWidth,			viewportHeight = window.innerHeight			}		siteLimitsHeight = viewportHeight - 100;		contentHeight = siteLimitsHeight - 250;		document.getElementById('siteLimits').style.height = siteLimitsHeight + "px";		document.getElementById('content').style.height = contentHeight + "px";		document.getElementById('contentWindow').style.height = contentHeight + "px";		}				function fetchContent(url, itemClicked) {	document.getElementById('contentWindow').style.display = "none";	portfolioStatus = false;		// IF THE ITEM CLICKED IS A PORTFOLIO CATEGORY, SETS FLAG AND RECORDS ITEM'S VERTICAL LOCATION	if (itemClicked.parentNode) {		if (itemClicked.parentNode.id == 'projects') { portfolioStatus = true; }		}			var content;	if (window.XMLHttpRequest){			 // If IE7, Mozilla, Safari, etc: Use native object			content = new XMLHttpRequest();		}	else {	if (window.ActiveXObject){			 // ...otherwise, use the ActiveX control for IE5.x and IE6			content = new ActiveXObject("Microsoft.XMLHTTP");			}		}	content.onreadystatechange=function() {		if (content.readyState==4) {			document.getElementById('contentWindow').innerHTML = content.responseText;			document.getElementById('contentWindow').style.display = "block";			if (itemClicked.className == 'projectThumbnail' || itemClicked.className == 'projectLineItem') {						imageList = document.getElementById('projectImageList').getElementsByTagName('li');				thumbList = document.getElementById('projectThumbsList').getElementsByTagName('li');//				firstPhoto = imageList[imageList.length-1]; 	// if there are five images, photos will be numbered 0,1,2,3,4 in the array				firstPhoto = imageList[0]; 	// if there are five images, photos will be numbered 0,1,2,3,4 in the array				lastImageIndicator = imageList[imageList.length-1];			// LOAD THUMBNAILS				for (m = 0; m < thumbList.length; m++) {					targetURL = 'url(images/content/projects/' + itemClicked.id + '/thumbs/' + thumbList[m].id + ')';					thumbList[m].style.background = targetURL;					}											// IF THERE IS ONLY ONE PHOTO TO DISPLAY, LOAD PHOTO AND TURN OFF IMAGE SELECTORS				if (imageList.length == 1) {					loadPhoto('images/content/projects/' + itemClicked.id + '/', firstPhoto);					imageSelectorsToHide = document.getElementById('projectImageList').getElementsByTagName('li');					for (l=0;l<imageSelectorsToHide.length;l++) {						imageSelectorsToHide[l].style.display="none";						}					}			// IF THERE ARE NO IMAGES TO DISPLAY, HIDE IMAGE BORDER				else if (imageList.length == 0) {					document.getElementById('projectImage').style.border="none";					}			// IF THERE ARE MULTIPLE IMAGES TO DISPLAY, LOAD FIRST PHOTO (PHOTO AT BOTTOM OF UNORDERED LIST)				else {					currentImage = imageList[0];					loadPhoto('images/content/projects/' + itemClicked.id + '/', firstPhoto);					}				}			if (portfolioStatus == true) {				fetchPortfolio(itemClicked.id);				}			}		}	content.open("GET",url,true);	content.send(null);	}function loadPhoto(photoURL, imageSelector) {	// SETS PROJECT TEXT AREA TO A DEFAULT WIDTH OF 380px	document.getElementById('projectText').style.width = '380px';	// IF VERTICAL SCROLL IS NECESSARY, CHANGE WIDTH OF PROJECT TEXT AREA TO PREVENT HORIZONTAL SCROLL BARS	if (document.getElementById('projectLeftColumn').offsetHeight - document.getElementById('contentWindow').offsetHeight > 0) {		document.getElementById('projectText').style.width = '380px';		}			if (imageSelector == "next") {		imageSelector = imageList[currentImage+1];		++currentImage;		if (currentImage == imageList.length) {imageSelector = firstPhoto; currentImage = 0;}		}	else {		for (var i=0; i < imageList.length; ++i) {			if (imageSelector.id == imageList[i].id) { currentImage = i; break; }			}		}	document.getElementById('projectImage').src = photoURL + imageSelector.id;	imageSelector.style.opacity="1";	if (lastImageSelector != null) {		lastImageSelector.style.opacity=".6";		}	if (lastImageSelector == imageSelector) {		}	lastImageSelector = imageSelector;	}function highlightImage(rolloverObject) {	rolloverObject.style.opacity="1";	}function clearImage(rolloverObject) {	rolloverObject.style.opacity=".5";	}		function fetchPortfolio(portfolioSection) {	previousPortfolioSection = portfolioSection;	projectThumbnails = document.getElementsByName('projectThumbnail');	if (projectThumbnails.length <= 1) {		document.getElementById('projectList').style.width = 2 * 155 + 40 + 'px'; // SETS MINIMUM WIDTH FOR PROJECT LIST TO (2) X WIDTH OF THUMBNAILS (OR 310) + 40 FOR 350px TOTAL		for (n in projectThumbnails) {			projectThumbnails[0].style.opacity="1";			}		}	else {		document.getElementById('projectList').style.width = projectThumbnails.length * 155 - 5 + 'px';		}	}	function highlightProject(rolloverObject) {	if (projectThumbnails.length != 1) {		projectImages = document.getElementsByName('projectThumbnail');		for (j in projectImages) {			if (projectImages[j].id == rolloverObject.id) { projectImages[j].style.opacity="1"; break; }			}		}	projectNames = document.getElementsByName('projectName');	for (k in projectNames) {		if (projectNames[k].parentNode.id == rolloverObject.id) { projectNames[k].style.color="#fff"; break; }		}	projectLocations = document.getElementsByName('projectLocation');	for (m in projectLocations) {		if (projectLocations[m].parentNode.id == rolloverObject.id) { projectLocations[m].style.color="#dcdcd2"; break; }		}	}function clearProject(rolloverObject) {	if (projectThumbnails.length != 1) {		projectImages = document.getElementsByName('projectThumbnail');		for (j in projectImages) {			if (projectImages[j].id == rolloverObject.id) {	projectImages[j].style.opacity=".6"; break; }			}		}	projectNames = document.getElementsByName('projectName');	for (k in projectNames) {		if (projectNames[k].parentNode.id == rolloverObject.id) { projectNames[k].style.color="#78786e"; break; }		}	projectLocations = document.getElementsByName('projectLocation');	for (m in projectLocations) {		if (projectLocations[m].parentNode.id == rolloverObject.id) { projectLocations[m].style.color="#44443a"; break; }		}	}
