(function(w, d){

function $id(id) {
	return d.getElementById(id);
};

w.dmf = {
	slideshow: (function() {
		var
			elm,
			items = null,
			index = 0,
			zIndex = 2;
		var fx = new secoya.fx({
			from: 0,
			to: 100,
			duration: 1,
			callback: function(x) {
				lightCore.setOpacity(elm, x);
			},
			finish: function() {
				setTimeout(startFx, 6000);
			}
		});
		function startFx() {
			if (items.length > 1) {
				index--;
				if (index < 0)
					index = items.length-1;
				elm = items[index];
				elm.style.zIndex = zIndex++;
				fx.start();
			}
		};
		return function() {
			items = $id('flash').getElementsByTagName('div');
			index = items.length -1;
			setTimeout(startFx, 6000);
		};
	})()
};

})(window, document);
