// all navigation related methods *must* be placed in 
// this class
///////////////////////////////////////////////////////


var Navigation = new Class({
	
	// CONSTRUCTOR
	initialize: function() {
		this.homeButton();
		this.createSubListBackground();
	},
	
	// METHODS
	
	// links back to home page
	homeButton: function() {
		var homeLink = $('navigationHome');
		
		if(homeLink) {
			homeLink.onclick = function() {				
				document.location.href = '/de/index.php';
				//alert(sprache);
			};
		}
	},
	
	createSubListBackground: function() {
		var list 			= $('navigationSubListContainer');
		var serviceList		= $('navigationServiceSubListContainer');
		var searchList		= $('navigationSearchSubListContainer');
		var container		= $('mainContainer');		
		
		if(list || serviceList) {
			if(list)
				var listPosition = list.getPosition();
			else if(serviceList)
				var listPosition = serviceList.getPosition();
			/*else if(searchList) 
				var listPosition = searchList.getPosition();*/
			
			var background	= document.createElement("div");
			var opacity		= '0.8';
			
			// styling the background
			if(list)
				background.style.backgroundColor = '#c9c0a0'; //c9c0a0
			else if(serviceList)
				background.style.backgroundColor = '#ecd6ba'; //c9c0a0
			/*else if(searchList) 
				background.style.backgroundColor = '#9e0b03';*/
			
			background.style.position	= 'absolute';
			background.style.width		= listPosition.width+"px";
			background.style.height		= listPosition.height+"px";
			background.style.top		= listPosition.top+"px";
			background.style.zIndex		= 1;
			background.id				= 'navigationSubListBackground'
			
			// adding it to the DOM
			container.appendChild(background);
			
			var newBackground	=$('navigationSubListBackground');
			if(document.all) {
				newBackground.style.filter = "alpha(opacity=" + 77.8 + ")";
			} else {
				newBackground.setOpacity(opacity);
			}
		}
		
		
		
		
	}
	
	
	
});


