$(document).ready(function($) {
		jQuery("#question-container .answer").hide();
		QAjs.addListeners();
});

var QAjs = {
  
  addListeners : function(){
  	
			jQuery('.question h2').live('click', function(){
				
				var el = $(this);
				var q = el.parent();
				var p = q.find('.answer');
				
				if(p.css("display") == "none"){
					total = $("#content").height() + p.height();
					$("#content").height(total);
					p.slideDown(500, function(){
						q.addClass("on");
						$("#content").height($(".page-detail").height())
					});
			
				}else{
					p.slideUp(500, function(){
					$("#content").height($(".page-detail").height())
				});
					q.removeClass("on");
				}
				
			});
  },
  
  showAll: function(){
  	jQuery(".question .answer").slideDown();
  }
  
}
