execOnLoad = function() {
 updateContentForNav();
 an_StartList();
 an_SetNavAndCrumbs();
}

execNow = function() {
 updateContentForNav();
}

window.onload=execOnLoad;

// ------------------------------------------------------------------------- \\

function updateContentForNav() {
  if (document.getElementById("secondary_navigation")) {
    var cw = document.getElementById("content-wrapper");
	if(cw && cw.style) {
		cw.style.marginRight = "200px";
		if (!cw.attributes["id"].value) { cw.style.width = "100%"; } /* IE 5.5 needs this also */
	};
  }
}

function an_StartList() {
  if (document.all&&document.getElementById && !window.opera) {
    navRoot = document.getElementById("primary-navigation");
    if (navRoot) {
      for (i=0; i<navRoot.childNodes.length; i++) {
   	    node1 = navRoot.childNodes[i];
       	if (node1.nodeName=="UL") {
	      for (j=0; j<node1.childNodes.length; j++) {
    	    node2 = node1.childNodes[j];
        	if (node2.nodeName=="LI") {
	          node2.onmouseover=function() {
    	        this.className+=" over";
        	  }
	          node2.onmouseout=function() {
    	        this.className=this.className.replace(" over", "");
        	  }
    } } } } }
	navRoot = document.getElementById("sites");
    if (navRoot) {
      for (i=0; i<navRoot.childNodes.length; i++) {
        node = navRoot.childNodes[i];
		if (node.attributes["class"].value) { cls = node.attributes["class"].value; } /* IE 6 */
		else { cls = node.attributes["class"]+""; /* IE 5.5 */ }
		if (cls.indexOf("expand") >= 0) {
          if (node.nodeName=="LI") {
            node.onmouseover=function() {
              this.className+=" over";
            }
            node.onmouseout=function() {
              this.className=this.className.replace(" over", "");
            }
    } } } }
	cls = "";
    navRoot = document.getElementById("site-tools");
    if (navRoot) {
      for (i=0; i<navRoot.childNodes.length; i++) {
   	    node1 = navRoot.childNodes[i];
       	if (node1.nodeName=="UL") {
	      for (j=0; j<node1.childNodes.length; j++) {
    	    node2 = node1.childNodes[j];
			if (node2.attributes["class"].value) { cls = node2.attributes["class"].value; /* IE 6 */ }
			else { cls = node2.attributes["class"]+""; /* IE 5.5 */ }
			if (cls.indexOf("expand") >= 0) {
        	if (node2.nodeName=="LI") {
	          node2.onmouseover=function() {
    	        this.className+=" over";
        	  }
	          node2.onmouseout=function() {
    	        this.className=this.className.replace(" over", "");
        	  }
    } } } } } }
} }


function an_IE_GetAttribute(tag,attribute,removeOnlyIfTwo) {
  attribute = attribute.toLowerCase();
  // Find the first instance of the attribute.
  var startOfClass = tag.toLowerCase().indexOf(attribute);
  if (startOfClass == -1) { return tag; /* probably need some kind of timeout event or something because IE sucks */ }
  // Make sure there is another class assigned
  if (startOfClass != tag.toLowerCase().lastIndexOf(attribute) || !removeOnlyIfTwo) {
    // Find the first space after the first class
    var lengthOfClass = tag.substring(startOfClass).indexOf(" ");
    // The string to remove is from 'class' up to the next space
    var classString = tag.substr(startOfClass,lengthOfClass)+" ";
    tag = an_StringReplace(tag,classString,"");
  }
  return tag;
}

var promotion_index = 0;
function an_Promotions(step) {
 var promotions = document.getElementById("promotions-content");
 if (promotions && promotions.childNodes) {

  var len = 0; // number of LI child nodes -- Opera, Mozilla consider blank space as a text node
  for (var i = 0; i < promotions.childNodes.length; i++) { if (promotions.childNodes[i].nodeName == "LI") len++; }
  if (len == 1) return;

  var new_index = promotion_index + step;
  if (new_index < 0) new_index = len-1;
  if (new_index >= len) new_index = 0;

  var c = 0;
  for (i = 0; i < promotions.childNodes.length; i++) {
   if(promotions.childNodes[i].nodeName == "LI") {
    if (promotion_index == c) { promotions.childNodes[i].style.display = "none"; }
    if (new_index == c) { promotions.childNodes[i].style.display = "block"; }
    c++;
   }
  }
  promotion_index = new_index;
 }
}




