﻿if (top.location != location) top.location.href = document.location.href;

Array.prototype.push = function(){
	for(var i = 0; i < arguments.length; i++){
		this[this.length] = arguments[i];
	};
	return this.length;
};
/*var Events = function () {
	var eA = new Array();
	var sNum = 0;
	var num = 0;
	return {
		set: function (o, e, f, c) {
			if (!c) c = false;
			if (f.indexOf("(") == -1) f = f + "()";
			SF = "f" + sNum; 
			if (window.addEventListener) {
				eval ("function "+SF+"{"+f1+"}");
				o.addEventListener(e,eval(SF),c);
				this.uAdd(o, e, eval(SF), c);
			}
			else {
				e = "on" + e;
				if (!c) {
					var b = o[e];
					if (typeof b != "function") o[e] = function() { eval(f); };
					else { o[e] = function() { b(); eval(f); }; }
				}
				else {
					o[e] = function() { eval(f); }
				}
				this.uAdd(o, e, null, null);
			}
			sNum++;
			this.uAdd(o, e, SF, c);
		},
		uAdd: function (o, e, f, c) {
			eA[num] = new Array(4);
			eA[num].push(arguments);
			num++;
		},
		flush: function() {
			for (var i = eA.length; i > 0; i--) {
				var id = eA[i];
				id[0].removeEventListener ?	id[0].removeEventListener(id[1], id[2] ,id[3]) : id[0][id[1]] = null;
			}
		}
	}
}();*/

//Events.set(window,"unload","Events.flush");
function setLoadEvent(f) {
	if (f.indexOf("(") == -1) f = f + "()";
	var b = window.onload;
	if (typeof b != "function") window.onload = function() { eval(f); };
	else { window.onload = function() { b(); eval(f); }; }
};

/*
var get = {
	DOM: (document.getElementById || document.all),
	DOM2: (document.getElementsByTagName || document.all),
	id: function (a) {
		var d = document;
		if (!(d.getElementById || d.all)) return false;
		else if (!a) return true;
		if (!d.getElementById(a)) return false;
		d.getElementById ? (this.o = d.getElementById(a), this.s = d.getElementById(a).style) : 
		document.all ? (this.o = d.all[a], this.s = d.all[a].style) : "";
	},
	tag: function (t,c) {
		var d = document;
		if (!(d.getElementsByTagName || d.all)) return false;
		else if (!t) return true;
		if (d.getElementsByTagName) return c ? c.getElementsByTagName(t) : d.getElementsByTagName(t);
		else if (d.all) return c ? c.all.tags(t) : d.all.tags(t);
	}
};
*/

var get = {
	DOM: (document.getElementById || document.all),
	DOM2: (document.getElementsByTagName || document.all),
	id: function (a) {
		var d = document;
		if (!(this.DOM)) return false;
		else if (!a) return true;
		if (!(d.getElementById(a) || d.all(a))) return false;
		if (document.getElementById) return d.getElementById(a);
		if (d.all) return document.all(a);
	},
	tag: function (t,c) {
		var d = document;
		if (!(this.DOM2)) return false;
		else if (!t) return true;
		if (d.getElementsByTagName) return c ? c.getElementsByTagName(t) : d.getElementsByTagName(t);
		else if (d.all) return c ? c.all.tags(t) : d.all.tags(t);
	}
};

var bD = {
	i: function () {
		this.b = this.sB(this.bI) || "an unknown browser";
		this.V = this.sV(navigator.userAgent) || this.sV(navigator.appVersion) || "an unknown version";	
	},
	sB: function (a) {
		var d;
		for (var i = 0; i < a.length; i++) {
			a[i].s == 1 ? d = navigator.vendor : a[i].s == 2 ? d = navigator.userAgent : "";
			var od = a[i].Os;
			this.vSS = a[i].vS || a[i].n;
			this.pAV = a[i].pV;
			if (d) { if (d.indexOf(a[i].sS) != -1) return a[i].n; }
			else if (od) return a[i].n;
		}
	},
	sV: function (b) {
		var ix = b.indexOf(this.vSS);
		if (ix == -1) return;
		return parseFloat(b.substring(ix + this.vSS.length + 1));
	},
	bI: [
		{
			s: 1,
			sS: "Apple",
			n: "Safari",
			pV: 0
		},
		{
			Os: window.opera,
			n: "Opera",
			pV: 6
		},
		{
			s: 1,
			sS: "KDE",
			n: "Konqueror",
			pV: 3
		},
		{
			s: 1,
			sS: "iCab",
			n: "iCab",
			pV: 1.8
		},
		{
			s: 2,
			sS: "Firefox",
			n: "Firefox",
			pV: 0
		},
		{
			s: 2,
			sS: "Netscape",
			n: "Netscape",
			pV: 6
		},
		{
			s: 2,
			sS: "MSIE",
			n: "Explorer",
			vS: "MSIE",
			pV: 5.5
		},
		{
			s: 2,
			sS: "Gecko",
			n: "Mozilla",
			vS: "rv",
			pV: 0
		},
		{
			s: 2,
			sS: "Mozilla",
			n: "Netscape",
			vS: "Mozilla",
			pV: 6
		}
	]
};

