var speed = 60 // decrease value to increase speed (must be positive)
var pause = 5000 // increase value to increase pause
var timerID = null
var bannerRunning = false
var currentMessage = 0
var offset = 0

function stopBanner() {
	if (bannerRunning)
	clearTimeout(timerID)
	bannerRunning = false
	}

function startBanner() {
	stopBanner()
	showBanner()
	}

function showBanner() {
	var text = ar[currentMessage]
	if (offset < text.length) {
		if (text.charAt(offset) == " ")
			offset++
			var partialMessage = text.substring(0, offset + 1)
			window.status = partialMessage
			offset++
			timerID = setTimeout("showBanner()", speed)
			bannerRunning = true
			} else {
				offset = 0
				currentMessage++
				if (currentMessage == ar.length)
					currentMessage = 0
			timerID = setTimeout("showBanner()", pause)
		bannerRunning = true
	}
}

function setCookie()	{
  var cookieString = new String(document.cookie);
  var cookieHeader = "LastVisit=";
  var beginString = cookieString.indexOf(cookieHeader);
  if(beginString != -1) {
	var dateVisit = new Date();
	var lastVisit = new String("LastVisit=" + dateVisit);
	cookieExp = new Date();
	cookieExp.setYear(cookieExp.getYear() + 1);
	cookieExpires = new String("; expires=" + cookieExp.toGMTString());
	document.cookie = lastVisit + cookieExpires;
  }
}

function getCookie()	{
  var cookieString = document.cookie + ";";
  var cookieHeader = "LastVisit=";
  var beginString = cookieString.indexOf(cookieHeader);
  if(beginString == -1) addCookie();
  else	{
    startOfCookie = beginString + cookieHeader.length;
    endOfCookie = cookieString.indexOf(";", startOfCookie);
    cookieString = cookieString.substring(startOfCookie, endOfCookie);

    var lastVisit = new Date(cookieString); var lastV = lastVisit.getTime();
    var upd1 = update1.getTime(), upd2 = update2.getTime(), upd3 = update3.getTime();
    var upd4 = update4.getTime(), upd5 = update5.getTime(), upd6 = update6.getTime();

    if(lastV < upd1 && lastV >= upd2) javascript:popUpSmall('scripts/update1.htm');
    else  { 
        if(lastV < upd2 && lastV >= upd3) javascript:popUpSmall('scripts/update2.htm');
        else  { 
          if(lastV < upd3 && lastV >= upd4) javascript:popUpSmall('scripts/update3.htm');
          else  { 
            if(lastV < upd4 && lastV >= upd5) javascript:popUpSmall('scripts/update4.htm');
            else if(lastV < upd5 && lastV >= upd6) javascript:popUpSmall('scripts/update5.htm');
    }  }  }
  } 
}

function addCookie()	{
  var dMsg1 = new String("Hi There. This is a very dynamic site with a lot happening. Is it okay to store the dates of your visits in an Older Tees cookie on your computer ?  ")
  var dMsg2 = new String("  This will enable me to let you know what changes have taken place when you visit again, so you don't miss anything important.")

  if (confirm(dMsg1+dMsg2)) {
    var dateVisit = new Date();
    var lastVisit = new String("LastVisit=" + dateVisit);
    cookieExp = new Date();
    cookieExp.setYear(cookieExp.getYear() + 1);
    cookieExpires = new String("; expires=" + cookieExp.toGMTString());
    document.cookie = lastVisit + cookieExpires;
  }
}


function MM_swapImgRestore() {
	var i,x,a=document.MM_sr;
 	for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() {
	var d=document; 
	if(d.images){ 
		if(!d.MM_p) d.MM_p=new Array();
		var i,j=d.MM_p.length,a=MM_preloadImages.arguments; 
		for(i=0; i<a.length; i++)
    			if (a[i].indexOf("#")!=0){ 
				d.MM_p[j]=new Image; 
				d.MM_p[j++].src=a[i];
			}
	}
}

function MM_findObj(n, d) {
	var p,i,x;  
	if(!d) d=document; 
	if((p=n.indexOf("?"))>0&&parent.frames.length) {
    		d=parent.frames[n.substring(p+1)].document; 
		n=n.substring(0,p);
	}
	if(!(x=d[n])&&d.all) x=d.all[n]; 
	for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document); 
	return x;
}

function MM_swapImage() {
	var i,j=0,x,a=MM_swapImage.arguments; 
	document.MM_sr=new Array; 
	for(i=0;i<(a.length-2);i+=3)
   		if ((x=MM_findObj(a[i]))!=null){
			document.MM_sr[j++]=x; 
			if(!x.oSrc) x.oSrc=x.src; 
			x.src=a[i+2];
		}
}

function popUp(whereTo) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(whereTo, '" + id + "', 'toolbar=0,scrollbars=1,location=0,left=70,top=0,statusbar=0,menubar=0,resizable=1,width=600,height=520');");
}

function popUpSmall(URL) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=0,scrollbars=1,location=0,top=100,left=150,statusbar=0,menubar=0,resizable=1,width=450,height=380');");
}

function popUpFull(URL) {
	day = new Date();
	id = day.getTime();
	eval("page" + id + " = window.open(URL, '" + id + "', 'toolbar=1,scrollbars=1,location=1,left=0,top=0,statusbar=1,menubar=1,resizable=1,width=790,height=425');");
}
