var kv_timer = null;

function show_next() {
	clearTimeout(kv_timer);
	$("div[id^='kepvalto-']").each(function() {
		if($(this).css('z-index')==1050) {
			id = $(this).attr("id");
			id = id.substring(9);
			return false;
		}
	});
	next = parseInt(id)+1;
	if(!$("div#kepvalto-"+next).length) {
		next = 1;
	}
	$("#kepvalto-"+next).css('z-index', '1049');
    $("#kepvalto-"+id).fadeOut(1000,function() {
        $("#kepvalto-"+id).css('z-index', '-1').show();
        $("#kepvalto-"+next).css('z-index', '1050');
		kv_timer = setTimeout( 'show_next()', 5000);
    });	
}

$(window).load(function() {
    $("#kepvalto-1").css('z-index', '1050');
	kv_timer = setTimeout( 'show_next()', 5000);
})

