currentIndex = 0;
indexImgs = new Array("images/banner/01.jpg", "images/banner/03.jpg", "images/banner/04.jpg", "images/banner/05.jpg", "images/banner/06.jpg", "images/banner/07.jpg");


$(document).ready(function(){
    
    (function($) {
	  var cache = [];
	  // Arguments are image paths relative to the current page.
	  $.preLoadImages = function() {
		var args_len = arguments.length;
		for (var i = args_len; i--;) {
		  var cacheImage = document.createElement('img');
		  cacheImage.src = arguments[i];
		  cache.push(cacheImage);
		}
	  }
	})(jQuery)
	
    jQuery.preLoadImages("images/banner/01.jpg", "images/banner/03.jpg", "images/banner/04.jpg", "images/banner/05.jpg", "images/banner/06.jpg", "images/banner/07.jpg");
    
    $("#indexImg").delay(2000).fadeOut(1000, function(){
        currentIndex++;
        $(this).attr("src", indexImgs[currentIndex]);
        $(this).fadeIn(1000);
        animate();
    });
    
	var windHeight = $(window).height();
	var windWidth = $(window).width();
	$("#introHolder").css({"height" : windHeight+"px"});
	$("#introHolder").css({"width" : windWidth+"px"});
	
    $("#eventStyling").delay(3000).fadeOut(1000);
    $("#stephanOt").delay(3000).fadeOut(1000, function(){
        $("#introFlower").delay(500).fadeOut(1000, function(){
            $("#indexIntro").delay(500).fadeOut(1000);
			$("#introHolder").delay(500).fadeOut(1000);
        });
    });
    
    

    /*
    $("#stephanotisFlower").mouseenter(function(){
        $("#footerText").animate({opacity: 0.5}, 700);
    });
    $("#stephanotisFlower").mouseleave(function(){
        $("#footerText").animate({opacity: 0}, 700);
    });
    */

    $("p[class*='hidden']").hide();

    $("p[class*='drop']").toggle(
        function(){
            $(this).parent().parent().find("p[class*='pink']").click();
            $(this).attr("class", "pink italic pointer");
            $(this).parent().find("p[class*='hidden']").slideDown(400);
            var html = $(this).parent().find(".hiddenInfo").html();
            $("#mainImg").fadeOut(200, function(){
                scroller = new Scroller(html);
            });
        },function(){
            $(this).attr("class", "grey drop pointer");
            $(this).parent().find("p[class*='hidden']").slideUp(400);
    });

    $("p[class*='open']").click();
});

function animate(){
    $("#indexImg").delay(5000).fadeOut(1000, function(){
        if(currentIndex < 5){
            currentIndex++;
        }else{
            currentIndex = 0;
        }
        $(this).attr("src", indexImgs[currentIndex]);
        $(this).fadeIn(1000);
        animate();
    });
}
