// Title: image rollovers
// Description: Swaps an original image for a secondary image, and back again
// Author: Scott Alden Hoffmeyer <scott_alden@hotmail.com>
// Author: Macromedia Web Development <www.macromedia.com>
// Date: January 15, 2002
// Version: 1.0


// --- swap arrow pic in place of blank pic ---
function turnArrowOn(imageName) {
	if (document.images) {
		document[imageName].src = eval("arrowOn.src");
	}
}

// --- swap blank pic in place of arrow pic ---
function turnArrowOff(imageName) {
	if (document.images) {
		document[imageName].src = eval("arrowOff.src");
	}
}

// --- swap arrow pic in place of blank pic (special image) ---
function turnSpArrowOn(imageName) {
	if (document.images) {
		document[imageName].src = eval("arrowOnSp.src");
	}
}

// --- swap blank pic in place of arrow pic (special image) ---
function turnSpArrowOff(imageName) {
	if (document.images) {
		document[imageName].src = eval("arrowOffSp.src");
	}
}

// --- swap regular image in place of secondary image ---
function swapImage() {
	var imgName, counter=0, newImage, x=swapImage.arguments;
	document.imgPosition = new Array
	for(imgName=0; imgName < (x.length-2); imgName+=3) {
		if((newImage=MM_findObj(x[imgName]))!=null) {
			document.imgPosition[counter++] = newImage;
			if(!newImage.oSrc)
				newImage.oSrc = newImage.src;
			newImage.src = x[imgName+2];
		}
	}
}

// --- swap secondary image in place of original image ---
function swapImgRestore() {
	var counter, oldImage, x=document.imgPosition;
	for(counter=0; x && counter < x.length && (oldImage=x[counter]) && oldImage.oSrc; counter++) {
		oldImage.src=oldImage.oSrc;
    }
}

// --- search for an object --- 
function MM_findObj(n, d) { //v4.0 by Macromedia
	var p, i, x;
	if(!d)
		d=document;
	if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document;
		n=n.substring(0,p);
	}
	if(!(x=d[n])&&d.all)
		x=d.all[n];
	for (i=0;!x&&i<d.forms.length;i++)
		x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++)
		x=MM_findObj(n,d.layers[i].document);
	if(!x && document.getElementById)
		x=document.getElementById(n);
	return x;
}

// --- loads images into RAM before page completely loads ---
function MM_preloadImages() {
	var d=document;
	if(d.images) {
		if(!d.MM_p)
			d.MM_p=new Array();
		var i, j=d.MM_p.length, a=MM_preloadImages.arguments;
		for(i=0; i<a.length; i++) {
			if (a[i].indexOf("#")!=0) {
				d.MM_p[j]=new Image;
				d.MM_p[j++].src=a[i];
			}
		}
	}
}
