var lastButton = null;
var lastButtonClass = null;
var PrevButton;
var PrevButtonID = "";
var isMac = false;
var ua = navigator.userAgent;

if ((ua.indexOf("Mac") != -1) || (ua.indexOf("Windows 3") != -1)) isMac = true;  

function Hilight(btn) {
	cancelBubble;
	if (btn.tagName != "DIV") return;
	if(window.event.fromElement.tagName == "A") return;
	DoButton(btn,"ldHover");
	if(PrevButtonID != "") {
		if(PrevButtonID != btn.id) {
			DoButton(PrevButton, "ldNormal");
		}
	}
	PrevButton = btn;
	PrevButtonID = btn.id;
}
function UnHilight(btn) {
	cancelBubble;
	if (btn.tagName != "DIV") return;	
	if(window.event.toElement.tagName == "A") return;
	DoButton(btn,"ldNormal");
}

function DoButton(TheObj,TheClass) {
	TheObj.className = TheClass;
    TheObj.children[0].className = TheClass;
}
 
function setBackLast(){

	lastButton.className = lastButtonClass;
	lastButton.children[0].className = "lmLink";
	lastButton = null;
}
function setBackLastTopMenu(){
	lastButton.className = "tmNormal";
	lastButton.children[0].className = "tmLink";
	lastButton = null;
}

function callSetBackLast(){
	if(lastButton != null && !ButtonTable.contains(window.event.toElement)){
		setBackLast();
	}
}

function callSetBackLastTopMenu(){
	if(lastButton != null && !topButtonTable.contains(window.event.toElement)){
		setBackLastTopMenu();
	}
}

function Menu_mo(elem){
	if (document.readyState != "complete" || isMac) return;
	var child, bold, div, A;
	if(lastButton != null){
		setBackLast();
	}
	if (elem.children.length == 0) return;
	div = elem.children[0];
	if (div.className == "tmChosen" || div.className == "lmChosen" || elem.children.length == 0) {
		cancelBubble;
		return;
	}
	A = elem.children[0].children[0];
	lastButton = elem.children[0];
	lastButtonClass = elem.children[0].className;
	if(LeftMenutable.contains(elem)){
		div.className = "lmMouseover";
		bold = A.style.fontWeight;
		A.className = "lmLinkMo";
		A.style.fontWeight = bold;
	}else{
		div.className = "tmMouseover";
		A.className = "tmLinkMo";
	}
	cancelBubble;
}


function cancelBubble(){
	window.event.cancelBubble = true;
}
//needed for legacy
function mouseoverlink(link) {
}
function mouseoutlink(link) {
}

////////////////////////////////
var oLastBtn=0;

window.onload = doOnload;


function doOnload(){
if (isMac){
}else{
	if (document.all){
	if (document.readyState != "complete") return;
	
		if(document.images["homegif"]){
			bIsMenu = true;
			//write in WinFamilyMenu on div id=WinFamilyMenu
			WinFamilyMenu.insertAdjacentHTML("AfterEnd", writeWinFamilyMenu());
			//event binders necessary for menu to work
			homegif.onmouseover = doMenu;
			if(!window.document.onmouseover)
				window.document.onmouseover = hideMenu;
		}
	}
}	
}

function RaiseButton(){
	
	window.event.cancelBubble=true;
	oBtn = window.event.srcElement;
	if(oLastBtn && oLastBtn != oBtn){
		HideButton();
	}
	if(oBtn.buttonType){
		oBtn.className = oBtn.buttonType + "Up";
		oLastBtn=oBtn;
	}
	else
		oLastBtn = 0;
	
	//used to cancel the WindowsFamilyMenu
	hideMenu();
}


function DepressButton(){
	window.event.cancelBubble=true;
	oBtn = window.event.srcElement;
	if(oBtn.buttonType){
		oBtn.className = oBtn.buttonType + "Down"; 
	}
}


function HideButton(){
	oLastBtn.className = oLastBtn.buttonType + "Off";
}

