/*****************************************
Scripte
angepasst und ergänzt von
(c) 2005 Mario Bretscher
www.letsbuild.ch
*****************************************/

/**********************************************************************************   
FoldoutMenu2 
*   Copyright (C) 2001 <a href="/dhtmlcentral/thomas_brattli.asp">Thomas Brattli</a>
*   This script was released at DHTMLCentral.com
*   Visit for more great scripts!
*   This may be used and changed freely as long as this msg is intact!
*   We will also appreciate any links you could give us.
*
*   Made by <a href="/dhtmlcentral/thomas_brattli.asp">Thomas Brattli</a> 
*********************************************************************************/
var laststate='/fold/circle_empty.gif';

function newWindow(url,w,h,bar) {
		if(bar='yes') {
				win=open('http://www.arbatherm.ch'+url,'window','status=no,resizable=yes,width='+w+',height='+h+',menubar=yes,titlebar=yes');
		}else{
				win=open('http://www.arbatherm.ch'+url,'window','status=no,resizable=yes,width='+w+',height='+h+',menubar=no,titlebar=no');
		}
		if(win) win.resizeTo(w,h);
		if(win) win.print();
}

function ref_over(obj,index)
{
with(document)
{
var ima_1 = getElementById('i'+index);
switch(obj)
{
case "1": 
ima_1.src = "ref_index/listener_full.gif"; 
if(getElementById('r'+index)){
	var legend = getElementById('r'+index);
	var leg = getElementById('legend');
	var ins = "000000" + index.toString();
	var t = '<img src="/fold/circle_full.gif" alt="" width="18" height="18" border="0">&nbsp;&nbsp;<span class="title">Objekt_' + ins.substr(ins.length-3,3) + '</span>';
	    t += '<p class="text" >' + legend.alt + '</p>';
	leg.innerHTML = t;
	}
break
case "2": 
	ima_1.src = "ref_index/listener_empty.gif"; 
	var leg = getElementById('legend');
	var t = '<img src="/fold/circle_empty.gif" alt="" width="18" height="18" border="0">&nbsp;&nbsp;<span class="title">W&auml;hlen Sie ein Objekt aus ...</span>';
	leg.innerHTML = t;	
break
}
}
}

function port_over(obj,index)
{
with(document)
{
var ima_1 = getElementById('i'+index);
switch(obj)
{
case "1": 
ima_1.src = "team_index/listener_full.gif"; 
if(getElementById('r'+index)){
	var legend = getElementById('r'+index);
	var leg = getElementById('legend');
	var ins = legend.alt;
	var bez = ins.split('-');
	var t = '<img src="../fold/circle_full.gif" alt="" width="18" height="18" border="0">&nbsp;&nbsp;<span class="title">' + bez[0] + '</span>';
	    t += '<span class="text" >' + bez[1] + '</span>';
	leg.innerHTML = t;
	}
break
case "2": 
	ima_1.src = "team_index/listener_empty.gif"; 
	var leg = getElementById('legend');
	var t = '<img src="../fold/circle_empty.gif" alt="" width="18" height="18" border="0">&nbsp;&nbsp;<span class="title">unser team ...</span>';
	leg.innerHTML = t;	
break
}
}
}


function lib_bwcheck(){ //Browsercheck (needed)
	this.ver=navigator.appVersion
	this.agent=navigator.userAgent
	this.dom=document.getElementById?1:0
	this.opera5=this.agent.indexOf("Opera 5")>-1
	this.ie5=(this.ver.indexOf("MSIE 5")>-1 && this.dom && !this.opera5)?1:0; 
	this.ie6=(this.ver.indexOf("MSIE 6")>-1 && this.dom && !this.opera5)?1:0;
	this.ie4=(document.all && !this.dom && !this.opera5)?1:0;
	this.ie=this.ie4||this.ie5||this.ie6
	this.mac=this.agent.indexOf("Mac")>-1
	this.ns6=(this.dom && parseInt(this.ver) >= 5) ?1:0; 
	this.ns4=(document.layers && !this.dom)?1:0;
	this.bw=(this.ie6 || this.ie5 || this.ie4 || this.ns4 || this.ns6 || this.opera5)
	return this
}
var bw=new lib_bwcheck()




