var marqueePos = -1;
var timeout = null;
var is_visible = true;
var marqueeText = [
	"<img src=\"img/marquee/panel1.jpg\">",
	"<font face=\"Times New Roman\" color=\"#FFFFFF\"><b>\"Beachbody and P90X helped me lose 50+ pounds and get in the best shape of my life.\" - Chris Sauer</b></font>",
	"<img src=\"img/marquee/panel2.jpg\">",
	"<font face=\"Times New Roman\" color=\"#FFFFFF\"><b>\"I feel healthier on the days I drink Shakeology, which has to be every day for me.\" – Mary Ann Kobes.   </b></font>",
	"<img src=\"img/marquee/panel3.jpg\">",
	"<font face=\"Times New Roman\" color=\"#FFFFFF\"><b>\"I was so impressed with Shakeology that I became a Beachbody Coach.\" - Teresa Heaney. <a href=\"https://teambeachbody.com/signup/-/signup/coach?referringRepId=2760\">Join our Team</a> and reap the 25% discounts available Only to Coaches </b></font>",
	"<img src=\"img/marquee/panel4.jpg\">",
	"<font face=\"Times New Roman\" color=\"#FFFFFF\"><b>\“I just could not get the pounds off! P90X and Shakeology has changed that!\” - Amy Harper</b></font>",
	"<font face=\"Times New Roman\" color=\"#FFFFFF\"><b>\I actually saw more results after one month on Turbo Jam than I did 20 years at the gym! I cancelled my gym membership!\" - Christina M Sears</b></font>",
	"<img src=\"img/marquee/panel5.jpg\">",
	"<font face=\"Times New Roman\" color=\"#FFFFFF\"><b>\“I had my first Shakeology this morning and it is so yummy! I placed my order this morning with my coach!\” - Michelle Kline</b></font>",
	"<font face=\"Times New Roman\" color=\"#FFFFFF\"><b>\"Tastes like a Rich Chocolate Peanut Butter Fudge Sickle\" - Debbie Siebers on <a href=\"http://heaveninaglass.info\">Shakeology</a></b></font>",
	"<font face=\"Times New Roman\" color=\"#FFFFFF\"><b>\“My hubby who six months ago swore up and down that he would never drink Shakeology and called it \"crap\" just started drinking Shakeology a week ago and is totally hooked and says he feels GREAT! The last two days he drank TWO of them!!..so trust me, if my stubborn hubby got convince (and it aint easy convincing him of anything) then you KNOW Shakeology is GOOOOOOD stuff!!\” – Christina M Sears</b></font>",
	"<font face=\"Times New Roman\" color=\"#FFFFFF\"><b>\"Ever since I started Shakeology I haven't had any acne breakouts and I've been struggling with that since I was 12\" - kara phillips</b></font>",
	"<font face=\"Times New Roman\" color=\"#FFFFFF\"><b>\"If you mix up the Chocolate Shakeology well enough, it tastes better than brownies. Thanks again for showing my mom and I Shakeology!\" - Trevor, Kenosha WI</b></font>",
	"<font face=\"Times New Roman\" color=\"#FFFFFF\"><b>\"A first for me…  finishing a workout and feeling like I got some more. Plus all that tension from work today has dissolved entirely\" –Kara Phillips</b></font>",
	"<font face=\"Times New Roman\" color=\"#FFFFFF\"><b>\"I had a few stubborn pounds to lose, and thanks to Shakeology I was able to do that!\" – Mindy Kinsella. </b></font>",
	"<font face=\"Times New Roman\" color=\"#FFFFFF\"><b>\“I just posted about how ever since I started drinking Shakeology(6mo ago) I have not been sick once...not even a cold!\” – Pria Elisabeth Orth</b></font>",
	"<font face=\"Times New Roman\" color=\"#FFFFFF\"><b>\“I don't feel like I have to take a nap everyday when I get home from work. With my thyroid disease I have a severe issue with energy. Thank You for helping me improve my life Tom\” </b></font>",
	"<font face=\"Times New Roman\" color=\"#FFFFFF\"><b>\I actually saw more results after one month on Turbo Jam than I did 20 years at the gym! I cancelled my gym membership!\" - Christina M Sears</b></font>",
	"<font face=\"Times New Roman\" color=\"#FFFFFF\"><b>\"It satisfies me for 2 – 3 HOURS. After my shake I have to remind myself to eat I am not hungry\" - Shevaun Williams on Shakeology</b></font>",
	"<font face=\"Times New Roman\" color=\"#FFFFFF\"><b>\“I think Shakeology does greatly reduce menopausal symptoms\” - Lora Cummins</b></font>",
	"<font face=\"Times New Roman\" color=\"#FFFFFF\"><b>\“I have noticed huge improvements on my digestive health\" - Karen Marie Powell</b></font>",
	"<font face=\"Times New Roman\" color=\"#FFFFFF\"><b>\“I'm Type I Diabetic and Shakeology has been great. Never felt better in my life!\” - Austin Demary</b></font>",
	"<font face=\"Times New Roman\" color=\"#FFFFFF\"><b>\“You just don't know how grateful I am that you introduced me to Shakeology! I haven't felt at 100% in over ten years, so this is the biggest blessing I've had in over a decade.\” - Samantha B</b></font>",
	"<font face=\"Times New Roman\" color=\"#FFFFFF\"><b>\“Shakeology brought my body back to life!\” - Cammie Lust after Chemo-therapy brought her digestive system down</b></font>",
	"<font face=\"Times New Roman\" color=\"#FFFFFF\"><b>\“I know I haven't touched my migraine meds since I started using it Shakeology!\" - Annette MacDougall</b></font>",
	"<font face=\"Times New Roman\" color=\"#FFFFFF\"><b>\“I tried Shakeology today for the first time and I was full after just drinking half the glass! Thanks Tom for introducing me to it!!\” - Lorna Walmsley</b></font>",
	"<font face=\"Times New Roman\" color=\"#FFFFFF\"><b>\“I have not been sick at all since Shakeology! Usually get 1 bad cold from the kids in the winter sometime. Everyone else was sick but me :)\” - Dave Prochaska</b></font>",
	"<font face=\"Times New Roman\" color=\"#FFFFFF\"><b>\“I use to get nauseated every morning and it was terrible. Only a few days into Shakeology I woke up without feeling nauseous for the first time in a long time!\" - Joyce Birkenmeyer</b></font>",
	"<font face=\"Times New Roman\" color=\"#FFFFFF\"><b>The fact that you can get into the most amazing shape in your life without leaving to go to the gym is absolutely priceless. Who's with me? :-)</b></font>",
	"<font face=\"Times New Roman\" color=\"#FFFFFF\"><b>80 percent of all deaths in todays modern America is from chronic illness largely due to lifestyle CHOICES</b></font>",
	"<font face=\"Times New Roman\" color=\"#FFFFFF\"><b>Procrastination is the cornerstone of all poverty</b></font>",
	"<font face=\"Times New Roman\" color=\"#FFFFFF\"><b>Reaping is reserved for those who sew a good seed and sew that good seed every day </b></font>",
	"<font face=\"Times New Roman\" color=\"#FFFFFF\"><b>Some people go through life without ever knowing they can change everything because they never sought after the knowledge and made the discovery</b></font>",
	"<font face=\"Times New Roman\" color=\"#FFFFFF\"><b>\"You don't need less problems you simply need more skill.\" - Jim Rohn</b></font>",
	"<font face=\"Times New Roman\" color=\"#FFFFFF\"><b>\"Don't wish it was easier wish you were better\" - Jim Rohn</b></font>",
	"<font face=\"Times New Roman\" color=\"#FFFFFF\"><b>\“One who lacks courage to start has already finished\” – unknown author</b></font>",
	"<font face=\"Times New Roman\" color=\"#FFFFFF\"><b>We either make ourselves miserable or we make ourselves strong. The amount of work is the same.</b></font>",
	"<font face=\"Times New Roman\" color=\"#FFFFFF\"><b>You’re child will live a life ten years younger than you because of the landscape of food that we’ve built around them.</b></font>",
	"<font face=\"Times New Roman\" color=\"#FFFFFF\"><b>\"I have used metrx, eas, slimfast, ensure, myoplex and other meal replacement shakes and they just do not compare to Shakeology.\" - Shevaun Williams</b></font>",
	"<font face=\"Times New Roman\" color=\"#FFFFFF\"><b>\"it helps to regulate my blood sugar & my craving for sweets & chocolate.\" - Shevaun Williams, Diabetic</b></font>",
	"<font face=\"Times New Roman\" color=\"#FFFFFF\"><b>\"That simple, seemingly insignificant error in judgment, compounded over time, will Kill you\" - Jeff Olson</b></font>",
	"<font face=\"Times New Roman\" color=\"#FFFFFF\"><b>Time, right now, is ALWAYS working for or against you.  Position yourself so that it's working for you</b></font>",
	"<font face=\"Times New Roman\" color=\"#FFFFFF\"><b>We dig our graves with our teeth</b></font>",
	"<font face=\"Times New Roman\" color=\"#FFFFFF\"><b>\"Successful people form habits that feed their success, instead of habits that feed their failure\" - Jeff Olson</b></font>",
	"<font face=\"Times New Roman\" color=\"#FFFFFF\"><b>\Right NOW the most important thing is to Start.  If you don't take that first step I promise you won't achieve your goals</b></font>",
	"<font face=\"Times New Roman\" color=\"#FFFFFF\"><b>Successful people do the things that unsuccessful won't do</b></font>",
	"<font face=\"Times New Roman\" color=\"#FFFFFF\"><b>\"The problem is that most of us live with one foot planted firmly in the past and the other tucked timidly in the future - never in the moment\" - Jeff Olson</b></font>",
	"<font face=\"Times New Roman\" color=\"#FFFFFF\"><b>\"Success doesn't come from nowhere.  It comes from a very small, tiny beginning-but there has to be a beginning.  Most people miss the beginning\" - Jeff Olson</b></font>",
	"<font face=\"Times New Roman\" color=\"#FFFFFF\"><b>Greatness in the future is always determined by what you do NOW, not tomorrow. If you want to be great Tomorrow you must act Today!</b></font>",
	"<font face=\"Times New Roman\" color=\"#FFFFFF\"><b>Are you still waiting for your ship to come in?  \"Your ship's not coming - it's already here. Docked and Waiting\" - Jeff Olson</b></font>",
	"<font face=\"Times New Roman\" color=\"#FFFFFF\"><b>Endeavor to simplify things, not complicate them.</b></font>",
	"<font face=\"Times New Roman\" color=\"#FFFFFF\"><b>Life is painful; suffering is optional.</b></font>",
	"<font face=\"Times New Roman\" color=\"#FFFFFF\"><b>Happiness is a direction, not a destination.</b></font>",
	"<font face=\"Times New Roman\" color=\"#FFFFFF\"><b>Ghandi: You must be the change that you wish to see in the world.</b></font>", ];

