<!-- yeah, I know...This is REALLY ugly, but it's here for now until I clean it up -->
var firstImage = new Image;

var nimage = new Image();
var BGwidth;
var BGheight;
function swapThumb ( image ) {
	oImage = image.src;
	image.src = image.src.replace ( ".jpg", "-2.jpg" );
//	whichImage.src = image.src;
}
function swapThumbBack( image ) {
	image.src = oImage;
}
function swapLarge ( image ) {
	nimage.src = LGRename(image.src);
	nimage.onload = function () {
		BGwidth = nimage.width + 20;
		BGheight = nimage.height + 35;
		new Effect.Opacity('contentBox', { from: 1.0, to: 0, duration: 0.1 });
		$('contentBG').morph('width:' + BGwidth + 'px', { duration: .5 });
		$('contentBG').morph('height:' + BGheight + 'px', { duration: .5 });
		alttt = image.alt;
		var t=setTimeout("LargeSwap()",700);
	}
	return nimage.src;
};
function LargeSwap () {
	document.getElementById( "large" ).src = nimage.src;
	document.getElementById( "large" ).height = nimage.height;
	document.getElementById( "large" ).width = nimage.width;
	new Effect.Opacity('contentBox', { from: 0, to: 1, duration: 0.1 });
	alttextSwap ( alttt );
};
function LGRename (image) {
	var txt1 = RegExp ('-t.jpg');
	var txt2 = RegExp ('-t-2.jpg');
	if ( txt2.test(image) || txt1.test(image) ) {
		var NewImage = image.replace ( "-t.jpg", ".jpg" );
		var NewImage = image.replace ( "-t-2.jpg", ".jpg" );
		return NewImage;
	}
	else {
		return image;
	}
};
function alttextSwap ( alttext ) {
	document.getElementById( 'alttext' ).innerHTML = alttext;
}
