﻿/*
window.addEvent('domready', function() {
	var accordion = new Accordion('#divLateral H2', '#divLateral DIV.conteudo', {
		opacity: false,
		show: 0,
		onActive: function(toggler, element) {
			element.getParent().setStyle('background-color', '#397491');
		},

		onComplete: function(toggler, element) {
			// var size = $("divLateral").getSize();
			// $("divMiolo").setStyle("height", size.y);
		},

		onBackground: function(toggler, element) {
			element.getParent().setStyle('background-color', '#236485');
		}
	});
});
*/

$(document).ready(function() {
	$('#divLateral .lateral H2').click(function() {
		// Resetamos propriedades
		$('#divLateral .lateral').css('background-color', '#236485');
		
		var item = $(this);
		
		$('#divLateral .lateral').each(function(i) {
			if ($(this).find("H2").text() == item.text()) {
				$(this).find(".conteudo").animate({ height: 'show', opacity: 'show' }, 'fast');
			} else {
				$(this).find(".conteudo").animate({ height: 'hide', opacity: 'hide' }, 'slow');
			}
		});
		
		$(this).parent().css('background-color', '#397491');
	})
});