
$(document).ready(function() {
    document.body.className += "hasJs";
	
	// Hide all answers to FAQs
	$(".faq ul li span.answer").hide();
	
	// Show or hide answers to FAQs when FAQ is clicked on
	$('.faq ul li a').click(function() {
		var spanner=$(this).parent().find('span.answer');
		if ((spanner).is(':visible')){
			spanner.hide();
			$(this).parent().css("background","url(../images/icons/arrow_red_right.png) no-repeat 0 11px");
		}
		else {
			spanner.show();
			$(this).parent().css("background","url(../images/icons/arrow_red_down.png) no-repeat 0 14px");
		}
		return false;
	});
	
	
	// Our Famous Sausages page, picture frames overlapping
	$(".famousSausages .pictureFrame .inner .infoNI").hide();
	$(".famousSausages .pictureFrame .top h3").show();
	
	$('.famousSausages .pictureFrame .top h3 a').click(function() {
		if ($(this).parent().hasClass('titleIng')) {
			$(this).parent().removeClass("off");
			$(this).parent().siblings().addClass("off");
			$(this).parent().parent().parent().find('.infoNI').hide();
			$(this).parent().parent().parent().find('.infoIng').show();
		}
		else if ($(this).parent().hasClass('titleNI')) {
			$(this).parent().removeClass("off");
			$(this).parent().siblings().addClass("off").css('backgroundPosition','right 0');
			$(this).parent().parent().parent().find('.infoIng').hide();
			$(this).parent().parent().parent().find('.infoNI').show();
		}
		return false;
	});
	
	
	// CTA buttons - gradient flips over on hover
	$("a.ctaButton").hover(
	  function () {
		$(this).css("backgroundImage","url(../images/buttons/cta_red_right_hi.png)");
		$(this).find("span").css("backgroundImage","url(../images/buttons/cta_red_left_hi.png)");
	  }, 
	  function () {
		$(this).css("backgroundImage","url(../images/buttons/cta_red_right.png)");
		$(this).find("span").css("backgroundImage","url(../images/buttons/cta_red_left.png)");
	  }
	 );

	$(".ctaButton input").hover(
	  function () {
		$(this).parent().css("backgroundImage","url(../images/buttons/cta_red_right_hi.png)");
		$(this).css("backgroundImage","url(../images/buttons/cta_red_left_hi.png)");
	  }, 
	  function () {
		$(this).parent().css("backgroundImage","url(../images/buttons/cta_red_right.png)");
		$(this).css("backgroundImage","url(../images/buttons/cta_red_left.png)");
	  }
	 );

	
});

