var ns = navigator.appName == "Netscape"; 
var menuopen=0,mouse_y=0,tries=0,mytop,newpos,mi_h,mi_w,mi_s,myleft,c_w,d_l,d_w,d_bg,smi_bg,smi_bk,smi_cl,shad,roll,move_height,s_w,b_l,b_h;
var menuItemOpen = new Array();
var thisMenuItemPosition = new Array();
var prodNav;
var additionalLayer;
if (!navbarImagePath) var navbarImagePath = "/images/nav-left/";
if (!bulletImageLocation) var bulletImageLocation = "/images/nav-left/bullet.gif";

//************** Kris Verhoye: changed the code: made it less static by creating these functions

// A boolean in order to stop the recursive effect of opening a menu item - thereby opening a page - thereby
// opening a menu item again...
var menuActionAfterCreateLayers=false;

// See the init method below regarding defaults for the following values
var showingMenuLinks;

var nrOfMenuItemTags;
var nrOfSubMenuItemTags;

var indexOfMenuDescriptionTag;
var indexOfMenuLinkTag;
var indexOfMenuNrOfSubItems;
var indexOfMenuAltTextTag;

var indexOfSubMenuDescriptionTag;
var indexOfSubMenuLinkTag;

function getMenuImageIndex(menuIterator) {
	return (menuIterator * nrOfMenuItemTags);
}

function getMenuImageAltTextIndex(menuIterator) {
	return (menuIterator * nrOfMenuItemTags) + indexOfMenuAltTextTag;
}

function getMenuDescriptionIndex(menuIterator) {
	return (menuIterator * nrOfMenuItemTags) + indexOfMenuDescriptionTag;
}

function getMenuLinkTextIndex(menuIterator) {
	return (menuIterator * nrOfMenuItemTags) + indexOfMenuLinkTag;
}

function getMenuNrOfSubItemsIndex(menuIterator) {
	return (menuIterator * nrOfMenuItemTags) + indexOfMenuNrOfSubItems;
}

function getSubMenuLinkTextIndex(menuIterator, subMenuIterator) {
	return (menuIterator * nrOfSubMenuItemTags) + (subMenuIterator - 1) * nrOfSubMenuItemTags;
}

function getSubMenuDescriptionIndex(menuIterator, subMenuIterator) {
	return (menuIterator * nrOfSubMenuItemTags) + (subMenuIterator - 1) * nrOfSubMenuItemTags + indexOfSubMenuDescriptionTag;
}

function getSubMenuUrlIndex(menuIterator, subMenuIterator) {
	return (menuIterator * nrOfSubMenuItemTags) + (subMenuIterator - 1) * nrOfSubMenuItemTags + indexOfSubMenuLinkTag;
}

//**************

function BaseUrl4Flash(href) {
	document.write("<base href='http://" + location.host + href +"'>");
}

function msMove(myEvents){
	mouse_y=myEvents.pageY+90;
}

document.captureEvents(Event.MOUSEMOVE);
document.onmousemove = msMove;

function MM_jumpMenu(targ,selObj,restore){	
	if (selObj.options[selObj.selectedIndex].value.length > 0) {
		eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
		if (restore) selObj.selectedIndex=0;
	}
}

function MM_jumpMenuNewWindow(selObj,w,h,restore){
	if ( (selObj.options[selObj.selectedIndex].value!="") && (selObj.options[selObj.selectedIndex].value!="null") ) {
		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=yes,resizable,location=yes,toolbar=yes,status=yes,directories=no,menubar=yes';
		window.open(selObj.options[selObj.selectedIndex].value,'JC',settings);
	}
	if (restore) selObj.selectedIndex=0;
}

function MM_jumpMenuNewWindowWarning(selObj,w,h,restore){
	if ( (selObj.options[selObj.selectedIndex].value!="") && (selObj.options[selObj.selectedIndex].value!="null") ) {
		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=yes,resizable,location=yes,toolbar=yes,status=yes,directories=no,menubar=yes';
		//window.open(selObj.options[selObj.selectedIndex].value,'JC',settings);
		openCenteredWindow('/backgrounders/externalwarning.jhtml?referer=' + selObj.options[selObj.selectedIndex].value + '&newWindow=true','popup','350','200');
	}
	if (restore) selObj.selectedIndex=0;
}

function openExt(url,conf){
	if (conf+''!='') {
		if (confirm(conf)) window.open(url,'popup','scrollbars=yes,resizable=yes,width=600,height=500,menubar=yes,toolbar=yes,status=yes,location=yes');
	}
	else window.open(url,'popup','scrollbars=yes,resizable=yes,width=600,height=500,menubar=yes,toolbar=yes,status=yes,location=yes');
}

