/******************************************
--  This site was designed and implemented by Miller Systems.
--  (c) Copyright 2003.  All rights reserved.
--  http://www.millersystems.com
--  Miller Systems, Inc. Boston MA 02116
******************************************/

var arPreloadedImages = new Array();
var initialized = false;

///////////////////////
// init()
//////////////////////
function init() {
	preloadImage("btn_services","/bin/images/home/btn_services.gif");
	preloadImage("btn_services_hl","/bin/images/home/btn_services_hl.gif");
	preloadImage("btn_products","/bin/images/home/btn_products.gif");
	preloadImage("btn_products_hl","/bin/images/home/btn_products_hl.gif");
	preloadImage("btn_case_studies","/bin/images/home/btn_case_studies.gif");
	preloadImage("btn_case_studies_hl","/bin/images/home/btn_case_studies_hl.gif");
	preloadImage("btn_markets","/bin/images/home/btn_markets.gif");
	preloadImage("btn_markets_hl","/bin/images/home/btn_markets_hl.gif");
	preloadImage("btn_partners","/bin/images/home/btn_partners.gif");
	preloadImage("btn_partners_hl","/bin/images/home/btn_partners_hl.gif");
	preloadImage("btn_about_us","/bin/images/home/btn_about_us.gif");
	preloadImage("btn_about_us_hl","/bin/images/home/btn_about_us_hl.gif");
	preloadImage("btn_news_and_events","/bin/images/home/btn_news_and_events.gif");
	preloadImage("btn_news_and_events_hl","/bin/images/home/btn_news_and_events_hl.gif");
	
	initialized = true;
}

///////////////////////
// preloadImage()
//////////////////////
function preloadImage(label,source) {
	arPreloadedImages[label] = new Image;
	arPreloadedImages[label].src = source;
}

///////////////////////
// swapImage()
// - used to swap a named image's src attribute for another
// - arguments - unlimited number of image name/source pairs
// - example - swapImage("foo","/bin/images/foo.gif")
///////////////////////
function swapImage() {
	if (!initialized) return;

	if (document.images) {
		for(var i=0;i<arguments.length;i++) {
			document.images[arguments[i]].src = arguments[i+1];
			++i;
		}
	}
}

///////////////////////
// swapPreloadedImage()
// - used to swap a preloaded named image's src attribute for another
// - arguments - unlimited number of image name/array key pairs
// - example - swapPreloadedImage("foo","foo_hl")
///////////////////////
function swapPreloadedImage() {
	if (!initialized) return;

	if (document.images) {
		for(var i=0;i<arguments.length;i++) {
			if (document.images[arguments[i]] && arPreloadedImages[arguments[i+1]]) {
				document.images[arguments[i]].src = arPreloadedImages[arguments[i+1]].src;
			}
			++i;
		}
	}
}

