// JavaScript Document

var MenuTabHit=false; //global variable to keep track of when menutab is moused on or off, had multiple hits mousing over
					  //dropdown for some reason so this is made to help make it only happen once - problem found in ie5/6
var BrowserType;      //Holdes the browser id info, derived from function below.
//This next function queries browser to see what kind it is, if it's not a version of IE, returns -1
//If it is a version of IE, returns the version number.
function getBrowserType () {
	var infoString=navigator.appVersion;
	var temp=infoString.indexOf('MSIE');
	if (temp==-1) {
		//Not IE browser
		return -1;
	} else {
		//Is IE browser and returns version number
		infoString=infoString.substr(temp);
		temp=infoString.indexOf(';');
		infoString=infoString.substring(0,temp);
		infoString=infoString.split(" ");
		return infoString[1];
	}
}
//document.getElementById('output').innerHTML;
BrowserType=getBrowserType();
//Create FadeIn object class
function Fader () {
	this.version;
	this.element;
	this.timerId;
	this.incr=0.0;
	this.fadeIn=function () {
		
		if (this.incr<.8) {
				switch (true)
				{
   					case (this.version!=-1 && this.version<7.0) ://IE and less than version 7.0
      					this.element.style.filter="alpha(opacity="+this.incr*100+")";
      					break;
   					case (this.version!=-1 && this.version>=7.0) ://IE version 7.0 or greater
      					this.element.style.filter="alpha(opacity="+this.incr*100+")";
      					break;
   					case (this.version==-1) ://All other browsers other than IE
      					this.element.style.opacity=this.incr;
      					break;
				} 
			this.incr+=.1;
		} else {

				switch (true)
				{
   					case (this.version!=-1 && this.version<7.0) ://IE and less than version 7.0
      					this.element.style.filter="alpha(opacity=77)";
      					break;
   					case (this.version!=-1 && this.version>=7.0) ://IE version 7.0 or greater
      					this.element.style.filter="alpha(opacity=77)";
      					break;
   					case (this.version==-1) ://All other browsers other than IE
      					this.element.style.opacity=.77;
      					break;
				} 
			this.incr=0.0;
			this.clearTimer();
		}
	}
	this.clearTimer=function () {
		if (this.timerId) {
				clearInterval(this.timerId);
			} else {
				this.timerId=false;
			}
	}
	this.start=function () {
		this.timerId=window.setInterval("faderObj.fadeIn()",1);
		}
}

faderObj= new Fader();
faderObj.version=BrowserType;
//---------------------------------------------------------------------------------------------------------------------
function showDropDown (node) {
	var dropDownElement=(node.getElementsByTagName('UL'))[0];
	dropDownElement.style.display='block';
	var menuTabLink=(node.getElementsByTagName('A'))[0];
	menuTabLink.className='menutablinkjavascripthover';
	if (menuTabLink.id) {menuTabLink.id="lastmenutablinkjavascripthover";}
	if (!MenuTabHit) {MenuTabHit=true;
		switch (true)
		{
   			case (faderObj.version!=-1 && faderObj.version<7.0) ://IE and less than version 7.0
				dropDownElement.style.filter="alpha(opacity=0)";
				faderObj.element=dropDownElement;
				faderObj.incr=0.0;
				faderObj.clearTimer();
				faderObj.start();
				//document.getElementById('output').innerHTML="IE browser less than version 7.0";
      			break;
   			case (faderObj.version!=-1 && faderObj.version>=7.0) ://IE version 7.0 or greater
				dropDownElement.style.filter="alpha(opacity=0)";
				faderObj.element=dropDownElement;
				faderObj.incr=0.0;
				faderObj.clearTimer();
				faderObj.start();
				//document.getElementById('output').innerHTML="IE browser 7.0 or greater";
      			break;
   			case (faderObj.version==-1) ://All other browsers other than IE
				dropDownElement.style.opacity=0.0;
				faderObj.element=dropDownElement;
				faderObj.incr=0.0;
				faderObj.clearTimer();
				faderObj.start();
				//document.getElementById('output').innerHTML="Non-IE browser";
      			break;
		}
	}
}
function hideDropDown (node) {
	var dropDownElement=(node.getElementsByTagName('UL'))[0];
	dropDownElement.style.display='none';
	var menuTabLink=(node.getElementsByTagName('A'))[0];
	menuTabLink.className='menutablink';
	if (menuTabLink.id) {menuTabLink.id="lastmenutablink";}
	MenuTabHit=false;
}
function highlightmenutab (node) {
	var menuTabLink=(node.parentNode).getElementsByTagName('A')[0];
	menuTabLink.className='menutablinkjavascripthover';
	MenuTabHit=true;
}
function unhighlightmenutab (node) {
	var menuTabLink=(node.parentNode).getElementsByTagName('A')[0];
	menuTabLink.className='menutablink';
	MenuTabHit=true;
}

//Only for IE7 menu positioning

window.onload=function () {

	if (BrowserType<8 && BrowserType!=-1) {

		var adjustPixelAmount=1;

		var menu=document.getElementById('menucontainer');

		    menu.style.top=adjustPixelAmount+parseInt((menu.currentStyle.top).replace(/px/,''))+"px";

	}

}
