window.addEvent("domready", function(){
	window.scroll = new Fx.Scroll($('tickercontent'));
	window.scroll.set(0,0);
	//window.current_scroll = 0;

	window.DTicker = {
	        position : 0,
        	ticker  : null,

	        next    : function() {
                	try {
        	                window.scroll.toElement(window.DTicker.items[DTicker.position++]);
        	        } catch(e) {
	                        window.DTicker.position = 0;
				window.scroll.toTop();
				window.DTicker.next();
                	}

			// Resets the counter when it gets to the end
			var count = window.DTicker.items.length;
			if(DTicker.position==(count-2)) {
				window.DTicker.position = 0;
                                window.scroll.toTop();
	                }
        	}
	};

	window.DTicker.items = $$('#tickercontent div');
	var count = window.DTicker.items.length;
	
	window.DTicker.next();	//Seems to need to be run to get it to the point where it will scroll
	window.DTicker.next.periodical([3500]);

	// Testing 
	var news = $$('#openimage div');
	$$('#openimage div').each(function(el) {
		el.addEvent("click", function() {

			collapseAll = function() {
				$$("#openimage div.active").each(function(el) {
					//el.tween('background-color', "#0D3F2C", "#9EB2AA");
					el.className = "";
					el.morph({
						'width' : '144px'
					});
				});
			}
		
			collapseAll();

			el.className = "active";
			//el.tween('background-color', "red", "pink");
			el.morph({
				'width' : '175'
			});
			//el.innerHTML = 'test';
			$("openimage").setStyle('background','transparent url(fileadmin/templates/images/other_bg.jpg) no-repeat scroll 0 0');
			$("opentext").innerHTML = 'dfsfdsdfsdf sd fss';
			/*top._scrollto = this;
			setTimeout(function() {
				scroll.toElement(top._scrollto);
				window.current_scroll = top._scrollto.getPosition($('fixtures')).y;
				top._scrollto = null;
			}, 550);
		
			top.markers[el.id].openInfoWindowHtml(el._body);
			*/
		});
	});
});
