﻿/*-----------------------------------------------------------------------+
 | attachWindowOpeners: Make all external/file links open in new windows |  +-----------------------------------------------------------------------*/
function attachWindowOpeners() {
	var links = document.getElementsByTagName("a");
	
	for (var i = 0; i < links.length; i++) {
		var theLink = links[i];
		
		if (/\.(doc|pdf|ppt|xls)$/.test(theLink.href)) {
			var url = theLink.href;
			
			links[i].onclick = function () {
				window.open(this.href);
				return false;
			}
		}
	}
}

/*-----------------------------------------------------------+
 | addLoadEvent: Add event handler to body when window loads |
 +-----------------------------------------------------------*/
function addLoadEvent(func) {
	var oldonload = window.onload;
	
	if (typeof window.onload != "function") {
		window.onload = func;
	} else {
		window.onload = function () {
			oldonload();
			func();
		}
	}
}

var xmlHttp;

/*------------------------------------+
 | Functions to run when window loads |
 +------------------------------------*/
addLoadEvent(function () {
	if (document.getElementById && document.getElementsByTagName) {
		initHoverStates();
//		initTagPreviews();
//		initTooltips();
//		initHighlighters();
	}
});

/*----------------------------------------------------------+
 | initHoverStates: Enable faux :hover functionality for IE |
 +----------------------------------------------------------*/
function initHoverStates() {
	if (document.all && document.getElementById && document.getElementsByTagName) {
		navRoot = document.getElementById("tabs");
		
		if (navRoot) {
			navNodes = navRoot.getElementsByTagName("li");
			for (i=0; i < navNodes.length; i++) {
				node = navNodes[i];
				
				if (node.className.indexOf("current") == -1) {
					node.onmouseover = function() {
						this.className += " over";
					}
					node.onmouseout=function() {
						this.className = this.className.replace(" over", "");
					}
				}
			}
		}
	}
}

function toggleDivVisible(divID) {
    if (document.getElementById(divID)) {
        theDiv = document.getElementById(divID);
        if (theDiv.className == 'hidden' ) {
            theDiv.className = 'visible';
        }
        else {
            theDiv.className = 'hidden';
        }
    }
}

var remote;
function launchWindow(helpURL, size){
	remote = window.open(helpURL, "help", size+",scrollbars=1,resizable=1, menuBar=0, status=1, toolbar=0");
	remote.focus();
}

