/*****************************************************
 * default javascript lib for odls
 ****************************************************/

/* openWin()
 * 
 * str url: url
 * str name: windowname
 * int w: window width
 * int h: window height
 * str mode: rich|medium|poor (window equipment)
 * int x: horizontal position on screen
 * int y: vertical position on screen
 * str max: h|v
 * str pos: n|ne|e|se|s|sw|w|nw (predifined positions)
 */

var newWin;

function openWin(url,name,w,h,mode,x,y,max,pos) {

  var props;
  
  if(mode) {
	if (mode=="poor") {
	  props = "resizable=1,scrollbars=0,status=0";
	} else if(mode=="medium") {
	  props = "resizable=1,scrollbars=1,status=1";
	} else if(mode=="rich") {
	  props = "menubar=1,resizable=1,scrollbars=1,status=1,toolbar=1";
	}
  }
  
  if(max && max=='h') {
	h = eval(screen.availHeight);
	x = "0"; 
  } else if (max && max=='v') {
	w = eval(screen.availWidth); 
	y = "0";
  }
  
  switch (pos) {
  case "n":
	y = "0";
	break;
  case "ne":
	y = "0";
	x = eval(screen.availWidth-w);
	break;
  case "e":
	x = eval(screen.availWidth-w);
	break;
  case "se":
	x = eval(screen.availWidth-w);
	y = eval(screen.availHeight-h);
	break;
  case "s":
	y = eval(screen.availHeight-h);
	break;
  case "sw":
	x = "0";
	y = eval(screen.availHeight-h);
	break;
  case "w":
	x = "0";
	break;
  case "nw":
	x = "0";
	y = "0";
	break;
  }
  

  if (x && !y) y = "0";
  if (y && !x) x = "0";
  
  newWin = window.open('',name,props);
	newWin.location.href = url;
	newWin.resizeTo(w,h);
  	
  if(x && y) { 
		newWin.moveTo(x,y); 
  }
    
  if (newWin.opener == null && !newWin.opener) { 
		newWin.opener = self; 
  }

  //newWin.focus();

  // DEBUG
  //alert("\n\nHöhe: " +h+ "\nBreite :" +w+ "\nVertikal Pos.:" +x+ "\nHorizontal Pos.:" +y+ "\nScreen-Height: " +screen.availHeight+ "\nScreen-Width :" +screen.availWidth+ "\nVert. oder horiz. maximieren?: " +max+ "\nPosition: " +pos+"\n\n");

} // end openWin()


/*****************************************************
 * javascript history back
 ****************************************************/

function prev_page() {
	history.back();
	return false;
}


/**** image-viewer *********************************/

// Script Source: CodeLifter.com
// Copyright 2003
// Do not remove this notice.



function popImage(imageURL,imageTitle,inscriptor,margin,closeLink){
	
	// SETUPS:
	// ===============================
	
	// Set the horizontal and vertical position for the popup
	
	PositionX = 100;
	PositionY = 100;
	
	// Set these value approximately 20 pixels greater than the
	// size of the largest image to be used (needed for Netscape)
	
	defaultWidth  = 500;
	defaultHeight = 500;
	
	// Set autoclose true to have the window close automatically
	// Set autoclose false to allow multiple popup windows
	
	var AutoClose = true;
	
	if(!margin){
		margin = 0;	
	}
	
	// Do not edit below this line...
	// ================================
	if (parseInt(navigator.appVersion.charAt(0))>=4){
		var isNN=(navigator.appName=="Netscape")?1:0;
		var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;
	}
	var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
	var optIE='scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;
	
	if (isNN){
		imgWin=window.open('about:blank','',optNN);
	}
	if (isIE){
		imgWin=window.open('about:blank','',optIE);
	}
	
	
	with (imgWin.document){
		writeln('<html><head><title>Loading...</title><style>body{margin:'+(margin/2)+'px;}</style>');
		writeln('<link rel="stylesheet" type="text/css" href="css/custom/custom.css">');
		writeln('<sc'+'ript>');
		writeln('var isNN,isIE;');
		writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
		writeln('isNN=(navigator.appName=="Netscape")?1:0;');
		writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
		writeln('function reSizeToImage(margin){');
		writeln('if (isIE){');
		writeln('window.resizeTo(100,100);');
		writeln('width=(margin + 100)-(document.body.clientWidth-document.images[0].width);');
		writeln('height=(margin + 115)-(document.body.clientHeight-document.images[0].height);');
		writeln('window.resizeTo(width,height);}');
		writeln('if (isNN){');
		writeln('window.innerWidth=(document.images["'+imageTitle+'"].width) + margin;');
		writeln('window.innerHeight=(document.images["'+imageTitle+'"].height) + margin + 20;}}');
		writeln('function doTitle(){document.title="'+imageTitle+'";}');
		writeln('</sc'+'ript>');
		if (!AutoClose) {
			writeln('</head><body scroll="no" onload="reSizeToImage();doTitle();self.focus()">');
		} else {
			writeln('</head><body scroll="no" onload="reSizeToImage('+margin+');doTitle();self.focus()" onblur="self.close()">');
			writeln('<img name="'+imageTitle+'" alt="'+imageTitle+'" src="'+imageURL+'" style="display:block">');
			if(closeLink){
				writeln('<div align="center"><small><a href="javascript;" onclick="window.close();">'+inscriptor+'</a></small></div>');
			}else{
				writeln('<div align="center"><small>'+imageTitle+'</small></div>');
			}
			writeln('</body></html>');
			close();		
		}
	}
}

function toggle(elname){
	var boxes = document.getElementsByName(elname);
	if(boxes[0].checked){
		var val = false;
	} else {
		var val = true;
	}
	for (i=0; i < boxes.length; i++) {
		boxes[i].checked = val;
	}
}

function dump(o) {
    var s = '';
    for (var prop in o) {
      s += prop + ' = ' + o[prop] + '\n';
    }
    x = window.open("", "debugger","resizable=1,scrollbars=1,status=1");
		x.document.write('<pre><strong>---------------------------------------------------<br />');
		x.document.write(' ' + o + '<br />');
		x.document.write('---------------------------------------------------</strong><br />');
    x.document.write(s + '</pre>');
 }