    var count = 1;
    $(document).ready( function() {
        $(".scrollable").scrollable();
        $("#billy_clip").cycle({
			fx: 'fade',
			pager:"#fade_indicators"
		});
		$('#billy_clip1').cycle({
			fx: 'fade',
			pager:"#fade_indicators1"
		});
    
    $('.cross').live('click', function() {
	    var h = $(this).closest('li').height();
        $(this).closest('li').remove();
		$('#test').height -= h;
		$("#middle").height($("#middle").height()- 20);
		var scrollDiv = document.getElementById('mycustomscroll');
		if(scrollDiv.fleXcroll) scrollDiv.fleXcroll.updateScrollBars();

    });
	$(document).pngFix(); 
	$('.friend-nyro').nyroModal({
		
	});
	
	
$("#addbtn").hover(
function(){
    $(this).toggleClass("addbtnhover")
});
$("#homerecipe p img").css("float", "none");
        $(".submit4").click(function(){location.href='register.php'});
        $("#imgb, #imga").click(function(){location.href='my-recipe-book.php'});

	$(".toprated").click(function(){
			location.href = "recipes_by_rating.php";
				  });
	
	$(".mostcommented").click(function(){
			location.href = "recipes_by_comment.php";
							  });
    $("#addbtn").click(function(){
        // check that we have text.
        
        if($(".sf_text").val() != ""){
            // add the another div to the list.
            count++;
            if(count % 2 == 0){
                $("#middle ul").prepend('<li class="alternate">'+$(".sf_text").val()+'<div class="cross" ></div></li>');
            }
            else{
                $("#middle ul").prepend('<li class="normal">'+$(".sf_text").val()+'<div class="cross" ></div></li>');
            }
            $(".sf_text").val("");
			if($("#middle").height()  != 100)
				$("#middle").height($("#middle").height() + 25);
             var scrollDiv = document.getElementById('mycustomscroll');
			if(scrollDiv.fleXcroll) 
				scrollDiv.fleXcroll.updateScrollBars();
            
        }
        else{
           alert("Please enter an ingredient.");
        }
        
    })
	
	$("#send-us-form").submit(function() {
		 if($("#name").val() != "" && $("#fname").val() != "" && $("#email").val() != "" && $("#femail").val() != "" ){
			 
			$.post('includes/mail-friend.php', $("#send-us-form").serialize());
			$(".cont").css("display", "none");
			$("#cont").css("visibility", "hidden");
			 
			$(".response").css("display", "block");
			$(".response").css("visibility", "visible");
		 
			return false;
		 }
		 else{
		 	alert("Please complete the form");
			 return false;
		 }
	});
	
	$('#contact-us-form').submit(function() {
		 if($("#name").val() != "" && $("#email").val() != "" && $("#message").val() != "" ){
			 
			$.post('includes/mail.php', $("#contact-us-form").serialize());
			$("#contentdiv").css("display", "none");
			$("#contentdiv").css("visibility", "hidden");
			 
			$("#thankyou").css("display", "block");
			$("#thankyou").css("visibility", "visible");
		 
			return false;
		 }
		 else{
		 	//alert("Please complete the form");
			 return false;
		 }
  		 

		 
	});
  /*  $("#create-your-own").hover(
		function() {
			$("#create-your-own #imgb").css("visibility", "hidden").fadeIn("fast");
			$("#create-your-own #imga").css("visibility", "visible").fadeIn("fast");
			$("#imgb, #imga").pngFix(); 
			
		},
		function() {
			$("#create-your-own #imga").css("visibility", "hidden").fadeIn("fast");
			$("#create-your-own #imgb").css("visibility", "visible").fadeIn("fast");
			$("#imgb, #imga").pngFix(); 
		}
		
	);
	$("#create-your-own-ex").hover(
		function() {
			$("#create-your-own-ex #imgb").css("visibility", "hidden").fadeIn("fast");
			$("#create-your-own-ex #imga").css("visibility", "visible").fadeIn("fast");
			$("#imgb, #imga").pngFix(); 
			
		},
		function() {
			$("#create-your-own-ex #imga").css("visibility", "hidden").fadeIn("fast");
			$("#create-your-own-ex #imgb").css("visibility", "visible").fadeIn("fast");
			$("#imgb, #imga").pngFix(); 
		}
		
	);
	$("#create-your-own-recipe").hover(
		function() {
			$("#create-your-own-recipe #imgb").css("visibility", "hidden").fadeIn("fast");
			$("#create-your-own-recipe #imga").css("visibility", "visible").fadeIn("fast");
			$("#imgb, #imga").pngFix(); 
			
		},
		function() {
			$("#create-your-own-recipe #imga").css("visibility", "hidden").fadeIn("fast");
			$("#create-your-own-recipe #imgb").css("visibility", "visible").fadeIn("fast");
			$("#imgb, #imga").pngFix(); 
		}
		
	);*/
	
	
	
	//#create-your-own
	$(".submit1, .submit2, .submit3, .submit4").hover(
		function() {
			$(this).toggleClass("submit-hover", true);
		},
		function() {
			$(this).toggleClass("submit-hover", false);
		});

	$(".calc, .calc2").hover(
		function() {
			$(this).toggleClass("calchover", true);
		},
		function() {
			$(this).toggleClass("calchover", false);
		});
	$(".submit2").click(
			  function(){
				  location.href = 'products.php?category_id=2';
			  }
			  );
	
	$(".cross").hover(
		function() {
			$(this).toggleClass("cross-hover", true);
		},
		function() {
			$(this).toggleClass("cross-hover", false);
		});
	


});
