tomcode = new function() {

	this.initActions = function()
	{
		this.initLangToggleRelease();

		this.initHovers();
	}
	
	this.changeLanguage = function(href)
	{
		var hash = location.hash;

		location.href = href +hash;
	};
	
	this.initLangToggleRelease = function()
	{
		var curEl = document.getElementById('linkToggleLang');

		var href = curEl.getAttribute('href');
		
		var atribute = 'javascript:tomcode.changeLanguage("' +href +'")';
		
		curEl.setAttribute('href', atribute);
	}

	this.initHovers = function()
	{
		var cName = "indexHover";

		var hasHovers = this.setHovers(cName);
		
		if( ! hasHovers) return;
		
		var currentHash = window.location.hash.substr(1);
		
		if(currentHash.indexOf('cat') === 0)
		{
			var curEl = document.getElementById(currentHash +'Link');
			
			this.setClassAttribute(curEl, cName);
		}
	}

	this.setHovers = function(cName)
	{
		var hoverWrapper = document.getElementById('indexNavigation');
		
		if( ! hoverWrapper) return false;
		
		var hoverEls = hoverWrapper.childNodes;

		for(var i = 0; i < hoverEls.length; i++)
		{
			if(hoverEls[i].nodeType == 1 && hoverEls[i].nodeName.toUpperCase() == 'A')
			{
				this.setClickEvent(hoverEls[i], cName);
			}
		}
		return true;
	}

	this.resetBgds = function()
	{
		var hoverEls = document.getElementById('indexNavigation').childNodes;
 
		var cName = "indexPlain";
		
		for(var i = 0; i < hoverEls.length; i++)
		{
			if(hoverEls[i].nodeType == 1 && hoverEls[i].nodeName.toUpperCase() == 'A')
			{
				this.setClassAttribute(hoverEls[i], cName);
			}
			
		}
	}
	
	this.setClassAttribute = function(el, cName)
	{
		var Klasse = document.createAttribute("class");
		
		Klasse.nodeValue = cName;
		
		el.setAttributeNode(Klasse);
	}
	
	this.setClickEvent = function(el, cName)
	{
		el.onclick = function()
		{
			tomcode.resetBgds();
			tomcode.setClassAttribute(this, cName);
		}
	  
	}
}