if(document.layers){ //NS4 resize fix...
	scrX= innerWidth; scrY= innerHeight;
	onresize= function(){if(scrX!= innerWidth || scrY!= innerHeight){history.go(0)} }
}

if(navigator.userAgent.indexOf('Opera')>-1 && document.getElementById){ //Opera 5 resize fix.
	scrX= innerWidth; scrY= innerHeight;
	document.onmousemove= function(){
		if(scrX<innerWidth-10 || scrY<innerHeight-10 || scrX>innerWidth+10 || scrY>innerHeight+10){
			scrX = innerWidth;
			scrY = innerHeight;
			foldInit();
		}
	};
}
/************************************************************************************
This is the new foldoutmenu, with more levels!
This is in some ways a rather advanced menu so please read every
note in this script and in the comments in the page to understand how
it works.

NOTE: if you change the position of divFoldCont from absolute to relative, 
you can put the menu in a table. HOWEVER it will no longer work in netscape 4.
If you wish to support netscape 4, you have to use absolute positioning.
************************************************************************************/

//Do you want images (if not set to 0 and remove the images from the body)?
foldImg=1

//Here are the images for the top links.
foldinImg=new Image(); foldinImg.src="/fold/circle_empty.gif"		//The image for the closed state.
foldoutImg=new Image(); foldoutImg.src="/fold/circle_full.gif"	//The image for the open state.
foldoverImg=new Image(); foldoverImg.src="/fold/circle_over.gif"
//Here are the images for the sub links.
foldsubinImg=new Image(); foldsubinImg.src="/fold/circle_empty.gif"		//The image for the "in" state.
foldsuboutImg=new Image(); foldsuboutImg.src="/fold/circle_full.gif"	//The image for the "out" state.
foldsuboverImg=new Image(); foldsuboverImg.src="/fold/circle_over.gif"
//If you change the images above please remember to change the images in the actual page as well.

mainmenus=6 //How many main menus do you have?

//How many submenus do you have beneath each main level.
submenus=new Array(2,3,2,2,2,1) 
//In this example I have 3 submenus in the first top menu,
//3, in the second, 2 submenus in the third top menu and 3 in the forth.
//It's really important that these numbers are correct.

pxbetweenmain = 10 //How much space should there be between the main menus
pxbetweensub = 5 //How much space should there be between the sub menus

mainstayfolded = false //Should the main menus stay folded?
substayfolded = false  //Should the sub menus stay folded?  Play with these 2 variables.

showCurrentOnLoad = true // Should the menu expand to the level pertaining to the page it is on? (Added by D. Schontzler)
useTopLevel = true // Should the menu look at top.location? (Added by D. Schontzler)

/************************************************************************************
Making cross-browser objects
************************************************************************************/
function makeMenu(obj,nest){
	nest=(!nest) ? "":'document.'+nest+'.';
   	this.css= bw.dom? document.getElementById(obj).style:bw.ie4?document.all[obj].style:bw.ns4?eval(nest+"document.layers." +obj):0;
	this.elm= bw.dom?document.getElementById(obj):bw.ie4?document.all[obj]:bw.ns4?eval(nest+'document.'+obj):0;
	this.ref= bw.dom || bw.ie4? document:bw.ns4?eval(nest+"document.layers." +obj+".document"):0;
	this.x= bw.ns4?this.css.left:bw.opera5?this.css.pixelLeft:this.elm.offsetLeft;
	this.y= bw.ns4?this.css.top:bw.opera5?this.css.pixelTop:this.elm.offsetTop;
	this.height= bw.ns4?this.ref.height:bw.opera5?this.css.pixelHeight:this.elm.offsetHeight;
	this.hideIt= b_hideIt;
	this.showIt= b_showIt;
	this.moveIt= b_moveIt;
	this.status= 0;
	return this;
}

// A unit of measure that will be added when setting the position of a layer.
var px = bw.ns4||window.opera?"":"px";

