$(document).ready(function(){
    // Clear the postcode when you click on the postcode box
    $("input[name='search_postcode']").click(function(){
        if ($(this).val() == 'Postcode') {
            $(this).val("");
        }
    });
    // Start the portfolio
	if ($('ul.galleria').length >= 1) {
    	$('ul.galleria').galleria({
    		history   : false,
    		clickNext : true,
    		insert    : "#gallery",
    		onImage   : function(image,caption,thumb) {
    			image.css('display','none').fadeIn(1000);
    			caption.css('display','none').fadeIn(1000);
    			var _li = thumb.parents('li');
    			_li.siblings().children('img.selected').fadeTo(500,0.6);
    			thumb.fadeTo('fast',1).addClass('selected');
    			image.attr('title','Next image >>');
    		},
    		onThumb : function(thumb) {
    			var _li = thumb.parents('li');
    			var _fadeTo = _li.is('.active') ? '1' : '0.6';
    			thumb.css({display:'none',opacity:_fadeTo}).fadeIn(1500);
    			thumb.hover(
    				function() { thumb.fadeTo('fast',1); },
    				function() { _li.not('.active').children('img').fadeTo('fast',0.6); }
    			)
    		}
    	});
	}
});