<!--
// Include styles for JavaScript enabled browsers
document.write('<link rel="stylesheet" type="text/css" href="css/js.css">');

function createCookie(name, value, days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name, "", -1);
}

var docLoc;
var startList = function() {
	if (document.getElementById) {
		docLoc = stripHost(document.location + '');
		var navRoot = document.getElementById("leftNavigation");
		applyMouseFunctions(navRoot);
	}
}

function stripHost(loc) {
	loc = loc.substr(loc.indexOf('//') + 2);
	loc = loc.substr(loc.indexOf('/'));

	return loc
}

function applyMouseFunctions(navRoot) {
	var node, expandable;
	
	for (var i=0; i<navRoot.childNodes.length; i++) {
		expandable = false;
		
		node = navRoot.childNodes[i];
		if (node.nodeName=="LI") {
			var expanded, childNode;
			
			for (var j=0; j<node.childNodes.length; j++) {
				childNode = node.childNodes[j];
				
				if (childNode.nodeName=="UL") {
					var id = childNode.id;
					
					expandable = true;
					
					expanded = readCookie(id);
					if (expanded != null) {
						if (expanded == 'true') {
							childNode.style.display = 'block';
						} else if (expanded == 'false') {
							childNode.style.display = 'none';
						}
					}
					applyMouseFunctions(childNode);
				}
			}
			
			for (var j=0; j<node.childNodes.length; j++) {
				childNode = node.childNodes[j];

				if (childNode.nodeName=="SPAN" || childNode.nodeName=="A") {
					if (true) {
						if (childNode.className.indexOf('noLink') > -1) {
							childNode.onclick=function() {
								return toggleChildList(this, false);
							}
						} else {
							childNode.onclick=function() {
								return toggleChildList(this, true);
							}
						}
					}
						
					if (expandable) {
						if (childNode.className.indexOf('expandable') < 0) childNode.className += ' expandable';
					}
					
					var theSpanNode = childNode;
				}
			}
			
			highlightCurrentLocation(node);
			highlightCurrentLocation(document.getElementById('hN').childNodes[0]);
		}
	}
}

function highlightCurrentLocation(node, loc) {
	if (!loc) loc = docLoc;

	var pNode = node.parentNode, childNode, nodeForParentStyling=false;
	
	for (var i=0; i<pNode.childNodes.length; i++) {
		node = pNode.childNodes[i];
		for (var j=0; j<node.childNodes.length; j++) {
			childNode = node.childNodes[j];
			if (childNode.nodeName=="A") {
				if (stripHost(childNode.href) == loc) {
					if (childNode.className.indexOf('over') < 0) childNode.className += ' over';
					nodeForParentStyling = childNode;
					if (nodeForParentStyling) styleParents(nodeForParentStyling);
				} else {
				}
			}
		}
	}
}

/*
function unHiglightSiblings(thisNode) {
	var pNode = thisNode.parentNode.parentNode, childNode, node;
	
	for (var i=0; i<pNode.childNodes.length; i++) {
		node = pNode.childNodes[i];
		for (var j=0; j<node.childNodes.length; j++) {
			childNode = node.childNodes[j];
			if (childNode.nodeName=="A") {
				if (thisNode != childNode) {
					if (childNode.className.indexOf('noLink') > -1) {
						childNode.className = "noLink";
					} else {
						childNode.className = "";
					}
				}
			}
		}
	}
}
*/

function unHighlightAll(nav) {
	var childNode, node, noLink, expandable;
	if (!nav) var nav = document.getElementById('leftNavigation');

	for (var i=0; i<nav.childNodes.length; i++) {
		node = nav.childNodes[i];
		for (var j=0; j<node.childNodes.length; j++) {
			childNode = node.childNodes[j];
			if (childNode.nodeName=="A") {
					if (childNode.className.indexOf('noLink') > -1) {
						noLink = true;
					} else {
						noLink = false;
					}
					if (childNode.className.indexOf('expandable') > -1) {
						expandable = true;
					} else {
						expandable = false;
					}

					childNode.className = "";

					if (noLink) {
						childNode.className += "noLink";
					} 
					if (expandable) {
						childNode.className += " expandable";
					} 
			} else if (childNode.nodeName=="UL") {
				unHighlightAll(childNode);
			}
		}
	}
}

function styleParents(node) {
	var childNode;
	while (node.parentNode.parentNode.parentNode.nodeName == 'LI') {
		var newNode = node.parentNode.parentNode.parentNode;
		for (var j=0; j<newNode.childNodes.length; j++) {
			childNode = newNode.childNodes[j];
			if (childNode.nodeName=="SPAN" || childNode.nodeName=="A") {
				highlightCurrentLocation(document.getElementById('hN').childNodes[0], stripHost(childNode.href));
				node = childNode;
				if (childNode.className.indexOf('over') < 0) childNode.className += " over";
				if (childNode.className.indexOf('down') < 0) childNode.className += " down";
			}
		}
	}
}

function toggleChildList(node, returnVal) {
	if ((node.nodeName == 'A') && (node.href.indexOf(document.location.hostname) == -1)) {
		return true;
	}
	
	var expanded, childNode;
	var newDocLoc = node.href;
	
	node = node.parentNode;
	
	for (var i=0; i<node.childNodes.length; i++) {
		childNode = node.childNodes[i];
		if (childNode.nodeName=="UL") {
			var id = childNode.id;
			if (childNode.style.display=='none' || childNode.style.display=='') {
				childNode.style.display = 'block';
				createCookie(id, true);
			} else {
				childNode.style.display = 'none';
				createCookie(id, false);
			}
		}

		if ((childNode.nodeName=="SPAN") || (childNode.nodeName=="A")) {
			if (childNode.className.indexOf('down') > -1) {
				childNode.className = childNode.className.replace('down', '');
				createCookie(id, false);
			} else {
				childNode.className = childNode.className + ' down';
				createCookie(id, true);
			}
		}
		if (childNode.nodeName=="A") {
			// alert(childNode.className);
		}
	}
	
	if (returnVal == true) {
		docLoc = stripHost(newDocLoc);
		document.location = docLoc;
		unHighlightAll();
		highlightCurrentLocation(node);
	}

	return false;
}

window.onload=startList;

function ChangeCountry(mycountrylist) {
	var url="";
	if (mycountrylist.value=="en") {
		url ="/";
	} else {
		url ="/"  + mycountrylist.value;
	}
	location = url;
}

function showCountrySelect() {
	var cs = document.getElementById('countrySelectList');
	cs.style.display = 'block';
}

function hideCountrySelect() {
	var cs = document.getElementById('countrySelectList');
	cs.style.display = 'none';
}
//-->