function MM_findObj(n, d) { 
	var p,i,x;
	if(!d) d=document;
	if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);
	}
	if(!(x=d[n])&&d.all) x=d.all[n];
	for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
	return x;
}

function MM_showHideLayers() { 
	var i,p,v,obj,args=MM_showHideLayers.arguments;
	for (i=0; i<(args.length-2); i+=3)
		if ((obj=MM_findObj(args[i]))!=null) {
			v=args[i+2];
			if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
			obj.visibility=v;
		}
}

function MM_swapImgRestore() { 
	var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { 
	var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
	var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
	if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImage() { 
	var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
	if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_reloadPage(init) { 
	if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
		document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
	else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}

function openExternalWarningWindow(url,name,w,h) {
	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=no,resizable=no,menubar=no,toolbar=no,status=no,location=no';
	window.open(url,name,settings);
	return false;
}

function openCenteredWindow(url,name,w,h) {
	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=no,resizable=no,menubar=no,toolbar=no,status=no,location=no';
	window.open(url,name,settings);	
}

function openRegularCenteredWindow(url,name,w,h) {
	if (w != "" && h != "") {
		sizeText = 'width=' + w +',height=' + h + ',';
	}
	LeftPosition = (screen.width) ? (screen.width-w)/2 : 0;
	TopPosition = (screen.height) ? (screen.height-h)/2 : 0;
	settings = sizeText + 'top='+TopPosition+',left='+LeftPosition+',scrollbars=yes,resizable=yes,menubar=yes,toolbar=yes,status=yes,location=yes';
	window.open(url,name,settings);
}

function MM_openBrWindow(theURL,winName,features) {
	window.open(theURL,winName,features);
}

function getpos(obj)
{
	myobj = document.layers[obj];
	pos=myobj.top;
	return (pos);
}

function moveobject(obj,pos)
{
	myobj = document.layers[obj];
	if (myobj!=null) myobj.top=pos;
}

function movemenu(n,pos)
{
 moveobject("menu"+n,pos);
}

function moveAdditionalLayer(additionalLayer,n) {
	if (menuopen!=0) {
		additionalLayerTop = mytop + ((menuitems.length/nrOfMenuItemTags)*22) + MM_findObj('submenu'+n).offsetHeight + 20;
	} else {
		additionalLayerTop = mytop + ((menuitems.length/nrOfMenuItemTags)*22) + 20;
	}
	moveobject(additionalLayer,additionalLayerTop);
}

function gotomenu(str, mi, smi) {
	found = 0;
	for (i = 1; i <= menuitems.length / nrOfMenuItemTags; i++) {
		k = 0;
		for (ii = 0; ii < i - 1; ii++) {
			k += menuitems[getMenuNrOfSubItemsIndex(ii)];
		}
		for (j = 1;j <= menuitems[getMenuNrOfSubItemsIndex(i-1)]; j++) {
			submenuUrl = submenuitems[getSubMenuUrlIndex(k,j)];
			first_pos = submenuUrl.indexOf("|");
			if (first_pos >= 0) {
				txt = submenuUrl.substr(0, first_pos);
			}
			else {
				txt = submenuUrl;
			}
			if (txt.charAt(0) == '_') {
				txt = txt.replace('_','');
			}
			if (txt == str) {
				submenuaction(i, k, j);
				found = 1;
			}
		}
	}
	if (found == 0) {
		if (mi == null) {
			mi = '0';
			smi = '0';
		}
		if (mi + '' == '-1') {
			mi = currentmenuitem;
			smi = currentsubmenuitem;
		}
		newpos = new Image;
		newpos.src='/navbarpos.jhtml?' + 'mi=' + mi + '&smi=' + smi + '&nh=' + nohints;
		i = setTimeout('gotolink("' + str + '");',50);
	}
}

function submenuaction(i, j, k) {
	G_day = new Date();
	G_seed = G_day.getTime();
	rand = parseInt(((G_seed - (parseInt(G_seed / 1000, 10) * 1000)) / 10) / 100 * 100000 + 1, 10);

	newpos = new Image; 
	newpos.src='/navbarpos.jhtml?' + 'mi=' + i + '&smi=' + k + '&nh=' + nohints + "&foo=" + rand;

	i = setTimeout('gotolink("' + submenuitems[getSubMenuUrlIndex(k,j)] + '");', 50);
}

function gotolink(link) {
	if (newpos.complete || tries > 20) {
		l = "" + location.href.toLowerCase();
		if (l.lastIndexOf("/") > 8) {
			l = l.substr(0, l.indexOf("/",7));
		}
		link = link.replace('_ref_', l);
		
		submenuUrl = link;
		first_pos = submenuUrl.indexOf("|");
		if (first_pos >= 0) {
			real_url = submenuUrl.substr(0, first_pos);
			real_popup = submenuUrl.substr(first_pos + 1);
		}
		else {
			real_url = submenuUrl;
			real_popup = 'FALSE';
		}

		if (real_popup.toUpperCase() == "TRUE") {
			param = "toolbar=yes,location=yes,status=yes,scrollbars=yes,resizable=yes,left=0,top=0";
			window.open(real_url, "", param);
		}
		else {
			document.location.href = real_url;
		}
	}
	else {
		tries++;
		i = setTimeout('gotolink("' + link + '");', 50);
	}
}

function menuaction(n)
{
	if (menuopen==0) {
		// If no submenu items are found, then use this menu image as a button
		if (menuitems[getMenuNrOfSubItemsIndex(n-1)] == 0) {	
			menuopen=n;

			// Menu items used as a link button store the link in the description tag
			// This should actually be changed since the navbar XML now may be changed in order
			// to add such links in a more appropriate 'menulink' tag.
			
			G_day = new Date();
			G_seed = G_day.getTime();
			rand = parseInt(((G_seed - (parseInt(G_seed / 1000, 10) * 1000)) / 10) / 100 * 100000 + 1, 10);
			
			newpos = new Image;
			newpos.src='/navbarpos.jhtml?' + 'mi=' + n + '&smi=' + 0 + '&nh=' + nohints + "&foo=" + rand;
			
			// Use the following flag to stop recursion opening the same menu item again. After a gotoLink
			// action the menu is redrawn by the createLayers function, which calls this function again
			// in order to open the appropriate menu again. This should only be done once!
			// This mechanism should be revised!
			if (!menuActionAfterCreateLayers) {
				// The link to go to should be stored in a separate tag, and the place of that tag in the
				// menu array should be denoted by the 'Menu Description Index'
				if (menuitems[getMenuDescriptionIndex(n-1)] == '') {
					// No link was found
					//gotolink('http://' + location.host + '/index.jhtml');
				}
				else {
					gotolink(menuitems[getMenuLinkTextIndex(n-1)]);
				}
			}
			else {
				menuActionAfterCreateLayers = false;
			}				
		}
		else { // else use the menu image as a normal menu with submenus		
			x=document.layers["submenu"+n]
			myheight=x.clip.height;
			for (i=n+1;i<=(menuitems.length/nrOfMenuItemTags);i++) {
				//12*menuitems[getMenuNrOfSubItemsIndex(n-1)]
				movemenu(i,move_height+mytop+(mi_s+mi_h)*(i-1)+myheight)
			}
			moveobject("submenu"+n,mytop+(mi_s+mi_h)*(n)-mi_s);
			mylayer=document.layers["submenu"+n]
			mylayer.visibility = 'show';
			x=MM_findObj('menuimg'+n)
			if (x!=null) x.src='/images/nav-left/minus.gif';
			menuopen=n;	
			
			// This flag is set to true if clicking on a menu image should be treated as clicking a href link
			if (showingMenuLinks) {
				G_day = new Date();
				G_seed = G_day.getTime();
				rand = parseInt(((G_seed - (parseInt(G_seed / 1000, 10) * 1000)) / 10) / 100 * 100000 + 1, 10);
				newpos = new Image;
				newpos.src='/navbarpos.jhtml?' + 'mi=' + n + '&nh=' + nohints + "&foo=" + rand;

				// Use the following flag to stop recursion opening the same menu item again. After a gotoLink
				// action the menu is redrawn by the createLayers function, which calls this function again
				// in order to open the appropriate menu again. This should only be done once!
				// This mechanism should be revised!
				if (!menuActionAfterCreateLayers) {
					// The link to go to should be stored in a separate tag, and the place of that tag in the
					// menu array should be denoted by the 'Menu LinkText Index'
					if (menuitems[getMenuLinkTextIndex(n-1)] == '|FALSE') {
						// No link was found
						//gotolink('http://' + location.host + '/index.jhtml');
					}
					else {
						gotolink(menuitems[getMenuLinkTextIndex(n-1)]);
					}
				}
				else {
					menuActionAfterCreateLayers = false;
				}
			}
		}
	}
	else
	{
		// If no submenu items are found, then use this menu image as a button. Buttons do not have plus/minus signs
		if (menuitems[getMenuNrOfSubItemsIndex(n-1)] != 0) {
			x=MM_findObj('menuimg'+menuopen);
			if (x!=null) x.src='/images/nav-left/plus.gif';
		}
		
		for (i=menuopen;i<=(menuitems.length/nrOfMenuItemTags);i++) {
			movemenu(i,mytop+(mi_s+mi_h)*(i-1));
		}
		mylayer=document.layers["submenu"+menuopen]
		mylayer.visibility = 'hide';
		
		if (menuopen!=n) {
			menuopen=0;
			menuaction(n);
		}
		else menuopen=0; 
	}
	if (additionalLayer) {
		moveAdditionalLayer(additionalLayer,n);
	}
}

function menuaction2(n) {
	var totalOpen=mytop;
	for (i=1;i<=menuitems.length/nrOfMenuItemTags;i++) {
		thisMenuItemPosition[i-1]=totalOpen;
		if (n==i) menuItemOpen[i-1]=!menuItemOpen[i-1];
		if (menuItemOpen[i-1] == true && menuitems[getMenuNrOfSubItemsIndex(i-1)] > 0) {
			totalOpen+=document.layers["submenu"+i].clip.height;
		}
		thisMenuItemPosition[i-1]+= (i-1) * (mi_h + mi_s);
	}
	menuaction3(n);
}

function menuaction3(n) {
	var menuItemPosition=0;
	var amountOpenMenuItems=0;
	for (i=1;i<=menuitems.length/nrOfMenuItemTags;i++) {
		if (menuItemOpen[i-1]==true && menuitems[getMenuNrOfSubItemsIndex(i-1)] > 0) {
			for (j=i+1;j<=(menuitems.length/nrOfMenuItemTags);j++) {
				movemenu(j,thisMenuItemPosition[j-1]);
			}
			moveobject("submenu"+i,thisMenuItemPosition[i-1]+(mi_h + mi_s)-mi_s);
			if (n==i) {
				mylayer=document.layers["submenu"+i]
				mylayer.visibility = 'show';
				x=MM_findObj('menuimg'+i)
				if (x!=null) x.src='/images/nav-left/minus.gif';
			}
		}
		if (n==i && menuItemOpen[i-1]==false && menuitems[getMenuNrOfSubItemsIndex(i-1)] > 0) {
			for (j=i+1;j<=(menuitems.length/nrOfMenuItemTags);j++) {
				movemenu(j,thisMenuItemPosition[j-1]);
			}
			if (n==i) {
				mylayer=document.layers["submenu"+i]
				mylayer.visibility = 'hide';
				x=MM_findObj('menuimg'+i);
				if (x!=null) x.src='/images/nav-left/plus.gif';
			}
		}
		if (n==i && menuitems[getMenuNrOfSubItemsIndex(i-1)] == 0 && menuitems[getMenuDescriptionIndex(i-1)]!="") {
			location.href=menuitems[getMenuDescriptionIndex(i-1)];
		}
	}
}

function highlightmenu(n,n2)
{
	n=''+n;
	if (n2!=0) n=''+n+'-'+n2;
	if (n.indexOf('-')<0) {
		if (roll) MM_swapImage('menuitem'+n,'',navbarImagePath+menuitems[getMenuImageIndex(n-1)]+'_on.gif',1);
		pos=getpos('menu'+n);
	}
	else {
		pos=mouse_y-100;
	}
	moveobject("desc"+n,pos);
	if (nohints!=1) {
		mylayer=document.layers["desc"+n]
		mylayer.visibility = 'show';
	}
} 

function unhighlightmenu(n,n2)
{
	n=''+n;
	if (n2!=0) n=''+n+'-'+n2;
	if (roll) MM_swapImgRestore();
	mylayer=document.layers["desc"+n]
	mylayer.visibility = 'hide';
}

function createmenulayers()
{
	for (i=1;i<=menuitems.length/nrOfMenuItemTags;i++) {
		myDesc = menuitems[getMenuDescriptionIndex(i-1)].replace(/'/g,"&acute;");
		mylayer=document.layers["menu"+i]=new Layer(mi_w+c_w);
		mylayer.clip.width=(mi_w+c_w);
		mylayer.clip.height=mi_h+s_w;
		mylayer.zIndex=2;
		mylayer.top=(mytop+(i-1)*(mi_s+mi_h));
		mylayer.left=myleft;
		mylayer.visibility = 'show';
		mylayer.document.open();
		if (leaveMenuItemsOpen==true) {
			if (menuitems[getMenuNrOfSubItemsIndex(i-1)] == 0) { // Do not show plus image for buttons
				mylayer.document.write('<table border=0 cellspacing="0" cellpadding="0"><tr><td nowrap><a href="javascript:menuaction2('+i+');" onMouseOut="unhighlightmenu('+i+',0);window.status=\'\'; return true;" onMouseOver="highlightmenu('+i+',0);window.status=\''+myDesc+'\'; return true;"><img name="menuitem'+i+'" border="0" src="'+navbarImagePath+menuitems[getMenuImageIndex(i-1)]+'.gif" width="'+(mi_w+c_w)+'" height="'+mi_h+'" alt="'+menuitems[getMenuImageAltTextIndex(i-1)]+'"></a></td></tr>');
			}
			else {
				mylayer.document.write('<table border=0 cellspacing="0" cellpadding="0"><tr><td nowrap><a href="javascript:menuaction2('+i+');" onMouseOut="unhighlightmenu('+i+',0);window.status=\'\'; return true;" onMouseOver="highlightmenu('+i+',0);window.status=\''+myDesc+'\'; return true;"><img name="menuitem'+i+'" border="0" src="'+navbarImagePath+menuitems[getMenuImageIndex(i-1)]+'.gif" width="'+mi_w+'" height="'+mi_h+'" alt="'+menuitems[getMenuImageAltTextIndex(i-1)]+'"><img name="menuimg'+i+'" src="/images/nav-left/plus.gif" width="'+c_w+'" height="'+mi_h+'" border="0"></a></td></tr>');
			}
		} else {
			if (menuitems[getMenuNrOfSubItemsIndex(i-1)] == 0) { // Do not show plus image for buttons
				mylayer.document.write('<table border=0 cellspacing="0" cellpadding="0"><tr><td nowrap><a href="javascript:menuaction('+i+');" onMouseOut="unhighlightmenu('+i+',0);window.status=\'\'; return true;" onMouseOver="highlightmenu('+i+',0);window.status=\''+myDesc+'\'; return true;"><img name="menuitem'+i+'" border="0" src="'+navbarImagePath+menuitems[getMenuImageIndex(i-1)]+'.gif" width="'+(mi_w+c_w)+'" height="'+mi_h+'" alt="'+menuitems[getMenuImageAltTextIndex(i-1)]+'"></a></td></tr>');
			}
			else {
				mylayer.document.write('<table border=0 cellspacing="0" cellpadding="0"><tr><td nowrap><a href="javascript:menuaction('+i+');" onMouseOut="unhighlightmenu('+i+',0);window.status=\'\'; return true;" onMouseOver="highlightmenu('+i+',0);window.status=\''+myDesc+'\'; return true;"><img name="menuitem'+i+'" border="0" src="'+navbarImagePath+menuitems[getMenuImageIndex(i-1)]+'.gif" width="'+mi_w+'" height="'+mi_h+'" alt="'+menuitems[getMenuImageAltTextIndex(i-1)]+'"><img name="menuimg'+i+'" src="/images/nav-left/plus.gif" width="'+c_w+'" height="'+mi_h+'" border="0"></a></td></tr>');
			}
		}
		if (i==(menuitems.length/nrOfMenuItemTags) && shad) mylayer.document.write('<tr><td><img src="/images/nav-left/light-shadow.gif" width="'+(mi_w+c_w)+'" height="'+s_w+'"></td></tr>');
		mylayer.document.write('</table>');
		mylayer.document.close();
		mylayer=document.layers["desc"+i]=new Layer(d_w);
		mylayer.clip.width=d_w;
		mylayer.zIndex=4;
		mylayer.left=(d_l+mi_w+myleft);
		mylayer.visibility = 'hide';
		mylayer.document.open();
		mylayer.document.write('<table width="'+d_w+'" border="0" cellspacing="0" cellpadding="0"><tr><td colspan="3"><img src="/images/nav-left/description-top.gif" width="'+d_w+'" height="7"></td></tr><tr><td bgcolor="#000000"><img src="/images/spacer.gif" width="1" height="1"></td><td bgcolor="'+d_bg+'" width="'+(d_w-2)+'"><img src="/images/spacer.gif" width="'+(d_w-2)+'" height="1"><br><table border=0 width=100% cellpadding=3><tr><td><span class="heading4">'+menuitems[getMenuDescriptionIndex(i-1)]+'</span></td></tr></table></td><td bgcolor="#000000"><img src="/images/spacer.gif" width="1" height="1"></td></tr><tr bgcolor="#000000"><td colspan="3"><img src="/images/spacer.gif" width="1" height="1"></td></tr>');
		mylayer.document.write('</table>');
		mylayer.document.close();
	} 
}

function createsubmenulayers()
{
	for (i=1;i<=menuitems.length/nrOfMenuItemTags;i++) 
	{
		k=0;
		for (ii=0;ii<i-1;ii++) k+=menuitems[getMenuNrOfSubItemsIndex(ii)];
		zi=1;
		if (i==menuitems.length/nrOfMenuItemTags) zi=2;
		mylayer=document.layers["submenu"+i]=new Layer(mi_w+c_w);
		mylayer.clip.width=(mi_w+c_w);
		mylayer.zIndex=5;
		mylayer.left=myleft;
		mylayer.visibility = 'hide';
		mylayer.document.open();
		mylayer.document.write('<table width="'+(mi_w+c_w)+'" border="0" cellspacing="0" cellpadding="0">');
		if (shad) mylayer.document.write('<tr><td><img src="/images/nav-left/dark-shadow.gif" width="'+(mi_w+c_w)+'" height="'+s_w+'"></td></tr>');
		for (j=1;j<=menuitems[i*nrOfMenuItemTags-1];j++) {
			css="navoff";
			if (i==currentmenuitem && j==currentsubmenuitem) css="navon";
			txt=submenuitems[getSubMenuLinkTextIndex(k,j)]; 
			if (txt.charAt(0)=='_') {
				txt=txt.replace('_','');
				mylayer.document.write('<tr><td '+smi_bg+' '+smi_bk+'><img src="/images/nav-left/separator.gif" width="'+(mi_w+c_w)+'" height="2"></td></tr>');
			}
			tmp_url = submenuitems[getSubMenuUrlIndex(k,j)];
			first_pos = tmp_url.indexOf("|");
			if (first_pos >= 0) {
				tmp_url = tmp_url.substr(0, tmp_url.indexOf("|"));
			}	
			if (tmp_url.lastIndexOf("'")>0)
				mylayer.document.write('<tr><td '+smi_bg+' '+smi_bk+'><table border="0" cellpadding="0" cellspacing="0" background=""><tr><td valign="top"><img src="/images/spacer.gif" width="'+b_l+'" height="8"><img src="'+bulletImageLocation+'" width="7" height="7"></td><td> <a href="javascript:submenuaction('+i+','+k+','+j+');" class="'+css+'" onMouseOut="unhighlightmenu('+i+','+j+');window.status=\'\'; return true;" onMouseOver="highlightmenu('+i+','+j+');window.status=\'\'; return true;">'+ txt +'</a></td><td><img src="/images/spacer.gif" width="3" height="3" border="0"></td></tr></table></td></tr>');
			else
				mylayer.document.write('<tr><td '+smi_bg+' '+smi_bk+'><table border="0" cellpadding="0" cellspacing="0" background=""><tr><td valign="top"><img src="/images/spacer.gif" width="'+b_l+'" height="8"><img src="'+bulletImageLocation+'" width="7" height="7"></td><td> <a href="javascript:submenuaction('+i+','+k+','+j+');" class="'+css+'" onMouseOut="unhighlightmenu('+i+','+j+');window.status=\'\'; return true;" onMouseOver="highlightmenu('+i+','+j+');window.status=\''+ tmp_url +'\'; return true;">'+ txt +'</a></td><td><img src="/images/spacer.gif" width="3" height="3" border="0"></td></tr></table></td></tr>');
		}
		if (smi_cl) {
			mylayer.document.write('<tr><td '+smi_bg+' '+smi_bk+'><img src="/images/nav-left/bottom.gif" width="'+(mi_w+c_w)+'" height="'+b_h+'"></td></tr>');
		}
		else {
			mylayer.document.write('<tr><td '+smi_bg+' '+smi_bk+'><img src="/images/spacer.gif" width="20" height="5"></td></tr>');
		}
		//if (shad) mylayer.document.write('<tr><td><img src="/images/nav-left/light-shadow.gif" width="'+(mi_w+c_w)+'" height="'+s_w+'"></td></tr>');
		mylayer.document.write('</table>');  
		mylayer.document.close();
	} 
}

function createdesclayers()
{
	for (i=1;i<=menuitems.length/nrOfMenuItemTags;i++) {
		k=0;
		for (ii=0;ii<i-1;ii++) k+=menuitems[getMenuNrOfSubItemsIndex(ii)];
		for (j=1;j<=menuitems[getMenuNrOfSubItemsIndex(i-1)];j++) {
			mylayer=document.layers["desc"+i+"-"+j]=new Layer(d_w);
			mylayer.clip.width=d_w;
			mylayer.zIndex=4;
			mylayer.left=(d_l+mi_w+myleft);
			mylayer.visibility = 'hide';
			mylayer.document.open();
			mylayer.document.write('<table width="'+d_w+'" border="0" cellspacing="0" cellpadding="0"><tr><td colspan="3"><img src="/images/nav-left/description-top.gif" width="'+d_w+'" height="7"></td></tr><tr><td bgcolor="#000000"><img src="/images/spacer.gif" width="1" height="1"></td><td bgcolor="'+d_bg+'" width="'+(d_w-2)+'"><img src="/images/spacer.gif" width="'+(d_w-2)+'" height="1"><br><table border=0 width=100% cellpadding=3><tr><td><span class="heading4">'+submenuitems[getSubMenuDescriptionIndex(k,j)]+'</span><br><img src="/images/spacer.gif" width="1" height="8"></td></tr></table></td><td bgcolor="#000000"><img src="/images/spacer.gif" width="1" height="1"></td></tr><tr bgcolor="#000000"><td colspan="3"><img src="/images/spacer.gif" width="1" height="1"></td></tr></table>');
			mylayer.document.close();
		}
	}
}

function change_hints()
{
	i=document.formhints.hints.checked;
	if (i==false) { 
		nohints=0;
	}
	else {
	nohints=1;
	}
	newpos=new Image; newpos.src='/navbarpos.jhtml?'+'mi=0&smi=0&nh='+nohints;
}

function preload()
{
        var d=document;
        if(d.images){
          if(!d.MM_p) d.MM_p=new Array();
          var i,j=d.MM_p.length;
          for (i=0;i<=menuitems.length-1;i=i+nrOfMenuItemTags) {
           img=navbarImagePath+menuitems[i]+'_on.gif';
           if (img.indexOf("#")!=0){
             d.MM_p[j]=new Image;
             d.MM_p[j++].src=img;
           }
          }
        }
}

function createlayers()
{
	createmenulayers();
	createsubmenulayers();
	createdesclayers();
	if (currentmenuitem!=0) {
		// Use the following flag to stop recursion opening the same menu item again. After a gotoLink
		// action - called in the menuaction function - the menu is redrawn by this function, which calls
		// the menuaction function again in order to open the appropriate menu again.
		// This should only be done once! This mechanism should be revised!
		menuActionAfterCreateLayers = true;
		if (leaveMenuItemsOpen==true) {
			menuaction2(currentmenuitem);
		} else {
			menuaction(currentmenuitem);
		}
	}
	MM_reloadPage(true);
}

function init_navbar(top,left,menuitem_height,menuitem_width,collapse_width,menuitem_spacer,desc_left,desc_width,desc_bgcolor,submenuitem_bgcolor,submenuitem_background,submenuitem_closing,display_shadows,display_rollovers,shadow_width,bullet_left,bottom_height,showMLink,nrOfMItems,indexOfMDescrTag,indexOfMLinkTag,indexOfMNrOfSubItems,nrOfSMItems,indexOfSMDescrTag,indexOfSMLinkTag)
{
	init_navbar(top,left,menuitem_height,menuitem_width,collapse_width,menuitem_spacer,desc_left,desc_width,desc_bgcolor,submenuitem_bgcolor,submenuitem_background,submenuitem_closing,display_shadows,display_rollovers,shadow_width,bullet_left,bottom_height,showMLink,nrOfMItems,indexOfMDescrTag,indexOfMLinkTag,indexOfMNrOfSubItems,nrOfSMItems,indexOfSMDescrTag,indexOfSMLinkTag,false)
}

function init_navbar(top,left,menuitem_height,menuitem_width,collapse_width,menuitem_spacer,desc_left,desc_width,desc_bgcolor,submenuitem_bgcolor,submenuitem_background,submenuitem_closing,display_shadows,display_rollovers,shadow_width,bullet_left,bottom_height,showMLink,nrOfMItems,indexOfMDescrTag,indexOfMLinkTag,indexOfMNrOfSubItems,nrOfSMItems,indexOfSMDescrTag,indexOfSMLinkTag,leaveMenuOpen)
{
	mytop=top;
	if (prodNav == true) mytop = mytop + navbarImageHeight;
	if (left<0) {
		left=Math.abs(left);
		left=((window.innerWidth-676)/2)+left;
	}
	myleft=left;
	mi_h=menuitem_height;
	mi_w=menuitem_width;
	c_w=collapse_width;
	mi_s=menuitem_spacer;
	d_l=desc_left;
	d_w=desc_width;
	d_bg=desc_bgcolor;
	smi_bg=submenuitem_bgcolor;
	if (smi_bg!='') smi_bg='bgcolor="'+smi_bg+'"';
	smi_bk=submenuitem_background;
	smi_cl=submenuitem_closing;
	shad=display_shadows;
	roll=display_rollovers;
	s_w=shadow_width;
	b_l=bullet_left;
	b_h=bottom_height;
	if (s_w=='') s_w=6;
	if (b_l=='') b_l=5;
	if (b_h=='') b_h=4;
	if (shad) {move_height=0;} else {move_height=4;}
	if (smi_bk!='') smi_bk='background="/images/nav-left/'+smi_bk+'"';
	leaveMenuItemsOpen=leaveMenuOpen;

	showMLink = "";
	if ((showMLink == null) || (showMLink == "") || (showMLink == "false")) {
		showingMenuLinks = false;
		nrOfMenuItemTags = 5;
		indexOfMenuDescriptionTag = 2;
		indexOfMenuNrOfSubItems = 4;
		indexOfMenuAltTextTag = 1;
		indexOfMenuLinkTag = 3;
		nrOfSubMenuItemTags = 3;
		indexOfSubMenuDescriptionTag = 1;
		indexOfSubMenuLinkTag = 2;		
	}
	else {
		showingMenuLinks = showMLink;
		nrOfMenuItemTags = parseInt(nrOfMItems);
		indexOfMenuDescriptionTag = parseInt(indexOfMDescrTag);
		indexOfMenuNrOfSubItems = parseInt(indexOfMNrOfSubItems);
		indexOfMenuLinkTag = parseInt(indexOfMLinkTag);
		nrOfSubMenuItemTags = parseInt(nrOfSMItems);
		indexOfSubMenuDescriptionTag = parseInt(indexOfSMDescrTag);
		indexOfSubMenuLinkTag = parseInt(indexOfSMLinkTag);
	}
	
	if (!ns) createlayers();
}

function bgprint(doctype)
{
	printfrom=window.location.href.replace('bgdisplay','bgprint');
	printfrom=printfrom.replace('education/detail','bgprint');
	printfrom=printfrom.replace('clinical_info/detail_trial','bgprint');
	printfrom=printfrom.replace('congresses/detail','bgprint');
	printfrom=printfrom.replace('events/detail','bgprint');
	printfrom=printfrom.replace('news/detail','bgprint');
	printfrom=printfrom.replace('disease/item_detail','bgprint');
	printfrom=printfrom.replace('disease/detail','bgprint');
	printfrom=printfrom.replace('product/detail','bgprint');
	printfrom=printfrom.replace('medline/details','bgprint');
	printfrom=printfrom.replace('faqdisplay','bgprint');
	if (doctype == "disease" || doctype == "product" || doctype == "clinicaltrail" || doctype == "congresses" || doctype == "events" || doctype == "news" || doctype == "medline" || doctype == "faq") {
		printfrom=printfrom+"&doctype="+doctype;
	}
	window.open(printfrom,'popup','scrollbars=no,resizable=no,width=200,height=100,menubar=no,toolbar=no,status=no,location=no');
}

function printMasterContent(url) {
	windowUrl = "/printMasterContent.jhtml?url="+url;
	window.open(windowUrl,'popup','scrollbars=no,resizable=no,width=200,height=100,menubar=no,toolbar=no,status=no,location=no');
}

function changelang(url,from,to,txt,full)
{
	l=""+location.href.toLowerCase();
	if (l.lastIndexOf("/")<10) l=l+"/";
	l=l.substr(0,l.indexOf("/",7)+1);
	l=l.replace(from,to);
	from=from.replace(".","-");
	to=to.replace(".","-");
	l=l.replace(from,to);
	if (full!=1) {
		return "<a href="+l+url+">"+txt+"</a>";
	}
	else {
		G_day = new Date();
		G_seed = G_day.getTime();
		rand = parseInt(((G_seed - (parseInt(G_seed/1000,10) * 1000))/10)/100*100000 + 1,10);

		return "<a href=javascript:void(window.open('"+l+url+"','newwindow"+rand+"','scrollbars=yes,resizable=yes,width="+(screen.width-10)+",height="+(screen.height-200)+",menubar=yes,toolbar=yes,status=yes,location=yes,left=0,top=0'));>"+txt+"</a>";
	}
}
