var bn = navigator.appName;
var vn = navigator.appVersion;

if ((bn!="Microsoft Internet Explorer") || (vn.substring(0,3)!="2.0")) {
	
	attr1 = new Image();
	attr1.src = "/images/mainpage/all_main_nav_01a.gif"
	attr2 = new Image();
	attr2.src = "/images/mainpage/all_main_nav_01b.gif"
	
	events1 = new Image();
	events1.src = "/images/mainpage/all_main_nav_02a.gif"
	events2 = new Image();
	events2.src = "/images/mainpage/all_main_nav_02b.gif"
	
	history1 = new Image();
	history1.src = "/images/mainpage/all_main_nav_03a.gif"
	history2 = new Image();
	history2.src = "/images/mainpage/all_main_nav_03b.gif"
	
	delta1 = new Image();
	delta1.src = "/images/mainpage/all_main_nav_04a.gif"
	delta2 = new Image();
	delta2.src = "/images/mainpage/all_main_nav_04b.gif"
	
	shop1 = new Image();
	shop1.src = "/images/mainpage/all_main_nav_05a.gif"
	shop2 = new Image();
	shop2.src = "/images/mainpage/all_main_nav_05b.gif"
	
	outdoor1 = new Image();
	outdoor1.src = "/images/mainpage/all_main_nav_06a.gif"
	outdoor2 = new Image();
	outdoor2.src = "/images/mainpage/all_main_nav_06b.gif"
	
	cane1 = new Image();
	cane1.src = "/images/mainpage/all_main_nav_07a.gif"
	cane2 = new Image();
	cane2.src = "/images/mainpage/all_main_nav_07b.gif"
	
	drive1 = new Image();
	drive1.src = "/images/mainpage/all_main_nav_08a.gif"
	drive2 = new Image();
	drive2.src = "/images/mainpage/all_main_nav_08b.gif"
	
	day1 = new Image();
	day1.src = "/images/new_mainpage/all_main_nav_08a.gif"
	day2 = new Image();
	day2.src = "/images/new_mainpage/all_main_nav_08b.gif"
	
}

function hiLite(name, source) {
	var bn = navigator.appName;
	var vn = navigator.appVersion;
	
	if ((bn!="Microsoft Internet Explorer") || (vn.substring(0,3)!="2.0")) {
	document.images[name].src = eval(source + ".src");
	}
}

function addEvent(obj,evType,fn){
	if(obj.addEventListener){
		obj.addEventListener(evType,fn,true);
		return true;
	}
	else if(obj.attachEvent){
		var r=obj.attachEvent("on"+evType,fn);
		return r;
	}
	else{
		eval("obj.on"+evType+ " = " + fn);
		return true;
	}
}

function getObj(name, ref) {
  if (document.getElementById) {
  	this.obj = document.getElementById(name);
		if(this.obj) 
			this.style = document.getElementById(name).style;
  }
  else if (document.all) {
		this.obj = document.all[name];
		if(this.obj)
			this.style = document.all[name].style;
  }
  else if (document.layers) {
   	this.obj = document.layers[name];
		if(this.obj)
	   	this.style = document.layers[name];
  }
	return this.obj; //secondary functionality returns reference to obj
}

function findPosY(obj){
	var curtop = 0;
	if (obj.offsetParent) {
		while (obj.offsetParent) {
			curtop += obj.offsetTop
			obj = obj.offsetParent;
		}
	}
	else if (obj.y)
		curtop += obj.y;
	return curtop;
}

function findPosX(obj){
	var curleft = 0;
	if (obj.offsetParent) {
		while (obj.offsetParent) {
			curleft += obj.offsetLeft
			obj = obj.offsetParent;
		}
	}
	else if (obj.x)
		curleft += obj.x;
	return curleft;
}


//****************************
//** FROM: somewhere. Seen these functions elsewhere too many times to properly credit
//***************************
function setOpacity(obj, opacity) {
  opacity = (opacity == 100)?99.999:opacity;
  // IE/Win
  obj.style.filter = "alpha(opacity:"+opacity+")";
  // Safari<1.2, Konqueror
  obj.style.KHTMLOpacity = opacity/100;
  // Older Mozilla and Firefox
  obj.style.MozOpacity = opacity/100;
  // Safari 1.2, newer Firefox and Mozilla, CSS3
  obj.style.opacity = opacity/100;
}

function fadeIn(objId,opacity) {
  if (document.getElementById) {
    obj = document.getElementById(objId);
    if (opacity <= 100) {
      setOpacity(obj, opacity);
      opacity += 10;
      window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 100);
    }
  }
}


function ImgRotator (objId,speed)
{
	this.objId = objId; // VARIABLE SHOULD BE NAMED THIS AS WELL
	this.obj = getObj(objId);
	this.speed = speed;
	this.ImgSrc = new Object();
	this.ImgAlt = new Object();
	this.curIndex =  0;
	this.count = 0;
	this.started = false;
	this.preloaded = false;
	if (this.obj) { this.addImage(this.obj.src,this.obj.alt);	this.curIndex++; }
}

var IR = ImgRotator.prototype;

IR.addImage = function(source,alt) { this.ImgSrc[this.count] = source; this.ImgAlt[this.count++] = alt; }
IR.preloadImages = function() { for(i=0;i < this.count;i++) { var img= new Image(); img.src = this.ImgSrc[i]; } this.preloaded = true; }
IR.beginSlideShow = function() { if (!this.obj) return; this.obj.onload = function() { this.started = true; setTimeout("eval("+this.id+").showImage()",eval(this.id).speed); } }
IR.showImage = function () { 
	if (this.obj.parentNode){
		this.obj.parentNode.style.backgroundImage = 'url('+this.obj.src+')';
	}
	this.obj.title = this.ImgAlt[this.curIndex];
	this.obj.alt = this.ImgAlt[this.curIndex];
	this.obj.src = this.ImgSrc[this.curIndex];
	this.curIndex++; this.curIndex %= this.count;
	
	fadeIn(this.objId,0);
}