/*
function toggleLesson(elem) {
if (elem.className == "closed") {
 elem.className = "open";
 elem.nextSibling.nextSibling.style.display = "block";
 } else {
	elem.className = "key_c";
	elem.nextSibling.nextSibling.style.display = "none";
  }
}

*/


// JavaScript Document
this.jSlideToggle = function()
{
  try
  {
  	$( '.jSlideToggle .head' ).each(
  	  function()
  	  {
        if ( $( this ).children( 'h2' ).hasClass( 'closed' ))
        {
          $( this ).parent().children( '.content' ).hide();
        }

        if ( !$( this ).children( 'h2' ).hasClass( 'open' ) &&
             !$( this ).children( 'h2' ).hasClass( 'closed' ))
        {
  	      $( this ).children( 'h2' ).addClass( 'open' );
        }
      }
    );

  	$( '.jSlideToggle .head' ).click(

  	  function( e )
  	  {
  	    $( this ).parent().children( '.content' ).slideToggle();

        if ( $( this ).children( 'h2' ).hasClass( 'open' ) )
        {
  	      $( this ).children( 'h2' ).removeClass( 'open' );
  	      $( this ).children( 'h2' ).addClass( 'closed' );
        }
        else
        {
  	      $( this ).children( 'h2' ).removeClass( 'closed' );
  	      $( this ).children( 'h2' ).addClass( 'open' );
        }

        return false;
      }
    );

  }
  catch (e) {alert(e); }
};

// starting the script on page load
$( document ).ready( function() {
  jSlideToggle();
} );

