var newsScroller = new Class({
	initialize: function(element){
		$(element).setStyles({
			"position":"relative",
			"overflow":"hidden",
			"height": "150px"
		});
		this.elements = $(element).getChildren();
		this.effects = [];
		this.currentIndex = 0;
		
		this.elements.each(function(el, index){
			el.setStyles({
				"position": "absolute",
				"top":"0px",
				"left":"0px",
				"background-color":"white"
			});
			this.effects.push(new Fx.Slide(el, {"duration": 500, "mode": "horizontal"}));
			this.effects[index].hide();
		}.bind(this));
		
		this.effects[this.currentIndex].slideIn();
		
		this.nextItem.periodical(5000,this);
	},
	
	nextItem: function(){
		this.effects[this.currentIndex].slideOut();
		
		this.currentIndex++;
		
		if(this.currentIndex >= this.effects.length){
			this.currentIndex = 0;
		}
		
		this.effects[this.currentIndex].slideIn();
	}
});
		

window.addEvent("domready", function(){
	//var links = $$("a");
	new SmoothScroll();
	new Tips($$(".tooltip"), { "offsets":{ "x":10, "y":20 } });

	new Accordion($$("#faqlist li span"), $$("#faqlist li p"), { "alwaysHide":true, "show":-1 });

	new Ticker($("newsArticles"), {interval: 5000});
	//new newsScroller("newsArticles");

	$$(".volatile").each(function(el){
		$(el).addEvent("focus", function(){
			if(this.getValue() == this.getProperty("title")) {
				this.value = "";
			}
		});
	});
	
	$$("a[rel*='external']").each(function(a){ 
		$(a).setProperty("target", "_blank");
	});


});

soundManager.onload = function() {
    $$("a[rel*='soundmanager']").each(function(a){
        a.addEvent("click", function(e){
            new Event(e).stop();
            soundManager.play(a.id, a.href);
        });
    });
}
