(function() { var $ = jQuery; if(!window.Stage) window.Stage = {}; window.Stage.xml = 'http://der-warnemuender.de/public//swf/xml/images.winter.xml'; function Stage(options) { var ref = this; this.index = 0; this.lists = []; this.options = $.extend({ waitTime : 5000, changeDuration : 1000 }, options); this.init = function() { var stage = $('#div_flash_header'); var ul = $(document.createElement('ul')); stage.append(ul); $.ajax({ url : window.Stage.xml, dataType : 'xml', success : function(data) { var doc = data; var root = doc.documentElement; $('img src', root).each(function() { var li = $(document.createElement('li')); var img = $(document.createElement('img')); img.attr('src', this.firstChild.data); li.append(img); ul.append(li); }); ref.start(); } }); }; this.start = function() { this.lists = $('#div_flash_header li'); this.lists.each(function() { this.style.zIndex = 0; }); $(this.lists[this.index]).css('z-index', 2); if(this.lists.length > 1) setInterval(function() { ref.change(); }, this.options.waitTime ); }; this.change = function() { var oldIndex = this.index; $(this.lists[oldIndex]).css('z-index', 1); ++this.index; if(this.index >= this.lists.length) this.index = 0; $(this.lists[this.index]).css('opacity', 0).css('z-index', 2).animate({opacity : 1.0}, this.options.changeDuration, function() { $(ref.lists[oldIndex]).css('z-index', 0); }); }; (function() { ref.init(); })(); } $(document).ready(function() { new Stage(); }); })();
