// CSS Modifikation falls Javascript aktiviert

document.writeln("<style type='text/css'>");
document.writeln("html>body #headcont {position: fixed;}");
document.writeln("html>body #mainnav {position: fixed;}");
document.writeln("#nav ul li ul {position: absolute; left: 14em; top: 0; margin: 0; display: none; width: 13em; height: auto; background-color: #e4eef9; border: 0.05em solid #999999;}");
document.writeln("</style>");

// CSS Workaround für IE falls Javascript aktiviert

document.writeln("<!--[if IE]>");
document.writeln("<style type='text/css'>");
document.writeln("@media screen {");
document.writeln("html, body {height: 100%; overflow-y: hidden;}");
document.writeln("#scrollarea {height: 100%; width: 100%; overflow: auto;}");
document.writeln("#container {position: static;}");
document.writeln("}");
document.writeln("</style>");
document.writeln("<![endif]-->");

// Aufklappen der Navigation nach rechts bei Mouseover

startList = function() {
if (document.all&&document.getElementById) {
  navRoot = document.getElementById("navlist");
  for (i=0; i<navRoot.childNodes.length; i++) {
  node = navRoot.childNodes[i];
  if (node.nodeName=="LI") {
    node.onmouseover=function() {
    this.className+=" over";
      }
    node.onmouseout=function() {
    this.className=this.className.replace(" over", "");
     }
     }
    }
 }
}

// Vergrößerung der Bilder

function dopic(src,x,y,auto){
if (auto){
	var autoy = 0;
	if (auto.offsetParent){
		while (auto.offsetParent){
			autoy += auto.offsetTop
			auto = auto.offsetParent;
		}
	}
	else if (auto.y) autoy += auto.y;
	var autox = 0;
	if (auto.offsetParent){
		while (auto.offsetParent){
			autox += auto.offsetLeft
			auto = auto.offsetParent;
		}
	}
	else if (auto.x) autox += auto.x;
	x+=autox;
	y+=autoy;
}

var altmessage = 'Zum Schließen ins Bild klicken';
var content="<a href=\"#\" onclick=\"dopic(0,0,0);return false;\"><img src=\"";
content=content+src+"\" alt=\""+altmessage+"\" border=\"0\"";
content=content+"></a>";
if (document.getElementById){
	if (src!=0){
		if (document.getElementById('domthumb')==null){
			divEl = document.createElement("div");
			linkEl = document.createElement("a");
			imgEl = document.createElement("img");
			imgEl.setAttribute('src',src);
			imgEl.setAttribute('id','domImg');
			imgEl.setAttribute('border',0);
			linkEl.setAttribute('href','javascript:dopic(0,0,0)');
			linkEl.setAttribute('title',altmessage);
			linkEl.appendChild(imgEl);
			divEl.appendChild(linkEl);
			document.documentElement.lastChild.appendChild(divEl);
			divEl.setAttribute('id','domthumb');
			document.getElementById('domthumb').style.display="block";							document.getElementById('domthumb').style.position='absolute';
			document.getElementById('domthumb').style.top="6.2em";    //y+"px";
			document.getElementById('domthumb').style.left="16em";    //x+"px";
			document.getElementById('domthumb').style.border="0.1em solid #0066cc";
		} else {
			oldparent=document.getElementById('domthumb').childNodes[0];	
			oldparent.removeChild(oldparent.childNodes[0]);
			imgEl = document.createElement("img");
			imgEl.setAttribute('src',src);
			imgEl.setAttribute('id','domImg');
			imgEl.setAttribute('border',0);
			linkEl.appendChild(imgEl);
			document.getElementById('domImg').setAttribute('src',src);
			document.getElementById('domthumb').style.display="block";
			document.getElementById('domthumb').style.position='absolute';
			document.getElementById('domthumb').style.top="6.2em";    //y+"px";
			document.getElementById('domthumb').style.left="16em";    //x+"px";
			document.getElementById('domthumb').style.border="0.1em solid #0066cc";
		}
	}else{
		document.getElementById('domthumb').style.display="none";
	}
}
else if (document.layers){
	if (src!=0){
		if(!document.layers['domthumb']){
			document.layers['domthumb'] = new Layer(1);
			document.layers['domthumb'].height = 20;
		}
		document.layers['domthumb'].left = x;
		document.layers['domthumb'].top = y;
		document.layers['domthumb'].visibility = "show";
		sprite=document.layers['domthumb'].document;
	  	sprite.open();
		sprite.write(content);
		sprite.close();
	}else{
		document.layers['domthumb'].visibility = "hide";
	}
}else if (document.all){
	if (src!=0){
		if(!document.all['domthumb']){
			document.body.insertAdjacentHTML("BeforeEnd",'<div id="domthumb" style="z-index:200;position:absolute;left:"+x+";top:"+y></div>');
		}
		domthumb.style.top=y
		domthumb.style.left=x;
		domthumb.style.visibility="show";
		document.all['domthumb'].innerHTML = content;
	}else{
		domthumb.style.visibility="hidden";
	}
}else{self.location=src;}

}

// Vergrößern der Bilder


function getElementsByClassName(class_name)
{
  var all_obj,ret_obj=new Array(),j=0,teststr;
   if(document.all)all_obj=document.all;
  else if(document.getElementsByTagName && !document.all)
    all_obj=document.getElementsByTagName("*");
   for(i=0;i<all_obj.length;i++)
  {
    if(all_obj[i].className.indexOf(class_name)!=-1)
    {
      teststr=","+all_obj[i].className.split(" ").join(",")+",";
      if(teststr.indexOf(","+class_name+",")!=-1)
      {
        ret_obj[j]=all_obj[i];
        j++;
      }
    }
  }
  return ret_obj;
}

onClickThumbs = function() {

if (document.getElementById) {
  thumbsRoot = getElementsByClassName("thumb");
  if (!thumbsRoot) return;
  for (i=0; i<thumbsRoot.length; i++) {
    thumbsRoot[i].onclick=function() {
      dopic(this.href,150,150,document);
      return false;
    }
  }
}
}

// Scripte initialisieren
window.onload=function() {startList(); onClickThumbs();}