function swapImgRestore() { //v3.0
  var i,x,a=document.sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.p) d.p=new Array();
    var i,j=d.p.length,a=preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.p[j]=new Image; d.p[j++].src=a[i];}}
}

function 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=findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function swapImage() { //v3.0
  var i,j=0,x,a=swapImage.arguments; document.sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=findObj(a[i]))!=null){document.sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.pgW=innerWidth; document.pgH=innerHeight; onresize=reloadPage; }}
  else if (innerWidth!=document.pgW || innerHeight!=document.pgH) location.reload();
}
reloadPage(true);

function 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=FindObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function tmt_findObj(n){
	var x,t; if((n.indexOf("?"))>0&&parent.frames.length){t=n.split("?");
	x=eval("parent.frames['"+t[1]+"'].document.getElementById('"+t[0]+"')");
	}else{x=document.getElementById(n)}return x;
}

function ShowHideLayers() { //v3.0A Modified by Al Sparber and Massimo Foti for NN6 Compatibility
  var i,p,v,obj,args=ShowHideLayers.arguments;if(document.getElementById){
   for (i=0; i<(args.length-2); i+=3){ obj=tmt_findObj(args[i]);v=args[i+2];
   v=(v=='show')?'visible':(v='hide')?'hidden':v;
   if(obj)obj.style.visibility=v;}} else{
  for (i=0; i<(args.length-2); i+=3) if ((obj=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 show_subnav(id) {

	restore();
	ShowHideLayers('nav_restore','','show');
	ShowHideLayers('nav_restore_top','','show');
	if (id) {
		ShowHideLayers('subnav_'+id,'','show');
	}
}

function restore() {

	for (x=0; x<=6; x++) {
		ShowHideLayers('subnav_'+x,'','hide');
	}
	ShowHideLayers('nav_restore','','hide');
	ShowHideLayers('nav_restore_top','','hide');
}

function info(url,instance,width,height,xpos,ypos){

	if (xpos == -1 && ypos == -1) {
	xcenter=(screen.width/2)-(width/2);
	ycenter=(screen.height/2)-(height/2);
	window.open(url,instance,"toolbar=no,location=no,directories=no,scrollbars=no,status=no,menubar=no,resizable=no,width="+width+",height="+height+",left="+xcenter+",top="+ycenter+"")
	}
	else {
	window.open(url,instance,"toolbar=no,location=no,directories=no,scrollbars=no,status=no,menubar=no,resizable=no,width="+width+",height="+height+",left="+xpos+",top="+ypos+"")
	}
}

function display(id) {
	if (id) {
		if (document.getElementById(id).style.display == 'none') {
			document.getElementById(id).style.display='block';
			nav_show=1;
		}
		else {
			document.getElementById(id).style.display='none';
		}
	}
}

function CalcAirFlow() {

	airin=document.myForm.airin.options[document.myForm.airin.selectedIndex].value
	airout=document.myForm.airout.options[document.myForm.airout.selectedIndex].value
	powerloss=document.myForm.powerloss.options[document.myForm.powerloss.selectedIndex].value
	deltat=airout - airin
	airflow=powerloss * 50 / deltat
	if (deltat > 0) {
		document.myForm.airflow.value=Math.round(airflow);
	}
	else {
		document.myForm.airflow.value="---";
	}
}

// Neuer Tooltipp *********************************************************************************************************

function tipp (var1,var2) {
	document.getElementById('tipp').innerHTML=var1;
	document.getElementById('tipp').style.width = var2+'px';
}

function tt_aus(ttipId) {document.getElementById(ttipId).style.display = 'none';}

function aus () {document.getElementById('tipp').style.visibility = 'hidden'; } 


var mouseX = 0, mouseY = 0;       // beinhalten später die Position des Mauszeigers
var xMargin = 10, yMargin = 10;   // zusätzlicher Abstand zum Mauszeiger
var ttipDisplayed = false;        // Statusvariable, nicht ändern

// Event-Handler, speichert ständig die aktuelle Position der Mauszeigers
function saveMouseCoords (e)
{
	if (window.Event)   // Netscape
	{
		mouseX = e.pageX;
		mouseY = e.pageY;
	}
	else   // MSIE
	{
		mouseX = window.event.clientX;
		mouseY = window.event.clientY;
	}
}

// Steuert Anzeige und Position des angegebenen Tooltips
function tt_an (ttipId)
{
	var elem = document.getElementById (ttipId);

	if (elem != null)
	{
		if (elem.style.display == "none"  ||  ttipDisplayed == false)
		{
			elem.style.left    = (mouseX + xMargin) + "px";
			elem.style.top     = (mouseY + yMargin) + "px";
			elem.style.display = "block";
			ttipDisplayed      = true;
		}
		else
		{
			elem.style.display = "none";
			ttipDisplayed      = false;
		}

		return true;
	}
	else
		return false;
}

// Einbinden des Event-Handlers
if (document.captureEvents)
	document.captureEvents (Event.MOUSEMOVE);

document.onmousemove = saveMouseCoords;
