<div style="text-align:center;">{+new Link().toFile("index.html").withText("Class Index")+}
| {+new Link().toFile("files.html").withText("File Index")+}</div>
<hr>
<details id="myElList" open class="details">
    <summary onClick="switchList('myElList')" class="summary">Elements</summary>
    <ul class="classList">
    	<for each="thisClass" in="data">
        	<li>{!
    		if(thisClass.isPseudo)
	    		output += new Link().toClass(thisClass.alias);
	        !}</li>
	    </for>
    </ul>
</details>
<details id="myClList" open class="details">
    <summary onClick="switchList('myClList')" class="summary">Classes</summary>
    <ul class="classList">
    	<for each="thisClass" in="data">
	      <li>{!
	      	if (thisClass.alias == "_global_") {
	      		output += "<i>"+new Link().toClass(thisClass.alias)+"</i>";
	      	}
	      	else {
	      		if(!thisClass.isPseudo)
	      			output += new Link().toClass(thisClass.alias);
	      	}
	      !}</li>
	    </for>
    </ul>
</details>
<hr>

<script>
  /* <![CDATA[ */

	function initList(id) {
      var val, c,
        cookieList = document.cookie.split('; ');

     // console.log(document.cookie);
      for(c = 0; c < cookieList.length; c++) {
        if(cookieList[c].indexOf(id.toLowerCase() + 'open') != -1) {
          val = cookieList[c].split('=')[1];
          if (val === '1') {
            document.getElementById(id).setAttribute('open', '');
            console.log(id, "open");
          } else {
            document.getElementById(id).removeAttribute('open');
            console.log(id, 'close')
          }
        }
      }
  	};

   	function switchList(id) {
        var val = document.getElementById(id).getAttribute('open');
        if (val === null) {
            val = '1';
        } else {
            val = '0';
        }
        // document.cookie = id.toLowerCase() + 'open=' + val + ';max-age=0';
        document.cookie = id.toLowerCase() + 'open=' + val + '';
  	};

  	initList('myElList');
    initList('myClList');
  /* ]]> */
</script>
