/* old sidenav function
function sidenav(highlight1,subnav1) {
	var strTemp = new String();
	if ( highlight1 != '' ) {
		document.getElementById(highlight1).className = 'topicon1';	
	}
	if ( subnav1 != '' ) {
		document.getElementById(subnav1).className = 'subtopicson1';
  	}
	if (arguments.length >= 3) { 
		var subhead2 = arguments[2];
  	  	document.getElementById(subhead2).className = 'topicon2';
		if (arguments.length >= 4){
			var subcat2 = arguments[3];
			document.getElementById(subcat2).className = 'subtopicson2';
			if (arguments.length >= 5){
				var subhead3 = arguments[4];
				document.getElementById(subhead3).className = 'topicon3';
			}
		}			
	}
	document.getElementById('sidenav').style.visibility = "visible"; 
	}
		
}
*/

  /*
    Adds CSS class names to the LI elements of a nested UL list.
    leafes get the menu_leaf_class
    open nodes get the menu_open_class
    closed nodes get the menu_closed_class
    the current node gets the menu_active_class
    
    written 2004 by Ortwin Glueck
    
    mods for siemens styling by Ryan Ragle 2007.04.11
  */

  //config

  
  //the default page that is displayed if URL ends in /

 
    
  //main function
  //menu_id : id of the element containing the navigation
  var menu_url;
  function sidenav() {
	
	
	var menu_id = "sidenav";
     	var url = location.href;
     if (url.lastIndexOf("/") == (url.length-1)) {
       url = url; //+"index.shtml";
     }
     if (url.lastIndexOf("?") >= 0) {
       url = url.substring(0, url.lastIndexOf("?"));
     }
     if (url.lastIndexOf("#") >= 0) {
       url = url.substring(0, url.lastIndexOf("#"));
     }
     menu_url = url;
     
     var main = document.getElementById(menu_id);
     if (!main) alert("No element with id '"+ menu_id +"' found");
     menu_traverse(main);
     
    
     
  }
  
  /* Walks down the subtree and on the way back
     sets properties.
     returns bit set
             1: set = element is a node, unset = element is a leaf
             2: set = element contains the active node
             4: set = element is the active A node
  */
  function menu_traverse(element) {
  var menu_active_class = "active";
  var menu_leaf_class = "leaf";
  var menu_open_class = "open";
  var menu_closed_class = "closed";
    var props  = 0;
    
    // walk down
    for (var i=0; i<element.childNodes.length; i++) {
      var child = element.childNodes[i];
      props |= menu_traverse(child); // aggregate bits
    }
    
    // on the way back now
    switch (element.tagName) {
      case "UL":
        props |= 1;
        break;
        
      case "LI":
       var c1
	if (props & 1) {
		if (props & (2|4)) {
			c1 = menu_open_class;
			} else {
			c1 = menu_closed_class;
		} 
	} else {
		c1 = menu_leaf_class; 
	}
	/* shorthand version
        var c1 = (props & 1) ? 
                   ((props & (2|4)) ? menu_open_class : menu_closed_class)
                 : menu_leaf_class; 
   	*/
	
	
	 element.className = element.className ? element.className+" "+c1 : c1;
	 
	 if (c1 == menu_open_class) {
	 	if (element.childNodes.length > 0) {
			if (element.childNodes[0].tagName == "A") {
				element.childNodes[0].className += " bold normalDownArrow";
			}
		 }
	 }
	 
	 if (c1 == menu_leaf_class || c1 == menu_closed_class) {
	 	if (element.childNodes.length > 0) {
			if (element.childNodes[0].tagName == "A") {
				element.childNodes[0].className += "  normalBullet";
			}
		 }
	 }
	 
	 
	 
	 if (props & 4) {
		 if (element.childNodes.length > 0) {
			element.childNodes[0].className += " bold activeArrow highlightBackground";
		 }
		if (!(props & 2)) { 
			element.className += " "+menu_active_class;
			// cycle through and add highlightedBullet to elements below
			 for (var j=0; j<element.childNodes.length; j++) {
				 //document.write("j-loop:" + element.childNodes[j].tagName);
				 if (element.childNodes[j].tagName == "UL") {
				 	for (var x=0; x<element.childNodes[j].childNodes.length; x++) {
						if (element.childNodes[j].childNodes[x].tagName == "LI") {
							element.childNodes[j].childNodes[x].className += " highlightBackground";
							for(var z=0; z<element.childNodes[j].childNodes[x].childNodes.length; z++) {
								if (element.childNodes[j].childNodes[x].childNodes[z].tagName == "A") {
									element.childNodes[j].childNodes[x].childNodes[z].className += " highlightBullet highlightBackground";
								}
							}
						}
					}
				 }
			 }
			
			
		}
			props |= 2;
			props &= 1 | 2; // reset bit 4
	}
	
	
	
	
        break;
        
      case "A":
	
        if (props & 2) break; // once is enough
        var href = element.getAttribute("href");
        if (menu_isSameUrl(menu_url, href)) props |= 4;
        break;
    }
    
    return props;
  }
 
  //matches two URIs when href is the last part of url
  //.. and . are correctly resolved
  function menu_isSameUrl(url, href) {
    var a = url.split(/[?\/]/i);
    var b = href.split(/[?\/]/i);
    var i = a.length - 1;
    var j = b.length - 1;
    while ((i >= 0) && (j >= 0)) {
      if (b[j] == "..") { j-=2; continue; }
      if (a[i] == "..") { i-=2; continue; }
      if ((b[j] == ".") || (b[j] == "")) { j--; continue; }
      if ((a[i] == ".") || (a[i] == "")) { i--; continue; }
      if (! (a[i] == b[j])) return false;
      i--;
      j--;
    }
    return true;
  }
  
  /* End New Code */





