var DOM = document.getElementById;
var NSC4 = document.layers;
var NSC4blinker = null;
var showAktu = null;

function linkblinkNSC4(x) {
  if (!NSC4) return;  
  if (NSC4blinker) clearTimeout(NSC4blinker);
  if (!document.layers[x+"text"]) return;
  var v = document.layers[x+"text"].visibility;
  document.layers[x+"text"].visibility = ((v=="show") ? "hide" : "show");
  NSC4blinker = setTimeout("linkblinkNSC4(\""+x+"\")",500);
  window.status=v;
}

function highlight(x) {
  if (NSC4) {
    linkblinkNSC4(x);
    return;
  }
  var a=document.getElementById(x+"link");
  if (a) a.className = "linkOn";
}
function antihighlight(x) {
  if (NSC4) {
    clearTimeout(NSC4blinker);
    if (document.layers[x+"text"]) document.layers[x+"text"].visibility="show";
    return;
  }
  var a=document.getElementById(x+"link");
  if (a) a.className = "linkOff";
}
function show(x) {
  setStyle(x,"visibility","visible");
  if(x=="vereinsidee") return;
  if(showAktu!=x) hide(showAktu);
  showAktu=x;
  highlight(x);
}
function hide(x) {
  if (timer) clearTimeout(timer);
  setStyle(x,"visibility","hidden");
  antihighlight(x);
}
var timer=null;

function filmkarte(elem) {
  if (!document.getElementById) return;
  var cs = elem.parentNode.childNodes;
  j=-1;
  for (i=0; i<cs.length; i++) {
    if (cs[i].nodeName=="DIV") j=i;
  }
  if (j==-1) return;
  var d = cs[j];
  if (d.style.display=="block") {
    d.style.display = "none";
    elem.style.backgroundColor="transparent";
    elem.parentNode.style.border="none";
    elem.parentNode.style.padding="0px";
    elem.parentNode.style.backgroundColor="transparent";
  } else {
    d.style.display = "block";
//    elem.parentNode.style.border="solid 1px #808080";
    elem.parentNode.style.padding="5px";
    elem.parentNode.style.backgroundColor="white";
  }
}

function vibrate(obj,x,y,n) {
  if (timer) clearTimeout(timer);
  setStyle(obj,"visibility","visible");
  if (n==0) { hide (obj); return; }
  if (n==null) n=25;
  show(obj);
  sign = (n%2 == 0) ? -1 : 1;
  setStyle(obj,"left",(x+sign*5*Math.random())+"px");
  setStyle(obj,"top",(y+sign*2*Math.random())+"px");
  timer=setTimeout('vibrate("'+obj+'",'+x+','+y+','+(n-1)+')',75);
}

function setStyle(x,s,v) {
  var ob = null;
  if (NSC4 && s=="visible") s="show";
  if (NSC4 && s=="hidden") s="hide";
  if (document.getElementById) {
    ob=document.getElementById(x);
    if (!ob) return false;
    ob.style[s] = v;
    return true;
  } else if (document.layers) {
    ob = document.layers[x]
    if (!ob) return false;
    ob[s] = v;
    return true;
  }
  return false;
}

function getStyle(x,s) {
  var ob = null;
  if (document.getElementById) {
    ob=document.getElementById(x);
    if (!ob) return null;
    return ob.style[s];
  } else if (document.layers) {
    ob = document.layers[x]
    if (!ob) return null;
    return ob[s];
  }
  return null;
}

function popUp(url) {
  win=window.open(url,"nbapopup","width=600,height=400,scrollbars=yes,left=0,top=0");
  setTimeout("win.focus()",1000);
  return false;
}

function homeButton() {
	 return;
  if (window.name!="nbapopup") document.writeln('<h1 class="popup" id="homebutton">[<a href="http://www.no-budget-arts.de">no-budget-arts</a>]</h1>');
}

var aktDia=0;
var diaTimer=null;
var diaIntervalZeit=2500;
var alleDias = new Array();
function initDiashow(attribute) {
  if (diaBilder && diaBilder.length && diaBilder.length>1) document.writeln('<img name="diaprojektor" src="'+diaBilder[0]+'"  '+attribute+' alt="[no-budget-arts]" title="[no-budget-arts]" onmouseover="diashowAus()" onmouseout="diashowAn()" onclick="diashowAus(); nextDia()"><br><span id="diabez">'+diaBilder[1]+'</span>');
  for (i=0; i<diaBilder.length; i=i+2) {
    alleDias[i] = new Image();
	alleDias[i].src = diaBilder[i];
	alleDias[i+1] = "";
  }
  setTimeout("diashowAn()",diaIntervalZeit);
}
function setDiaIntervalZeit(diz) {
  diaIntervalZeit=diz;
}
function diashowAn() {
  if (diaTimer) return;
  diaTimer = setInterval("nextDia()", diaIntervalZeit );
}
function diashowAus() {
  if (diaTimer) clearInterval(diaTimer);
  diaTimer=null;
}
function nextDia() {
  aktDia = (aktDia+2) % (diaBilder.length);
  document.diaprojektor.src = alleDias[aktDia].src;
  if (!document.getElementById) return;
  document.getElementById("diabez").innerHTML = diaBilder[aktDia+1];
}