// JavaScript Document
function init() {
initMenu();
initTips();
}



// Flash
flashVersion = 0; flashEnabled="";

function writeFlash(fname, width, height) {
// Flash Check
if (flashEnabled=="") {
agent = navigator.userAgent.toLowerCase(); 

if (navigator.plugins != null && navigator.plugins.length > 0) {
var flashPlugin = navigator.plugins['Shockwave Flash'];
if (typeof flashPlugin == 'object') { 
 for (var i = 9; i >= 3; i--) {
  if (flashPlugin.description.indexOf(i + '.') != -1) { flashVersion = i; break; }
 }
}


} else if (agent.indexOf("msie") != -1 && parseInt(navigator.appVersion) >= 4 && agent.indexOf("win")!=-1) {
  var doc = '<scr' + 'ipt language="VBScript"\> \n';
  doc += 'On Error Resume Next \n';
  doc += 'Dim obFlash \n';
  doc += 'For i = ' + 9 + ' To 3 Step -1 \n';
  doc += '   Set obFlash = CreateObject("ShockwaveFlash.ShockwaveFlash." & i) \n';
  doc += '   If IsObject(obFlash) Then \n';
  doc += '      flashVersion = i \n';
  doc += '      Exit For \n';
  doc += '   End If \n';
  doc += 'Next \n';
  doc += '</scr' + 'ipt\> \n';
  document.write(doc);
}

flashEnabled = (flashVersion >= 6) ? true : false;
}


if (flashEnabled) {
 document.write("<div><object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0\" width=\""+width+"\" height=\""+height+"\"><param name=\"movie\" value=\""+fname+".swf\" /><param name=\"menu\" value=\"false\" /><param name=\"quality\" value=\"best\" /><param name=\"scale\" value=\"noscale\" /><param name=\"wmode\" value=\"transparent\" /><param name=\"bgcolor\" value=\"#ffffff\" /><embed src=\""+fname+".swf\" menu=\"false\" quality=\"best\" scale=\"noscale\" wmode=\"transparent\" bgcolor=\"#ffffff\" width=\""+width+"\" height=\""+height+"\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\"></embed></object></div>");
} else {
 document.write('<img src="'+ fname +'.jpg" width="'+ width +'" height="'+ height +'" alt="" />');
}
}


// Tips
document.write("<div id=\"tiplayer\"><div></div></div>");
tiptags = Array("dfn","acronym","area","img");
tiptext = Array; tiptimer = -1;


function initTips() {
for (t=0; t < tiptags.length; t++) {
for (i=0; i < document.getElementsByTagName(tiptags[t]).length; i++) {
 tiptext[(tiptags[t]+i)] = document.getElementsByTagName(tiptags[t])[i].title.replace(/\*([^\*]+)\*/g,'<strong>$1</strong>').replace(/ -- /g,"<br /><br />").replace(/ - /g,"<br />");

 document.getElementsByTagName(tiptags[t])[i].title = "";
 document.getElementsByTagName(tiptags[t])[i].id = tiptags[t]+i;
 document.getElementsByTagName(tiptags[t])[i].onmouseover = handleTip;
 if (tiptags[t]=="img") {
	 document.getElementsByTagName(tiptags[t])[i].onmousemove = handleTip;
	tiptext[(tiptags[t]+i)] = tiptext[(tiptags[t]+i)];
 }
 document.getElementsByTagName(tiptags[t])[i].onmouseout = hideTip;
}
}

tip = document.getElementById("tiplayer");
}

