function MM_findObj(n, d) { //v4.0
  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 && document.getElementById) x=document.getElementById(n); return x;
}

function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-1); i+=2) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+1];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
    
}

function condHideMenu2() {
	var l='';
	var u=window.location.pathname.substr(0,3);
	var p=window.location.pathname.substr(2,4);

	MM_showHideLayers('layMenu01','hide','layMenu02','hide','layMenu03','hide','layMenu04','hide','layMenu05','hide','layMenu06','hide','layMenu07','hide');

	switch(u) {
	case "/":
		l=""; break;
	case "/in":
		l=""; break;
	case "/02":
		l=""; break;
	case "/03":
		l=""; break;
	case "/04":
		l=""; break;
	case "/05":
		l="layMenu05"; break;
	case "/06":
		l=""; break;
	case "/07":
		l=""; break;
	}
	// Ausnahmen
	if('1030' == p) {
		l="";
	}
	if(('2005' == p) || ('2040' == p) || ('2050' == p)) {
		l="layMenu01";
	}
	if(('4010' == p) || ('4020' == p) || ('4030' == p)) {
		m="m6"; l="";
	}

	if('' != l) {
		document.getElementById(l).style.visibility = 'visible';
	}
}

// global
var sponsor = 1;
var popUpWin = 0;
var popUpAd = 0;

// function to link to sponsor
function GoSponsor() {
	switch(sponsor) {
		case 1: URLStr="http://www.mckinsey.de"; break;
		case 2: URLStr="http://www.stern.de"; break;
		case 3: URLStr="http://www.zdf.de"; break;
		case 4: URLStr="http://www.web.de"; break;
	}
	popUpWindow(URLStr, 0, 0, 800, 600);
}

function popUpWindow(URLStr, left, top, width, height)
{
	if(popUpWin)
	{
		if(!popUpWin.closed) popUpWin.close();
	}
	popUpWin = open(URLStr, 'popUpWin', 'toolbar=yes,location=yes,directories=yes,status=yes,menubar=yes,scrollbars=yes,resizable=yes,copyhistory=yes,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
}

function popUpAdvert(URLStr, left, top, width, height)
{
	if(popUpAd)
	{
		if(!popUpAd.closed) popUpAd.focus();
	} else {
		popUpAd = open(URLStr, 'popUpAd', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no,copyhistory=no,width='+width+',height='+height+',left='+left+', top='+top+',screenX='+left+',screenY='+top+'');
	}
}

// function to rotate image (currently uses 2 images)
function rotate() {
	if (++sponsor > 4) sponsor = 1;
	document.images['initiatoren'].src = "koop/koop" + sponsor+ ".gif";
	window.setTimeout('rotate();',3000);
}

function selMenu() {
	var m='';
	var l='';
	var u=window.location.pathname.substr(0,3);
	var p=window.location.pathname.substr(2,4);

	switch(u) {
	case "/":
		m="";	l=""; break;
	case "/02":
		m="m2"; l=""; break;
	case "/03":
		m="m3"; l=""; break;
	case "/04":
		m="m4"; l=""; break;
	case "/05":
		m="m5"; l="layMenu05"; break;
	case "/06":
		m="m6"; l=""; break;
	}

	// Ausnahmen
	if('1030' == p) {
		m="m7"; l="";
	}
	if(('2005' == p) || ('2040' == p) || ('2050' == p)) {
		m="m1";	l="layMenu01";
	}
	if(('3065' == p) || ('3066' == p) || ('3100' == p) || ('3101' == p) || ('3200' == p) || ('3201' == p)) {
		m="m4"; l="";
	}
	if(('4010' == p) || ('4020' == p) || ('4030' == p)) {
		m="m6"; l="";
	}

	if('' != m) {
		document.getElementById(m).style.color = "#FD8E0B";
	}
	if('' != l) {
		document.getElementById(l).style.visibility = 'visible';
	}

	if('/' != u) {
		if(document.getElementById('m'+p)) {
			document.getElementById('m'+p).style.color = "#FD8E0B";
		}
	}
}

function goUmfrageBanner() {
	mynum=611401;
	muster=/(^[0-9]{6}$)/g;

        if(muster.test(mynum)) {
                newurl="http://perspektive.tns-global.com/wix/p0013748.aspx?ccd=" + mynum;
        } else {
                newurl="http://perspektive.tns-global.com/wix/p0013748.aspx";
        }

	survey = window.open(newurl,'pnwC','width=800,height=600,resizable,scrollbars=yes');
}

function goUmfrage() {
	mynum=612001;
	muster=/(^[0-9]{6}$)/g;

        if(muster.test(mynum)) {
                newurl="http://perspektive.tns-global.com/wix/p0013748.aspx?ccd=" + mynum;
        } else {
                newurl="http://perspektive.tns-global.com/wix/p0013748.aspx";
        }

	survey = window.open(newurl,'pnwC','width=800,height=600,resizable,scrollbars=yes');
}
