/*
  demo1.js
  Collapsible/Expandable Sections
  This is the Javascript for the tutorial in the X Quick-Start document.
*/

xAddEventListener(window, 'load', initializeCollapsibleProgramm, false);

function initializeCollapsibleProgramm()
{
  var i, icon, headings = xGetElementsByClassName('collapsibleProgramm');


//document.getElementById("service1").style.display = 'none';
//document.getElementById("service2").style.display = 'block';
//document.getElementById("service3").style.display = 'block';

for (i = 0; i < headings.length; i++) {
icon = document.createElement('div');
icon.collapsibleSection = xNextSib(headings[i]);
icon.onclick = iconOnClickProgramm;
icon.onclick();
//icon.onmouseover = iconOnMouseover;
//icon.onmouseout = iconOnMouseout;
headings[i].appendChild(icon);
}


var  alle = xGetElementsByClassName('exp_containerProgramm');

for (j = 0; j < alle.length; j++) {
//if (j == 0){
// immer das erste ausgeklappt zeigen jetzt deaktiviert
//alle[j].style.display='block';
//headings[j].lastChild.className='CollapseIcon';
//headings[j].lastChild.title = 'Schließen';
//} else {


alle[j].style.display='none';

headings[j].lastChild.className='ExpandIcon';
headings[j].lastChild.title = 'Öffnen';
//}
}

}



function iconOnClickProgramm()
{

var container = xGetElementsByClassName('exp_containerProgramm');
var headerlines = xGetElementsByClassName('collapsibleProgramm');


var section = this.collapsibleSection;

// für programm-seite ausschalten: zuklappen wenn anderer container aufgeklappt wird

//for (x = 0; x < container.length; x++) {
//if (container[x] !=  section) {
//container[x].style.display = 'none';

//if (navigator.appName != "Microsoft Internet Explorer") {
//headerlines[x].lastChild.className='ExpandIcon';
//headerlines[x].lastChild.title = 'Öffnen';
//}

//} 
//}

if (section.style.display != 'block') {
    section.style.display = 'block';

    this.className = 'CollapseIcon';
    this.title = 'Schließen';




  }  else {
    section.style.display = 'none';
    this.className = 'ExpandIcon';
    this.title = 'Öffnen';
  }




}

function iconOnMouseover()
{
  //this.collapsibleSection.style.backgroundColor = '#cccccc';
}

function iconOnMouseout()
{
 // this.collapsibleSection.style.backgroundColor = 'transparent';
}