startList = function(){
if (document.all&&document.getElementById){
  navRoot = document.getElementById("nav");
  for (i=0; i<navRoot.childNodes.length; i++){
    node = navRoot.childNodes[i];
    if (node.nodeName=="LI"){
		node.onmouseover=function(){
			this.className+=" over";
			}
		node.onmouseout=function(){
			this.className=this.className.replace(" over", "");
			}
		}
	}
  }
}
window.onload=startList;


var win = null;
function newWindow(mypage,myname,w,h,scroll){
LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
settings =
'height='+h+',width='+w+',top='+TopPosition+',left='+LeftPosition+',scrollbars='+scroll+',resizable'
win = window.open(mypage,myname,settings)
}
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function writeIndicator(expires,what) {
	var today = new Date();
	if (what == 'new' && today < expires) {
		document.write("<span class='accenttext'><strong>New!</strong></span>");
	} else if (what == 'updated' && today < expires) {
		document.write("<span class='accenttext'><strong>Updated!</strong></span>");
	} else {
		document.write("");
	}
}

function setupRollovers() {
  if (!document.getElementsByTagName)
    return;
  var all_links = document.getElementsByTagName('a');
  for (var i = 0; i < all_links.length; i++) {
    var link = all_links[i]; 
    if (link.className &&
        (' ' + link.className + ' ').indexOf(' rollover ') != -1) {
      if (link.childNodes &&
          link.childNodes.length == 1 &&
          link.childNodes[0].nodeName.toLowerCase() == 'img') {
        link.onmouseover = mouseover;
        link.onmouseout = mouseout;
      }
    }
  }
}

function find_target(e)
{

	var target; 
	
	if (window.event && window.event.srcElement) 
		target = window.event.srcElement;
	else if (e && e.target)
		target = e.target;
	if (!target)
		return null;
	
	while (target != document.body && target.nodeName.toLowerCase() != 'a')
		target = target.parentNode;
	
	if (target.nodeName.toLowerCase() != 'a')
		return null;
	
	return target;
}

function mouseover(e) {
	var target = find_target(e);
	if (!target) return;
	var img_tag = target.childNodes[0];
	img_tag.src = img_tag.src.replace(/(\.[^.]+)$/, '_over$1');
}

function mouseout(e) {
	var target = find_target(e);
	if (!target) return;
	var img_tag = target.childNodes[0];
	img_tag.src = img_tag.src.replace(/_over(\.[^.]+)$/, '$1');
}

