/*v.1.0
Made by Corné Hogerheijde @ Effectory*/
$(function(){
	var maxVal = $('#flash').find('img').size();
	//StartChanging input params: Startvalue -> on which imageblock to start, maxValue -> number of images to change, timeOut time -> time to wait before change, div id -> id of the div object in which to find the images
                if(maxVal != 1 && maxVal !=0)
                        $('#flash').StartChanging(1, maxVal, 8000, '#flash'); 
}); 

jQuery.fn.extend({
	StartChanging: function(curval, maxVal, time, object){
		if (curval == maxVal + 1)
			curval = 1;
		setTimeout('$("' + object + '").ChangeFlashIn(' + curval + ',' + maxVal + ',' + time + ',"' + object + '")', time);
	},
	ChangeFlashIn: function(curval, maxVal, time, object){
			$(object).find('#banner' + curval).fadeTo(2000, 0); 
			curval = curval + 1;
			if(curval > maxVal)
				curval = 1;
		setTimeout('$("' + object + '").ChangeFlashOut(' + curval + ',' + maxVal + ',' + time + ',"' + object + '")', 800);
	},
	ChangeFlashOut: function(curval, maxVal, time, object){
		$(object).find('#banner' + curval).show().fadeTo(0,0).fadeTo(2000, 1);
		$(object).StartChanging(curval, maxVal, time, object);
	}
});

        
        
    


