/************************************************************
Liquid (Javascript Animation)
Copyright by Dennis Loewel
www.loewel-it.de
************************************************************/

/************************************************************************/
/* Onload Event Loader 1.0  - Copyright by Loewel IT - www.loewel-it.de */
/************************************************************************/
document.onload_array = new Array();
function AddOnload(command){
	document.onload_array.push(command);
	}
function DoOnload(){
	for(var i = 0; i < document.onload_array.length; i++) {
		setTimeout(document.onload_array[i], 0);
		}
	} 

/***********************************************************/
/* Popup 0.81  - Copyright by Loewel IT - www.loewel-it.de */
/***********************************************************/
function popup(url, target, width, height){
	if(typeof width != 'undefined' && typeof height != 'undefined'){
		window.open(url, target, 'scrollbars=no,toolbar=yes,location=no,directories=no,status=no,menubar=yes,resizable=yes,width='+(width+10)+',height='+(height+28));
		}
	else{
		window.open(url, target, 'scrollbars=no,toolbar=yes,location=no,directories=no,status=no,menubar=yes,resizable=yes');
		}
	return false;
	}

/**************************************************************************************/
/* Objekt Animation Grundfunktionen 1.31  - Copyright by Loewel IT - www.loewel-it.de */
/**************************************************************************************/
/* fade */
function ELEM_opac(obj, newopac){
	if(typeof obj == 'object' && obj != null && (typeof obj.fading == 'undefined' || typeof obj.opac == 'undefined' || (obj.fading == 'out' && obj.opac > newopac) || (obj.fading == 'in' && obj.opac < newopac))){
		obj.opac = (newopac < 0 || newopac > 100) ? ((newopac < 0) ? 0 : 100) : newopac;		
		//newopac = (newopac == 100) ? 99.999 : newopac;
		obj.style.filter = "alpha(opacity:"+newopac+")";
		obj.style.KHTMLOpacity = newopac / 100; 
		obj.style.MozOpacity = newopac / 100; 
		obj.style.opacity = newopac / 100;
		}	
	}
	
function ELEMID_opac(id, newopac, cmd_after){
	var obj = document.getElementById(id);
	ELEM_opac(obj, newopac);
	if(typeof cmd_after == 'string' && typeof obj == 'object' && obj != null && typeof obj.target == 'number' && obj.target == obj.opac){
		setTimeout(cmd_after, 0);
		}
	}

function ELEM_fade(obj, newopac, stretch, cmd_after){
	if(typeof obj.id != 'string' || obj.id == ''){obj.id = GET_newid();}	
	if(typeof obj.opac != 'number'){obj.opac = 100;}
	if(typeof stretch != 'number'){stretch = 5;}
	var opac = obj.opac;
	var time = 0;	
	obj.fading = (opac > newopac) ? 'out' : 'in';
	if(typeof cmd_after == 'string'){
		obj.target = newopac;
		while(opac != newopac){
			time++;
			opac = (opac > newopac) ? opac - 1 : opac + 1;
			setTimeout('ELEMID_opac(\''+obj.id+'\', '+opac+', "'+cmd_after+'")', time * stretch);
			}
		}
	else{
		while(opac != newopac){
			time++;
			opac = (opac > newopac) ? opac - 1 : opac + 1;
			setTimeout('ELEMID_opac(\''+obj.id+'\', '+opac+')', time * stretch);
			}
		}
	}
function ELEMID_fade(id, newopac, stretch, cmd_after){
	var obj = document.getElementById(id); 
	if(typeof obj == 'object' && obj != null){
		ELEM_fade(obj, newopac, stretch, cmd_after);
		}
	}

function ELEM_insertfade(obj, newchild, cmd_after){
	ELEM_opac(newchild, 0);
	obj.appendChild(newchild);	
	if(typeof cmd_after == 'string'){ELEM_fade(newchild, 100, 5, cmd_after);}
	else{ELEM_fade(newchild, 100);}
	}

/* Misc */
function GET_newid(){x = 'rand_1'; while(document.getElementById(x)){x = 'rand_' + Math.floor(Math.random() * 100000 + 1);} return x;}

function ELEM_pos(obj, x, y){if(typeof obj == 'object' && obj != null){obj.style.left = x+'px';	obj.style.top = y+'px';}}	
function ELEMID_pos(id, x, y){var obj = document.getElementById(id);	ELEM_pos(obj, x, y);}
	
function ELEM_display(obj, style){if(typeof obj == 'object' && obj != null){obj.style.display = style;}}
function ELEMID_display(id, style){var obj = document.getElementById(id); ELEM_display(obj, style);}

function PAGE_jump(href){location = href;}
/* ####################################### */

/**************************************************************************************/
/* 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 = '_img/'+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 = '_img/'+path+'/aktiv/'+objs[i].name+'.png';
			top_img.src = '_img/'+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 = '_img/'+path+'/aktiv/'+objs[i].name+'.png';
		top_img.src = '_img/'+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){
					ELEMID_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);	
						ELEMID_display('sm'+i, 'none');
						}
					else{
						ELEM_fade(document.getElementById('sm'+i), 0, 3, "ELEMID_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 = GET_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();
	}

/* ##################################### */