function flipMessage (i) {
	document.getElementById("dynamic-heading").innerHTML = Heading[i];
	document.getElementById("dynamic-message").innerHTML = Message[i];
}
function increaseSize (listId, graphicId, i, usemap) {
	var widthGain = (largeGraphicWidth - smallGraphicWidth) / tweenLevels;
	var HeightGain = (largeGraphicHeight - smallGraphicHeight) / tweenLevels;
	var finalWidth = Math.round (smallGraphicWidth + widthGain * counterIn[i]);
	if (isNaN (finalWidth)) {
		counterIn [i] = 1;
		finalWidth = Math.round (smallGraphicWidth + widthGain * 1);
	}
	if (finalWidth > largeGraphicWidth) {
		finalWidth = largeGraphicWidth;
	}
	var finalHeight = Math.round (smallGraphicHeight + HeightGain * counterIn[i]);
	if (finalHeight > largeGraphicHeight) {
		finalHeight = largeGraphicHeight;
	}
	var horizontalPaddingRight = Math.round ((largeGraphicWidth - finalWidth) / 2);
	var verticalPaddingBottom = Math.round ((largeGraphicHeight - finalHeight) / 2);
	if (finalWidth + horizontalPaddingRight * 2 > largeGraphicWidth) {
		var horizontalPaddingLeft = horizontalPaddingRight - 1;
	} else {
		var horizontalPaddingLeft = horizontalPaddingRight;
	}
	if (finalHeight + verticalPaddingBottom * 2 > largeGraphicHeight) {
		var verticalPaddingTop = verticalPaddingBottom - 1;
	} else {
		var verticalPaddingTop = verticalPaddingBottom;
	}
	var padding = verticalPaddingTop + "px " + horizontalPaddingRight + "px " + verticalPaddingBottom + "px " + horizontalPaddingLeft + "px";
	document.getElementById(listId).style.width = finalWidth + "px";
	document.getElementById(listId).style.height = finalHeight + "px";
	document.getElementById(listId).style.padding = padding;
	document.getElementById(graphicId).style.width = finalWidth + "px";
	document.getElementById(graphicId).style.height = finalHeight + "px";
	counterIn[i] = counterIn[i] + 1;
	if (counterIn[i] > tweenLevels || finalWidth >= largeGraphicWidth) {
		clearInterval (tweenTimer[i]);
		counterIn[i] = 1;
		counterOut[i] = tweenLevels;
		tweenTimer[i] = null;
		fader[i] = null;
		// add Smart Quote Online usemap here, if applicable.
		if (usemap != "undefined" && usemap != null && usemap != "") {
			document.getElementById(usemap).style.display = "block";
		}
	}
}
function removeUsemap(usemap) {
	document.getElementById(usemap).style.display = "none";
}
function tweenLarger (listId, imageId, usemap) {
	var arrayId = Math.floor ((imageId  - 1) / 2);
	if (loadedImages && fader[arrayId] != "IN") {  // have images been loaded, and is fade in not already initialized?
		var graphicId = listId + "-image";
		if (fader[arrayId] == "OUT") {  // is this image already being tweened out?
			clearInterval (tweenTimer[arrayId]);
			counterIn [arrayId] = counterOut [arrayId];
			counterOut [arrayId] = tweenLevels;
			tweenTimer[arrayId] = null;
		} else {
			document.getElementById(graphicId).style.width = smallGraphicWidth;
			document.getElementById(graphicId).style.height = smallGraphicHeight;
		}
		document.getElementById(graphicId).src = loadedImages[imageId].src;
		fader[arrayId] = "IN";
		if (counterIn[arrayId] == undefined || isNaN(counterIn[arrayId])) {
			counterIn[arrayId] = 1;
		}
		var msgId = eval (arrayId) + 1;
		flipMessage(msgId);
		tweenTimer[arrayId] = setInterval ("increaseSize ('" + listId + "', '" + graphicId + "', " + arrayId + ", '" + usemap + "')", tweenInterval);
	}
}
function decreaseSize (listId, graphicId, imageId, i) {
	var widthDecrease = (largeGraphicWidth - smallGraphicWidth) / tweenLevels;
	var HeightDecrease = (largeGraphicHeight - smallGraphicHeight) / tweenLevels;
	var finalWidth = Math.round (largeGraphicWidth - widthDecrease * (tweenLevels - counterOut[i]));
	if (isNaN (finalWidth)) {
		counterOut[i] = tweenLevels;
		finalWidth = Math.round (largeGraphicWidth - widthDecrease * (tweenLevels - counterOut[i]));
	}
	if (finalWidth < smallGraphicWidth) {
		finalWidth = smallGraphicWidth;
	}
	var finalHeight = Math.round (largeGraphicHeight - HeightDecrease * (tweenLevels - counterOut[i]));
	if (finalHeight < smallGraphicHeight) {
		finalHeight = smallGraphicHeight;
	}
	var horizontalPaddingRight = Math.round ((largeGraphicWidth - finalWidth) / 2);
	var verticalPaddingBottom = Math.round ((largeGraphicHeight - finalHeight) / 2);
	if (finalWidth + horizontalPaddingRight * 2 > largeGraphicWidth) {
		var horizontalPaddingLeft = horizontalPaddingRight - 1;
	} else {
		var horizontalPaddingLeft = horizontalPaddingRight;
	}
	if (finalHeight + verticalPaddingBottom * 2 > largeGraphicHeight) {
		var verticalPaddingTop = verticalPaddingBottom - 1;
	} else {
		var verticalPaddingTop = verticalPaddingBottom;
	}
	var padding = verticalPaddingTop + "px " + horizontalPaddingRight + "px " + verticalPaddingBottom + "px " + horizontalPaddingLeft + "px";
	document.getElementById(listId).style.width = finalWidth + "px";
	document.getElementById(listId).style.height = finalHeight + "px";
	document.getElementById(listId).style.padding = padding;
	document.getElementById(graphicId).style.width = finalWidth + "px";
	document.getElementById(graphicId).style.height = finalHeight + "px";
	counterOut[i] = counterOut[i] - 1;
	if (counterOut[i] < 0 || finalWidth <= smallGraphicWidth) {
		document.getElementById(graphicId).src = loadedImages[imageId].src;
		clearInterval (tweenTimer[i]);
		counterIn[i] = 1;
		counterOut[i] = tweenLevels;
		tweenTimer[i] = null;
		fader[i] = null;
	}
}
function tweenSmaller (listId, imageId) {
	var arrayId = Math.floor (imageId / 2);
	if (loadedImages && fader[arrayId] != "OUT") {  // have images been loaded, and is fade in not already initialized?
		var graphicId = listId + "-image";
		if (fader[arrayId] == "IN") {  // is this image already being tweened in?
			curIn = "";
			clearInterval (tweenTimer[arrayId]);
			tweenTimer [arrayId] = null;
			counterOut [arrayId] = counterIn [arrayId];
			counterIn [arrayId] = 1;
		}
		fader[arrayId] = "OUT";
		if (counterOut[arrayId] == undefined || isNaN (counterOut[arrayId])) {
			counterOut[arrayId] = tweenLevels;
		}
		flipMessage (0);
		tweenTimer[arrayId] = setInterval ("decreaseSize ('" + listId + "', '" + graphicId + "', " + imageId + ", " + arrayId + ")", tweenInterval);
	}
}
function noTweenMax(i) {
	// this function is in place to counter a Firefox/Safari bug whereby the hover over the "Click to Call" image map is not recognized.
		counterIn[i] = 1;
		counterOut[i] = tweenLevels;
		fader[i] = null;
		tweenTimer [i] = null;
		flipMessage(i + 1);
		document.getElementById("tester").innerHTML += "noTween " + i + "<br />";
}
function initialize() {
	for (var i = 0; i <= numImages; i++) {
		counterIn[i] = 1;
		counterOut[i] = tweenLevels;
		fader[i] = null;
		tweenTimer [i] = null;
	}
	Heading [0] = "<span class=\"red-text\">Stop !</span> And Choose Your Smart Quote . . ."
	Message [0] = "<p>See Just How Quick,  Easy &amp; Affordable Automobile Insurance Can Be!<br />\n"
	Message [0] += "At SmartCoverage we tailor your experience to suit your particular auto insurance needs.<br />\n"
	Message [0] += "<strong>Now that's Smart!</strong></p>\n"
	Heading [1] = "I Want To Take the  <span class=\"red-text\">30 Second Auto Insurance Smart Quote Qualifier</span> First"
	Message [1] = "<p>There's no quicker way to ensure you qualify for the best online auto insurance quote.  Take our Smart Quote Qualifier now to confirm your eligibility and start taking advantage of quality coverage at exceptional rates.</p>\n"
	Heading [2] = "I Want My <span class=\"green-text\">Auto Insurance Smart Quote</span> Now"
	Message [2] = "<p>If you're a great driver with a clean driving history, SmartCoverage can provide you with an online auto insurance quote in  <strong>about 5 minutes</strong>. Or save time by first making sure you qualify for an online quote with our 30-Second <strong>SmartQualifier</strong>.</p>\n"
	Heading [3] = "I Prefer A No-Obligation Quote By Phone<br /><span class=\"blue-text\">SmartConnect&#8482; Now</span>"
	Message [3] = "<p>Enter your phone number and we will call you back and connect you to a knowledgeable <strong>Insurance Representative</strong> immediately, or at a convenient time.</p>\n"
}
var smallGraphicWidth = 188;  // width of the small SmartQuote graphic.
var smallGraphicHeight = 258; // height of the small SmartQuote graphic. 
var largeGraphicWidth = 225;  // width of the large SmartQuote graphic.
var largeGraphicHeight = 331; // height of the large SmartQuote graphic. 
var defaultHorizontalPadding = 36.5; // default horizontal padding length.
var defaultVerticalPadding = 18.5 // default vertical padding length.
var tweenLevels = 20; // number of tween levels from little to big and back again.
var tweenInterval = 25; // interval between each tween move.
var numImages = 2; // number of images (-1) to be tracked.
var counterIn = new Array (numImages);   // tween counters, tweenTimer (for setting intervals), fader check (in or out)?
var counterOut = new Array (numImages);
var fader = new Array (numImages);
var tweenTimer = new Array (numImages);
var Heading = new Array (numImages + 1);
var Message = new Array (numImages + 1);

