function cRowCollection() {
		
	this.aRows = new Array();
	this.cardIndex = 0;
				
	this.addRow = function(oRow) {
		this.aRows.unshift(oRow);				
	}	this.getRowCount = function() {	
		return this.aRows.length;
	}
	this.toHTML = function() {	
		var head = '';
		
		for(var i=this.getRowCount()-1 ; i>=0 ; i--)
		{
			head += this.aRows[i].toHTML(i);
		}
		return head;
	}
						
	this.switchCard = function(rowIndex, cardIndex) {
		
		
	
		if(rowIndex == 0 && this.cardIndex == cardIndex )
			return;
			
		if(rowIndex != 0){
			this.switchRows(rowIndex);
			
		} else	{
			var td = document.getElementById("reg_karte0" + this.cardIndex);
			var style = this.aRows[0].aCards[this.cardIndex].style;
			if(style == 'DOWNLOADS')
				td.className = "reg_karte_inaktiv_new";
			else
				td.className = this.aRows[0].aCards[this.cardIndex].classNameInaktiv;
		}
		
		var o = document.getElementById("cardText");
		o.innerHTML = this.aRows[0].aCards[cardIndex].html;
	
		var td = document.getElementById("reg_karte0" + cardIndex);
		td.className = "reg_karte_aktiv";
				
		this.cardIndex = cardIndex;
	}
						
	this.switchRows = function(clickedRowIndex) {
	
		aNewRowOrder = new Array();
		aNewRowOrder.push(this.aRows[clickedRowIndex])
		
		for(var i=0; i<this.getRowCount() ; i++)
		{
			if(i == clickedRowIndex)
				continue;
			
			aNewRowOrder.push(this.aRows[i]);					
		}
		
		this.aRows = aNewRowOrder;
		var div = document.getElementById("cardNav");
		div.innerHTML = this.toHTML();
	}								
}
			
			
function cRow(rowIndex) {
	this.aCards = new Array();
		
	this.addCard = function(oCard) {
		this.aCards.push(oCard);				
	}			
				
	this.toHTML = function(rowIndex) {
				
		var html = '<table id="row' + this.rowIndex + '" width="100%" cellspacing="0" cellpadding="0" class="registerkarten">';
		var opt = 'reg_karte_inaktiv';
		
		html 		+= '<tr>';
				
		for(var i=0 ; i<this.aCards.length ; i++){
			opt = this.aCards[i].classNameInaktiv;

			if(this.aCards[i].style == 'DOWNLOADS')
				opt = 'reg_karte_inaktiv_new';
				
			html 	+= '<td height="22" align="center" class="'+opt+'" id="reg_karte' + rowIndex + i + '">';
			html 		+= '<a href="#" onclick="oRowCollection.switchCard(' + rowIndex + ',' + i + '); return false;">' + this.aCards[i].title + '</a>';
			html 	+= '</td>';	
		}
					
		html 		+= '</tr>';
		html 	+= '</table>';
		return html;
	}
}
			
function cCard(title, html, classNameInaktiv, style) {
	this.style = style;
	this.title = title;
	this.html = html;
	this.classNameInaktiv = (typeof classNameInaktiv == "undefined") ? "reg_karte_inaktiv" : classNameInaktiv;
}

var index = 0;
var oRowCollection = new cRowCollection();
var oRow;