function b_showIt(){this.css.visibility="visible"; this.status=1}
function b_hideIt(){this.css.visibility="hidden"; this.status=0}
function b_moveIt(x,y){this.x=x; this.y=y; /*this.css.left=this.x+px;*/ this.css.top=this.y+px;}
/************************************************************************************
Initiating the page and making the menu
************************************************************************************/
function foldInit(){
	//Fixing the browsercheck for opera... this can be removed if the browsercheck has been updated!!
	bw.opera5 = (navigator.userAgent.indexOf("Opera")>-1 && document.getElementById)?true:false
	if (bw.opera5) bw.ns6 = 0
	
	//Creating the foldoutmenu
	oFold = new Array();
	y = 0;
	for (var i=0; i<mainmenus; i++){
		oFold[i] = new makeMenu('divFold'+i,'divFoldCont');
		oFold[i].moveIt(0,y);
		oFold[i].size = oFold[i].height;
		y += oFold[i].height+pxbetweenmain;
		if (bw.ns4) oFold[i].css.clip.bottom = 500;
		oFold[i].sub = new Array();
		oFold[i].subs = top_subs;
		suby = oFold[i].height+pxbetweensub;
		for (var j=0; j<submenus[i]; j++){
			oFold[i].sub[j] = new makeMenu('divFoldSub'+i+'_'+j,'divFoldCont.document.divFold'+i);
			oFold[i].sub[j].sub = new makeMenu('divFoldSub'+i+'_'+j+'_0','divFoldCont.document.divFold'+i+'.document.divFoldSub'+i+'_'+j);
			oFold[i].sub[j].hideIt();
			oFold[i].sub[j].sub.hideIt();
			oFold[i].sub[j].moveIt(10,suby);
			suby += oFold[i].sub[j].height+pxbetweensub;
		}
	}
  	oFoldCont = new makeMenu('divFoldCont');
	if (bw.ns4) oFoldCont.css.clip.bottom = 800;
  	oFoldCont.showIt(); //Showing the menu when the menu have been "created"
  	if(showCurrentOnLoad) expandOnLoad() // Added by D. Schontzler
}
/************************************************************************************
Object function to the top of the menus.
************************************************************************************/
function top_subs(show, num){
	for (var j=0; j<this.sub.length; j++){
		if (show){
			this.sub[j].showIt()
			if (foldImg) this.ref["imgFold"+num].src = foldoutImg.src
			if (substayfolded){if(this.sub[j].sub.status) this.sub[j].sub.showIt()
			}else{
				if (foldImg) this.sub[j].ref["imgFold"+num+"Sub"+j].src = foldsubinImg.src
				this.sub[j].sub.hideIt()
			}
		}else{
			this.sub[j].hideIt()
			if (foldImg) this.ref["imgFold"+num].src = foldinImg.src
			if (!substayfolded) this.sub[j].sub.hideIt()
			else if (substayfolded) this.sub[j].sub.css.visibility="hidden"
		}
	}
}
/************************************************************************************
Checking height of the menus, and moves them to the correct position.
************************************************************************************/
function checkheight(org){
	if(mainstayfolded) istart=org; else istart=0
	for(i=istart;i<oFold.length;i++){
		oFold[i].size=oFold[i].height
		for(j=0;j<oFold[i].sub.length;j++){
			oFold[i].sub[j].size=oFold[i].sub[j].height+pxbetweensub
			if(oFold[i].sub[j].status){
				oFold[i].size+=oFold[i].sub[j].size
				if(oFold[i].sub[j].sub.status){
					oFold[i].size+=oFold[i].sub[j].sub.height+pxbetweensub
					oFold[i].sub[j].size+=oFold[i].sub[j].sub.height+pxbetweensub
				}
			}
			if(j!=0) oFold[i].sub[j].moveIt(10,oFold[i].sub[j-1].y+oFold[i].sub[j-1].size)
		}
		if(i!=0) oFold[i].moveIt(0,oFold[i-1].y+oFold[i-1].size+pxbetweenmain)
	}
}
/************************************************************************************
Fold in and out the submenus.
************************************************************************************/
function subfoldmenu(main,sub){
	if (!substayfolded){
		for (var i=0; i<oFold[main].sub.length; i++){
			if (i!=sub){
				oFold[main].sub[i].sub.hideIt();
				if (foldImg) oFold[main].sub[i].ref["imgFold"+main+"Sub"+i].src = foldsubinImg.src
			}
		}
	}
	if (!oFold[main].sub[sub].sub.status){
		oFold[main].sub[sub].sub.showIt()
		if(foldImg) oFold[main].sub[sub].ref["imgFold"+main+"Sub"+sub].src = foldsuboutImg.src
	}
	else{
		oFold[main].sub[sub].sub.hideIt()
		if(foldImg) oFold[main].sub[sub].ref["imgFold"+main+"Sub"+sub].src = foldsubinImg.src
	}
	oFold[main].sub[sub].ref["imgFold"+main+"Sub" + sub].src = foldsubinImg.src
	checkheight(main)
}
/************************************************************************************
Fold in and out the mainmenus
************************************************************************************/
function foldmenu(num){
	if (!mainstayfolded){
		for(var i=0; i<oFold.length; i++){
			if(i!=num) oFold[i].subs(0,i)
		}
	}
	if (!oFold[num].sub[0].status)oFold[num].subs(1,num)
	else oFold[num].subs(0,num)
	checkheight(num)
}
//Initiating the menus onload, if the browser is ok.
if(bw.bw) onload = foldInit;

