/**************************************************************************************/
/* Scan'n'AutoResize 1.10  - Copyright by Loewel IT - www.loewel-it.de */
/**************************************************************************************/
function SnAR(){	
	var objs = document.getElementsByTagName("div");
	for(var i=0; i < objs.length; i++){
		sp = objs[i].className.indexOf('SnAR');
		if(sp >= 0){
			minusH = (sp < objs[i].className.length) ? parseInt(objs[i].className.substring(sp+4, objs[i].className.length)) : 0;
			if(GetH() > 700) objs[i].style.height = (GetH() - minusH)+'px';
			else objs[i].style.height = 'auto';
			}
		}
	}
	
/* ####################################### */

/**************************************************************************************/
/* Grafik Menu 1.22  - Copyright by Loewel IT - www.loewel-it.de */
/**************************************************************************************/
function IMGMenu_init(menu_id, path){
	var objs = document.getElementById(menu_id).getElementsByTagName("a");
	
	for(var i=0; i < objs.length; i++){
		objs[i].removeChild(objs[i].firstChild);
		
		if(objs[i].className.indexOf('aktiv') != -1){
			var img = document.createElement("img");		
			img.src = path+'/aktiv/'+objs[i].name+'.png';
			objs[i].appendChild(img);
			}
			
		else{
			var sub_img = document.createElement("img");
			var top_img = document.createElement("img");			
			
			sub_img.src = path+'/aktiv/'+objs[i].name+'.png';
			top_img.src = path+'/normal/'+objs[i].name+'.png';
						
			top_img.name = objs[i].name;
			
			top_img.onmouseover = function(){ELEM_fade(this, 30, 3);};
			top_img.onmouseout = function(){ELEM_fade(this, 100, 3);};
						
			objs[i].appendChild(sub_img);
			objs[i].appendChild(top_img);
			}		
		}	
	}
	
 function IMGSubMenu_init(menu_id, path){
	var objs = document.getElementById(menu_id).getElementsByTagName("a");
	
	for(var i=0; i < objs.length; i++){
		objs[i].removeChild(objs[i].firstChild);
		
		var sub_img = document.createElement("img");
		var top_img = document.createElement("img");			
		
		sub_img.src = path+'/aktiv/'+objs[i].name+'.png';
		top_img.src = path+'/normal/'+objs[i].name+'.png';
					
		top_img.name = 'sm'+(i+1);
		ELEMID_opac(top_img.name, 0);	
		
		top_img.onmouseover = function(){
			ELEM_fade(this, 0, 3);
			for(var i=1; i < 5; i++){
				if('sm'+i == this.name){
					ELEM_display(this.name, 'block');
					if(typeof browser != 'undefined' && browser == 'ie6'){
						ELEMID_opac(this.name, 100);	
						}
					else{
						ELEM_fade(document.getElementById(this.name), 100, 3);
						}
					}
				else{
					if(typeof browser != 'undefined' && browser == 'ie6'){
						ELEMID_opac('sm'+i, 0);	
						ELEM_display('sm'+i, 'none');
						}
					else{
						ELEM_fade(document.getElementById('sm'+i), 0, 3, "ELEM_display('"+"sm"+i+"', 'none')");
						}
					}
				}
			
			};
		top_img.onmouseout = function(){
			ELEM_fade(this, 100, 3);
			};
					
		objs[i].appendChild(sub_img);
		objs[i].appendChild(top_img);
				
		}	
	}
/* ####################################### */

/**************************************************************************/
/* Slideshow Animation v.2.06 - Copyright by Loewel IT - www.loewel-it.de */
/**************************************************************************/
var SLIDE_box, SLIDE_path, SLIDE_images, SLIDE_pos = 0, SLIDE_stretch = 10, SLIDE_timeout = 8000;
function SLIDE_init(id, path, imgarray, stretch, timeout){
	SLIDE_box = document.getElementById(id);
	SLIDE_path = path;
	SLIDE_images = imgarray;
	if(typeof stretch == 'number'){SLIDE_stretch = stretch;}
	if(typeof timeout == 'number'){SLIDE_timeout = timeout;}	
	SLIDE_switch();	
	}
	
function SLIDE_switch(){
	var aktimg = SLIDE_box.getElementsByTagName("img");
	if(aktimg.length > 1){
		if(typeof aktimg[0].id != 'string' || aktimg[0].id == ''){aktimg[0].id = ELEM_newid();}			
		ELEM_fade(aktimg[1], 100, SLIDE_stretch, 'SLIDE_removeold(\''+aktimg[0].id+'\')');		
		}
	else if(SLIDE_images.length > 1){
		if(SLIDE_pos < SLIDE_images.length-1){SLIDE_pos++;}
		else{SLIDE_pos = 0;}
		var newimg = document.createElement("img");
		newimg.onload = function(){
			ELEM_opac(newimg, 0);
			SLIDE_box.appendChild(newimg);
			setTimeout('SLIDE_switch()', SLIDE_timeout);
			}
		newimg.src = SLIDE_path+SLIDE_images[SLIDE_pos];
		}	
	}
	
function SLIDE_removeold(id){
	SLIDE_box.removeChild(document.getElementById(id));
	SLIDE_switch();
	}

/* ##################################### */

/**************************************************************************************/
/* TM Marker  - Copyright by Loewel IT - www.loewel-it.de */
/**************************************************************************************/
var tmm = null;
var tm_menu = null;
function init_tm(){
	tm_menu = document.getElementById('tm_container');
	tmm = document.getElementById('tmm');
	if(tmm != null && tm_menu != null){
		tmm.posX = 50;
		tmm.posY = 370;
		tmm.runs = 0;		
		}
	}

function marker_newpos(newX, newY){
	if(tmm != null){
		tmm.newX = newX;
		tmm.newY = newY;
		tmm.runs++;
		marker_move();
		}
	}

function marker_move(){
	if(tmm != null){
		tmm.runs--;
		if(tmm.runs <= 0 && tmm.posX + tmm.posY - tmm.newX - tmm.newY != 0){
			tmm.runs = 20;
			for(i=0; i<tmm.runs; i++){
				setTimeout("marker_move()", 10*i);
				}
			}
		if(tmm.runs > 0){
			if(tmm.newX > tmm.posX) tmm.posX++;
			else if(tmm.newX < tmm.posX) tmm.posX--;
			if(tmm.newY > tmm.posY) tmm.posY++;
			else if(tmm.newY < tmm.posY) tmm.posY--;			
			tmm.style.left = tmm.posX;
			tmm.style.top = tmm.posY;
			}
		}
	}
/* ##################################### */

