$( function(){ 
    $('#header_img').innerfade({ speed: 'slow', timeout: 8000, type: 'sequence', containerheight: '135px' });
    $("#mainNav").lavaLamp({ fx: "backout", speed: 700 });
    $('#my_gallery').jqGalViewII();
    $.addCelsiusClickHandler();
});

jQuery.addCelsiusClickHandler = function(){
    $("#mainNav a, #leftNav a").click(function(){
        var $this = this;
        $('#image_section').hide("drop", { direction: "right" }, 700 );
        $('#content_middle').hide("drop", { direction: "right" }, 700, function(){
            $.get($($this).attr('href'), function(html){
                $('#leftNav li').removeClass('current');
                $($this).parent().addClass('current');
                $('#content_middle').html($('#content_middle', html) .html());
                $('#content_middle').show("blind", { direction: "vertical" }, 700);
                $('#image_section').html($('div.main_img', html) .html());
                $('#image_section').show("blind", { direction: "vertical" }, 700);
                $('#my_gallery').jqGalViewII();
            });
        });
        return false;
    });
};

// Makes the registration form opens in a thickbox window
  $('a.thickbox.enquiry').each(function(){
    var url = $(this).attr('href');
    $(this).attr('href', '#TB_inline?' + url.split('?')[1] + '&height=470&width=520&inlineId=enquiryForm');
  });
  
  // hide and reveal the "other" option in the sources form
  var option_other = $('#frmEnquiry #enquiry_other_source').parent();
  option_other.hide();
  $('#enquiry_source').change(function(){
    if($('option:selected', this).text() == 'Other')
    {
      $(option_other).show();
    }
    else
    {
      option_other.hide();
    }
  });