var fP = {
	i: function () {
		if (!get.tag()) return;
		this.x = get.tag("img");
		this.i = 0;
		this.fI();
	},
	fI: function () {
		with (this) {
			while (i < x.length) {
				if (x[i].id.indexOf("png") != -1 && bD.V >= bD.pAV) {
					fFB(x[i]);
				}
				i++;
			}
		}
	},
	fFB: function (i) {
		if (document.body.filters) {
			var iS = i.src.substring(0,i.src.lastIndexOf(".")) + ".png";
			var iID = (i.id) ? "id='" + i.id + "' " : "";
			var iC = (i.className) ? "class='" + i.className + "' " : "";
			var iT = (i.title) ? "title='" + i.title  + "' " : "title='" + i.alt + "' ";
			var iSy = "display:inline-block;" + i.style.cssText;
			var sN = "<span " + iID + iC + iT + " style=\"" + "width:" + i.width + "px; height:"
				+ i.height + "px;" + iSy + ";" + "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
				+ "(src=\'" + iS + "\', sizingMethod='scale');\"></span>";
			i.outerHTML = sN;
		}
		else {
			var pS = i.src.substring(0,i.src.lastIndexOf(".")) + ".png";
			var a = new Image();
			a.src = pS;
			i.src = a.src;
			return;
		}
		this.fI();
	}
};

var iC = {
	i: function (id1,id2) {
		if (!get.id() || !get.tag()) return;
		if (!this.x) {
			this.x = 0;
			this.mOv = new Array();
			this.mO = new Array();
		}
		this.m = 0;
		this.sUC(id1,id2);
	},
	sUC: function (id1,id2) {
		with (this) {
			var b = "";
			var h = get.id(id1);
			if (id2) b = get.id(id2);
			var ig = get.tag("img",h);
			while (m < ig.length) {
				var a = ig[this.m];
				a.onmouseover = this.ov;
				a.onmouseout = this.o;
				a.n = x;
				a.fb = b;
				var sf = a.src.substring(a.src.lastIndexOf("."));
				mO[x] = new Image();
				mO[x].src = a.src;
				mOv[x] = new Image();
				mOv[x].src = a.src.substring(0,a.src.lastIndexOf(".")) + "_over" + sf;
				x++;
				m++;
			}
		}
	},
	ov: function () {
		with (this) {
			src = iC.mOv[n].src;
			if (fb) fb.innerHTML = alt;
		}
	},
	o: function () {
		with (this) {
			src = iC.mO[n].src;
			if (fb) fb.innerHTML = "";
		}
	}
};

var sS = {
	i: function () {
		if (!get.tag()) return;
		var a = get.tag("a");
		for (var i = 0; i < a.length; i++) {
			a[i].onmouseover = this.ov;
			a[i].onmouseout = this.o;
		}
	},
	ov: function () {
		window.status = this.title;
		return true;
	},
	o: function () {
		window.status = "";
		return true;
	}
};
/*
var nW = {
	i: function () {
		if (!get.tag()) return;
		var a = get.tag("a");
		for (var i = 0; i < a.length; i++) {
			if  (a[i].title.indexOf("(New Window)") != -1) {
				a[i].onclick = this.cF;
			}
		}
	},
	cF: function (e) {
		if (!e) var e = window.event;
		if  (e.shiftKey || e.altKey || e.ctrlKey || e.metaKey) {
			return true;
		}
		else {
			var nw = window.open(this.href,"mcvs");
			if (nw) {
				if (window.focus) nw.focus();
			}
			return false;
		}
	}
};
*/
var nW = {
	i: function () {
		if (!get.tag()) return;
		var a = get.tag("a");
		for (var i = 0; i < a.length; i++) {
			if  (a[i].title.indexOf("(New Window)") != -1) {
				a[i].onclick = this.cF;
			}
		}
	},
	cF: function () {
		var nw = window.open(this.href,"mcvs");
		if (nw) {
			if (window.focus) nw.focus();
		}
		return false;
	}
};

function fixFlash() {
	if (!get.tag()) return;
	var o = get.tag("object");
	for (var i = 0; i < o.length; i++) {
	    o[i].outerHTML = o[i].outerHTML;
	}
};

var cH = {
	//This script must be called after all instances of the mouse over script.
	//This is an explorer issue where the script will not fully execuite if mouse over scripts are called before
	//has completed execution.
	i: function () {
		if (!get.tag()) return;
		var t = new Image();
		var tp = new Date();
		var sf = tp.getTime();
		t.onload = this.rI;
		t.src = "/images/a.gif?" + sf;
	},
	rI: function () {
		if (document.getElementById) {
			var a = document.createElement("img");
			var x = get.tag("h1");
			for (var i = 0; i < x.length; i++) {
				if (x[i].id) {
					a.src = "/images/headers/" + x[i].id + ".gif";
					a.alt = x[i].firstChild.nodeValue;
					x[i].replaceChild(a,x[i].firstChild);
				}
			}
		}
	}
};
setLoadEvent("init");
setLoadEvent("cH.i"); //explorer work around


function init() {
	bD.i();
	fP.i();
	iC.i("rollOver","navInfo");
	iC.i("validLogos");
	sS.i();
	nW.i();
	fixFlash();
};