window.addEvent('domready', function(){

	/*************************************************************
	 * Accordion 1
	 ************************************************************/

	var accordion1Show = false;
	var offset = 0;
	$$('#rgaccordmenu li span.toggle').each(function(anchorid, i) {
		if (anchorid.hasClass('open')) accordion1Show = offset;
		else offset++;
	});

	// show: show initially WITHOUT transition
	// display: display initially WITH transition
	var accordion1 = new Accordion('span.toggle', 'ul.content', {
		show: accordion1Show,
		display: false,
		alwaysHide: true,
		opacity: false,
		onActive: function(toggler, element){
			toggler.addClass('act');
			parentelement = element;
		},
		onBackground: function(toggler, element){
			toggler.removeClass('act');		
		}
	});	


	/*************************************************************
	 * Accordion 2
	 ************************************************************/

	var accordion2Show = false;
	var offset = 0;
	$$('span.toggle2').each(function(anchorid, i) {
		if (anchorid.hasClass('open')) accordion1Show = offset;
		else offset++;
	});

	accordion2 = new Accordion('span.toggle2', 'ul.content2', {
		show: accordion2Show,
		display: false,
		alwaysHide: true,
		opacity: false,
		onActive: function(toggler, element){
			toggler.addClass('act2');
			parentelement = element;
		},
		onBackground: function(toggler, element){
			toggler.removeClass('act2');		
		}
	});	

	/*************************************************************/



	/*************************************************************
	 * Accordion 3
	 ************************************************************/
/*
	var accordion3Show = false;
	var offset = 0;
	$$('#nav-news li span.toggle3').each(function(anchorid, i) {
		if (anchorid.hasClass('open')) accordion3Show = offset;
		else offset++;
	});

	// show: show initially WITHOUT transition
	// display: display initially WITH transition
	var accordion3 = new Accordion('span.toggle3', 'div.content3', {
		show: accordion3Show,
		display: false,
		alwaysHide: true,
		opacity: false,
		onActive: function(toggler, element){
			toggler.addClass('act');
			parentelement = element;
		},
		onBackground: function(toggler, element){
			toggler.removeClass('act');		
		}
	});
*/

	$$( '.rgaccord1-nest' ).each(function(item){
	  var thisSlider = new Fx.Slide( item.getElement( '.rgaccord1-content' ), { duration: 500 } );
	  //thisSlider.hide();

	  item.getElement( '.rgaccord1-toggle' ).addEvent( 'click', function(){ 
	    thisSlider.toggle(); 

	    // add the act class
	    if (item.getElement( '.rgaccord1-toggle' ).hasClass('act')) {
	      item.getElement( '.rgaccord1-toggle' ).removeClass('act');
	    } else {
	      item.getElement( '.rgaccord1-toggle' ).addClass('act');
	    }

	  });
	});


});

