// JScript File

// Image Rollover Image Code for the For Professionals Page

/* This array is used simply to pre-load images. Do not include any extensions. They are added in the
    init() function 
*/

var imageNames = new Array(
"cpe_button"
);

function init()
{
	var rImages = new Array();
	/* Preload images here. */
	for (var x=0, y=0; x< imageNames.length; x++, y+=2)
	{
		rImages[y] = new Image();
		rImages[y] = "/images/ForProfessionals/" + imageNames[x] + ".gif";
		rImages[y+1] = new Image();
		rImages[y+1] = "/images/ForProfessionals/" + imageNames[x] + "-over.gif";
	}
}

function swap(img)
{
	/* This function depends on a particular naming convention. It expects the image's default image
	    to be just it's name. It expects the image's rollover to be the same as it's default but with
	    _on appended to the name. For example: carl.jpg would be a default and carl_on.jpg would be
	    the rollover image.
	*/

	var currentSrc = img.src;
	var result = currentSrc.indexOf("-over.gif");
	var newSrc = ""
	
	/* Let's see if image is already on. If so turn it off */
	
	if (result >= 0)
	{
		newSrc = currentSrc.replace("-over.gif",".gif");
	}
	else
	{
		newSrc = currentSrc.replace(".gif","-over.gif");
	}
	
	img.src = newSrc;
}