﻿//Build Messages:
var msgApps;
var msgSys;
var msgTech;
var tblApps;
var tblSys;
var tblTech;

msgApps = 'Databases, Websites, Custom Spreadsheet Formulae & Scripts...';
msgSys = 'Computers Built To <i>Your</i> Specifications...';
msgTech = 'Comprehensive Hardware & Software Support...';

tblApps = '<table cellpadding="0" cellspacing="0" class="Table_600"><tr><td style="width: 195px; text-align: center; padding-left: 14px; padding-top: 5px; font-size: large; color: Yellow;">';
tblApps += 'Applications</td>';
tblApps += '<td style="width: 195px; text-align: center; padding-left: 15px; padding-top: 5px; font-size: large; color: White;">';
tblApps += 'Systems</td>';
tblApps += '<td style="width: 195px; text-align: center; padding-left: 17px; padding-top: 5px; font-size: large; color: White;">';
tblApps += 'Technical Support</td>';
tblApps += '</tr><tr><td colspan="3">&nbsp;</td></tr><tr><td colspan="3" style="font-size:medium; padding-left:20px;">';
tblApps += '<a href="';
tblSys = '<table cellpadding="0" cellspacing="0" class="Table_600"><tr><td style="width: 195px; text-align: center; padding-left: 14px; padding-top: 5px; font-size: large; color: White;">';
tblSys += 'Applications</td>';
tblSys += '<td style="width: 195px; text-align: center; padding-left: 15px; padding-top: 5px; font-size: large; color: Yellow;">';
tblSys += 'Systems</td>';
tblSys += '<td style="width: 195px; text-align: center; padding-left: 17px; padding-top: 5px; font-size: large; color: White;">';
tblSys += 'Technical Support</td>';
tblSys += '</tr><tr><td colspan="3">&nbsp;</td></tr><tr><td colspan="3" style="font-size:medium; padding-left:20px;">';
tblSys += '<a href="';
tblTech = '<table cellpadding="0" cellspacing="0" class="Table_600"><tr><td style="width: 195px; text-align: center; padding-left: 14px; padding-top: 5px; font-size: large; color: White;">';
tblTech += 'Applications</td>';
tblTech += '<td style="width: 195px; text-align: center; padding-left: 15px; padding-top: 5px; font-size: large; color: White;">';
tblTech += 'Systems</td>';
tblTech += '<td style="width: 195px; text-align: center; padding-left: 17px; padding-top: 5px; font-size: large; color: Yellow;">';
tblTech += 'Technical Support</td>';
tblTech += '</tr><tr><td colspan="3">&nbsp;</td></tr><tr><td colspan="3" style="font-size:medium; padding-left:20px;">';
tblTech += '<a href="';

function makeMessage(c,l,t,m){
    this.copy = c;
    this.link = l;
    this.tip = t;
    this.msg = m;
	this.write = writeMessage;
}

function writeMessage(){
    var str = '';
    str += this.copy;
    str += this.link + '" style="text-decoration:none; color:Yellow; target="_self" title="' + this.tip + '">';
    str += this.msg;
    str += '</a></td></tr></table>';
	return str;
}

var messageArray = new Array();
messageArray[0] = new makeMessage(tblApps, "applications.aspx", "Applications",msgApps).write();
messageArray[1] = new makeMessage(tblSys, "systems.aspx","Systems",msgSys).write();
messageArray[2] = new makeMessage(tblTech, "techsupport.aspx","Technical Support",msgTech).write();

var randomNumber=Math.floor(Math.random()*2)
var nIndex = randomNumber;
var timerID = null;

function rotateMessage(){
	var len = messageArray.length;
	if(nIndex >= len)
		nIndex = 0;
	document.getElementById('message').innerHTML = messageArray[nIndex];
	nIndex++;
	timerID = setTimeout('rotateMessage()',3000);
}
function pauseMessage() {
	if (timerID != null) {
		clearTimeout(timerID);
		timerID = null;
	}
}

function playMessage() {
	if (timerID == null) {
		timerID = setTimeout('rotateMessage()', 1000);
	}
}

