$(document).ready(function()
{

  // FLASH FONTS
  // (Disabled as they double up on IE8)
  // $("h3").sifr({path: 'flash/', font: 'NeoSans', build:436, version:3, forceSingleLine:true});

  // HEADER MENU
  $("#header li a").each(function()
  {
    var itemname = $(this).html();
    $(this).html("<img src='images/" + itemname + ".png' alt='Home'/>");
    $(this).mouseenter(function()
      {
	$(this).children().stop().animate({paddingTop: "5px", paddingBottom: "15px"}, 100);
	//$(this).animate({opacity: 0.5 }, 100)
      }).mouseout(function()
	{
	  $(this).children().animate({paddingTop: "10px", paddingBottom: "10px"}, 100);
	});
      });


  // BUTTON ANIMATION
  $(".jq-bump").mouseenter(function()
  {
    $(this).animate({marginLeft: "5px"}, 100);
  }).mouseout(function()
    {
      $(this).animate({marginLeft: "0px"}, 100);
    });


  // POPUPS
  $("a.popup").fancybox({frameWidth: 730,
			 frameHeight: 404});

  // FORMS
  $("#submit").click(function()
  {
    // Show loading graphic
    $(".fp-form .error").html('<img src="images/ajax-loader.gif" alt="Loading..." />');
    var formName = $("#name").val();
    var formEmail = $("#email").val();
    var formEnquiry = $("#enquiry").val();
    $.post("form-submit.php",
    { name: formName, email: formEmail, enquiry: formEnquiry, submit: 'submit' },
    function(data)
      {
	if(data.indexOf ('Thanks') != -1){
	  $(".fp-form .inner").html('<div class="thanks">' + data + '</div>');
	}
	else
	{
	  $(".fp-form .error").html(data);
	};
      });

    return false;
  });
});

