
/* All time units are milliseconds. */
var featureDuration = 200;          /* The time it takes for a feature box to appear. */
var pause = 10;                     /* The time between a feature box becoming fully visible and the next one starting to appear. */

$(document).ready(function(){

	if (document.documentElement && document.documentElement.clientWidth && document.documentElement.clientWidth <= 480) {
		var maxHeight = 0;
		$(".feature, .new-hiring").each(function() {
			var height = $(this).height();
			if (height > maxHeight) maxHeight = height;
		});
		$(".feature, .new-hiring").height(maxHeight+72);
		return;
	}

    var elements = $(".feature .inner, #showreel .inner, .new-hiring .inner, .person .inner, #slideshow .inner, #short-film .inner, #book .inner, #join-ping-pong .inner");
    elements.each(function() {
        $(this).css("top", (($(this).height()+10) * -1) + "px");
    });

    function showElements(elements) {
        var current = elements.eq(0);
        current.animate({
            top: "0"
        }, featureDuration, "linear", window.setTimeout(function() {
            showElements(elements.slice(1));
        }, featureDuration+pause));
    }
    window.setTimeout(function() {
        showElements(elements);
    }, 200);
});