// expandOnLoad function added by D. Schontzler
function expandOnLoad()
{
	if(document.getElementsByTagName) // check to see if browser supports DOM structure
	{
		el = document.getElementsByTagName('a')
		tgs = new Array()
		fTags = new Array()
		for(i=0;(el.item(i));i++)
		{
			if(el.item(i).className.indexOf('cl')>-1) tgs[tgs.length] = el.item(i)
		}
		for(i in tgs)
		{
			if(tgs[i].className.indexOf('Links')>-1&&tgs[i].href.indexOf('#')==-1) fTags[fTags.length] = tgs[i]
		}
		useLevel = useTopLevel ? top : window
		thisLoc = useLevel.location.href.toLowerCase()
		if(thisLoc.indexOf('#')) thisLoc = thisLoc.split('#')[0]
		//if(thisLoc.indexOf('?')) thisLoc = thisLoc.split('?')[0]
		for(i in fTags)
		{
			if(thisLoc == fTags[i].href.toLowerCase())
			{
				subH = fTags[i].parentNode.id.split('_')
				setH = new Array()
				for(i in subH) setH[i] = subH[i].charAt(subH[i].length-1)
				if(setH.length<=2) {
					foldmenu(setH[0])
					document.images['imgFold'+setH[0]+'Sub'+setH[1]].src="/fold/circle_full.gif";	
				}	
				else if(setH.length>2)
				{
					foldmenu(setH[0])
					subfoldmenu(setH[0],setH[1])					
				}
				break
			}
		}
		delete el; delete tgs; delete subH; delete setH; delete thisLoc // clear variables
	}
}



function sitemap()
{
			if(document.getElementsByTagName) // check to see if browser supports DOM structure
			{
				tt= "<div class='listing'><p class='title'>sitemap:</p><br><br>";
				el = document.getElementsByTagName('a')
				tgs = new Array()
				var con = document.getElementById('content')
				fTags = new Array()
					for(i=0;(el.item(i));i++)
					{
						if(el.item(i).className.indexOf('cl')>-1) t = el.item(i).innerHTML;				
						if(t) {
							at=t.split('>');
							if (el.item(i).href==el.item(0).href){
							tt += '<img src=/fold/circle_empty.gif>'+ at[1]+'<br>';
							}else {
							//sitemap = new Image();
							//sitemap.src = '/fold/circle_full.gif';
							//sitemap.name = 'sitemap' + i;
							tt += '<img name=sitemap'+ i +' src="/fold/circle_full.gif"><a href=' + el.item(i).href + ' onmouseover="swapover(sitemap' + i + ');" onmouseout="swapout(sitemap' + i + ');">' + at[1]+'</a><br>';
							}
							}
							
						t="";	
					}
			con.innerHTML = tt + '</div>';
			}
}

