
(function($) {
 /**
 * equalizes the heights of all elements in a jQuery collection
 * thanks to John Resig for optimizing this!
 * usage: $("#col1, #col2, #col3").equalizeCols();
 */

 $.fn.equalizeCols = function(){
 var height = 0,
 reset = $.browser.msie ? "1%" : "auto";

 return this
 .css("height", reset)
 .each(function() {
 height = Math.max(height, this.offsetHeight);
 })
 .css("height", height)
 .each(function() {
 var h = this.offsetHeight;
 if (h > height) {
 $(this).css("height", height - (h - height));
 };
 });

 };

})(jQuery);

$(document).ready(function() {
 $("#sidebar, #content").equalizeCols();
});

//fade images //
    var stack = []; 
 
    // preload images into an array; we will preload beach3.jpg - beach8.jpg 
    for (var i = 1; i <= 5; i++) { 
        var img = new Image(737,175); 
        img.src = 'http://www.st-andrews.ac.uk/~staorg/wordpress/wp-content/themes/alumni/images/montage' + i + '_bw.jpg'; 
        $(img).bind('load', function() { 
            stack.push(this); 
        }); 
    }  
 
    // start slideshow 
    $('#slideshow').cycle({ 
        timeout:  5000, 
        before:   onBefore
    }); 
 
    // add images to slideshow 
    function onBefore(curr, next, opts) { 
        if (opts.addSlide) // <-- important! 
            while(stack.length) 
                opts.addSlide(stack.pop());  
    }; 

