window.addEvent('load', function(){
	if(el = $$('.news')[0]){
		  var j = 0;
		  var jl = newsArray.length;
		
	      var newsIn = function(){
			if (j == (jl - 1)){
				j = 0;
			} else {
				j = j + 1;
			}
	        el.innerHTML = newsArray[j];
	        el.effect('opacity').custom(0,1);
	      };
	      (function(){
	        el.effect('opacity', {onComplete: newsIn}).custom(1,0)
	      }).periodical(newsspeed * 1000);
	}
	if(el2 = $('topleftbox')){
		var n = 0;
		var l = 0;
		var fl = imgArray.length;
		(function(){
			if (l == (fl - 1)){
				n = 0;
			} else {
				n = l + 1;
			}
			var newfadeimg = new Element('img');
			newfadeimg.setProperty('id','fadeimg' + n).setProperty('src',imgArray[n]).setStyle('position','absolute').setStyle('z-index','55').setOpacity(0).injectBefore($('fadeimg' + l));
			newfadeimg.effect('opacity',{duration:(imgduration * 1000),onComplete: function(){
				$('fadeimg' + l).remove();
				l = n;
				newfadeimg.setStyle('z-index','5');
			}}).start(1);
		}).periodical(imgspeed * 1000);
	}
	imgArray.each(function(o,i){
		new Asset.image(o);
	});
});