function swapover(imgname)
{
	if(imgname.length>0) {
		laststate = document.images[imgname].src;
		document.images[imgname].src='/fold/circle_over.gif';
		//alert(document.images[imgname].src);
	} else {
		laststate = imgname.src; 
		imgname.src = '/fold/circle_over.gif';
		//alert(imgname.src);
	}
}
function swapout(imgname)
{
	if(imgname.length>0) {
		document.images[imgname].src=laststate;
	} else {
		imgname.src = laststate;
	}
}
function printthispage()
{
			if(document.getElementsByTagName) // check to see if browser supports DOM structure
			{
				t="";
				neuesfenster = window.open('');
				pict=document.getElementById("picture").innerHTML;
				cont=document.getElementById("content").innerHTML;
				neuesfenster.focus();
					t+= '<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">';
					t+= '<html>';
					t+= '<head>';
					t+= '		<meta http-equiv="content-type" content="text/html;charset=iso-8859-1">';
					t+= '		<meta name="generator" content="Adobe GoLive">';
					t+= '		<title>Seite drucken</title>';
					t+= '<style type="text/css">';
					t+= '.subtitle   { color: black; font-family: Geneva, Arial, SunSans-Regular, sans-serif; margin-bottom: 15pt }';
					t+= '.text      { color: black; font-family: Geneva, Arial, SunSans-Regular, sans-serif }';
					t+= '.title        { color: #c74d33; font-family: Geneva, Arial, SunSans-Regular, sans-serif; font-weight: bold; text-align: left }';
					t+= '#picture  { visibility: visible; padding-top: 25px; position: relative; top: 50px; left: 300px; width: 500px; height: 250px }';
					t+= '</style>';
					t+= '</head>';

					t+= '<body bgcolor="#ffffff" style="color:white; text-decoration:none;">';
					t+=			'<table width="700" border="0" cellspacing="0" cellpadding="0" align="center" height="1000">';
					t+=				'<tr bgcolor="black" height="75">';
					t+=					'<td bgcolor="black" width="25" height="75" ></td>';
					t+=					'<td width="25" height="75"><a class="text" href="javascript:close();"><font color=white>Fenster&nbsp;schliessen<font></a></td>';
					t+=					'<td height="75">&nbsp;</td>';
					t+=					'<td align="right" valign="top" height="75"><img src="../images/arb_log_cmyk_neg_rev1_small.gif" alt="" height="51" width="150" border="0" livesrc="../../web-data/SmartObjects/arb_log_cmyk_neg_rev1.ai"></td>';
					t+=					'<td align="right" valign="top" width="25" height="75"></td>';
					t+=					'<td align="right" valign="top" bgcolor="black" width="25" height="75"></td>';
					t+=				'</tr>';
					t+=				'<tr height="25">';
					t+=					'<td bgcolor="black" height="25"></td>';
					t+=					'<td colspan="2" height="25"></td>';
					t+=					'<td height="25"></td>';
					t+=					'<td height="25"></td>';
					t+=					'<td bgcolor="black" height="25"></td>';
					t+=				'</tr>';
					t+=				'<tr>';
					t+=					'<td bgcolor="black" width="25"></td>';
					t+=					'<td colspan="2">&nbsp;</td>';
					t+=					'<td valign="top">'+pict+'</td>';
					t+=					'<td width="25"></td>';
					t+=					'<td bgcolor="black" width="25"></td>';
					t+=				'</tr>';
					t+=				'<tr height="25">';
					t+=					'<td bgcolor="black" height="25"></td>';
					t+=					'<td colspan="2" height="25"></td>';
					t+=					'<td height="25"></td>';
					t+=					'<td height="25"></td>';
					t+=					'<td bgcolor="black" height="25"></td>';
					t+=				'</tr>';				
					t+=				'<tr>';
					t+=					'<td bgcolor="black" width="25"></td>';
					t+=					'<td colspan="2">&nbsp;</td>';
					t+=					'<td valign="top">'+cont+'</td>';
					t+=					'<td width="25"></td>';
					t+=					'<td bgcolor="black" width="25"></td>';
					t+=				'</tr>';
					t+=				'<tr height="25">';
					t+=					'<td bgcolor="black" height="25"></td>';
					t+=					'<td colspan="2" height="25"></td>';
					t+=					'<td height="25"></td>';
					t+=					'<td height="25"></td>';
					t+=					'<td bgcolor="black" height="25"></td>';
					t+=				'</tr>';					
					t+=				'<tr bgcolor="black" height="75">';
					t+=					'<td bgcolor="black" width="25" height="75"></td>';
					t+=					'<td width="25" height="75">&nbsp;</td>';
					t+=					'<td height="75">&nbsp;</td>';
					t+=					'<td height="75">&nbsp;</td>';
					t+=					'<td width="25" height="75"></td>';
					t+=					'<td bgcolor="black" width="25" height="75"></td>';
					t+=				'</tr>';
					t+=			'</table>';
					t+=		'</body>';
					t+= '</html>';
					t+= '\n\n';
				neuesfenster.document.clear();
				neuesfenster.document.write(t);
				neuesfenster.document.close();
			}
}
