$(document).ready(function() {
    $('.slideshow').cycle({
		fx: 'fade'
	});
	$('#featured').cycle({ 
 		fx:     'scrollLeft',
        speed:  '1000',
        timeout: 6000,
        pager:  '#featurednav'
});


	$('#mainimg').cycle({
		fx: 'fade',
		speed: 3000,
		timeout: 6000
	});
	
	$('.colorbox').colorbox();
 
    $("div.scrollable").scrollable({size:2}).circular().autoscroll({interval : 5000});
 	
	$('.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;
	});
	
}); 
