function Browser() {

  var ua, s, i;

  this.isIE    = false;  // Internet Explorer
  this.isNS    = false;  // Netscape
  this.version = null;

  ua = navigator.userAgent;

  s = "MSIE";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isIE = true;
    this.version = parseFloat(ua.substr(i + s.length));
	
//	uaLow = ua.toLowerString();
	if(ua.indexOf("Mac") >= 0) {
		window.location = "macie.shtml";	
	}
    return;
  }

  s = "Netscape6/";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = parseFloat(ua.substr(i + s.length));
    return;
  }

  // Treat any other "Gecko" browser as NS 6.1.

  s = "Gecko";
  if ((i = ua.indexOf(s)) >= 0) {
    this.isNS = true;
    this.version = 6.1;
    return;
  }
}

var browser = new Browser();

var a = null;
var b = null;
var c = null;
var d = null;
var e = null;
var ntic = null;
var bowl = null;
var fishy = null;

var locSlider = null;
var comSlider = null;
var franSlider = null;
var empSlider = null;
var expSlider = null;
var newsSlider = null;
var newsCurrent = 1;
var newsCount = 0;
var bowlSlider = null;

function init(newsNum) {
	expSlider = document.getElementById("mExp2");
	locSlider = document.getElementById("mLoc");
	comSlider = document.getElementById("mCom");
	franSlider = document.getElementById("mFran");
	empSlider = document.getElementById("mEmp");
	
	bowlSlider = document.getElementById("homeBowl");
//	fishSlider = document.getElementById("golean");
	
	newsSlider = document.getElementById("tickerSlider");
	newsCount = newsNum;
	
	newsTimer = setTimeout("slideNewsTicker()",3000);

	bowlTimer = setTimeout("slideBowlDown()",2000);
//	fishTimer = setTimeout("slideFishDown()",3500);

//	fishTimer = setTimeout("slideGoLeanDown()",3500);

	document.getElementById("homeFlash").innerHTML = "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\" width=\"295\" height=\"320\"><param name=\"movie\" value=\"home.swf\" /><param name=\"quality\" value=\"high\" /><param name=\"wmode\" value=\"transparent\" /><embed src=\"home.swf\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" wmode=\"transparent\" type=\"application/x-shockwave-flash\" width=\"295\" height=\"320\"></embed></object>";
//	alert("html: " + document.getElementById("homeFlash").innerHTML);
}

function init2(newsNum) {
	expSlider = document.getElementById("mExp2");
	locSlider = document.getElementById("mLoc");
	comSlider = document.getElementById("mCom");
	franSlider = document.getElementById("mFran");
	empSlider = document.getElementById("mEmp");
	
	bowlSlider = document.getElementById("homeBowl");
	fishSlider = document.getElementById("golean");
	
	newsSlider = document.getElementById("tickerSlider");
	newsCount = newsNum;
	
	newsTimer = setTimeout("slideNewsTicker()",3000);

	bowlTimer = setTimeout("slideBowlDown()",2000);
	fishTimer = setTimeout("slideGoLeanDown()",3500);
	
	document.getElementById("homeFlash").innerHTML = "<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0\" width=\"295\" height=\"320\"><param name=\"movie\" value=\"home.swf\" /><param name=\"quality\" value=\"high\" /><param name=\"wmode\" value=\"transparent\" /><embed src=\"home.swf\" quality=\"high\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\" wmode=\"transparent\" type=\"application/x-shockwave-flash\" width=\"295\" height=\"320\"></embed></object>";
}

//ANIMATION FUNCTIONS
///////////////////////////////////////////////////////

// Locations Menu
function slideLocDown() {
	if (a != null) {
		a.stop();
		a = null;
	}

	a = new Accelimation(locSlider.style, "height", 26, 300, .8, "px");
	a.onend = onLocEnd;
	a.onframe = slideLoc;
	a.start();
}

function slideLocUp() {
	if (a != null) {
		a.stop();
		a = null;
	}

	a = new Accelimation(locSlider.style, "height", 206, 400, .8, "px");
	a.onend = onLocEnd;
	a.onframe = slideLoc;
	a.start();
}

function onLocEnd() {
	a.stop();
	a = null;
}

function slideLoc(y) {
	locSlider.style.height = y + "px"; 
}

// Communications Menu
function slideComDown() {
	if (b != null) {
		b.stop();
		b = null;
	}

	b = new Accelimation(comSlider.style, "height", 26, 300, .8, "px");
	b.onend = onComEnd;
	b.onframe = slideCom;
	b.start();
}

