$(document).ready(function() {
	$('a.menu_search').click(function(){
		$('#flashhandler').hide();
		$('#searchform').slideDown();	
	});

	$('#sidebar h2 span').click(function(){
		$(this).next().hide();
	});

	$('.morepictures').live('click', function() {
		var foo = $(this).attr('id');
		var exploded  = foo.split('-');
		var idprop = exploded['1'];
				$('#gallery-container-'+idprop).load('_RETS_property-photos.php?id_prop='+idprop);
				$('#gallery-container-'+idprop).slideToggle('500');

				//$(this).next('div.gallery-container').fancybox;
				//$("$(this).next('div.gallery-container img:first").trigger('click');
				
				return false;
	});
	

    function pagerFactory(idx, slide) {
        var s = idx > 2 ? ' style="display:none"' : '';
        return '<li'+s+'><a href="#">'+(idx+1)+'</a></li>';
    };

    if($("img").lenght){
	    $("img").lazyload({ 
	    	placeholder : "img/placeholder.png",
	        effect : "fadeIn",
	        threshold : 500
	    });	
    }

    if($(".fancy").lenght){
    	$(".fancy").fancybox();	
    }
    
    
    $('#searchform_neigh').change(function(){
        $.get("/includes/ajax.php?ajaxcall&complexdropdown="+$(this).val(), function(j){
            $("#searchform_complex").html(j);
          });
        });
    
    $('.searchsubmit').hover(function(){$(this).css('backgroundPosition', '0 -31px');},function(){$(this).css('backgroundPosition', '0 0');});
});
