//	This script handles all image highlighting and layer switching events.
//
//	---------------------------------
//	Basic image highlighting (non-layer images):
//	Images to be highlighted must have a [name="<image_name>"] tag in the HTML image definition;
//	the highlighted version of each image must be in the same folder as the basic image, it must be named like this:
//	basic image (Lowlight): e.g. "image_name.gif"  -> highlighted image = "image_name-a.gif" 
//	Both image types 'gif' and 'jpg' are supported.
//	The following line must be added to the images' <a href=....> tag:
//	onMouseOver="mouseOver('<image_name>'); self.status='<your browser-statusline text>'; return true;" onMouseOut="mouseOut('<image_name>'); self.status=' '; return true;"
//	A sample link here will look like this:
//	<a href="sitemap/sitemap.html" 
//	target="content" 
//	onMouseOver="mouseOver('bottom_sitemap'); self.status='Site Map'; return true;" 
//	onMouseOut="mouseOut('bottom_sitemap'); self.status=' '; return true;">
//	<img src="images/bottom_sitemap.gif" alt="" width="45" height="16" border="0" NAME="bottom_sitemap">
//	< /a>
//
//	---------------------------------
//	Image highlighting in layers:
//	Images to be highlighted must have a [name="<image_name>"] tag in the layers' HTML image definition;
//	the highlighted version of each image must be in the same folder as the basic image, it must be named like this:
//	basic image (Lowlight): e.g. "image_name.gif"  -> highlighted image = "image_name-a.gif" 
//	Both image types 'gif' and 'jpg' are supported.
//	The following line must be added to the images' <a href=....> tag:
//	onMouseOver="layerMouseOver('<image_name>','<layer_name>'); self.status='<your browser-statusline text>'; return true;" onMouseOut="layerMouseOut('<image_name>','<layer_name>'); self.status=' '; return true;"
//	A sample link here will look like this:
//	<a href="sitemap/sitemap.html" 
//	target="content" 
//	onMouseOver="layerMouseOver('top_overview','firstlayer'); self.status='Overview'; return true;" 
//	onMouseOut="layerMouseOut('top_overview','firstlayer'); self.status=' '; return true;">
//	<img src="images/top_overview.gif" alt="" width="45" height="16" border="0" NAME="top_overview">
//	< /a>
//
//	NOTE: the ticks around <image_name> on the MouseOver- and MouseOut-events.
//	NOTE: image names must be unique through the whole HTML document, including layers.
//
//	---------------------------------
//	Showing and hining layers:
//	use the following syntax:
//	vSwitch('<a_layername>',1): shows layer <a_layername>
//	vSwitch('<a_layername>',0): hides layer <a_layername>
//	as onClick-events in your <a href="..."> tag.
//	a sample link herefor will look like this:
//	<a href="#" onClick="vSwitch('layer1',0)"> to hide layer "layer1"
//	<a href="#" onClick="vSwitch('layer1',1)"> to show layer "layer1"
//
//	NOTE: the ticks around <a_layername> in the vSwitch function call.

//--BEGIN global variables, do not edit   --//
var pictures = new Array();
var userAgent = window.navigator.userAgent;
var bVers = parseInt(userAgent.charAt(userAgent.indexOf("/")+1),10);
var preLoadIsComplete = false;
//--END global variables, do not edit   --//

//--BEGIN Netscape layer functionality  --//
function findElement(n,ly)
	{
	var curDoc = ly ? ly.document : document;
	var elem = curDoc[n];
	if (bVers < 4)
		return document[n];
	if (!elem)
		{
		for (var i=0;i<curDoc.layers.length;i++)
			{
			elem = findElement(n,curDoc.layers[i]);
			if (elem)
				return elem;
			}
		}
	return elem;
	}
//--END Netscape layer functionality  --//

//--BEGIN Netscape layer access  --//
function NSStyle(s)
	{
	return findElement(s,0);
	}
//--END Netscape layer access  --//

//--BEGIN Constructor for interactive image obbjects  --//
function activeImageConstructor(aName,aLowlightSrc,aHighlightSrc)
	{
	this.name  = aName;
	this.lowLight  = new Image();
	this.lowLight.src  = aLowlightSrc;
	this.highLight  = new Image();
	this.highLight.src  = aHighlightSrc;
	}
//--END Constructor for interactive image obbjects  --//

