// JavaScript Document
$(document).ready(function() {
    $('.room a.rollover').click(function() {
        var section = $(this).closest('.section').not('.expanded');
        $('.section').removeClass('expanded');
        section.addClass('expanded');
    })

	$('.expanded a.rollover2').click(function(){
        var section = $(this).closest('.section');
        section.toggleClass('expanded');
		return false;
	})

    $('.auction_table .col1 a,.auction_table .col2 a,.auction_table .col3 a').click(function() {
        $(this).closest('.item').toggleClass('expanded');
        return false;
    });
    $(':input.date').datepicker({
        dateFormat: 'dd/mm/yy',
        numberOfMonths: [1, 2]
    });


	if($('.frames .slideshow img').size()>1){
		$('.slideshow').innerfade({ speed: 2000, timeout: 5000, type: 'sequence', containerheight: '541px' });		
	}
	
	if($('.room .slideshow img').size()>1){
		$('.slideshow').innerfade({ speed: 2000, timeout: 5000, type: 'sequence', containerheight: '270px'});		
	}
	
	if($('.event_banners a').size()>1){
		$('.event_banners').innerfade({ speed: 2000, timeout: 5000, type: 'sequence', containerheight: '203px'});		
	}
	
	if($('#discs a').size()>0){
		$('#discs').show();
	
	    $('#discs a').hover(function() {
	        $(this).fadeTo('slow', 0.8,
	        function() {
	            // Animation complete.
	            });
	    },
	    function() {
	        $(this).fadeTo('fast', 1,
	        function() {
	            // Animation complete.
	            });
	    });
		
	}

    $('a[rel="prettyPhoto"]').prettyPhoto({show_title:false});

	$('.map_content').each(function(){
		if($(this).find('img').size()>0){
			$(this).parent().find('a.map').show();
		}
	})
	
	var n=$('.team .team_member').size();
	
	if(n>0&&n%3>0){
		var n=3-(n%3);
		var $parent=$('.team');
		var template='<div class="team_member"><a class="rollover3" href="javascript:;"><img src="assets/images/teamshots/teamsquare-blank.jpg" />		</a></div>';
		for(i=0;i<n;i++){
			$parent.append(template);
		}
	}
	
	$('.item_content table').tablesorter();
})



/*

$.fn.pngFix = function() {
  if (!$.browser.msie || $.browser.version >= 9) { return $(this); }

  return $(this).each(function() {
    var img = $(this),
        src = img.attr('src');

    img.attr('src', '/assets/js/x.gif')
        .css('filter', "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled='true',sizingMethod='crop',src='" + src + "')");
  });
};
*/
