$(document).ready(function() {

   
    Faq.init();
    
    
    $('p a img').parent().css('border', 'none');
    

      
});

var Faq =
{
	init:function()
	{
		// Only run on faq page
		if ( !jQuery('.page-id-20').length > 0)
		{
			return false;
			
		}
		
		
		
		var $container = $('#post-20'); 
		$container.find('p').not(':first').hide(); // Hide all categories in col-content except the first 
 
    $container.find('h3').css('cursor','pointer');
 
		$container.find('h3').click(function() // Lightweight accordion when click on headers in one category
		{
			var $target = $(this).next('p'); // The p we want to show
			
      var $current = $container.find('div p:visible'); // The currently opened one (if any)

			// Set boolean if we only want to hide a div. This is if the currently opened one is clicked again
			var just_hide = false;

			if ($target.is(':visible'))
			{
				just_hide = true;
			}

			if ($current.size()) // Check if we have an open div. If so, slide that one up
			{
				$current.slideUp('fast',function()
				{
					if ( ! just_hide) // Check if we need to open a div
					{
						$target.slideDown('normal');
					}
				});
			}
			else // This is if no div is open. So just show the wanted one
			{
				$target.slideDown('normal');
			}

			return false;
		});

	   var $container = $('#post-20'); 
    $container.find('h3:first').next('p').slideDown('normal');
	}
};
