$(document).ready(function() {
   $('.ccm-linklist').css('display','none');
   $('.ccm-linklist-category').css('cursor','pointer');
   $('.ccm-linklist-category').click(function() {
   	next = $(this).next('.ccm-linklist');
   	if ($(next).css('display')=='none')
	     $(next).css('display','block');
	   else
	     $(next).css('display','none');
   });

   $('.ccm-filelist').css('display','none');
   $('.ccm-filelist-category').css('cursor','pointer');
   $('.ccm-filelist-category').click(function() {
      next = $(this).next('.ccm-filelist');
	
	   if ($(next).css('display')=='none')
         $(next).css('display','block');
      else
         $(next).css('display','none');	
    });
});

function adjustPrint() {
 document.getElementById('Newsticker').display='none';
}

window.onbeforeprint=adjustPrint;


// Script fur Sprachenwechsel

function changeLanguage(lang) {
  document.location = "process.php?cat=iow&template=index&lang=" + lang;
}


// Script für Hauptmenu

function ShowMain(fid,sid) {

  var f = document.getElementById(fid);
  var s = document.getElementById(sid);
 
  if(f) f.className="HauptsparteMarked";
  if(s) s.className="SparteMarked";

  return true;
}



// Script für Dropdown-Menu

function at_display(x)
{
  var win = window.open();
  for (var i in x) win.document.write(i+' = '+x[i]+'<br>');
}

function at_show_aux(parent, child)
{
  var p = document.getElementById(parent);
  var c = document.getElementById(child );

  var top  = (c["at_position"] == "y") ? p.offsetHeight + 0 : 0;
  var left = (c["at_position"] == "x") ? p.offsetWidth + 2 : 0;

  for (; p; p = p.offsetParent)
  {
    top  += p.offsetTop;
    left += p.offsetLeft;
  }

  c.style.position   = "absolute";
  c.style.top        = "105px";    //top +'px';
  c.style.left       = left+'px';
  c.style.visibility = "visible";
  c.style.zIndex     = "4";
}

function at_show()
{
  var p = document.getElementById(this["at_parent"]);
  var c = document.getElementById(this["at_child" ]);

  at_show_aux(p.id, c.id);

  clearTimeout(c["at_timeout"]);
}

function at_hide()
{
  var c = document.getElementById(this["at_child"]);

  c.style.zIndex     = "3";

  c["at_timeout"] = setTimeout("document.getElementById('"+c.id+"').style.visibility = 'hidden'", 200);
}

function at_click()
{
  var p = document.getElementById(this["at_parent"]);
  var c = document.getElementById(this["at_child" ]);

  if (c.style.visibility != "visible")
       at_show_aux(p.id, c.id);
  else c.style.visibility = "hidden";

  return false;
}

function at_attach(parent, child, showtype, position, cursor)
{
  var p = document.getElementById(parent);
  var c = document.getElementById(child);

  p["at_parent"]     = p.id;
  c["at_parent"]     = p.id;
  p["at_child"]      = c.id;
  c["at_child"]      = c.id;
  p["at_position"]   = position;
  c["at_position"]   = position;

  c.style.position   = "absolute";
  c.style.visibility = "hidden";

  if (cursor != undefined) p.style.cursor = cursor;

  switch (showtype)
  {
    case "click":
      p.onclick     = at_click;
      p.onmouseout  = at_hide;
      c.onmouseover = at_show;
      c.onmouseout  = at_hide;
      break;
    case "hover":
      p.onmouseover = at_show;
      p.onmouseout  = at_hide;
      c.onmouseover = at_show;
      c.onmouseout  = at_hide;
      break;
  }
}



// Script für den Marquee-Container

/***********************************************
* Cross browser Marquee II- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/

var delayb4scroll=0 //Specify initial delay before marquee starts to scroll on page (2000=2 seconds)
var marqueespeed=1 //Specify marquee scroll speed (larger is faster 1-10)
var pauseit=1 //Pause marquee onMousever (0=no. 1=yes)?

////NO NEED TO EDIT BELOW THIS LINE////////////

var copyspeed=marqueespeed
var pausespeed=(pauseit==0)? copyspeed: 0
var actualheight=''

function scrollmarquee(){
if (parseInt(cross_marquee.style.top)>(actualheight*(-1)+8)) //if scroller hasn't reached the end of its height
cross_marquee.style.top=parseInt(cross_marquee.style.top)-copyspeed+"px" //move scroller upwards
else //else, reset to original position
cross_marquee.style.top=parseInt(marqueeheight)+8+"px"
}

function initializemarquee(){
cross_marquee=document.getElementById("vmarquee")
cross_marquee.style.top=0
marqueeheight=document.getElementById("marqueecontainer").offsetHeight
actualheight=cross_marquee.offsetHeight //height of marquee content (much of which is hidden from view)
if (window.opera || navigator.userAgent.indexOf("Netscape/7")!=-1){ //if Opera or Netscape 7x, add scrollbars to scroll and exit
cross_marquee.style.height=marqueeheight+"px"
cross_marquee.style.overflow="scroll"
return
}
setTimeout('lefttime=setInterval("scrollmarquee()",30)', delayb4scroll)
}

if (window.addEventListener)
window.addEventListener("load", initializemarquee, false)
else if (window.attachEvent)
window.attachEvent("onload", initializemarquee)
else if (document.getElementById)
window.onload=initializemarquee


// Script für Album-Slideshow

var n=0;

function start() {
  if(!(nextExists(0))) window.document.getElementById('forward').className='AlbumSlideFOFF';
}

function position(pos) {
  if (pos==(pics.length-1)) {
    window.document.getElementById('back').className='AlbumSlideB';
    window.document.getElementById('forward').className='AlbumSlideFOFF';
  }
  if (pos==0) {
    window.document.getElementById('back').className='AlbumSlideBOFF';
    window.document.getElementById('forward').className='AlbumSlideF';
  }
  if (pos>0 && pos<(pics.length-1)) {
    window.document.getElementById('back').className='AlbumSlideB';
    window.document.getElementById('forward').className='AlbumSlideF';
  }
} 

function nextExists(pos) {
  if (pos<=(pics.length-2)) return true;
    return false;
}
function prevExists(pos) {
  if (pos>=1) return true;
    return false;
}
function next() {
  if(nextExists(n)) {
    n+=1;
//    position(n); PFEILSTUEUERUNG!!!
    window.document.getElementById('Hauptbild').src = pics[n];
    window.document.getElementById('Hauptbild').attributes.alt.nodeValue = titel[n];
    window.document.getElementById('quelle').firstChild.nodeValue = quelle[n];
  } else {
    n=0;
//    position(0);
    window.document.getElementById('Hauptbild').src = pics[0];
    window.document.getElementById('Hauptbild').attributes.alt.nodeValue = titel[0];
    window.document.getElementById('quelle').firstChild.nodeValue = quelle[0];
  }
}
function back() { 
  if (prevExists(n)) {
    n-=1; 
//    position(n);
    window.document.getElementById('Hauptbild').src=pics[n];
    window.document.getElementById('Hauptbild').attributes.alt.nodeValue = titel[n];
    window.document.getElementById('quelle').firstChild.nodeValue = quelle[n];
  } 
} 

