/*   
        util js    
        Copyright (C) 2000 - 2003  Holger Hellinger 
		
		Some of this functionalitys do not support netscape 4x. and this might be good,
		cause the DOM isn't quite well implemented in this browser. using of the page is 
		still possible
          
        This javascript sniplets are free software; you can redistribute it and/or   
        modify it under the terms of the GNU General Public License   
        as published by the Free Software Foundation; either version 2   
        of the License, or (at your option) any later version.   
          
        This javascript sniplets are distributed in the hope that it will be useful,   
        but WITHOUT ANY WARRANTY; without even the implied warranty of   
        MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the   
        GNU General Public License for more details.
          
        You should have received a copy of the GNU General Public License   
        along with this program; if not, write to the Free Software   
        Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.   
          
        Comments to the author -  sitte@polente.de  
        Visit our website - www.holger-hellinger.de
*/
//browservariables
var dom = (document.getElementById && !document.all)? 1 : 0;
var nn4 = (document.layers)? 1 : 0;
var ie4 = (document.all)? 1 : 0;
var nnMac = (nn4 &&  navigator.platform == "MacPPC")? 1 : 0;
var ieMac = (ie4 &&  navigator.platform == "MacPPC")? 1 : 0;

var loaded = false;

//general show/hide-functions work on any client that supports <div></div>
function show(id) {
	if (nn4) document.layers[id].visibility = "show"
	else if (ie4) document.all[id].style.visibility = "visible"
	else if (dom) document.getElementById(id).style.visibility ="visible"
}
function hide(id) {
	if (nn4) document.layers[id].visibility = "hide"
	else if (ie4) document.all[id].style.visibility = "hidden"
	else if (dom) document.getElementById(id).style.visibility ="hidden"
}

//framebuster, ohne history kill
if (self.parent.frames.length != 0 && document.name!="am") {
	parent.location.replace(document.location);
}

//general moveto funktion, works in ie, nn4, nn6, and all the others W3C conform browsers
function placeTo(div,x,y) {
	if (ie4) {
		document.all[div].style.left = x;
		document.all[div].style.top = y;
	} else if (nn4) {
		document.layers[div].left = x;
		document.layers[div].top = y;
	} else if (dom) {
		document.getElementById(div).style.left = x;
		document.getElementById(div).style.top = y;
	} 
}

//layer beschreiben
function layerText(div, text) {
    if (nn4) {
		return null;
    } else {
        if (ie4) {
            eval("document.all." + div + ".innerHTML='" + text + "'");
        } else {
            document.getElementById(div).innerHTML = text;
        }
    }
}

//image preloading
function preload(imgObj,imgSrc) {
	imgObj = new Image();
	imgObj.src = imgSrc;
}

//replace of history pages - nach laden einer seite mit abfragen, wird diese ersetzt
function pageReplace(url) {
	window.location.replace(url);
}
//redirect
function pageRedirect(url) {
	window.location.href=url;
}

//funktionrn für das menu (komplex, aber tut seinen job ;o)
var highLight;
function init(x) {
	highLight = x;
	//alert('er hats getan'); //initiale anzeige der navi (und verdecken)
	for (i=1;i<=3;i++) {
		document.getElementById("nav"+i).style.background = "#C8DBED";
		setLabel("nav"+i).style.color = "#336699";
		setLabel("navText"+i).style.color = "#336699";
		hide("subNavigation"+i);
	}
	if (x!=null) {
		show("subNavigation"+x);
		doHighlight(x);
	}
	loaded = true;
}

function doHighlight(x) {
	document.getElementById("nav"+x).style.background = "#CCCCCC";
	setLabel("nav"+x).style.color = "#333333";
	setLabel("navText"+x).style.color = "#333333";
}

function navOver(x) {
	//alert(highLight);
	if (x!=null) {
		for (i=1;i<=3;i++) {
			document.getElementById("nav"+i).style.background = "#C8DBED";
			setLabel("nav"+i).style.color = "#336699";
			setLabel("navText"+i).style.color = "#336699";
		}
		switch(x) {
			case 1:
				show("subNavigation"+x);
				hide("subNavigation2");
				hide("subNavigation3");
			break;
			case 2:
				hide("subNavigation1");
				show("subNavigation"+x);
				hide("subNavigation3");
			break;
			case 3:
				hide("subNavigation1");
				hide("subNavigation2");
				show("subNavigation"+x);
			break;
		}
		if (highLight!=null) {
			show("subNavigation"+highLight);
			doHighlight(highLight);
		}
		doHighlight(x);
	}
}

//main id funktion
function setLabel(setID) {
	if (!nn4) {
		return document.getElementById(setID);
	}
}

//Werkefunktionen
function showWerk(x,text) {
	document.anzeige.src=x;
	//alert(document.anzeige.src);
	layerText("textDiv", text)
}

//printfunktion in js, incl ie4 (in vb)
ieAlt=(navigator.platform.indexOf('MSIE 4') > 0 && !dom);
function printPage() {
  if (dom || nn4 || ie4) {
    self.focus();
    window.print();
  } else if (ieAlt && !navigator.platform == "MacPPC") {
    vbPrintPage();  
  } else {
    alert('Bitte benutzen Sie die Druckfunktion Ihres Browsers!');
  }
}

if (ieAlt && !navigator.platform == "MacPPC") { // IE4 (Windows)
  writeln('<OBJECT ID="WB" WIDTH="0" HEIGHT="0" CLASSID="clsid:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>');
  writeln('<' + 'SCRIPT LANGUAGE="VBScript">');
  writeln('Sub window_onunload');
  writeln('  On Error Resume Next');
  writeln('  Set WB = nothing');
  writeln('End Sub');
  writeln('Sub vbPrintPage');
  writeln('  OLECMDID_PRINT = 6');
  writeln('  OLECMDEXECOPT_DONTPROMPTUSER = 2');
  writeln('  OLECMDEXECOPT_PROMPTUSER = 1');
  writeln('  On Error Resume Next');
  writeln('  WB.ExecWB OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER');
  writeln('End Sub');
  writeln('<' + '/SCRIPT>');
}
//!print