// Copyright info://// This JavaScript code is © Copyright, December 1998, by Black Type White Paper// All rights reserved unless explicitly given written permission// This code is permitted for use by Black Type White Paper customers only// Do not change this code in any way, Black Type White Paper will not be// responsible for any changes to this specific file by the customer//// Release  Version: 1.1.5// Internal Version: 2.2.6// // Internal Version bug fix history://		//		2.1.4:	Initial tracking release////		2.1.5:	fixed attempt at displaying of non-existant state in InternalDisplayNow()////		2.2.5:	Added in much more comprehensive debugging display routines////		2.2.6:	fixed incorrect image drawing in InternalDisplayNow(),//					was trying to display an IMG rather than a Cached Image (which is linked to an IMG) [doh!]//					removed redundant calls to series linking detection, a featuritis that never worked//					fixed erroneous call in InternalDisplayLater, changed call from InternalDisplayNow() to DisplayNow()////		2.2.7:	Doh!#2   Discovered that Netscape evaluates the following statement "incorrectly":////						if (!theState)//							theState = 1;////					If theState is defined as the number zero, then the IF statement evaluates as true,//					yet in our calls the zero value is valid. IE seems to handle this better by//					evaluating !theState as the existence of a variable.//// Release Version bug fix history://		1.1.4:	Initial tracking release//		1.1.5:	Removed all occurances of language/browser specific differences in//					IF statements (see Internal Version bug fix 2.2.7)Caching							= new Object();// Defaults for caching, user can change these with the accessor functionsCaching.Default				= new Object();Caching.Default.ImagePath	= "art";			// Accessor Function: DefaultImagePath()Caching.Default.ImageExte	= "jpg";			// Accessor Function: DefaultImageExtension()Caching.Default.HTMLPath	= "";				// Accessor Function: DefaultHTMLPath()Caching.Default.HTMLExte	= "html";		// Accessor Function: DefaultHTMLExtension()Caching.Default.Timeout		= 750;			// Accessor Function: DefaultTimeout()Caching.Default.GIFOnce		= false;			// Accessor Functions:  GIFsAreSingleAnimations()															//								GIFsAreContinuousAnimations()Caching.Debug			= new Object();Caching.Debug.Level	= 0;Caching.Debug.Window	= top.section;// Internal defaults the user should not touchCaching.Loading	= true;Caching.Cache		= "top.Cached";			// "top." is used to preserve caching across frames// Internal variables to define the internal storage areas for each "data" typeCaching.Images		= "Caching.zImages";		// Name space for image associationsCaching.Frames		= "Caching.zFrames";		// Name space for images associated to framesCaching.Series		= "Caching.zSeries";		// Name space for recording Series names and their detailsCaching.Updates	= "Caching.zUpdates";	// Name space for delayed displaying of associated imagesDefault				= Caching.Default;if (!this[Caching.Cache])						// does the cache database exist?	this[Caching.Cache]	= new Object();	// no, create itthis[Caching.Images]		= new Object();this[Caching.Series]		= new Object();this[Caching.Frames]		= new Object();this[Caching.Updates]	= new Object();	Caching.Images		+= ".";						// From now on, only the names within each objectCaching.Series		+= ".";						// will be used, and not the object itself. So we addCaching.Cache		+= ".";						// in the member selector "." to make the following codeCaching.Updates	+= ".";						// easy to use and readCaching.Frames		+= ".";function Debug(theLevel, theMsg, theParm1, theParm2, theParm3,theParm4, theParm5){	if (Caching.Debug.Level >= theLevel)	{		var w = Caching.Debug.Window.document;		w.write(theMsg);		if (theParm1)	w.write(" (" + theParm1);		if (theParm2)	w.write(", " + theParm2);		if (theParm3)	w.write(", " + theParm3);		if (theParm4)	w.write(", " + theParm4);		if (theParm5)	w.write(", " + theParm5);		if (theParm1)	w.write(")");			w.write("<BR>");	}}function AssociateImageToIMGs(theImage, theIMG, theFrom, theTo){	Debug(1, "AssociateImageToIMGs", theImage, theIMG, theFrom, theTo);	for (var i = theFrom; i <= theTo; i++)		this[Caching.Images + theIMG + i] = theImage;}function AssociateIMGToSeries(theIMG, theSeries){	Debug(1, "AssociateIMGToSeries", theIMG, theSeries);	var Series = this[Caching.Series + theSeries];		if (Series)		for (var i = Series.From; i <= Series.To; i++)		{			this[Caching.Images + theSeries + i] = theIMG;			Debug(3, "the IMG Name='"+theIMG+" will be updated when '"+theSeries+i+"' is updated")		}				else		Debug(0, "Internal Error: AssociateImageToSeries()... the series: '"+theSeries+"' is not cached");}function AssociateSeriesToFrame(theSeries, theFrame, theHTMLSeries, theState){	Debug(1, "AssociateSeriesToFrame", theSeries, theFrame, theHTMLSeries, theState);	var HTMLNaE = theHTMLSeries.split('.');	if (!theState)		theState = 1;	if (!HTMLNaE[1])												// if no extension was specified		HTMLNaE[1] = Default.HTMLExte;						// put in the default extension			if (Default.HTMLPath != "")							// if there is a default HTML path,		HTMLNaE[0] = Default.HTMLPath + HTMLNaE[0];		// insert it	var Series = this[Caching.Series + theSeries];		// find the cached image series		if (Series)		for (var i = Series.From; i <= Series.To; i++)	// for each cached image		{			FrameData = new Object();			FrameData.FrameName = theFrame;									// store the target frame			FrameData.FrameURL = HTMLNaE[0] + i + '.' + HTMLNaE[1];	// store the HTML file name we will send to the frame			this[Caching.Frames + theSeries + i + 'z' + theState] = FrameData; // store the FrameData into our Frames namespace			Debug(2, "the Frame '"+theIMG+" will be updated when '"+theSeries+i+"' is moused over")		}				else		Debug(0, "Internal Error: AssociateSeriesToFrame()... the series: '"+theSeries+"' is not cached");}function CacheImage(theImage, theFileState1, theFileState2, theFileState3, theFileState4){	Debug(1, "CacheImage", theFileState1, theFileState2, theFileState3, theFileState4);	if (!theFileState1)		theFileState1 = "";	InternalCacheFile(theImage, theFileState1);	if (theFileState2)	InternalCacheFile(theImage, theFileState2);	if (theFileState3)	InternalCacheFile(theImage, theFileState3);	if (theFileState4)	InternalCacheFile(theImage, theFileState4);}function CacheSeries(theSeries, theFrom, theTo, theFileState1, theFileState2, theFileState3, theFileState4){	Debug(1, "CacheSeries", theSeries, theFrom, theTo, theFileState1, theFileState2, theFileState3, theFileState4);	if (!theFileState1)		theFileState1 = "";	InternalCacheSeries(theSeries, theFrom, theTo, theFileState1);	if (theFileState2)	InternalCacheSeries(theSeries, theFrom, theTo, theFileState2);	if (theFileState3)	InternalCacheSeries(theSeries, theFrom, theTo, theFileState3);	if (theFileState4)	InternalCacheSeries(theSeries, theFrom, theTo, theFileState4);}function InternalCacheSeries(theSeries, theFrom, theTo, theFileState){	Debug(1, "InternalCacheSeries", theSeries, theFrom, theTo, theFileState);	var NaE			= theSeries.split('.');			// separate the name from the extension	var StateNaE	= theFileState.split('.');		// ditto		if (!StateNaE[1])										// if no extension given in state,		StateNaE[1] = Default.ImageExte;				// give it our default	if (!NaE[1])											// if no extension given in series,		NaE[1] = StateNaE[1];							// set it to the state's extension	for (var i = theFrom; i <= theTo; i++)		InternalCacheFile(NaE[0] + i + '.' + NaE[1], StateNaE[0]);	var SeriesName = Caching.Series + NaE[0];		if (!this[SeriesName])	{		this[SeriesName]	= new Object();		Series				= this[SeriesName]; 		Series.From			= theFrom;		Series.To			= theTo;	}	else	{		Series = this[SeriesName];		if (theFrom < Series.From)		Series.From = theFrom;	// make sure our beginning range is correct		if (theTo > Series.To)			Series.To = theTo;		// make sure our end range is correct	}}function InternalCacheFile(theFile, theFileState)				// Requires an extension in the file name{	Debug(1, "InternalCacheFile", theFile, theFileState);	if (!theFileState)		theFileState = "";	if (theFile)	{			var NaE				= theFile.split('.');					// NaE means "Name and Extension"		var OtCName			= Caching.Cache + NaE[0];		var OtC				= this[OtCName];							// OtC means "Object to Cache"				if (!OtC)		{			OtC				= new Object();			OtC.States		= new Array();			OtC.Paths		= new Array();			this[OtCName]	= OtC;		}		OtC.Paths[OtC.Paths.length]	= "";		OtC.States[OtC.States.length]	= new Image();		if ((Default.GIFOnce == false) || (NaE[1] != "gif"))				OtC.States[OtC.States.length-1].src	= Default.ImagePath+"/"+NaE[0]+theFileState+'.'+NaE[1];		else	OtC.Paths[OtC.Paths.length-1]			= Default.ImagePath+"/"+NaE[0]+theFileState+'.'+NaE[1];				Debug(2, "image: "+OtCName+" state: " + (OtC.States.length-1));		Debug(3, "cached: " + OtC.States[OtC.States.length-1].src);	}}function InternalDisplayNow(theIMG, theImage, theState){	Debug(1, "InternalDisplayNow", theIMG, theImage, theState);	var CachedImage = this[Caching.Cache + theImage];	if (CachedImage)	{		if (CachedImage.Paths.length <= theState)			theState = CachedImage.Paths.length-1;				if (CachedImage.Paths[theState] == "")				document.images[theIMG].src = CachedImage.States[theState].src;		else	document.images[theIMG].src = CachedImage.Paths[theState];	}		var Associate = this[Caching.Frames + theImage + "z" + theState];	if (Associate)	{		Frame = top.frames[Associate.FrameName];		if (Frame)			Frame.location = Associate.FrameURL;		else			Debug(0, "Internal Error: InternalDisplayState()... "+Associate.FrameName+" does not exist as a Frame");	}}function InternalDisplayLater(theIMG){	Debug(1, "InternalDisplayLater", theIMG);	var Update		= this[Caching.Updates + theIMG];	var NewState	= Update.Image + Update.State;		if (Update.Drawn != NewState)	{			DisplayNow(Update.Image, Update.State);		Update.Drawn = NewState;	}}function InternalUpdateLater(theIMG, theImage, theState){	Debug(1, "InternalUpdateLater", theIMG, theImage, theState);	var UpdateName	= Caching.Updates + theIMG;	var Update		= this[UpdateName];	if (!Update)	{		this[UpdateName] = new Object();		Update = this[UpdateName];		Update.Drawn = "";	}	Update.Image	= theImage;	Update.State	= theState;		setTimeout("InternalDisplayLater('"+theIMG+"')", Default.Timeout);}function InternalDisplayState(theImage, theState, theLater){	Debug(1, "InternalDisplayState", theImage, theState, theLater);	var DisplayedSomething = false;		if(document.images[theImage])	{		if (theLater)	InternalUpdateLater(theImage, theImage, theState);		else				InternalDisplayNow(theImage, theImage, theState);		DisplayedSomething = true;	}	var Associate = this[Caching.Images + theImage];	if (Associate)	{		if (document.images[Associate])		{			if (theLater)	InternalUpdateLater(Associate, theImage, theState);			else				InternalDisplayNow(Associate, theImage, theState);			DisplayedSomething = true;		}	}		if (!DisplayedSomething)		Debug(0, "Internal Error: InternalDisplayState()... "+theImage+" does not exist as a images[] nor is it cached");}function Display(theImage)						{	DisplayState(theImage, 0);	}function DisplayOff(theImage)					{	DisplayNow(theImage, 0);	}function DisplayOn(theImage)					{	DisplayNow(theImage, 1);	}function DisplayUnselect(theImage)			{	DisplayNow(theImage, 0);	}function DisplaySelect(theImage)				{	DisplayNow(theImage, 1);	}function DisplayNow(theImage, theState)	{	InternalDisplayState(theImage, theState, false);}function DisplayState(theImage, theState)	{	InternalDisplayState(theImage, theState, true);	}function GIFsAreSingleAnimations(theTruth){		if (!theTruth)		theTruth = true;	Default.GIFOnce = theTruth;}function GIFsAreContinuousAnimations(theTruth){	if (!theTruth)		theTruth = false;	Default.GIFOnce = theTruth;}function CacheCleanup()									{	Caching.Loading = false;				}function DefaultImagePath(thePath)					{	Default.ImagePath = thePath;			}function DefaultImageExtension(theExtension)		{	Default.ImageExte = theExtension;	}function DefaultTimeout(theTimeout)					{	Default.Timeout = theTimeout			}