/*################################################################################
	D E B U G
################################################################################*/

var debugModus = 0	; // Debugmodus EIN = 1 || AUS = 0

function debug(txt)
{
	if(!debugModus || typeof(console) != "object") { return; }
	else { console.log(txt); }
}
debug("debugModus = true");


/*################################################################################
	$$$
################################################################################*/

// get Elements by Name

function $$$(obj)
{
	var obj = document.getElementsByName(obj);
	obj = (obj.length==1)?obj[0]:obj;
	return obj;
}


/*################################################################################
	F U N C T I O N S
################################################################################*/

var showitTimeout;
var openItem;
function showit(){
}

function getNaviOffset(a, id){	
	a.image = $('link' + id);
	a.subNavi = $('subnavi' + id);
	a.subNavi.setStyle('left', a.image.offsetLeft - 6 + "px");
}

function showNavi(a,id, onimg, offimg) {
	
	a.image = $('link' + id);
	a.subNavi = $('subnavi' + id);
	if(a.image!=undefined){
		a.subNavi.style.left = a.image.offsetLeft - 6 + "px";
	}
	a.subNavi.root = a;
	var activeItem = $$('ul.mattig_subNaviAktiv');
	openItem=activeItem[0];
	a.subNavi.onmouseover = function() {
		this.style.display = "block";
		this.root.onmouseover();
	}
	
	a.subNavi.onmouseout = function() {
		this.style.display = "none";
		this.root.onmouseout();
	}
	
	a.onmouseout = function() {
		showit=function(){
			if(openItem != undefined){
				openItem.setStyle('display','block');
			}
		}
		showitTimeout=window.setTimeout(showit,100);
		if(this.image != undefined){
			this.image.set('src',offimg);
		}
		a.subNavi.style.display = "none";
	}
	
	a.onmouseover = function() {
		if(openItem != undefined){
			if(a != openItem.getPrevious('a')){
				window.clearTimeout(showitTimeout);
			}
			openItem.setStyle('display','none');
		}
		if(this.image != undefined){
			this.image.set('src',onimg);
		}
		a.subNavi.style.display = "block";
	}
	
	a.onmouseover();	
}
