function addEventSimple(obj,evt,fn) {
	if (obj.addEventListener) {
		obj.addEventListener(evt,fn,false);
	}
	else if (obj.attachEvent) {
		obj.attachEvent('on'+evt,fn);
	}
}

function max_width(){
	if (!document.body.clientWidth)return;
	if (document.body.clientWidth < 1008 && document.body.clientWidth > 720) {
		document.getElementById('MaxWidth').style.width= 'auto';
		window.name = 'autowidth';
	}
	if (document.body.clientWidth < 720) {
		document.getElementById('MaxWidth').style.width= '720px';
		window.name = 'smallwidth'; 	
	}
}

if(document.getElementById('MaxWidth')){
	if(window.name == 'autowidth') {
		document.getElementById('MaxWidth').style.width= 'auto';
	}
	if(window.name == 'smallwidth') {
		document.getElementById('MaxWidth').style.width= '720px';
	}

}
addEventSimple(window,"load",max_width);


// JS function for uncrypting spam-protected emails:
function UnCryptMailto(s) {	//
	var n=0;
	var r="";
	for(var i=0; i < s.length; i++) {
		n=s.charCodeAt(i);
		if (n>=8364) {n = 128;}
		r += String.fromCharCode(n-(1));
	}
	return r;
}
  // JS function for uncrypting spam-protected emails:
function linkTo_UnCryptMailto(s)	{	//
	location.href=UnCryptMailto(s);
}


var newWin, dispImg, dispTitle, dispWidth, dispHeight;

function display_img(newImg,newTitle,newWidth,newHeight)
{
   dispImg    = newImg;   
   dispTitle  = newTitle;
   dispWidth  = newWidth;
   dispHeight = newHeight;
   newWinClose();
   setTimeout("show()",1000);
}

function show()
{  
   display_height = dispHeight + 30;
   display_width = dispWidth + 40;
   parameter = 'toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0,height='+display_height+',width='+display_width;
   newWin = window.open('','',parameter);
   
   with (newWin) 
   {
   	  document.writeln('<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">');
      document.writeln('<html>\n<head>\n<title>' + dispTitle + '</title>\n</head>');
	  document.writeln('<meta http-equiv="content-type" content="text/html;charset=ISO-8859-1">');
	  document.writeln('<link rel=stylesheet type="text/css" href="layout/bild.css">');
      document.writeln('<body>\n<div>');
      document.writeln('<img src="'+dispImg+'" width='+dispWidth+' height='+dispHeight+' border=0 alt="'+dispTitle+'">');
      document.writeln('</div>\n</body>\n</html>');
   }
}

function newWinClose()
{
   if (newWin != null)
     if (!newWin.closed)
        if (newWin.close)
           newWin.close(); 
}


function openPic(url,winName,winParams)	{	//
		var theWindow = window.open(url,winName,winParams);
		if (theWindow)	{theWindow.focus();}
	}
	