function MakeBGBlue(oRegion) {
	oRegion.style.backgroundColor="#99CCFF";	
	oRegion.style.cursor="hand";		
}

function MakeBGWhite(oRegion) {
	var oToEl = window.event.toElement;
	if ((oToEl && !oRegion.contains(oToEl))||!oToEl) {
	oRegion.style.backgroundColor="#FFFFFF";	
	}		
}

function ToolbarRed() {
	oSrcEl = window.event.srcElement;
	if (oSrcEl.tagName == "IMG") {
		oSrcEl.src = oSrcEl.src.substring(0,(oSrcEl.src.indexOf(".gif"))) + "-red.gif";
		window.event.cancelBubble = true;
	}
}
function ToolbarWhite() {
	oSrcEl = window.event.srcElement
	if (oSrcEl.tagName == "IMG") {
		oSrcEl.src = oSrcEl.src.substring(0,(oSrcEl.src.indexOf("-red.gif"))) + ".gif";
		window.event.cancelBubble = true;
	}
}

//*****************************************	 
//Global caps function.  Use g_bc in all pages
//to access the browser info
//*****************************************	 
function globalCaps(){
	var A=navigator.userAgent, t=true, p="", v="";
	p=A.indexOf("MSIE");
	if (p!=-1){
    	this.ie=true;
		v=A.charAt(p+5);
		(v=="2")?this.ie2=true:this.ie2=false;
		(v=="3")?this.ie3=true:this.ie3=false;
		(v=="4")?this.ie4=true:this.ie4=false;
		(v=="5")?this.ie5=true:this.ie5=false;
	} else {
		this.ie=false;
		this.ie2=false;
		this.ie3=false;
		this.ie4=false;
		this.ie5=false;	
	}
	(this.ie4||this.ie5)?this.IE4RelOrNewer=true:this.IE4RelOrNewer=false;
	(A.indexOf("Mozilla") != -1 && A.indexOf("compatible")==-1)?this.nav=true:this.nav=false;
	(A.indexOf("Windows 95")>0||A.indexOf("Win95")!=-1||A.indexOf("Win98")!=-1||A.indexOf("Windows 98")!=-1||A.indexOf("Windows NT")!=-1)?this.win32=true:this.win32=false;
	(A.indexOf("Windows 3.1")!=-1||A.indexOf("Win16")!=-1)?this.win16=true:this.win16=false;
	(A.indexOf("Mac")!=-1)?this.anymac=true:this.anymac=false;
	(A.indexOf("SunOS")!=-1||A.indexOf("HP-UX")!=-1||A.indexOf("X11")!=-1)?this.unix=true:this.unix=false;
	(A.indexOf("Windows CE")!=-1)?this.wince=true:this.wince=false;
}

//*****************************************
//Global browser info object
//*****************************************
var gbc=new globalCaps();


//*****************************************	 
//functions to support WinFamilyMenu
//*****************************************	 
function HideErrors(){
return true;
}

function doMenu() {
	if (document.readyState != "complete") return;

		window.event.cancelBubble = true;
		changeHome();
		MenuBorder.style.top = homegif.height + ((hometable.offsetTop + 1) - 5);
		MenuBorder.style.left = hometable.offsetLeft + 1;
		WinHome.className = 'winFamilyMenuItem';
		Win95.className = 'winFamilyMenuItem';
		Win98.className = 'winFamilyMenuItem';
		NTW.className = 'winFamilyMenuItem';
		NTS.className = 'winFamilyMenuItem';
		WinTech.className = 'winFamilyMenuItem';
		MenuBorder.style.display = "block";
		FamilyMenu.style.display = "block";

}


function hideMenu(oItem){

	if (document.readyState != "complete") return;
	if (document.readyState == "complete") {
		var L_homegif_Address = '/ntserver/media/nt-hm-btn-up.gif';
		FamilyMenu.style.display = "none";
		MenuBorder.style.display = "none";
		homegif.src = L_homegif_Address;
		window.event.cancelBubble = true;
	}
}

function keepMenu(){
	if (document.readyState != "complete") return;
	window.event.cancelBubble = true;
}

