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

	CSS on Sails Framework
	Title: Central Insurers Group
	Author: XHTMLized (http://www.xhtmlized.com/)
	Date: May 2011

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


$(document).ready(function() {

	//
	$('a[rel=_blank]').click(function(){
		this.target = "_blank";
	});

	//
	$('#navigation ul li ul').hide();
	$("#navigation ul li").hover(
		function () {
			$(this).children('ul').show();
		},
		function () {
			$(this).children('ul').hide();
		}
	);

	//
	$('#content .accordion-wrapper .accordion-header').each( function(){
		if ( $(this).hasClass('active') ) {
			$(this).next().show();
		}
	});
	$('#content .accordion-wrapper .accordion-header h2').live('click', function(){
		if ( $(this).parent().hasClass('active') ) {
			$(this).parent().removeClass('active');
			$(this).parent().next().hide();
		} else {
			$(this).parent().addClass('active');
			$(this).parent().next().show();
		}
	});
	$('#content .accordion-wrapper ul li:first-child').live('click', function(){
			$('#content .accordion-wrapper .accordion-header').addClass('active');
			$('#content .accordion-wrapper .accordion-content').show();
			return false;
	});
	$('#content .accordion-wrapper ul li:last-child').live('click', function(){
			$('#content .accordion-wrapper .accordion-header').removeClass('active');
			$('#content .accordion-wrapper .accordion-content').hide();
			return false;
	});

});


