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

	var qanswers = 0;
	$('dlspc').set('opacity',0);

	$$('a.questiony').each(function(el){
		el.addEvent('click', function(e){
			var theparent = el.getParent().getParent().getParent();
			qanswers++;
			
			if (qanswers == 6) {
				$('qspc').fade('out');
				(function(){
					$('qspc').destroy();
					$('dlspc').fade('in');
				}).delay(900);
			} else {
				el.setStyle('color', '#0f0');
				(function(){
					theparent.getPrevious('h4').fade('out');
					theparent.getPrevious('small').fade('out');
					theparent.fade('out');
					(function(){
						theparent.getPrevious('h4').destroy();
						theparent.getPrevious('small').destroy();
						(function(){theparent.destroy();}).delay(25);
					}).delay(500);
				}).delay(900);
			}
			e.stop();
		});
	});
	
	$$('a.questionn').each(function(el){
		el.addEvent('click', function(e){
			el.setStyle('text-decoration', 'line-through');
			el.setStyle('color', '#f00');
			e.stop();
		});
	});
	
});