function an_StringReplace(str, match, replace) {
  // This function takes a three string arguments.
  //  str - the string to work on
  //  match - a sub string of str to replace with:
  //  replace - text to replace 'match' with
  str=str+""; // This was needed to make sure str is considered a string.
  var a=str.indexOf(match);
  if (a >= 0) { str = str.substring(0,a) + replace + str.substring(a+match.length); }
  return str;
}

// -----------------------------------------------------------------------------
// The following function cycles through the main nav HTML and highlights the
// appropriate top-level section.
// It also assembles and generates the page breadcrumbs based on values in the
// main nav.
function an_SetNavAndCrumbs() {
  var crumb = document.getElementById("breadcrumbs");
  if (crumb) {
	// If there are no list-item descendants, continue...
	if (crumb.getElementsByTagName('li').length == 0) {

		var breadcrumbs = ["Home", "/"];

		var loc = document.location+"";

		loc = loc.replace("://", "");
		loc = loc.substring(loc.indexOf("/"));

		var navroot = document.getElementById("primary-navigation");
		if (navroot) var c = an_GetChildrenOfType(navroot, "ul");

		if(c.defined) {
    	  c = an_GetChildrenOfType(c[0],"li");
	  	  for (var i = 0; i < c.length; i++) {
			// For every <li> child, we must test it's the href value of it's <a> child:
			var li = c[i];
			var a = an_GetChildrenOfType(li,"a")[0]; // first anchor child of current LI
			var href = (a+"").replace("//","");
			href = href.substring(href.indexOf("/"));

			if (loc.indexOf(href) == 0) {
				// At this point, we've found the top-level section this page belongs to
				// Store the breadcrumb information:
				breadcrumbs[breadcrumbs.length] = a.firstChild.data;
				breadcrumbs[breadcrumbs.length] = href;

				// Set the proper section active:
				an_SetAttribute(li, "class", "active");

				// Now, we prepare to visit the second-level elements:
				var d = an_GetChildrenOfType(li, "div")[0];
				var ul = an_GetChildrenOfType(d, "ul")[0];
				c = an_GetChildrenOfType(ul,"li");
				for (var j = 0; j < c.length; j++) {
					var li = c[j];
					var a = an_GetChildrenOfType(li,"a")[0];
					var href = (a+"").replace("///","").replace("//","");
					href = href.substring(href.indexOf("/"));

					if (loc.indexOf(href) >= 0) {
						// At this point, we've found the next level element
						// Store the breadcrumb information:
						breadcrumbs[breadcrumbs.length] = a.firstChild.data;
						breadcrumbs[breadcrumbs.length] = href;
						break;
					}
				}
				break;
			}
		  }
		}

//	  Remove any default breadcrumbs
//	  crumb.innerHTML = "";

	  // Loop through our breadcrumbs array
  	  for (var i = 0; i < breadcrumbs.length; i+=2) {
		// Create our text node
		var text = document.createTextNode(breadcrumbs[i]);

		// Create the anchor tag
		var a = document.createElement('a');
		an_SetAttribute(a, "href", breadcrumbs[i+1]);

		// Create the LI tag
		var li = document.createElement('li');

		// Finally, assemble everything and add it to the page.
		a.appendChild(text);
		li.appendChild(a);
		crumb.appendChild(li);
	  }
	  if ((loc.indexOf("index.") < 0) && (loc.lastIndexOf('/') != loc.length-1) ) {
	    // Override for specific sections:
	  	if (loc.indexOf("/news/press/") < 0 && (loc.lastIndexOf('/news/releases/') < 0) ) {
			// For the final crumb, we get the value from the <title> tag.
			var text_content = document.getElementsByTagName('title')[0].innerHTML;

			// Create the final LI node, and add it to the document.
			var text = document.createTextNode(text_content);
			var li = document.createElement('li');
			li.appendChild(text);
			crumb.appendChild(li);
		}
	  }
	}
  }
}

function an_GetChildrenOfType(n,t) {
	// This function returns an array of child nodes of type 't'
	var a = [];
	var c = 0;
	// Cycle through all child nodes:
	for (var i = 0; i < n.childNodes.length; i++) {
		if (n.childNodes[i].nodeName.toLowerCase() == t.toLowerCase()) {
			a[c] = n.childNodes[i];
			c++;
		}
	}
	a.length=c;
	a.defined=true;
	return a;
}

