
$(document).ready(function() {

    
    if($('#search_mls').length > 0) {
        $('#search_mls').bind('focusin', function() {
            if($('#search_mls').val() == 'Enter MLS #') {
                $('#search_mls').val('');
            }
        }).bind('focusout', function() {
            if($('#search_mls').val() == '') {
                $('#search_mls').val('Enter MLS #');
            }
        });
    }

});


    
    $('#main_slideshow .slideset').each(function(){

        var slides = $(this).find('.slide');
        var width  = $(this).width(), height = $(this).height();

        slides.css({
            'width'  : width,
            'height' : height
        });

        slides.each(function() {
            $(this).find('img').each(function () {
                var $this = $(this);
                $this.attr('src', '/thumbs/' + width + 'x' + height + '/' + $this.attr('delayedsrc'));
                $this.closest('.slide').not('.active').css('opacity', 0);
            });
        });

        setInterval(function () {

            var slides = $('#main_slideshow').find('.slide');

            var active = slides.filter('.active');

            if (active.length == 0) active = slides.filter(':first');

            var next = active.next().length ? active.next() : slides.filter(':first');

            active.removeClass('active').animate({opacity: 0.0}, 500, function() {
                next.show().addClass('active').animate({opacity: 1.0}, 500);
            });

        }, 5000);

    });


