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

Author     : Jordan Prybylski, JRD89
Name       : Quick FAQ's
Created    : Dec 23rd 2010 for CodeCanyon.com
Version    : 1.0
Help File  : For More information and help please read the help file
	       supplied with this file. If after reading the help file
	       you still need technical help. Please feel free to 
             email me via codecanyon.com
			 
///////////////////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////////////////*/

$(function(){
	
	//HIDE FAQS LIST WITH JQUERY FOR DEGRADING PURPOSE
	$('.post-content').css('display','none');
	
	//WHEN POST TITLE IS CLICKED, TOGGLE THE CONTENT
	$('.post-title a').click(function(e){
		var parent  = $(this).parent().parent();
		var content = parent.find('.post-content');
		
		if(content.is(':visible'))
		{
			content.slideUp(100,function(){
				content.hide();
			});
		}else
		{
			content.fadeIn(100,function(){
				content.show();
			});
		}
		e.preventDefault();
	});
	
	//WHEN EXPAND ALL IS CLICKED, TOGGLE VIEW OF ALL CONTENT
	$('a.expand-all').toggle(function(e){
		$(this).text('Hide All');
		$('.post-content').each(function(i,val){
			$(this).slideDown(100,function(){
				$(this).show();
			});
		});
		e.preventDefault();
	},function(e){
		$(this).text('Expand All');
		$('.post-content').each(function(i,val){
				$(this).slideUp(100,function(){
					$(this).hide();
				});
			});
			e.preventDefault();
	});
});