tipobj=-1;
function handleTip(e) {
if (tiptimer) window.clearTimeout(tiptimer);
if (tiptext[this.id]=="" || tiptext[this.id]=="&nbsp;&nbsp;") return;
tip.firstChild.innerHTML = tiptext[this.id];

if (this.tagName.toLowerCase()=="area") { //sonderfall area
tip.style.left = ((! document.all) ? e.pageX : document.body.scrollLeft + event.clientX)  + 10 + "px";
tip.style.top = ((! document.all) ? e.pageY : document.body.scrollTop + event.clientY) - 110 + "px";
tip.className = "tip-rechts";
tip.style.display='block';
return;
} else if (this.tagName.toLowerCase()=="img") {
tip.style.left = ((! document.all) ? e.pageX : document.body.scrollLeft + event.clientX) + "px";
tip.style.top = ((! document.all) ? e.pageY : document.body.scrollTop + event.clientY) +20 + "px";
tip.firstChild.style.width = "auto";
tip.className = "simpletip";
if (tiptext[this.id].indexOf('Marion')>-1) tip.className+=' tipseccolor';
tip.style.display='block';
return;

} else {
			getPos(this);
}

//if (this.tagName.toLowerCase()!="img") {this.className = "toolhover"; tipobj = this;} else{ tipobj=-1;} 

tip.style.top = absoluteTop - 90 + "px";

if (absoluteLeft + this.offsetWidth + 250 > document.body.offsetWidth) {
tip.style.left = absoluteLeft - 220 + "px";
tip.className = "tip-links";
} else {
tip.style.left = absoluteLeft + this.offsetWidth - 2 + "px";
tip.className = "tip-rechts";
}

tiptimer = window.setTimeout("tip.style.display='block'",200);
}
function hideTip() {
//if (document.tipobj && tipobj.tagName.toLowerCase()!="img") tipobj.className = "";
if (tiptimer) window.clearTimeout(tiptimer);
tip.style.display="none";
}



// Fade
fadelevel = 1; fadeobj = -1; fadetimer = -1;
function startFade(obj,fadein) {
if (fadetimer) window.clearTimeout(fadetimer);
fadeobj = obj;
fadelevel = 1;
fadeObj(fadein);
fadeobj.style.display = "block";
}

function fadeObj(fin) {
A = fadelevel * 10;
if (! fin) {A = 100 - A;}

if (A==0) {
fadeobj.style.display="none";
} else {
if (typeof(fadeobj.style.MozOpacity)!="undefined") {
fadeobj.style.MozOpacity = A / 100 - 0.01;
} else if (typeof(fadeobj.style.Opacity)!="undefined") {
fadeobj.style.Opacity = A / 100;
} else {
fadeobj.style.filter = "progid:DXImageTransform.Microsoft.Alpha(opacity="+A+")";
}
}

if (++fadelevel > 10) { fadelevel=1; } else { fadetimer = window.setTimeout("fadeObj("+fin+")",30); }
}



// Menu
document.write("<style type=\"text/css\">#navigation {margin: 0px 0px 10px 205px; width: 555px;} #navigation ul {width:auto;margin-top:0px;display:none;position:absolute;} #navigation a {background-image: none;} #navigation li {float:none;} #navigation h2 { clear:none;text-align:left; margin: 0px 1px 0px 0px;background-color: #969696; color: white;} #navigation .last {margin-right: 0px !important;} h2 span {display:none;}</style>");
hidetimer = -1; hidethis = -1; lastmnu = -1;

function getPos(obj) {
absoluteTop = obj.offsetTop;
absoluteLeft = obj.offsetLeft;
while(obj.offsetParent!=null) {
objParent = obj.offsetParent;
absoluteTop += objParent.offsetTop;
absoluteLeft += objParent.offsetLeft;
obj = objParent;
}
}
function initMenu() {
for (i=1; i < 5; i++) {
 document.getElementsByTagName("h2")[i].onmouseover = handleMenu;
 document.getElementsByTagName("h2")[i].onmouseout = hideMenu;
 document.getElementsByTagName("ul")[i].onmouseout = hideMenu;
 document.getElementsByTagName("ul")[i].onmouseover = stopHideTimer;
 document.getElementsByTagName("ul")[i].lastChild.style.borderBottom = "0px";
}
}
function handleMenu() {
this.style.backgroundColor = "#646464";
stopHideTimer();
for (i=1; i < 5; i++) {
 document.getElementsByTagName("ul")[i].style.display = "none";
}
mnuobj = this.nextSibling;
getPos(this);
mnuobj.style.top = absoluteTop + this.offsetHeight + 1 + "px";
mnuobj.style.left = absoluteLeft + "px";

startFade(mnuobj,true);
}

function hideMenu() {
if (this.nodeName.toLowerCase()=="h2") { this.style.backgroundColor = "#969696"; hidethis = this.nextSibling; } else { hidethis = this; }
hidetimer = window.setTimeout("startFade(hidethis,false);",1000);
}
function stopHideTimer() {
if (hidetimer) window.clearTimeout(hidetimer);
}