$(function() { 
 
	$('#mainimg').cycle({
		fx: 'fade',
		speed: 3000,
		timeout: 6000
	});

	$('.colorbox').colorbox();
	$('.colorbox-link').colorbox({iframe:true, width:'95%', height:'85%'});

	// initialize scrollable
	$("#featuredpropertiesbox div.scrollable").scrollable({size:2}).circular().autoscroll({interval : 5000});
//	$("#newfeaturedpropertiesbox div.newscrollable").scrollable({size:1}).circular().autoscroll({interval : 5000});
//	$("#open-houses div.ohscrollable").scrollable({size:1, prevPage : '.prevPage_oh', nextPage : '.nextPage_oh'}).circular().autoscroll({interval : 4000});

	$("#newfeaturedpropertiesbox div.newscrollable").cycle({
		fx:			'fade',
		speed:		'fast',
		timeout:	0,
		next:		'.nextPage',
		prev:		'.prevPage'
	});
	$("#open-houses div.ohscrollable").cycle({
		fx:			'fade',
		speed:		'fast',
		timeout:	0,
		next:		'.nextPage_oh',
		prev:		'.prevPage_oh'
	});
 	
	$('#featuredpropertiesbox div.scrollable .items img').each(function(){
		$(this).load(function(){
			var h = parseInt($(this).height());
			
			if ( h < 168 ) {
				$(this).css('margin-top',168 - h +'px');
			}
			else if ( h > 168 ) {
				$(this).height('168');
			}
			
		});
	});
	
	$('.school').click(function(){
		var url = $(this).attr('href');
		window.open(url,'davies-schools','width=440,height='+ (screen.height-60) +',screenX=0,screenY=0,top=0,left=0,scrollbars=yes,resizable=yes');
		return false;
	});
	
}); 
