jQuery.fn.eachDelay = function(callback, speed){
	return jQuery.eachDelay( this, callback, speed)
}
jQuery.extend({
	eachDelay: function(object, callback, speed){ 
		var name, i = -1, length = object.length, $div = $('<div>'), id;
		if (length === undefined) { //not an array process as object
			var arr = [], x = -1;
			for (name in object) arr[++x] = name; 
			id = window.setInterval(function(){
			 if( ++i === arr.length || callback.call(object[ arr[i] ], arr[i], object[ arr[i] ]) === false) 
			 	 clearInterval(id);
			}, speed);	
		}
		else { //array-compatible element ie. [], jQuery Object
			id = window.setInterval(function(){ 
				if (++i === object.length || callback.call(object[i], i, object[i]) === false) 
					clearInterval(id);
			}, speed);
		}
		return object;
	}
});

$(document).ready(function(){
	$('#fadePanel div').hide();
	$('#cont1').show();

	$('#fade a').click(function(){
		$('#fadePanel div').fadeOut('slow');
		$(this.hash).fadeIn('slow');
		return false;
	});

	$('#fade a').eachDelay(function(i){ if( i == 0 ){ return; } $(this).trigger('click'); }, 4000);
	$.timer(12000, function (timer) {
   		$('#fade a').eachDelay(function(i){ $(this).trigger('click'); }, 4000);
	});
});