function doHighlight(oItem){
	if (document.readyState != "complete") return;
	var thisItem = document.all(oItem);	
	thisItem.className = 'highlightItem';
	window.event.cancelBubble = true;
}

function doUnHighlight(oItem){
	if (document.readyState != "complete") return;
	var thisItem = document.all(oItem);	
	thisItem.className = 'winFamilyMenuItem';
	window.event.cancelBubble = true;
}

function cancelBubble(){
	window.event.cancelBubble = true;
}

function doDepress(oItem){
	if (document.readyState != "complete") return;
	var thisItem = document.all(oItem);	
	thisItem.className = 'depressItem';
	window.event.cancelBubble = true;
}

function changeHome(){
	if (document.readyState != "complete") return;
	var L_homegif_Address = '/ntserver/media/nt-hm-btn-dwn.gif';
	homegif.src = L_homegif_Address;
	window.event.cancelBubble = true;
}

function writeWinFamilyMenu(){
	var r;
	var L_Win95_Address = '/windows95/';
	var L_Win98_Address = '/windows98/';
	var L_NTW_Address = '/ntworkstation/';
	var L_NTS_Address = '/ntserver/';
	var L_WinHome_Address = '/windows/';
	var L_Win2000Server_Address = '/windows/server/';
	var L_Win2000Pro_Address = '/windows/professional/';
	var L_Tech_Address = '/windows/technologies/';
	var L_WinHome_Text = 'Windows Home';
	var L_Win98_Text = 'Windows 98';
	var L_NTW_Text = 'Windows NT Workstation 4.0';
	var L_NTS_Text = 'Windows NT Server 4.0';
	var L_Win95_Text = 'Windows 95';
	var L_Win2000Server_Text = 'Windows 2000 Server';
	var L_Win2000Pro_Text = 'Windows 2000 Professional';
	var L_Tech_Text = 'Windows Technologies';
	
	r="<DIV ID='MenuBorder' onMouseover='keepMenu();' STYLE='width:194;height:149;padding-left:0;padding-top:5;padding-bottom:35;padding-right:0;display:none;position:absolute;'>";
	r+="<DIV ID='FamilyMenu' onMouseover='keepMenu();' STYLE='width:194;display:none;position:absolute;background-color:#0099ff;font-family:verdana'>";
	r+=writeFamilyMenuItem("WinHome", L_WinHome_Address, L_WinHome_Text, true);
	r+=writeFamilyMenuItem("Win98", L_Win98_Address, L_Win98_Text, true);
	r+=writeFamilyMenuItem("NTW", L_NTW_Address, L_NTW_Text, true);
	r+=writeFamilyMenuItem("NTS", L_NTS_Address, L_NTS_Text, true);
	r+=writeFamilyMenuItem("Win95", L_Win95_Address, L_Win95_Text, true);
	r+=writeFamilyMenuItem("Win2000Pro", L_Win2000Pro_Address, L_Win2000Pro_Text, true);
	r+=writeFamilyMenuItem("Win2000Server", L_Win2000Server_Address, L_Win2000Server_Text, true);
	r+=writeFamilyMenuItem("WinTech", L_Tech_Address, L_Tech_Text, false);
	r+="</DIV></DIV>"
	return r;
}

function writeFamilyMenuItem(strID, strHREF, strText, bDash){
	var r;
	var L_DashLine_Text = '/ntserver/media/dash-line-blu.gif';

	r="<A target=_top HREF='" + strHREF + "'>";
	r+="<DIV CLASS=winFamilyMenuItem ID=" + strID + " onmousedown='doDepress(\"" + strID + "\");' onmouseover='doHighlight(\"" + strID + "\");' onmouseout='doUnHighlight(\"" + strID + "\")'>";
	r+=strText+"</DIV></A>";

	if (bDash){
		r+="<img src=" + L_DashLine_Text + " align=center onmouseover='cancelBubble();'><br>";
	}
	return r;
}

//*****************************************	 
//End of functions to support WinFamilyMenu
//*****************************************	 


