//USE IN <BODY> TAG: onLoad="preloadImages('photos_products_over', 'photos-products_over.jpg', 'photos_products_over005', 'photos-products_over-05.jpg');"
//USE IN <A> or <IMG> TAG: onmouseover="changeImages('photos_products', 'images/photos-products_over-06.jpg', 'frames', 'images/frames_over.gif'); return true;" onmouseout="changeImages('photos_products', 'images/photos-products.jpg', 'frames', 'images/frames.gif'); return true;"
var d=document,
iDir2="images/";//if you use a different image directory, override this variable in the calling code before calling any of these functions

function newImage(arg) {
	if (d.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (d.images && (preloadFlag == true))
		for (var i=0; i<changeImages.arguments.length; i+=2)
			d[changeImages.arguments[i]].src = changeImages.arguments[i+1];
}

var preloadFlag = false;
function preloadImages() {
	if (d.images) {
    var a = preloadImages.arguments;
    for (var x = 0; x < a.length; x+=2) a[x] = newImage(iDir2 + a[x+1]);
		preloadFlag = true;
	}
}
