/**
 * @author adam
 */

$(document).ready(function() {
	
	var question = $('.question');
	
	question.hover(function() {
		if ($(this).attr('rel') !== "open") {
			$(this).css({
				'background': 'url(images/faq-arrow.gif) no-repeat right',
				'opacity': '1'
			});
		}
		
	}, function() {
		if ($(this).attr('rel') !== "open") {
			$(this).css({
				'background': 'none',
				'opacity': '0.7'
			});
		}
	});
	
	question.click(function() {
		$('.question').css({
			'background' : 'none',
			'opacity' : '0.7'
		}).attr('rel', '');
		
		$('.answer').hide();
		
		var id = $(this).attr('id').split("_");
		var aid = "a_"+id[1];
		
		$('#'+aid).fadeIn(500);
		$(this).css({
			'background' : 'url(images/tri_down.gif) no-repeat right',
			'opacity' : '1'
		}).attr('rel', 'open');	
		
	});
	
	
});
