// JavaScript Document
/* ================================================================ 
This copyright notice must be untouched at all times.

The original version of this script is 
Copyright (c) 2010 by Oliver Haufe. All rights reserved.
This script and the associated (x)html may be modified in any 
way to fit your requirements.

if you want all hidden at start place a

.innerAccordion {
display:none;
}

in your stylesheet

=================================================================== */

hideacc = function() {
    // hide all
    var divs = document.getElementsByTagName('div');  
    var divsL = divs.length;  
    for(var i = 0; i< divsL; i++)  
        {  
         if(divs[i].className == "innerAccordion")  
            {  
            divs[i].style.display = "none";  
            }  
        }  
}  

accordion = function() {
    var divs = document.getElementsByTagName('div');  
    var divsL = divs.length;  
	var getAgn = divs;
	
	hideacc();
    for(var i = 0; i< divsL; i++)  
        {  
		 if(divs[i].className == "outerAccordion") {
			   divs[i].onclick=function() {
				   
				 //  debugger
                   var nS = this.nextElementSibling || this.nextSibling.nextSibling  
				 
				 if (this.nextElementSibling) {
				      nS = this.nextElementSibling;
					 }
				   else
				     {
					 nS = this.nextSibling;
                      while(nS && nS.nodeType !== 1)
                            nS = nS.nextSibling ;
					 }
				   if(nS.style.display == "none")  
                     {  
					 hideacc();
                     nS.style.display = "inline";       
                     }  
                   else if(nS.style.display == "inline")  
                     {  
                     nS.style.display = "none"; 
                     }  
                  } 
		    } 
		 
         if(divs[i].className == "innerAccordion")  
            {  
            divs[i].style.display = "none";  
            }  
        }     
}  
	