function slideComUp() {
	if (b != null) {
		b.stop();
		b = null;
	}

	b = new Accelimation(comSlider.style, "height", 206, 400, .8, "px");
	b.onend = onComEnd;
	b.onframe = slideCom;
	b.start();
}

function onComEnd() {
	b.stop();
	b = null;
}

function slideCom(y) {
	comSlider.style.height = y + "px"; 
}

// Franchise Menu
function slideFranDown() {
	if (c != null) {
		c.stop();
		c = null;
	}

	c = new Accelimation(franSlider.style, "height", 26, 300, .8, "px");
	c.onend = onFranEnd;
	c.onframe = slideFran;
	c.start();
}

function slideFranUp() {
	if (c != null) {
		c.stop();
		c = null;
	}

	c = new Accelimation(franSlider.style, "height", 206, 400, .8, "px");
	c.onend = onFranEnd;
	c.onframe = slideFran;
	c.start();
}

function onFranEnd() {
	c.stop();
	c = null;
}

function slideFran(y) {
	franSlider.style.height = y + "px"; 
}

// Employment Menu
function slideEmpDown() {
	if (d != null) {
		d.stop();
		d = null;
	}

	d = new Accelimation(empSlider.style, "height", 26, 300, .8, "px");
	d.onend = onEmpEnd;
	d.onframe = slideEmp;
	d.start();
}

function slideEmpUp() {
	if (d != null) {
		d.stop();
		d = null;
	}

	d = new Accelimation(empSlider.style, "height", 206, 400, .8, "px");
	d.onend = onEmpEnd;
	d.onframe = slideEmp;
	d.start();
}

function onEmpEnd() {
	d.stop();
	d = null;
}

function slideEmp(y) {
	empSlider.style.height = y + "px"; 
}

// Exeperience Menu
var expMsg = "";

function slideExpDown() {
	if (e != null) {
		e.stop();
		e = null;
	}

	e = new Accelimation(expSlider.style, "height", 26, 300, .8, "px");
	e.onend = onExpEnd;
	e.onframe = slideExp;
	e.start();
}


function slideExpUp() {
	expMsg = "";
	
	if (e != null) {
		e.stop();
		e = null;
	}


	e = new Accelimation(expSlider.style, "height", 206, 400, .8, "px");
	e.onend = onExpEnd;
	e.onframe = slideExp;
	e.start();
}

function onExpEnd() {
	e.stop();
	e = null;
//	alert(expMsg);
}

function slideExp(y) {
	expSlider.style.height = y + "px"; 
//	expMsg += y + ", ";
}


function slideNewsTicker() {
	if (ntic != null) {
		ntic.stop();
		ntic = null;
	}

	dest = newsCurrent * -520;
//	alert("dest: " + dest);

	ntic = new Accelimation(newsSlider.style, "left", dest, 800, .8, "px");
	ntic.onend = onNewsEnd;
	ntic.onframe = slideNews;
	ntic.start();
	newsCurrent++;
}

function onNewsEnd() {
	ntic.stop();
	ntic = null;
//	alert(expMsg);
	if (newsCurrent == newsCount) {
		newsSlider.style.left = "0px";
		newsCurrent = 1;
	}
	newsTimer = setTimeout("slideNewsTicker()",4000);
}

function slideNews(x) {
	newsSlider.style.left = x + "px"; 
//	expMsg += y + ", ";
}

function slideBowlDown() {
	if (bowl != null) {
		bowl.stop();
		bowl = null;
	}

	bowl = new Accelimation(bowlSlider.style, "top", -270, 400, 1.5, "px");
	bowl.onend = onBowlEnd;
	bowl.onframe = slideBowl;
	bowl.start();
}

function onBowlEnd() {
	bowl.stop();
	bowl = null;
}

function slideBowl(x) {
	bowlSlider.style.top = x + "px"; 
}

function testBowl() {
	bowlSlider.style.top = "-560px";
	slideBowlDown();
}

/*--------------- Temporary Seafood Banner for Lent ----------*/ 

function slideGoLeanDown() {
	if (fishy != null) {
		fishy.stop();
		fishy = null;
	}

	fishy = new Accelimation(fishSlider.style, "top", -340, 600, 1.8, "px");
	fishy.onend = onFishEnd;
	fishy.onframe = slideFish;
	fishy.start();
}

function onFishEnd() {
	fishy.stop();
	fishy = null;
}

function slideFish(x) {
	fishSlider.style.top = x + "px"; 
}

function closePopup() {
	if (fishy != null) {
		fishy.stop();
		fishy = null;
	}

	fishy = new Accelimation(fishSlider.style, "top", -900, 400, 1.0, "px");
	fishy.onend = onFishEnd;
	fishy.onframe = slideFish;
	fishy.start();
}