function an_SetAttribute(node,att,val) {
	var current = "";
	if (node.attributes[att]) {
		current = node.attributes[att].nodeValue;
		val = current ? current + " " + val : val;
		node.attributes[att].nodeValue = val;
	} else {
		node.setAttribute(att,val);
	}
		
}

// Year Script
function printYear() {
  var time=new Date();
  var year=time.getYear();
  if (year < 2000)
    year = year + 1900; 
    document.write(year);
}

// Spam-proof email by deanq.com
function vmemail(who,subject,domain,body) {
  if (!domain) var domain = "vmware.com";
  if (!subject) var subject = " ";
  if (!body) var body = " ";
  eval("location.href='mailto:" + who + "@" + domain + "?subject=" + subject + "&body=" + body + "'");
}

// General popup window function
function popup(URL,name,w,h,scroll, resize, status, buttons) {
  var featureStr = "";
  if (scroll) { scroll = 'yes'; } else { scroll = 'no'; }
  if (resize) { resize = 'yes'; } else { resize = 'no'; }
  if (status) { status = 'yes'; } else { status = 'no'; }
  if (!buttons) { buttons = 'no'; } else { buttons = 'yes'; } // This includes location bar, menubar and toolbar
  featureStr = "width=" + w + ",height=" + h + ",directories=no,location=" + buttons + ",menubar=" + buttons + ",resizable=" + resize + ",scrollbars=" + scroll + ",status=" + status + ",toolbar=" + buttons
  var newWin = window.open(URL,name,featureStr);
  newWin.focus(); // Bring window to focus (in case of updating an existing window)
}

// HBX tracking
var _hbEC=0,_hbE=new Array;function _hbEvent(a,b){b=_hbE[_hbEC++]=new Object();b._N=a;b._C=0;return b;}
var hbx=_hbEvent("pv");hbx.vpc="HBX0100u";hbx.gn="ehg-vmware.hitbox.com";

hbx.acct="DM551011A7BE96EN3;DM550929D5BC96EN3";//ACCOUNT NUMBER(S) VMTN;Rollup
hbx.pn="PUT+PAGE+NAME+HERE";//PAGE NAME(S)
hbx.mlc="CONTENT+CATEGORY";//MULTI-LEVEL CONTENT CATEGORY
hbx.pndef="filename";//DEFAULT PAGE NAME
hbx.ctdef="full";//DEFAULT CONTENT CATEGORY

hbx.fv="";//FORM VALIDATION MINIMUM ELEMENTS OR SUBMIT FUNCTION NAME
hbx.lt="auto";//LINK TRACKING
hbx.dlf=".rpm,.flp,.tgz,.diff,.rss,.wrf";//DOWNLOAD FILTER
hbx.dft="n";//DOWNLOAD FILE NAMING
hbx.elf="n";//EXIT LINK FILTER

hbx.seg="";//VISITOR SEGMENTATION
hbx.fnl="";//FUNNELS

hbx.cmp="";//CAMPAIGN ID
hbx.cmpn="";//CAMPAIGN ID IN QUERY
hbx.dcmp="";//DYNAMIC CAMPAIGN ID
hbx.dcmpn="";//DYNAMIC CAMPAIGN ID IN QUERY
hbx.dcmpe="";//DYNAMIC CAMPAIGN EXPIRATION
hbx.dcmpre="";//DYNAMIC CAMPAIGN RESPONSE EXPIRATION
hbx.hra="";//RESPONSE ATTRIBUTE
hbx.hqsr="";//RESPONSE ATTRIBUTE IN REFERRAL QUERY
hbx.hqsp="";//RESPONSE ATTRIBUTE IN QUERY
hbx.hlt="";//LEAD TRACKING
hbx.hla="";//LEAD ATTRIBUTE
hbx.gp="";//CAMPAIGN GOAL
hbx.gpn="";//CAMPAIGN GOAL IN QUERY
hbx.hcn="";//CONVERSION ATTRIBUTE
hbx.hcv="";//CONVERSION VALUE
hbx.cp="null";//LEGACY CAMPAIGN
hbx.cpd="";//CAMPAIGN DOMAIN

hbx.ci="";//CUSTOMER ID
hbx.hc1="";//CUSTOM 1
hbx.hc2="";//CUSTOM 2
hbx.hc3="";//CUSTOM 3
hbx.hc4="";//CUSTOM 4
hbx.hrf="";//CUSTOM REFERRER
hbx.pec="";//ERROR CODES
