execOnLoad = function() {
 an_ActivateNav();
}


function an_ActivateNav() {
 // This function checks for a version of Internet Explorer less than 7, and
 //  parses through a navigation structure adding mouseOver and mouseOut events.
 // These mouse events add/remove a class 'hover' to that element.
 // The purpose is to simulate CSS' :hover
  var v = an_GetIEVersion();
  if (v >= 0 && v < 7) {
    var navRoot = document.getElementById("sitesul");  // First level <ul>
    if (navRoot) {
	  var nodes = navRoot.getElementsByTagName("LI");
	  for (i = 0; i < nodes.length; i++) {
		if (nodes[i].nodeName=="LI") { an_IE_SetHover(nodes[i]); }
	  }
	}
  }
}

activateMenu = function(nav) {

    /* currentStyle restricts the Javascript to IE only */
	if (document.all && document.getElementById(nav).currentStyle) {  
        var navroot = document.getElementById(nav);
        
        /* Get all the list items within the menu */
        var lis=navroot.getElementsByTagName("LI");  
        for (i=0; i<lis.length; i++) {
        
           /* If the LI has another menu level */
            if(lis[i].lastChild.tagName=="UL"){
            
                /* assign the function to the LI */
             	lis[i].onmouseover=function() {	
                
                   /* display the inner menu */
                   this.lastChild.style.display="block";
                }
                lis[i].onmouseleave=function() {                       
                   this.lastChild.style.display="none";
                }
            }
        }
    }
}

function an_IE_SetHover(n) {
  // This function take a node and:
  //   - adds a mouseover function which adds 'hover' class
  //   - adds a mouseout function which removes the previous 'hover' class
  // It does not remove existing classes
  if(n) {
	n.onmouseover=function() { this.className+="hover"; }
	n.onmouseout=function() { this.className=this.className.replace("hover", ""); }
  }
}

function an_GetIEVersion() {
	// This function returns:
	//   -1   For non-IE browsers
	//   x.x  Style version number for IE browsers.
	// This isn't complete browser detection, it only cares about IE, irrespective of OS.
	var version = -1;
	var agent = navigator.userAgent.toLowerCase();
	var position = agent.indexOf("msie");
	if (position > -1 && !window.opera && navigator.vendor != 'KDE') { // Untested: navigator.vendor might work to not detect Safari
		var versionSegment = agent.substring(position);
		var versionStart = versionSegment.indexOf(' ')+1;
		var versionEnd = versionSegment.indexOf(';');
	    version = versionSegment.substring(versionStart, versionEnd);
		// 'version' now should be in the form of '6.0'
	}
	return version;
}

function an_toggleDisplay(index) {
	// This function will display a certain object in a series, and hide all others.
	//  It takes the index of the object to show as its first argument and
	//  the base ID name (ie. the ID minues the index number) of the objects as
	//  it's second (and third, fourth, etc..) argument.
	//  Example: an_toggleDisplay(2, "testA", "testB") will show "testA2" and "testB2"
	//   but hide all other "testA#" and "testB#" objects.
	//  It toggles between display types "none" and "block" only.
	//  Indexes start at 0, not 1.
	for(var n = 1; n < an_toggleDisplay.arguments.length; n++) {
		var i = 0;
		var baseID = an_toggleDisplay.arguments[n];
		var t = document.getElementById(baseID+i);
		while (t) {
			t.style.display = "none";
			i++;
			t = document.getElementById(baseID+i);
		}
		t = document.getElementById(baseID+index);
		if (t) { t.style.display="block"; }
	}
}

function an_toggleActive(index) {
	// This function will takes an object ID as an argument (2nd, 4th, 6th, etc..)
	//  and will remove the class "active" from all of that object's children of
	//  a type specified by the 3rd (and 5th, 7th, etc..) argument.
	//  Finally, it will set class "active" on the element specified by the first
	//  argument.
	//  Example: an_toggleActive(2, "test", "li") will set class "active" on
	//   the 2nd 'li' descendant of the object with id "test".
	//  Note that the hierarchy is not preserved, it will cycle through all 
	//   descendants of specified node type, not just direct child nodes.
	for(var n = 1; n < an_toggleActive.arguments.length; n++) {
		var i = 0;
		var parentID = an_toggleActive.arguments[n];
		var element = an_toggleActive.arguments[n+1];
		var t = document.getElementById(parentID);
		if (t) {
			var el = t.getElementsByTagName(element);
			for (i = 0; i < el.length; i++) {
				el[i].className = el[i].className.replace("active", "");
				el[i].className = el[i].className.replace("active", "");
			}
			if (el[index]) { el[index].className+="active"; }
		}
	}
}


function BlankWin (url) {
     blankWin = window.open(url,'_blank');
  }
  
// Added from ITs Common Functions JavaScript

// Used in the TOP Menu to go to Education Course List


function goToEducationCourseList() 
{ 
	var siteURL;
// if ((navigator.appName == "Microsoft Internet Explorer")&&( sGeobytesCountry == 'United States'))
//       { 
//	      siteURL  =	'https://registration.tibco.com/education/gi/educationSC.html';
//		  window.open(siteURL) ;
//	  }			
//	 else { 
		  siteURL = 'http://support.tibco.com/etraining/start.swe?SWECmd=GotoView&SWEView=TIBCO+EDU+Public+Training+Course+List+View'
; 
  window.location= siteURL;
//		}		
//	
 }

// Used in the TOP Menu to go to Class Schedule Page
function goToEducationClassSche() 
{ 
	var siteURL;
//	if ((navigator.appName == "Microsoft Internet Explorer")&&( sGeobytesCountry == 'United States'))
//      { 
//	      siteURL  =	'https://registration.tibco.com/education/gi/educationSC.html?Location=jsx_1';
//		   window.open(siteURL) ;
//	  }			
//	 else { 
		  siteURL = 'http://support.tibco.com/etraining/start.swe?SWENeedContext=false&SWECmd=GotoPageTab&W=t&SWEC=11&SWEBID=-1&SWETS=&SWEScreen=TIBCO+EDU+Public+Training+Class+Detail+Screen&SWEScrnCap=Class+Schedule'; 
	
	  window.location= siteURL;
//	  	}		
	 
}


// Used in the TOP Menu to go to Education Registration form
function goToEducationRegForm() 
{ 
	var siteURL;
//	if ((navigator.appName == "Microsoft Internet Explorer")&&( sGeobytesCountry == 'United States'))
//      { 
//	      siteURL  =	'https://registration.tibco.com/education/gi/educationSC.html';
//		  
//	  }			
//	 else { 
		  siteURL = 'https://registration.tibco.com/education/registration.cfm'; 
//		}		
	  window.open(siteURL) 
}


