window.addEvent('domready', function(){
	var accLinks = $$('.accLink');
	
	accLinks.each(function(el, i){
		//do not use stop event as your link have to do their link job
		el.addEvent('click', function(){
			//retrieves the rel of the clicked link
			var ziRel = el.getProperty('rel');
			//and put it in the cookie
			Cookie.set('accSelect', ziRel);
		});
	});
	//your acc elements and togglerglers array
	var togs	= $$('#accordion .tog'); 
	var elems	= $$('#accordion .element');
	
	//retreive the cookie value if there is
	if (Cookie.get('accSelect')) {
		var accSelect = Cookie.get('accSelect');
		//initialize an array of the divs ids
		var elemsId = [];
		//and then put all the div ids into it
		elems.each(function(el, i){
			var ziId = el.getProperty('id');
			elemsId.push(ziId);
		});
		//here we are
		var voir = elemsId.indexOf(accSelect);
	}
	//in case you arrive on the page without having clicked on a concerned link
	else {
		var voir = 0;
	}
	//this is the acc statement
	var myAcc = new Accordion('h2.atStart', 'div.atStart', {
		opacity			: false,
		alwaysHide		: true,
		display			: voir,
		onBackground	: function(toggler) {
			toggler.setStyle('color', '#661417');
     toggler.addClass('openBgImage');
      toggler.removeClass('noopenBgImage'); // ADDED
		},
		onActive		: function(toggler) {
			toggler.setStyle('color', '#661417;');
      toggler.addClass('noopenBgImage');
     toggler.removeClass('openBgImage'); // ADDED
		}
	});
});
