var imageArray;   //  Global image array
imageArray = new Array();	
/* ----------------------------------------------------------------------------------
   preLoadImages(): Function that used to preload images (roll overs, etc )
							
   description:		This function interates trough a list of image SRC's creating
   					an instance of an image and assigning defined SRC into that 
					image
   
   parameters:		a comma delimeted list of string representing the SRC of the
   					images to preload

   dependancies:	A global variable imageArray 

   Side effects:	After a call to this function, imageArray is filled with images.  
   					Any call to swapImage first checks to see if an image is located
					in this array.			

   return values:	None
------------------------------------------------------------------------------------*/
function preLoadImages() {

	imageArray.length=preLoadImages.arguments.length;

	for (var i=0; i < preLoadImages.arguments.length; i++) {
		imageArray[i]= new Image;
		imageArray[i].src=preLoadImages.arguments[i];
	}

}

/* ----------------------------------------------------------------------------------
   restoreImage():	Function that swaps an images back to it original image
   							
   description:		This function can be used to perform image rollover or any change
   					of images.  Use it when you wish to swap back to an image that
					has already been rendered on the load of the page.
   
   parameters:		the ID of the image to change "imageID" and the path to the 
   					image SRC that you wish to load "pathToImageSrc".

   dependancies:	a global variable imageArray

   Side effects:	Image is changed.

   NOTE :			This function performs a rapid swap, use were ever possible (Do not
   					use for preloaded images
   					
					
   return values:	None
------------------------------------------------------------------------------------*/
function restoreImage(imageId,pathToImageSrc) {
	var imageRef;
	// Get a browser independent reference to image
	if (document.layers){    // NS < 6
		imageRef = document[imageId];
	}
	else if (document.all) { // IE
		imageRef = eval("document.all." + imageId  );
	} 	
	else {  // NS 6
		imageRef = document.getElementById(imageId);
	}
	imageRef.src=pathToImageSrc;
	return;
}

/* ----------------------------------------------------------------------------------
   swapImage():		Function that swaps images 
   							
   description:		This function can be used to perform image rollover or any change
   					of images.
   
   parameters:		the ID of the image to change "imageID" and the path to the 
   					image SRC that you wish to load "pathToImageSrc".

   dependancies:	a global variable imageArray

   Side effects:	This function must search the preloaded image array, requiring
   					extra overhead. 

   NOTE :			THIS SHOULD BE CALLED TO SWAP AN IMAGE THAT IS LOCATED LOCALLY 
   					THROUGH A PRELOAD, BUT THAT HAS NOT YET BEEN RENDERED.  IN CASE WERE
					YOU ARE SWAPPING BACK TO AN IMAGE THAT HAS ALREADY BEEN LOADED, USE
					FUNCTION RestoreImage
					
					Images must have id and name parameters, and the calls must be on an
					<a></a> not on the image to work in all browsers.
   
   return values:	None
------------------------------------------------------------------------------------*/
function swapImage(imageId,pathToImageSrc) {
	var i,i2;
	var imageRef;
	// Get a browser independent reference to image
	if (document.layers){		// NS < 6 
		imageRef = document[imageId];
	}
	else if (document.all) {	// IE
		imageRef = eval("document.all." + imageId  );
	} 	
	else { // NS 6
		imageRef = eval('document.getElementById(imageId)');
	}
	// Make pathToImageSrc full path: image.gif -> http://www.insightinfo.com/image.gif  110.193 27.147
	//pathToImageSrc = "http://www.insightinfo.com" + pathToImageSrc;
	// Check array to see if image preloaded
	for  (i=0; i < imageArray.length ; i++)   {
		if (imageArray[i].src == pathToImageSrc)   {
			imageRef.src=imageArray[i].src;
			return;  // we have made swap
		}
	}				
	// Assume image not preloaded, so download (or use local version if possible)
	imageRef.src=pathToImageSrc;
	return;
}

// Utility Functions.
function getObj(layerName){
	var layerRef;
  	
	if (document.all) {
		layerRef = eval("document.all."+layerName+".style");
	}
	else if (document.layers) {
		layerRef = document.layers[layerName];
	}
	else   {
		layerRef = document.getElementById(layerName).style;  
 	}
	return layerRef;
}

// Menu functions
function showMenu(menuId) {
	var menuObj = getObj(menuId);
	var j = menuId.replace("div","");
	j = j - 1;
	if (j > 0) {hideMenu("div"+j);}
	if (menuObj) {
		menuObj.visibility = "visible";
		//setTimeout('menuObj.visibility = "hidden";', 30)
	}
}
function hideMenu(menuId) {
	var menuObj = getObj(menuId);
	if (menuObj) {
		menuObj.visibility = "hidden";
	}
}
function delayShowMenu() {
	delay=setTimeout("showMenu('pressdiv'),hideMenu('conferencesdiv');", 600);
}

function stopDelayShowMenu() {
	clearTimeout(delay);
}