
/**
 * Browser sniffer
 */
function browserChecker () {

	this.agent = navigator.userAgent.toLowerCase ();

	this.major = parseInt (navigator.appVersion);
	this.minor = parseFloat (navigator.appVersion);

	this.dom = document.getElementById ? 1 : 0;

	// Opera spoofs IE
	this.op5 = (this.agent.indexOf ("opera 5") != -1 || this.agent.indexOf ("opera/5") != -1 && window.opera);
	this.op6 = (this.agent.indexOf ("opera 6") != -1 || this.agent.indexOf ("opera/6") != -1 && window.opera);

	this.ie5 = (this.agent.indexOf ("msie 5") != -1 && !this.op5 && !this.op6);
	this.ie55 = (this.ie5 && this.agent.indexOf ("msie 5.5") != -1);

	this.ie6 = (this.agent.indexOf ("msie 6") != -1 && !this.op5 && !this.op6)
	this.ie4 = (this.agent.indexOf ("msie") != -1 && document.all && !this.ie5 && !this.ie6);

	this.ie45 = (this.ie4 || this.ie5 || this.ie55);

	this.mac = (this.agent.indexOf ("mac") != -1);

	this.ns6 = (this.agent.indexOf ("gecko") != -1 || window.sidebar);

	// Netscape 4 doesn't support the DOM.
	this.ns4 = (!this.dom && document.layers) ? 1 : 0;

	// The list of supported browsers for this file.
	this.supported = (this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.op5 || this.op6);

	this.useDom = this.ns6 || this.ie5 || this.ie55 || this.ie6;
	this.reuseLayers = this.ie || this.useDom;

	return this;
}


var onloadFuncArray = new Array ();
var brwCheck = new browserChecker ();

var brwDim;
// = new encDimensions ();

addToOnLoadList (encInit);

// the last layer that was set to visible
var curVisibleLayer;

// the width of the outermost content table.
var contentWidth = 770;

var encOverDiv = false;
var encDivTimer = null;

var secondsVisible = 1;

var winWidth;
var snavXPos, snavYPos;

var leftCol;

function encInit () {


	brwDim = new encDimensions ();

	leftCol = (brwDim.windowWidth - contentWidth) / 2;
	leftCol = Math.round (leftCol);

	// pageOnload ();
}

function encShowLayer (name) {
	curVisibleLayer = name;
	if (brwCheck.ns4 && document.layers[name]) {
		document.layers[name].visibility = "show";
	}
	if (brwCheck.ie5 && document.all[name]) {
		document.all[name].style.visibility = "visible";
		curVisibleLayer = name;
	}
	if (brwCheck.ns6 || brwCheck.ie6) {
		var elem = document.getElementById (name);
		if (elem) {
			elem.style.visibility = "visible";
		}
	}
}

function encHideLayer (name) {
	if (brwCheck.ns4 && document.layers[name]) {
		document.layers[name].visibility = "hide";
	}
	if (brwCheck.ie5 && document.all[name]) {
		document.all[name].style.visibility = "hidden";
	}
	if (brwCheck.ns6 || brwCheck.ie6) {
		var elem = document.getElementById (name);
		if (elem) {
			elem.style.visibility = "hidden";
		}
	}
	curVisibleLayer = "";
}

function encMoveLayerTo (name, x, y) {

    if (brwCheck.ns4 && document.layers[name]) {
        document.layers[name].left = x;
        document.layers[name].top = y;
    }
    if (brwCheck.ie45 && document.all[name]) {
        document.all[name].style.left = x;
        document.all[name].style.top = y;
    }
	if (brwCheck.ns6 || brwCheck.ie6) {
		var elem = document.getElementById (name);
		if (elem) {
			elem.style.left = x + "px";
			elem.style.top = y + "px";
		}
	}
}

function encMoveLayerBy (name, x, y) {

    if (brwCheck.ns4 && document.layers[name]) {
        document.layers[name].left += x;
        document.layers[name].top += y;
    }
    if (brwCheck.ie45 && document.all[name]) {
		var temp = parseInt (document.all[name].style.left) + x;
        document.all[name].style.left = temp;
		temp = parseInt (document.all[name].style.top) + y;
        document.all[name].style.top = temp;
    }
	if (brwCheck.ns6 || brwCheck.ie6) {
		var elem = document.getElementById (name);
		if (elem) {
			var temp = parseInt (elem.style.left) + x;
			elem.style.left = (temp + "px");
			temp = parseInt (elem.style.top) + y;
			elem.style.top = (temp + "px");
		}
	}
}

function encHideCurrent () {
	encHideLayer (curVisibleLayer);
}

function encDivOver () {
	encOverDiv = true;
	clearTimeout (encDivTimer);
}

function encDivOut () {
	encOverDiv = false;
	encDivTimer = setTimeout ("encHideCurrent ();", secondsVisible * 1000);
}

function encGetElementHeight (name) {
	var height = 50;
	if (brwCheck.ns4 && document.layers[name]) {
		height = document.layers[name].clip.bottom;
	}
	if (brwCheck.ie5) {
		height = document.all[name].clientHeight;
	}
	return height;
}

function encGetElement (name) {
	var elem;
	if (brwCheck.ns4) {
		elem = document.layers[name];
	}
	if (brwCheck.ie45) {
		elem = document.all[name];
	}
	if (brwCheck.ns6 || brwCheck.ie6) {
		elem = document.getElementById (name);
	}
	return elem;
}

function addToOnLoadList (fname) {

	if (brwCheck.ie45 && brwCheck.isMac) {
		window.onload = encOnLoad;
		onloadFuncArray[onloadFuncArray.length] = fname;
	} else {

		if (window.onload) {
			if (window.onload != encOnLoad) {
				onloadFuncArray[onloadFuncArray.length] = window.onload;
				onloadFuncArray[onloadFuncArray.length] = fname;
				window.onload = encOnLoad;
			} else {
				onloadFuncArray[onloadFuncArray.length] = fname;
			}
		} else {
			onloadFuncArray[onloadFuncArray.length] = fname;
			window.onload = encOnLoad;
		}
	}
}

function encOnLoad () {
	for (var i = 0; i < onloadFuncArray.length; i++) {
		onloadFuncArray[i] ();
	}
}

function encDimensions () {
	var temp = 0;
	if (brwCheck.ns4) {
		temp = window.innerWidth;
	} 
	if (document.ie45) {
		temp = document.body.clientWidth;
	}
	if (brwCheck.ie6) {
		if (document.body.clientWidth) {
			temp = document.body.clientWidth - 18;
		}
	}
	if (brwCheck.ns6) {
		temp = window.innerWidth - 18;
	}

	this.windowWidth = temp;

	return this;
}

function encRemoveClickBorder (object) {
	if (brwCheck.ie45) {
		if (object.blur) {
			object.blur ();
		}
	}
}

function alertSize() {
  var myWidth = 0, myHeight = 0;

  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else {
    if( document.documentElement &&
        ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
      //IE 6+ in 'standards compliant mode'
      myWidth = document.documentElement.clientWidth;
      myHeight = document.documentElement.clientHeight;
    } else {
      if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
        //IE 4 compatible
        myWidth = document.body.clientWidth;
        myHeight = document.body.clientHeight;
      }
    }
  }
  window.alert( 'Width = ' + myWidth );
  window.alert( 'Height = ' + myHeight );
}

