

function init() {
	inputSelect();
	tabDecoration();
	highlight();
}

var doInpSel = true; 
function inputSelect() {
		var sInput	= document.getElementById('s');
	if (doInpSel ){
		sInput.focus();
		sInput.select();
		doInpSel = false;
	}else {
		doInpSel	= true;	
	}
}
function tabDecoration(){
	if (document.getElementById && document.createTextNode){
		var tables=document.getElementsByTagName('table');
   	for (var i=0;i<tables.length;i++){
			if(tables[i].className=='liste'){		
    		var trs=tables[i].getElementsByTagName('tr');
	 			var dnkl=false;
				for(var j=1;j<trs.length;j++){
					if(trs[j].parentNode.nodeName=='TBODY'){	   
	 					if ( dnkl ) {
							trs[j].style.backgroundColor = "#F5F8FD";
							trs[j].style.backgroundColor = "#F5F8FD";
							dnkl = false;								
							trs[j].onmouseover=function(){
								this.style.backgroundColor = "#FFFFCC";
							};
							trs[j].onmouseout=function(){
								this.style.backgroundColor = "#F5F8FD";
							};
	   				}else {
							trs[j].style.backgroundColor = "#FFFFFF";
							dnkl = true;
							trs[j].onmouseover=function(){this.style.backgroundColor = "#FFFFCC";};
							trs[j].onmouseout=function(){this.style.backgroundColor = "#FFFFFF";};
						}	
    			}
    		}
    	}
		}
	}
}
var act 		= true;
function highlight(){
	
	var ancTxt 					= ' ';
	var isHlighted			= false;
	var txtHlighted 		= '';
	var idHlighted 			= '';
	var idNumHlighted 	= '';
	var bgHlighted 			= '';
	      
	
	if (document.getElementById && document.createTextNode){
		var tables=document.getElementsByTagName('table');
		for (var i=0;i<tables.length;i++){
			if(tables[i].className=='liste'){		
				var td=tables[i].getElementsByTagName('td');
				for(var j=0;j<td.length;j++){
					if (td[j].childNodes[0].className == "hl" ){
						var anc= td[j].getElementsByTagName('a');
						for(var k=0;k<anc.length;k++) {
							anc[k].onmouseover=function(){								
								act = false;
							}
							anc[k].onmouseout=function(){								
								act = true;
							}	
						}						
						td[j].onclick=function(){	
							if (isHlighted == false || this.id != idHlighted ) {
								var inh = this.getElementsByTagName('a');
								ancTxt = this.getElementsByTagName('a')[0].name;
							}
							ancTxt = ancTxt.replace(/"/g, "'");
							if (act) {								
								if (isHlighted) {
									doInpSel = true;
									tabDecoration();
									document.getElementById(idHlighted).innerHTML = txtHlighted; 	
									inputSelect();
									isHlighted	= false;
									var newAnc = document.getElementById(idHlighted).getElementsByTagName('a');
									for(var m=0;m<newAnc.length;m++) {
										newAnc[m].onmouseover=function(){								
											act = false;
										}
										newAnc[m].onmouseout=function(){								
											act = true;
										}
									}
									if (this.id == idHlighted ) {
										return true;
									}
								}
								txtHlighted 	= this.innerHTML;
								isHlighted 		= true;
								idHlighted		= this.id;
								var inpWigth	= ancTxt.length * 7 + 15;
								if (inpWigth > 250){
									inpWigth = 250;
								}
								var idAnc = idHlighted+'anc';
								this.nowrap = true;
								this.innerHTML = '<input  id="'+idAnc+'" value="'+ancTxt+'" type="text" style="margin-left: 10px; width:'+inpWigth+'px; overflow:hidden;  " onmouseover="act = false;" onmouseout="act = true" />';
								
								document.getElementById(idAnc).focus();
								document.getElementById(idAnc).select();
								idNumHlighted = idHlighted.replace(/td_(\d+)_\d+/, '$1');
								bgHlighted = document.getElementById('tr'+idNumHlighted).style.backgroundColor;
								document.getElementById('tr'+idNumHlighted).onclick=function(){
									this.style.backgroundColor = '#00FF99';	
								}
								document.getElementById('tr'+idNumHlighted).onmouseover=function(){
									this.style.backgroundColor = '#00FF99';	
								}
								document.getElementById('tr'+idNumHlighted).onmouseout=function(){
									this.style.backgroundColor = '#00FF99';	
								}
								this.style.padding = '0px';
								ancTxt = '';
							}
						}
					}
				}
			}
		}
	}
}
function noClick(root, name) {
var obj = root.getElementsByTagName('name');
	for(var i=0;i<obj.length;i++) {
		obj[i].onmouseover=function(){								
			act = false;
		}
		obj[i].onmouseout=function(){								
				act = true;
		}
	}
}
function putUml(was) {
	var sInput	= document.translate.s;
	if (was=="ae") sInput.value += "ä";
	if (was=="ue") sInput.value += "ü";
	if (was=="oe") sInput.value += "ö";
	if (was=="Ae") sInput.value += "Ä";
	if (was=="Ue") sInput.value += "Ü";
	if (was=="Oe") sInput.value += "Ö";
	if (was=="sz") sInput.value += "ß";
	sInput.focus();	
}
function setLng(lang) {
		document.translate.d.value=lang;
		javascript:document.translate.submit();
}
function slectSubmit() {
	document.translate.submit();	
}

function go(url, link, end){
	if ( link.length < 1 ){
		return false;
	}
  self.location.href = encodeURI(url+link+end);
}
function inputHover (object){
	object.style.backgroundColor='#D6FCD9';
	object.style.border='1px solid #00CC66';	
}
function inputUnHover (object){
	object.style.backgroundColor='#FFFFFF';
	object.style.border='1px solid #FFFFFF';	
}



