function setupNews() {
	// Allgemeine Variablen Definieren
		var nameOfParentItems	= ["n1","n2","n3"]
		var nrOfItems	 		= [1,1,1];
		var newsbox				= "newsbox";
		
		var nbnode				= dojo.byId(newsbox);
		dojo.style(newsbox,"display","block");
		
		news = new NewsController(nameOfParentItems,nrOfItems);
}

dojo.declare("NewsController",null,{
	constructor: function(names,nrs) {
		this.names			= names;
		this.nrOfChilds		= nrs;
		this.newsItems		= new Array(names.length);
		
		for (var i=0;i<this.names.length;i++) {
			this.newsItems[i] = new NewsItem(names[i],nrs[i],this)
		}
		
	},
	
	hideDetails: function() {
		for (var i=0;i<this.newsItems.length;i++) {
			this.newsItems[i].hideEntries();
		}
	}
	
})

dojo.declare("NewsItem",null,{
	
	constructor: function(name,nr,contr) {
		this.controller = contr;
		this.name			= name;
		this.nrOfEntries	= nr;
		this.node			= dojo.byId(name);
		this.entries		= new Array(nr);
		this.activated		= false;
		
		dojo.connect(this.node,"onclick",this,this.onMouseOver)
		for (var i=0;i<nr;i++) {
			this.entries[i] = dojo.byId(name+"_"+(i+1));
		}

	},
	
	hideEntries: function() {

		for(var i=0;i<this.nrOfEntries;i++) {
			dojo.style(this.entries[i],"display","none")
		}
		this.activated = false;
	},
	
	showEntries: function() {
		for(var i=0;i<this.nrOfEntries;i++) {
			dojo.style(this.entries[i],"display","block")
		}
		this.activated = true;
	},
	
	onMouseOver: function(event) {
		if (this.activated) {
			this.hideEntries();
		} else {
			this.showEntries();
		}
	}
	
})


dojo.addOnLoad(setupNews);
