// workaround for the infamous Netscape CSS- and Layer-bug:

// reloads the window on resize
function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  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();
}
MM_reloadPage(true);


function MM_findObj(n, d) { //v4.01
  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);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  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; }
}


// ----------------------------------------------------------------------------------------
// scripts for the rollover-effect in the  navigation bar
// ----------------------------------------------------------------------------------------

var selectedtopic = 0;
var selectedSubtopic = 0;
var topicsPresent = 6;
var subTopicsPresent = 0;
var selectedlanguage = ""; 

var path = "/en/";

URL = location.href

if (URL.indexOf("/en/") != -1) path = "../";
if (URL.indexOf("/de/") != -1) path = "../";
if (URL.indexOf("/fr/") != -1) path = "../";

if (document.images)  {
	picturesDef = new Array();
		for (i = 1; i <= topicsPresent ; i++)   {
			picturesDef[i] = new Image();
			picturesDef[i].src = path + "nav_images/nav_"  + i + "d.gif";}
	picturesHi = new Array();
		for (i = 1; i <= topicsPresent; i++)   {
			picturesHi[i] = new Image();
		    picturesHi[i].src = path + "nav_images/nav_"  + i + "h.gif";}

	picturesOver = new Array();
		for (i = 1; i <= topicsPresent; i++)   {
			picturesOver[i] = new Image();
			picturesOver[i].src = path + "nav_images/nav_"  + i + "s.gif";}
}

function loadSubTopics(picCount) {
	subDef = new Array();
		for (i = 1; i <= topicsPresent ; i++)   {
			subDef[i] = new Image();
			subDef[i].src = path + "nav_images/subnav_"  + i + "d.gif";}

	subHi = new Array();
		for (i = 1; i <= topicsPresent; i++)   {
			subHi[i] = new Image();
			subHi[i].src = path + "nav_images/subnav_"  + i + "h.gif";}
	subTopicsPresent = picCount;
}

function overPic(picNum)	 {
	if (document.images)  {
	eval("document.topic" + picNum + ".src = picturesOver[picNum].src;");
	}
}

function changePic(picNum)   {
	if (document.images)  
	{
		if (URL.indexOf("/partners/") != -1)
		{
			if (picNum == 3)
			{
				eval("document.topic" + picNum + ".src = picturesOver[picNum].src;");}
			else
			{
				eval("document.topic" + picNum + ".src = picturesHi[picNum].src;");}
		}
	else
		{		
		eval("document.topic" + picNum + ".src = picturesHi[picNum].src;");}
    }        
}

function changeSubPic(picNum)   {
	if (document.images)  {
	eval("document.sub" + picNum + ".src = subHi[picNum].src;");
    }        
}

function resetPic()   {
	if (document.images)  {
		for (i = 1; i <= topicsPresent; i++)   {
		if (selectedtopic == 3)  {
		eval("document.topic" + selectedtopic + ".src = picturesOver[selectedtopic].src;");
		}
		if ( i != selectedtopic) {
		eval("document.topic" + i + ".src = picturesDef[i].src;");
       }

        }
	}
}

function resetSubPic()  {
	if (document.images)  {
		for (i = 1; i <= subTopicsPresent; i++)   {
		eval("document.sub" + i + ".src = subDef[i].src;");
        }
		if (selectedSubtopic != 0)  {
		eval("document.sub" + selectedSubtopic + ".src = subHi[selectedSubtopic].src;");
		}
	}
}

function checkTopic() {
	URL=location.href
	if (document.images) { 
	resetPic(); 
	
	if (URL.indexOf("/de/") != -1) selectedlanguage = "d";
	if (URL.indexOf("/fr/") != -1) selectedlanguage = "f";
	if (URL.indexOf("/en/") != -1) selectedlanguage = "e";
	
   	if (URL.indexOf("/firm/") != -1) selectedtopic = 1;
	if (URL.indexOf("/principles/") != -1) selectedtopic = 2;	
    if (URL.indexOf("/services/") != -1) selectedtopic = 6;
	if (URL.indexOf("/partners/") != -1) selectedtopic = 3;
	if (URL.indexOf("/joining/") != -1) selectedtopic = 4;
	if (URL.indexOf("/contact/") != -1) selectedtopic = 5;	
	//if (URL.indexOf("/partners/roost.htm") != -1) selectedSubtopic = 1;
//	if (URL.indexOf("/partners/altherr.htm") != -1) selectedSubtopic = 2;
	//if (URL.indexOf("/partners/hellweg.htm") != -1) selectedSubtopic = 2;	

	if (selectedtopic != 0) { eval("document.topic" + selectedtopic + ".src = picturesHi[selectedtopic].src;");}
	if (selectedtopic ==3)  { eval("document.topic" + selectedtopic + ".src = picturesOver[selectedtopic].src;");}
	if (selectedSubtopic !=0) { eval("document.sub" + selectedSubtopic + ".src = subHi[selectedSubtopic].src;");}
	
	eval("document." + selectedlanguage + ".src = '/images/" + selectedlanguage + "_h.gif'");
	
	
	}  
}

function changeImage(row,s,image) { 
	if (!document.images) return ;
	if (s==1) {
		eval("document." + row + ".src = image");
	} else {
		if (selectedlanguage != row) {
			eval("document." + row + ".src = image");
        }
	}
}