function changeMarqueeText ()
{
	document.getElementById ( "marquee" ).innerHTML = marqueeText [ marqueePos ];
}

function setMarqueeOpacityForAllBrowsers ( alpha ) {
	document.getElementById ( "marquee" ).style.filter = "progid:DXImageTransform.Microsoft.Alpha(style=0,opacity:" + alpha + ")";	// MSIE
	document.getElementById ( "marquee" ).style.KHTMLOpacity = alpha / 100;	// Safari < 1.2, Konqueror
	document.getElementById ( "marquee" ).style.MozOpacity = alpha / 100;	// Older Mozilla & Firefox
	document.getElementById ( "marquee" ).style.opacity = alpha / 100;	// Safari 1.2+, newer Mozilla & Firefox, CSS3
}

function affectMarquee ( currentAlpha, increment, cbFuncName ) {

	var alpha = currentAlpha + increment;

	// have we gone beyond either threshold?
	if ( alpha < 0 || alpha > 95 )	// use 95 so code jumps from 95 -> 99; Mozilla flickers the div if 95 -> 100
	{
		// if so, cancel the operation by invoking callback
		if ( cbFuncName != null )
			cbFuncName ();
	} else {
		// else, adjust transparency and setup the next adjustment
		setMarqueeOpacityForAllBrowsers ( alpha );
		setTimeout ( "affectMarquee ( " + alpha + ", " + increment + ", " + cbFuncName + " )", 25 );
	}
}


