/************************************************************
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;
	}

function activateLink(obj){
	if(typeof obj == 'string')	obj = document.getElementById(obj);
	if(typeof obj == 'object' && obj != null && typeof obj.href == 'string') window.location.href = obj.href;
	}

/**************************************************************************************/
/* Objekt Animation Grundfunktionen 1.40  - Copyright by Loewel IT - www.loewel-it.de */
/**************************************************************************************/
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.opacity = newopac / 100;
		obj.style.filter = "alpha(opacity:"+newopac+")";
		/* obj.style.KHTMLOpacity = newopac / 100; */
		/* obj.style.MozOpacity = 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 = ELEM_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);
	}

function ELEM_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 == 'string')	obj = document.getElementById(obj);
	if(typeof obj == 'object' && obj != null)	obj.style.left = x+'px';	obj.style.top = y+'px';
	}	
	
function ELEM_display(obj, wert){
	if(typeof obj == 'string')	obj = document.getElementById(obj);
	if(typeof obj == 'object' && obj != null)	obj.style.display = wert;
	}

function ELEM_scanAbsPos(obj){
	if(typeof obj == 'string')	obj = document.getElementById(obj);
	if(typeof obj == 'object' && obj != null){	
      var xPos = 0;
      var yPos = 0;
		var scanobj = obj;
      while(scanobj.nodeName != "BODY"){
         xPos += scanobj.offsetLeft;
         yPos += scanobj.offsetTop;
         scanobj = scanobj.offsetParent;
			}
		obj.absX = xPos;
		obj.absY = yPos;
		}
	}

function ELEM_setAnker(obj, anker){
	if(typeof obj == 'string')	obj = document.getElementById(obj);
	if(typeof obj == 'object' && obj != null){
		if(typeof obj.href == 'string') obj.href += '#'+anker;
		if(typeof obj.action == 'string') obj.action += '#'+anker;
		}
	return true;
	}	

function ELEM_setValue(obj, val){
	if(typeof obj == 'string')	obj = document.getElementById(obj);
	if(typeof obj == 'object' && obj != null && typeof obj.value == 'string') obj.value = val;
	return true;
	}	
	
/* ####################################### */
