var focusElementAlts = [
	'Community Health 1',
	'Community Health 2',
	'Community Health 3'];
var focusElementImages = [
	'/images/template/header/imagestrip/home/imageStrip1.png',
	'/images/template/header/imagestrip/home/imageStrip2.png',
	'/images/template/header/imagestrip/home/imageStrip3.png'];
var focusElementLinks = [
	'#',
	'#',
	'#'];
var focusElementTexts = [
	'<h2>We offer the highest quality  medical service within a professional, friendly and caring environment...</h2>' +
        '<p>Our team of medical, nursing and allied health professionals work together to deliver excellent, ' +
        'cost effective healthcare in the communities we serve.  We bulk bill all eligible services.</p>',
	'<h2>We offer the highest quality  medical service within a professional, friendly and caring environment...</h2>' +
        '<p>Our team of medical, nursing and allied health professionals work together to deliver excellent, ' +
        'cost effective healthcare in the communities we serve.  We bulk bill all eligible services.</p>',
	'<h2>We offer the highest quality  medical service within a professional, friendly and caring environment...</h2>' +
        '<p>Our team of medical, nursing and allied health professionals work together to deliver excellent, ' +
        'cost effective healthcare in the communities we serve.  We bulk bill all eligible services.</p>'];

var focusElementTicks = 0;
var focusElementMode = 0;
var focusImagesLoaded = false;
var focusElementRotation = true;
var fadeSteps = [ 10, 15, 20, 25, 30, 35, 40, 45, 50, 55, 60, 65, 70, 75, 80, 85, 90, 95, 100, 100, 100];

function preloadFocusImages()
{
	if (!focusImagesLoaded)
	{
		focusImagesLoaded = true;
		
		document.getElementById("focusElementImg").alt = focusElementAlts[focusElementMode];
		document.getElementById("focusElementImg").title = focusElementAlts[focusElementMode];
		document.getElementById("focusElementImg").src = focusElementImages[focusElementMode];

		focusElementMode++;
		
		for (var i = 0; i < focusElementImages.length; i++)
		{
			var image1 = new Image();
			image1.src = focusElementImages[i];
		}
	}
}

function swapFocusImages()
{
	preloadFocusImages();

	if (document && document.getElementById)
	{
		if (focusElementRotation)
		{
			focusElementTicks++;
		
			if (focusElementTicks > -1 && focusElementTicks < 21)
			{
				document.getElementById("focusElementImg").style.opacity =
					fadeSteps[focusElementTicks] / 100;
				document.getElementById("focusElementImg").style.filter =
					"alpha(opacity=" + fadeSteps[focusElementTicks] + ")";
			}
			else if (focusElementTicks > 78 && focusElementTicks < 100)
			{
				document.getElementById("focusElementImg").style.opacity =
					fadeSteps[100 - focusElementTicks] / 100;
				document.getElementById("focusElementImg").style.filter =
					"alpha(opacity=" + fadeSteps[100 - focusElementTicks] + ")";
			}
			else if (focusElementTicks >= 100)
			{
				focusElement(focusElementMode);

				focusElementTicks = 0;
				focusElementMode++;

				if (focusElementMode >= focusElementImages.length) 
				{
					focusElementMode = 0;
				}
			}
		}

		setTimeout("swapFocusImages()", 50);
	}
}

function focusElement(elementID)
{
	document.getElementById("focusElementImg").alt = focusElementAlts[elementID];
	document.getElementById("focusElementImg").title = focusElementAlts[elementID];
	document.getElementById("focusElementImg").src = focusElementImages[elementID];
	document.getElementById("focusElementTxt").innerHTML = focusElementTexts[elementID];

    /*
	document.getElementById("liFor0").className = '';
	document.getElementById("liFor1").className = '';
	document.getElementById("liFor2").className = '';
	document.getElementById("liFor3").className = '';
	document.getElementById("liFor4").className = '';
	document.getElementById("liFor" + elementID).className = 'selected';
    */
}

function focusElementOver(elementID)
{
	focusElement(elementID);

	document.getElementById("focusElementImg").style.opacity = 1;
	document.getElementById("focusElementImg").style.filter = "alpha(opacity=100)";

	focusElementRotation = false;
	focusElementTicks = 25;
	focusElementMode = elementID + 1;

	if (focusElementMode >= focusElementImages.length) 
	{
		focusElementMode = 0;
	}
}

function focusElementOut()
{
	focusElementRotation = true;
}

function onDocumentLoad()
{
	focusElementOver(0);
	focusElementMode = 0;
	focusElementRotation = true;
	swapFocusImages();
}

window.onload = onDocumentLoad;