function marqueeDisappear ()
{
	affectMarquee ( 100, -5, "marqueeDisappearCallback" );
}

function marqueeAppear ()
{
	affectMarquee ( 0, 5, "marqueeAppearCallback" );
}

function marqueeDisappearCallback ()
{
	is_visible = false;
	marqueeForward ();
	marqueeAppear ();
}

function marqueeAppearCallback ()
{
	is_visible = true;
	setMarqueeOpacityForAllBrowsers ( 99 );
	timeout = setTimeout ( "marqueeDisappear ()", 4000 );
}

function marqueeForward ()
{
	if ( timeout != null ) clearTimeout ( timeout ); // cancel the pending fade out
	marqueePos++;
	if ( marqueePos >= marqueeText.length ) marqueePos = 0;
	changeMarqueeText ();

	if ( is_visible )
		timeout = setTimeout ( "marqueeDisappear ()", 4000 ); // reschedule the fade out in another 10 s
}

function marqueeBackward ()
{
	if ( timeout != null ) clearTimeout ( timeout ); // cancel the pending fade out
	marqueePos--;
	if ( marqueePos < 0 ) marqueePos = marqueeText.length - 1;
	changeMarqueeText ();

	if ( is_visible )
		timeout = setTimeout ( "marqueeDisappear ()", 4000 ); // reschedule the fade out in another 10 s
}

function startMarquee ()
{
	marqueeDisappear ();
}
