function resetAllLists() {
	var mainMenu = document.getElementById("main-menu");
	var submenus = mainMenu.getElementsByTagName ("ul");
	var links = mainMenu.getElementsByTagName ("a");
	for (var i = 0; i < submenus.length; i++) {
		submenus[i].className = "submenu";
	}
	for (var i = 0; i < links.length; i++) {
		if (links[i].className == "main-menu-current") {
			links[i].className = "";
		}
	}
	clearTimer ();
}
function displayList (listID, linkID) {
	resetAllLists();
	document.getElementById(listID).className = "submenu-visible";
	document.getElementById(linkID).className = "main-menu-current";
}
function setTimer () {
	timer = setTimeout ("resetAllLists()", 1000);
}
function clearTimer () {
	clearTimeout (timer);
	timer = null;
}
 function loadNewLink(link) {
	window.open(link); 
	return false;
}
function loadImages(){
   var img
   if (document.images){
      if (!loadedImages) loadedImages = new Array()
      for (var i=0; i < arguments.length; i++){
         img = new Image()
         img.src = arguments[i]
         loadedImages[loadedImages.length] = img
      }
   }
}
function flip(imgName, imgSrc){
   if (document.images){
   	  var theImg = document.getElementById(imgName);
      theImg.src = imgSrc;
   }
}
//Fix Netscape resize bug for mouseDown and mouseUp events.
function forceReload() {
      location.reload()
}
function fixNetscape4(){
   NS4 = document.layers
   NSVer = parseFloat(navigator.appVersion)
   if (NSVer >= 5.0 || NSVer < 4.1) NS4 = false

   if (NS4) onresize = forceReload
}
function fadeImages (oldDiv, newDiv) {
//	timerCount = timerCount - 1;
	var opacityNew = "opacity-" + eval ((10 - timerCount) * 10);
	var opacityOld = "opacity-0";
//	var opacityOld = "opacity-" + eval (timerCount * 10);
//	if (timerCount == 0) {
//		opacityNew = "";
//	}
	document.getElementById(oldDiv).className = opacityOld;
	document.getElementById(newDiv).className = "";
//	if (timerCount == 0) {
	clearInterval (timer2);
	timer2 = null;
//	}
}
function rotateHomeImages() {
	var oldDiv = "home-image-" + count;
	if (count == 5) {
		count = 0;
	}
	count = eval (count + 1);
	var newDiv = "home-image-" + count;
	var functionName = "fadeImages('" + oldDiv + "', '" + newDiv + "')"
	timerCount = 1;
	timer2 = setInterval (functionName, 50);
}
function setRotatorInterval () {
	timer = setInterval("rotateHomeImages()", 4950);
}
function clearRotatorInterval () {
	clearTimeout (timer);
	timer = null;
}
function loadPortfolioPopup (newLink) {
	var windowWidth = 788;
	var windowHeight = 687;
	var left = (screen.width - windowWidth) / 2;
	var top = (screen.height - windowHeight) / 2;
	var newWindow = window.open (newLink, 'largerImageWindow', 'toolbar=0,scrollbars=0,location=0,statusbar=0,menubar=0,resizable=0,width=' + windowWidth + ',height=' + windowHeight + ',left=' + left + ',top=' + top);
	newWindow.focus();
	return false;
}
var timer = null;
var loadedImages = null;
var homeImages = 5;
var count = 1;
var timerCount = 0;
var timer2 = null;