
function flipIt( imgID ) {

	var imgNum = document.getElementById( imgID ).src;

	// imgNum is the image pathname, EX:"./images/fub1.png"
	// Image files need to have 3 character names with a one digit signifier.
	// "1" for front, "2" for back

	// Strip off the first three characters of the image name
	imgNam = imgNum.substr( imgNum.lastIndexOf( "/" ) + 1, 3 );
	imgNum = imgNum.substr( imgNum.lastIndexOf( "/" ) + 4, 1 );
	imgNum == 1 ? imgNum = 2 : imgNum = 1;

	// Set the new image
	document.getElementById( imgID ).src="./images/" + imgNam + imgNum + ".png";

	// Get the text below the image
	imgTxt = document.getElementById( imgNam + "Txt" ).innerHTML;

	// Split the string into two components
	var txtPre = imgTxt.substr( 0, imgTxt.lastIndexOf( " " ) );
	var txtSub = imgTxt.substr( imgTxt.lastIndexOf( " " )+1 );
	
	// Clear out whitespace
	txtSub.replace( /\s/g, "" );
	txtPre.replace( /\s/g, "" );

	// Swap 'em
	if( txtSub == "Front" ){
		txtSub = "Back";
	}
	else
		txtSub = "Front";
	imgTxt = txtPre + " " + txtSub;

	//Write it back
	document.getElementById( imgNam + "Txt" ).innerHTML = imgTxt;

}


