// function RotatingTextBox(element_id,interval,messages,[,maxHeight,defaultFontSize][,minFontSize])

// Create a rotating text box in element element_id that displays the array of strings in messages,

// pausing interval seconds between each message.

// If maxHeight, defaultFontSize, and minFontSize are supplied, the size of the rotating text will

// be scaled to as few as minFontSize pixels to reduce the box height below maxHeight.

// If no minFontSize is supplied, the variable defaults to a value of 1.

// If maxHeigh and defaultFontSize aren't supplied, the box will not change size.

function RotatingTextBox() {

	switch(arguments.length) {

		case 6:

			this.minFontSize = arguments[5];

		case 5:

			this.maxHeight = arguments[3];

			this.defaultFontSize = arguments[4];

		case 3:

			this.domObj = getElement(arguments[0]);

			this.interval = arguments[1];

			this.messages = arguments[2];

			break;

		default:

			return;



	}



	// Display first message

	this.currentMessage = Math.floor(Math.random()*this.messages.length);

	this.showMessage(this.currentMessage);

}

RotatingTextBox.prototype.showMessage = function(messageId) {

	this.currentMessage = messageId;

	this.domObj.innerHTML = this.messages[messageId];



	if(typeof(this.maxHeight) != 'undefined') {

		if(this.currentFontSize != this.defaultFontSize)

			this.setTextSize(this.defaultFontSize);



		while(this.domObj.offsetHeight > this.maxHeight && this.currentFontSize > this.minFontSize) {

			this.setTextSize(--this.currentFontSize);

		}

	}

}

RotatingTextBox.prototype.showNextMessage = function() {

	this.showMessage(this.currentMessage >= this.messages.length-1 ? 0 : this.currentMessage+1);

}

RotatingTextBox.prototype.setTextSize = function(size) {

	this.currentFontSize = size;

	this.domObj.style.fontSize = size + 'px';

}

RotatingTextBox.prototype.startRotation = function() {

	var myself = this;

	function rotate() {

		myself.showNextMessage();

	}

	this.rotator = window.setInterval(rotate,this.interval*1000);

}

RotatingTextBox.prototype.stopRotation = function() {

	window.clearInterval(this.rotator);

}



// Get the DOM element with the specified ID.

function getElement(id) {

   if(document.getElementById) {

      return(document.getElementById(id));

   }

   else if(document.all) {

      return(document.all[id]);

   }

   else if(document[id]) {

      return(document[id]);

   }

   else {

      return;

   }

}



// Call fn when this window loads without destroying the value of window.onload.

function addOnloadEvent(fn) {

	var loads = window.onload;

	if(typeof(window,onload) == 'undefined') {

		window.onload = fn;

	}

	else {

		window.onload = function() {

			if(loads) {

				loads();

			}



			fn();

		}

	}

}



function initSlogansBox() {

	var slogans = [

	"Sharpen your memory<br>Memory and health longevity<br>MD developed &amp; tested supplement.",

	"The elephant's secret<br>Sharper memory, ageless longevity<br>Improve you brain with reVITALIZER.",

	"Try Memory reVITALIZER®<br>Better Memory, Improved Health<br>MD developed and tested supplement",

	"Try Memory reVITALIZER®<br>MD developed and tested supplement.<br>Compare health to your supplement.",

	"Try memory reVITALIZER<br>memory supplement about $2 a day<br>better memory. Improved health",

	"Elephants never forget.<br>Do you? Try reVITALIZER today.<br>memory, energy, health &amp; wellness",

	"The elephant's secret<br>Gotu kola: The herbal magic<br>Sharpen mental performance",

	"Elephants have secrets<br>Ageing is not for the faint hearted<br>memory longevity, health &amp; wellness",

	"Elephants remember-Do you?<br>Memory, energy, health &amp; longevity<br>Try reVITALIZER today.",

	"Try Memory reVITALIZER®<br>Wellness and longevity<br>over 8 years of clinical testing.",

	"Is your memory ageing<br>return your mental stamina to when<br>you were 30. Try Memory reVITALIZER®",

	"The Real Brain Food<br>Try Memory reVITALIZER® Today",

	"It's memory, energy,<br>cardiovascular and more.",

	"The premier patented<br>Synergistic anti-aging biosupplement",

	"MD developed biosupplement.<br>Compare health to your supplement.",

	"Sharpen your memory<br>Doctor developed",

	"Sharper memory, while slowing aging",

	"Sharpen mental performance<br>better memory. Improved health",

	"Memory reVITALIZER® has over 9 years of clinical use.<br>Judge the improvements for yourself",

	"Elephants never forget.<br>Why should you?",

	"Is your memory slowing?<br>Return your mental stamina to when you were 30."

	];



	var slogansBox = new RotatingTextBox('header_slogan',10,slogans,102,24,10);

	slogansBox.startRotation();

}



addOnloadEvent(initSlogansBox);

addOnloadEvent(function() {MM_preloadImages('nav/images/nav_ro_02.jpg','nav/images/nav_ro_04.jpg','nav/images/nav_ro_06.jpg','nav/images/nav_ro_10.jpg','nav/images/nav_ro_12.jpg','nav/images/nav_ro_14.jpg','nav/images/nav_ro_16.jpg')});