// When the page loads, set up the rollovers
window.onload = setupRollovers;

function toggleLayer(whichLayer)
{
	if (document.getElementById)	{
		var style2 = document.getElementById(whichLayer).style;
		style2.display = style2.display? "":"block";
	}
	else if (document.all) {
		var style2 = document.all[whichLayer].style;
		style2.display = style2.display? "":"block";
	}
	else if (document.layers) {
		var style2 = document.layers[whichLayer].style;
		style2.display = style2.display? "":"block";
	}
}


/*standard JS code - pasted 11/14/2007 bes */

function getPos(id)
{
	var obj = document.getElementById(id);
	var pos = {left:0, top:0};

	if(typeof obj.offsetLeft != 'undefined') {

		while (obj) {
			pos.left += obj.offsetLeft;
			pos.top += obj.offsetTop;
			obj = obj.offsetParent;
		}
	} else {
		pos.left = obj.left;
		pos.top = obj.top;
	}

	return pos;
}

function maxPosition()
{
	var iMaxPos = -Number.MAX_VALUE;

	for(var i = 0; i < maxPosition.arguments.length; i++) {
		if(maxPosition.arguments[i] > iMaxPos) {
			iMaxPos = maxPosition.arguments[i];
		}
	}
	return iMaxPos;
}

function setObjectHeight(id, height)
{
	var obj = document.getElementById(id);
	obj.style.height = height + "px";
}

function getObjectHeight(id)
{
	var obj = document.getElementById(id);
	var iObjectHeight = 0;
	iObjectHeight = obj.offsetHeight;
	return parseInt(iObjectHeight);
}

function getWindowInnerSize(win)
{
	if(!win) win = window;
		var objWin = new Object();
		if(typeof win.innerWidth != 'undefined') {
			objWin.width = win.innerWidth;
			objWin.height = win.innerHeight;
		} else {
			var obj = getBody(win);
			objWin.width = parseInt(obj.clientWidth);
			objWin.height = parseInt(obj.clientHeight);
		}
		return objWin;
}

function getBody(w)
{
	return (w.document.compatMode && w.document.compatMode == "CSS1Compat") ? w.document.documentElement : w.document.body || null;
}

function positionFooter(sLeftColPHId, sMiddleColPHId, sRightColPHId, sFooterId)
{
	try {
	var iSecNavPos = getPos(sLeftColPHId).top;
	var iContentPos = getPos(sMiddleColPHId).top;
	var iContextPos = getPos(sRightColPHId).top;

	var iWindowInnerHeight = getWindowInnerSize().height;
	var iWindowMinPos = iWindowInnerHeight - getObjectHeight(sFooterId);

	var iMaxValue = maxPosition(iSecNavPos, iContentPos, iContextPos, iWindowMinPos);

	var iContentFooterPHHeight = 0;

	if (iMaxValue > iContentPos) {
		iContentFooterPHHeight = iMaxValue - iContentPos;
	}

	setObjectHeight(sMiddleColPHId, (iContentFooterPHHeight - 15));
	} catch(e) { }
	
}

function init()
{
	//commenting for now, causes bug on some pages in IE
	positionFooter("sec-nav-footer-placeholder", "content-footer-placeholder", "context-footer-placeholder", "footer-padding");
	
}

window.onresize = init;

//START: Fix IE 6 Text Selection Bug
if (window.createPopup && document.compatMode && document.compatMode=="CSS1Compat")
{
	document.onreadystatechange = function fixIE6AbsPos() {
		if( !document.body ) { return; }
		document.body.style.height = document.documentElement.scrollHeight + 'px';
	}
}
//END: Fix IE 6 Text Selection Bug

