

var i = 0;//initialize
var int=0;//Internet Explorer Fix
var imageCount = 0;
$(window).bind("load", function() {//The load event will only fire if the entire page or document is fully loaded
	imageCount =  $('#MainColSlideshow img').length;
	var int = setInterval("doThis(i)",200);//500 is the fade in speed in milliseconds
});

function doThis() {
	if (i == imageCount - 1) {// Loop the images
		clearInterval(int);//When it reaches the last image the loop ends
		startSlideshow();
	}
	$('img:hidden').eq(0).fadeIn(200);//fades in the hidden images one by one
	i++;//add 1 to the count

}

function startSlideshow() {
    $('#MainColSlideshow').cycle({ 
		fx: 'fade',
        speed: 500,
		timeout: 4000,
		pager:  '#nav',
		pagerAnchorBuilder: function(idx, slide) { 
		        return '<a href="#"></a>'; 
		    }
    });
}
