if (document.images) {																						// Preload the images.
	var folderOpen16 = new Image();		folderOpen16.src =		"/images/icons/folderopen16.gif";
	var folderShut16 = new Image();		folderShut16.src =		"/images/icons/foldershut16.gif";
	var folderOpen24 = new Image();		folderOpen24.src =		"/images/icons/folderopen24.gif";
	var folderShut24 = new Image();		folderShut24.src =		"/images/icons/foldershut24.gif";
	var historyActive24 = new Image();	historyActive24.src =	"/images/icons/historyactive24.gif";
	var historyDisab24 = new Image();	historyDisab24.src =	"/images/icons/historydisab24.gif";
	
	var aImages = [[folderOpen16.src, folderShut16.src], [folderOpen24.src, folderShut24.src], [historyActive24.src, historyDisab24.src]];
}

var _POPUP_FEATURES = 'location=no,statusbar=no,menubar=no,resizable=yes,scrollbars=yes,width=400,height=300';			// popup handling taken from http://www.alistapart.com/articles/popuplinks

function raw_popup(url, target, features) {
	if (typeof features == 'undefined') {
		features = _POPUP_FEATURES;
	}
	if (typeof target == 'undefined') {
		target = '_blank';
	}
	var theWindow = window.open(url, target, features);
	theWindow.focus();
	return theWindow;
}

function link_popup(src, features) {
	return raw_popup(src.getAttribute('href'), src.getAttribute('target') || '_blank', features);
}

function swapImage(image) {
	var finished = false;

	for (var i = 0; i < aImages.length; i++) {
		for (var j = 0; j < 2; j++) {
			if (image.src == aImages[i][j]) {
				image.src = aImages[i][j == 0 ? 1 : 0];
				finished = true;
				break;
			}
		}

		if (finished) break;
	}
}

function showHide(nr) {																	// showHide() toggles the display of sites below it in the tree.
   if (document.getElementById) {													// IE 5+ and Netscape 6+
      current = (document.getElementById(nr).style.display == 'block') ? 'none' : 'block';
      document.getElementById(nr).style.display = current;
   } else if (document.all) {															// IE 4
      current = (document.all[nr].style.display == 'block') ? 'none' : 'block';
      document.all[nr].style.display = current;
   }
   else alert ('This link does not work in your browser.');
}

function showHideInline(nr) {																	// showHide() toggles the display of sites below it in the tree.
   if (document.getElementById) {													// IE 5+ and Netscape 6+
      current = (document.getElementById(nr).style.display == 'inline') ? 'none' : 'inline';
      document.getElementById(nr).style.display = current;
   } else if (document.all) {															// IE 4
      current = (document.all[nr].style.display == 'inline') ? 'none' : 'inline';
      document.all[nr].style.display = current;
   }
   else alert ('This link does not work in your browser.');
}