//Footer Functions
// ====================================================================
//       URLEncode and URLDecode functions
//
// Copyright Albion Research Ltd. 2002
// http://www.albionresearch.com/
//
// You may copy these functions providing that 
// (a) you leave this copyright notice intact, and 
// (b) if you use these functions on a publicly accessible
//     web site you include a credit somewhere on the web site 
//     with a link back to http://www.albionresearch.com/
//
// If you find or fix any bugs, please let us know at albionresearch.com
//
// SpecialThanks to Neelesh Thakur for being the first to
// report a bug in URLDecode() - now fixed 2003-02-19.
// And thanks to everyone else who has provided comments and suggestions.
// ====================================================================
function URLEncode(plaintext)
{
	// The Javascript escape and unescape functions do not correspond
	// with what browsers actually do...
	var SAFECHARS = "0123456789" +					// Numeric
					"ABCDEFGHIJKLMNOPQRSTUVWXYZ" +	// Alphabetic
					"abcdefghijklmnopqrstuvwxyz" +
					"-_.!~*'()";					// RFC2396 Mark characters
	var HEX = "0123456789ABCDEF";

	var encoded = "";
	for (var i = 0; i < plaintext.length; i++ ) {
		var ch = plaintext.charAt(i);
	    if (ch == " ") {
		    encoded += "+";				// x-www-urlencoded, rather than %20
		} else if (SAFECHARS.indexOf(ch) != -1) {
		    encoded += ch;
		} else {
		    var charCode = ch.charCodeAt(0);
			if (charCode > 255) {
			    alert( "Unicode Character '" 
                        + ch 
                        + "' cannot be encoded using standard URL encoding.\n" +
				          "(URL encoding only supports 8-bit characters.)\n" +
						  "A space (+) will be substituted." );
				encoded += "+";
			} else {
				encoded += "%";
				encoded += HEX.charAt((charCode >> 4) & 0xF);
				encoded += HEX.charAt(charCode & 0xF);
			}
		}
	} // for
	return encoded;
};

function URLDecode(strValue)
{
   // Replace + with ' '
   // Replace %xx with equivalent character
   // Put [ERROR] in output if %xx is invalid.
   var HEXCHARS = "0123456789ABCDEFabcdef"; 
   var encoded = strValue;
   var plaintext = "";
   var i = 0;
   while (i < encoded.length) {
       var ch = encoded.charAt(i);
	   if (ch == "+") {
	       plaintext += " ";
		   i++;
	   } else if (ch == "%") {
			if (i < (encoded.length-2) 
					&& HEXCHARS.indexOf(encoded.charAt(i+1)) != -1 
					&& HEXCHARS.indexOf(encoded.charAt(i+2)) != -1 ) {
				plaintext += unescape( encoded.substr(i,3) );
				i += 3;
			} else {
				alert( 'Bad escape combination near ...' + encoded.substr(i) );
				plaintext += "%[ERROR]";
				i++;
			}
		} else {
		   plaintext += ch;
		   i++;
		}
	} // while
   return plaintext;
};

function CreatePopupWindow(windowname, url, width, height)
{
  // tests for the existence of the window.focus method. window.focus is how we bring the popup to the front every time, even though it was already open. Some older browsers do not have window.focus -- those browsers degrade gracefully by failing out of the function and going to the popup's URL in the current window. Note that there are no parentheses after window.focus because we are testing for the existence of the function, not running it.
  if (! window.focus)
    return true;
  // Line 6 declares the href variable, which holds the URL to which the popup should navigate. Lines 7 to 10 figure out what that URL is. In 7 we test if mylink is a string. If it is a string, in line 8 we assign to href the value of the string. If mylink is not a string then we assume it is an <A ...> or <AREA ...> object and in line 10 assign to href the value of the objects href property (which was set in the HREF attribute of the <A ...> or <AREA ...> tag). 
  var href, left, top; 
  // center popup window 
  left = (screen.width - width) / 2
  top = (screen.height - height) / 2
  if (typeof(url) == 'string')
     href=url;
  else
     href=url.href;
  window.open(url, windowname, 'width='+width+',left='+left+',top='+top+',height='+height+',resizable=yes,scrollbars=yes');
  //return false to cancel the click on the link. If we don't return false the link will navigate the current window to the URL of the popup
  //return false;
}

function mailpage() {

var strURL1 = URLEncode(URLEncode(window.location.toString())); //engine requires double encode
CreatePopupWindow('popup','http://www.siemens.com/misc/pageMailer/pageMailerPopup.jsp?sdc_contentid=1182073&sdc_pmorigurl=' + strURL1,460,450);

}