//--BEGIN preLoad fundtion  --//
function preLoad()
	{
	var preLoadedImgs = "";
	if (document.all)
		for (i=0; i<document.all.tags("div").length; i++)
			{
			for (j=0; j<document.all.tags("div")[i].document.images.length; j++)
				{
				if (document.all.tags("div")[i].document.images[j].name)
					{
					if ( preLoadedImgs.indexOf(document.all.tags("div")[i].document.images[j].name) < 0)
						{
						var imgSrc = document.all.tags("div")[i].document.images[j].src;
						var tmpPrefix = imgSrc.substr(0,imgSrc.length-4);
						var tmpSuffix = imgSrc.substr(imgSrc.length-4,imgSrc.length-1);
						var tmpActiveSrc = tmpPrefix + "-a" + tmpSuffix;
						var IEFix = new activeImageConstructor(document.all.tags("div")[i].document.images[j].name,document.all.tags("div")[i].document.images[j].src,tmpActiveSrc);
						var tmpData = new Array(IEFix);
						pictures = pictures.concat(tmpData);
						preLoadedImgs = preLoadedImgs.concat(document.all.tags("div")[i].document.images[j].name);
						}
					}
				}
			}
	else
		for (i=0; i<document.layers.length; i++)
			{
			for (j=0; j<document.layers[i].document.images.length; j++)
				{
				if (document.layers[i].document.images[j].name)
					{
					var imgSrc = document.layers[i].document.images[j].src;
					var tmpPrefix = imgSrc.substr(0,imgSrc.length-4);
					var tmpSuffix = imgSrc.substr(imgSrc.length-4,imgSrc.length-1);
					var tmpActiveSrc = tmpPrefix + "-a" + tmpSuffix;
					var IEFix = new activeImageConstructor(document.layers[i].document.images[j].name,document.layers[i].document.images[j].src,tmpActiveSrc);
					var tmpData = new Array(IEFix);
					pictures = pictures.concat(tmpData);
					}
				}
			}
	for (i=0; i<document.images.length; i++)
		{
		if (document.images[i].name)
			{
			if ( preLoadedImgs.indexOf(document.images[i].name) == -1)
				{
				var imgSrc = document.images[i].src;
				var tmpPrefix = imgSrc.substr(0,imgSrc.length-4);
				var tmpSuffix = imgSrc.substr(imgSrc.length-4,imgSrc.length-1);
				var tmpActiveSrc = tmpPrefix + "-a" + tmpSuffix;
				var IEFix = new activeImageConstructor(document.images[i].name,document.images[i].src,tmpActiveSrc);
				var tmpData = new Array(IEFix);
				pictures = pictures.concat(tmpData);
				}
			}
		}
	preLoadIsComplete = true;
	}
//--END preLoad fundtion  --//

//--BEGIN mouseOver function for body document --//
function mouseOver(aPic)
	{
	if (preLoadIsComplete)
		{
		for (i=0; i<pictures.length; i++)
			{
			if (pictures[i].name == aPic)
				{
				eval("document.images." + aPic + ".src = pictures[" + i + "].highLight.src");
				}
			}
		}
	else
		preLoad();
	}
//--END mouseOver function for body document --//

//--BEGIN mouseOut function for body document --//
function mouseOut(aPic)
	{
	if (preLoadIsComplete)
		{
		for (i=0; i<pictures.length; i++)
			{
			if (pictures[i].name == aPic)
				eval("document.images." + aPic + ".src = pictures[" + i + "].lowLight.src");
			}
		}
	else
		preLoad();
	}
//--END mouseOut function for body document --//

//--BEGIN mouseOver function in layers --//
function layerMouseOver(aPic,aLayer)
	{
	if (preLoadIsComplete)
		{
		for (i=0; i<pictures.length; i++)
			{
			if (pictures[i].name == aPic)
				if (document.layers)
					eval("NSStyle('"+aLayer+"').document.images['"+aPic+"'].src = pictures["+i+"].highLight.src");
				else
					eval("document.all.tags('div')."+aLayer+".document.images['"+aPic+"'].src = pictures["+i+"].highLight.src");
			}
		}
	else
		preLoad();
	}
//--END mouseOver function in layers --//

//--BEGIN mouseOut function in layers --//
function layerMouseOut(aPic,aLayer)
	{
	if (preLoadIsComplete)
		{
		for (i=0; i<pictures.length; i++)
			{
			if (pictures[i].name == aPic)
				if (document.layers)
					eval("NSStyle('"+aLayer+"').document.images['"+aPic+"'].src = pictures["+i+"].lowLight.src");
				else
					eval("document.all.tags('div')."+aLayer+".document.images['"+aPic+"'].src = pictures["+i+"].lowLight.src");
			}
		}
	else
		preLoad();
	}
//--BEGIN mouseOut function in layers --//

//--BEGIN Internet Explorer layer access  --//
function IEStyle(s)
	{
	return document.all.tags("div")[s].style;
	}
//--END Internet Explorer layer access  --//

//--BEGIN visibility switch for layers  --//
function vSwitch(aLayer,aBool)
	{
	if (preLoadIsComplete)
		{
		if (document.all)
			IEStyle(aLayer).visibility = (aBool == 0) ? "hidden" : "visible";
		else
			NSStyle(aLayer).visibility = (aBool == 0) ? 'hide' : 'show';
		}
	else
		preLoad();
	}
//--END visibility switch for layers  --//
