// filename: format.js
// functions for the main navigation and other pages
// version 1.01 - 2004-08-23
// Distributed under the terms of the GNU Library General Public License
// author: randolf dot manderbach at gpm dot de
// author: frank dot klein at gpm dot de

window.onerror = null


/////////////////////////
// page initialization //
/////////////////////////

function pageInit(section) {
	is = new BrowserCheck();
	if (is.ns4) { 
		/* correct display for Netscape 4.x */
		document.layers["disclaimerDiv"].top = 400;
		//document.layers["pathDiv"].top = 130;	
	}
}


/////////////////////////////
// sub navigation          //
/////////////////////////////


function subover(wo) {

	if (is.ns4) {
	}
	else {
		document.images["navpointer"+wo].src = suboverimage.src;
	}
}

function subout(wo) {

	if (is.ns4) {}
	else document.images["navpointer"+wo].src = suboutimage.src;


}

///////////////////////////
// zoom functions       //
//////////////////////////

function showZoom(was,dateiname) {

	document.getElementById("zoom"+was).style.display = "block";
	document.images["zoombild"+was].src = "/img/zoom/"+dateiname;
}

function hideZoom(was) {

	document.getElementById("zoom"+was).style.display = "none";

}


/////////////////////////////
// other helpful functions //
/////////////////////////////

// reloadPage() causes NS4 to reload on resize due to known Netscape resize bug,
// positions bottom bar on the bottom screen edge in NS6 and IE4+
function reloadPage(init) {
	// initialize function on first call
	if (init == true) {
		// set resize event
		window.onresize = reloadPage;}

	// do something if window size has changed
	else if (window.innerWidth != fenster.visWidth || window.innerHeight != fenster.visHeight) {
		// re-center
		if (is.dom) {
			fenster = new screenObject();
			centerPage();}
		// reload page in NS4
		else if (is.ns4) {
			window.location.reload();}
	}
}
	
// screenObject() creates universally accessible screen attribute objects
function screenObject() {
	// bottom edge
	if (window.pageYOffset) {
		this.bottom = window.pageYOffset;}
	else if (document.body && document.body.scrollHeight) {
		this.bottom = document.body.scrollHeight;}
	else {this.bottom = false;}

	// height	
	if (window.outerHeight) {
		this.height = window.outerHeight;}
	else if (document.body && document.body.offsetHeight) {
		this.height = document.body.offsetHeight;}
	else {this.height = false;}
		
	// visible height
	if (window.innerHeight) {
		this.visHeight = window.innerHeight;}
	else if (document.body && document.body.clientHeight) {
		this.visHeight = document.body.clientHeight;}
	else {this.visHeight = false;}
		
	// width
	if (window.outerWidth) {
		this.width = window.outerWidth;}
	else if (document.body && document.body.offsetWidth) {
		this.width = document.body.offsetWidth;}
	else {this.width = false;}
		
	// visible width
	if (window.innerWidth) {
		this.visWidth = window.innerWidth;}
	else if (document.body && document.body.clientWidth) {
		this.visWidth = document.body.clientWidth;}
	else {this.visWidth = false;}
		
	// scroll position
	if (window.pageYOffset) {
		this.scrollTop = window.pageYOffset;}
	else if (document.body && document.body.scrollTop) {
		this.scrollTop = document.body.scrollTop;}
	else {this.scrollTop = 0}
}

// open pop-up window
function windowOpener(winUrl,winWidth,winHeight,winName,winX,winY,winScrollbars,winLocation,winStatus,winPersonalbar,winResizable,winToolbar,winMenubar,winDependent,winDirectories) {
	var windowName = ""
	// set defaults
	if (!winWidth) winWidth = 770
	if (!winHeight) winHeight = 550
	if (!winName) winName = 'popupWindow'
	if (!winX) winX = 10
	if (!winY) winY = 10
	if (!winScrollbars) winScrollbars = "yes"
	if (!winLocation) winLocation = "no"
	if (!winStatus) winStatus = "no"
	if (!winPersonalbar) winPersonalbar = "no"
	if (!winResizable) winResizable = "no"
	if (!winToolbar) winToolbar = "no"
	if (!winMenubar) winMenubar = "yes"
	if (!winDependent) winDependent = "no"
	if (!winDirectories) winDirectories = "no"
	// open pop-up window
	eval(winName +  '= window.open(winUrl,winName,"width=' + winWidth + ",height=" + winHeight + ",left=" + winX + ",top=" + winY + ",screenX=" + winX + ",screenY=" + winY + ",scrollbars=" + winScrollbars + ",location=" + winLocation + ",status=" + winStatus + ",personalbar=" + winPersonalbar + ",resizable=" + winResizable + ",toolbar=" + winToolbar + ",menubar=" + winMenubar + ",dependent=" + winDependent + ",directories=" + winDirectories + '")')
	eval(winName).focus()
}

// preload images for subnavpointer

var suboverimage = new Image();
var suboutimage = new Image();
suboverimage.src = "/img/arrow_right_act.gif";
suboutimage.src = "/img/arrow_right.gif";
