
//BROWSER VARIABLES
function BrowserCheck() {
	var b = navigator.appName;
	if (b=="Netscape") this.b = "ns";
	else if (b=="Microsoft Internet Explorer") this.b = "ie";
	else this.b = b;
	this.version = navigator.appVersion;
	this.v = parseInt(this.version);
	this.ns = (this.b=="ns" && this.v>=4);
	this.ns4 = (this.b=="ns" && this.v==4);
	this.ns5 = (this.b=="ns" && this.v==5);
	this.ie = (this.b=="ie" && this.v>=4);
	this.ie4 = (this.version.indexOf('MSIE 4')>0);
	this.ie5 = (this.version.indexOf('MSIE 5')>0);
	this.min = (this.ns||this.ie);
}
var browser = new BrowserCheck();


//------
//IMAGE ROLLOVERS
function imgOn(imgName) { document[imgName].src = eval(imgName + "_on.src"); }
function imgOff(imgName) { document[imgName].src = eval(imgName + "_off.src"); }

//IMAGE CACHING
function cacheImg(name,src,rollover,type){
	if (!type) var type = "gif";
	if (rollover==true){
		eval(name + "_off =  new Image");
		eval(name + "_off.src = \'" + src + name + "_off." + type + "\'");
		eval(name + "_on =  new Image");
		eval(name + "_on.src = \'" + src + name + "_on." + type + "\'");
	} else {
		eval(name + " = new Image");
		eval(name + ".src = \'"+src+name+"."+type+"\'");
	}
}

var oImgPath = new Object();
oImgPath.primary = "static/images/nav/";
oImgPath.home = "static/images/home/";


//------
//SET THE APPROPRIATE STYLE SHEET
var isMac = (navigator.appVersion.indexOf("Macintosh")!=-1)? 1 : 0;
var isIE = (navigator.appVersion.indexOf("MSIE")!=-1)? 1 : 0;

function styleSheet(){
	if (isMac){ return "faf_global_mac.css"; }
	else if (isIE){ return "faf_global.css"; }
	else { return "faf_global_netscape.css"; }
}

function writeCSSInclude(src){ document.write('<link rel=\"stylesheet\" href=\"' + src + styleSheet() + '\">' ); }

function getObjRef(id){
	if (browser.ns4) { return document.layers[id]; }
	else if (browser.ns5) { return document.getElementById(id); }
	else if (document.all){ return document.all[id]; }
	else { return false; }
}

//------
//LAYER FUNCTIONS
function getObjRef(id){
	if (browser.ie) return document.all[id];
	else if (browser.ns) return document.getElementById(id);
}
function showLayer(id){
	if (document.all) document.all[id].style.visibility='visible';
	else if (browser.ns4) document.layers[id].visibility='show';
	else if (browser.ns5) document.getElementById(id).style.visibility='visible';
}
function hideLayer(id){
	if (document.all) document.all[id].style.visibility='hidden';
	else if (browser.ns4) document.layers[id].visibility='hide';
	else if (browser.ns5) document.getElementById(id).style.visibility='hidden';
}


//------
//RELOAD IF NS4 RESIZED
if (browser.ns4){ origWidth=innerWidth;origHeight=innerHeight;onresize=function(){if(innerWidth!=origWidth||innerHeight!=origHeight)location.reload() }}


