function changeSubmenue(id){
	var splitArray	= id.split("_");
	var prefix		= splitArray[0];
	var openId		= splitArray[1];

	if(submenue['status_'+openId]==0){
		document.getElementById(id).style.display="block";
		document.getElementById('line_'+openId).style.display="block";
		document.getElementById(id).style.height="0px";
		rollInSubmenueEngine(id,5,80);
		submenue['status_'+openId] = 1;
	}else{
		document.getElementById(id).style.display="none";
		document.getElementById('line_'+openId).style.display="none";
		submenue['status_'+openId] = 0;
	}

	for(i=1;i<=countSubmenues;i++){
		if(submenue['status_'+i]==1 && i!=openId){
			document.getElementById(prefix+"_"+i).style.display="none";
			document.getElementById('line_'+i).style.display="none";
			submenue['status_'+i] = 0;
		}
	}
}

function rollInSubmenueEngine(id,fast,delay){
	var splitArray	= id.split("_");
	var prefix		= splitArray[0];
	var openId		= splitArray[1];
	var height		= getDimension(id).height;

	if( height <= submenue['height_'+openId] ){
		document.getElementById(id).style.height = eval(height +fast)+"px";
		window.setTimeout(function(){rollInSubmenueEngine(id,fast,delay);},delay);
	}
}

var submenue		= new Array();
var countSubmenues	= 0;

function menueReadIn(id,count){
	countSubmenues = count;
	for(i=0;i<count;i++){
		if(document.getElementById(id+'_'+i)){
			isOpen=true;
			var classArray = (document.getElementById(id+'_'+i).className).split(" ");
			while(classArray.length>0){
				if(classArray.pop()=="noDisplay"){
					isOpen=false;
				}
			}

			document.getElementById(id+'_'+i).style.display="block";
			var dimension = getDimension(id+'_'+i);
			submenue['height_'+i]	= dimension.height;
			if(!isOpen){
				document.getElementById(id+'_'+i).style.display="none";
				submenue['status_'+i]	= 0;
			}else{
				submenue['status_'+i]	= 1;
			}
		}
	}
}


/* BEGIN *** Faden01-Effekt  *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */
var markFaderAllowToMove = new Array;

function markFader(id,fadeOut,fastness,onStartFunc,onChangeFunc,onFinishFunc){

	var i = 1;
	while(1){
		
		var objId = id+"_"+i;

		if(typeof(markFaderAllowToMove[objId])!="undefined" && markFaderAllowToMove[objId]==false)
			return;

		if(onStartFunc && i==1){
			eval(onStartFunc+'("'+objId+'");');
		}

		if(!document.getElementById(id+"_"+i)){
			break;
		}

		if(document.getElementById(id+"_"+i).style.marginLeft=="" || document.getElementById(id+"_"+i).style.marginLeft=="undefined"){
			document.getElementById(id+"_"+i).style.marginLeft="0px";
		}

		fastness = fastness/2; // delay
		markFaderEngine(objId,fadeOut,1,fastness,onStartFunc,onChangeFunc,onFinishFunc);
		i++;

	}

}

function markFaderEngine(objId,fadeOut,currentFade,fastness,onStartFunc,onChangeFunc,onFinishFunc){

	// ende
	if(currentFade>(fadeOut*2)){
		markFaderAllowToMove[objId]=true;
		return;
	}
	
	// fade out
	if(currentFade>fadeOut && currentFade<=(fadeOut*2)){
		
		markFaderAllowToMove[objId]=false;

		if(currentFade==(fadeOut*2)){
			if(onFinishFunc){
				eval(onFinishFunc+'("'+objId+'");');
			}
		}

		document.getElementById(objId).style.marginLeft = ((fadeOut*2)-currentFade)+"px";
		document.getElementById(objId).style.marginTop = ((fadeOut*2)-currentFade)+"px";
		currentFade++;

		window.setTimeout(function(){markFaderEngine(objId,fadeOut,currentFade,fastness,onStartFunc,onChangeFunc,onFinishFunc);},fastness);
		return;
	}

	// fade in
	if(currentFade<=fadeOut){

		markFaderAllowToMove[objId]=false;

		if(currentFade==fadeOut){
			if(onChangeFunc){
				eval(onChangeFunc+'("'+objId+'");');
			}
		}

		document.getElementById(objId).style.marginLeft = currentFade+"px";
		document.getElementById(objId).style.marginTop = currentFade+"px";
		currentFade++;

		window.setTimeout(function(){markFaderEngine(objId,fadeOut,currentFade,fastness,onStartFunc,onChangeFunc,onFinishFunc);},fastness);
		return;
	}

}
/* END *** Faden01-Effekt  *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** */

function myRandom(min, max){
	return Math.floor(min+(max-min+1)*(Math.random()));
}

/*** BEGIN *** Roll-In Effect 02 *** *** *** *** *** *** *** *** *** ***/
var fadeBoxEffect01AllowToMove	= new Array();
var fadeBoxEffect01Dimension	= new Array();
var fadeBoxEffect01Status		= new Array();

function fadeBoxEffect01(id,steps,speed,noMoveIfOpen,autoCloseTime){

	if(typeof(noMoveIfOpen)!="undefined" && noMoveIfOpen!=null && fadeBoxEffect01Status[id]==true){
		return;
	}

	if(typeof(fadeBoxEffect01AllowToMove[id])!="undefined" && fadeBoxEffect01AllowToMove[id]==false){
		return;
	}
	fadeBoxEffect01AllowToMove[id] = false;

	elem = document.getElementById(id);

	elem.style.display="block";

	if(elem.style.visibility!="hidden"){
		elem.style.visibility="hidden";
	}
	if(elem.style.overflow!="hidden"){
		elem.style.overflow="hidden";
	}
	
	if(typeof(fadeBoxEffect01Dimension[id])=="undefined"){
		var dimension = getDimension(id);
		fadeBoxEffect01Dimension[id] = new Array();
		fadeBoxEffect01Dimension[id]['height'] = dimension.height;
		fadeBoxEffect01Dimension[id]['width']  = dimension.width;
	}

	var originalHeight = fadeBoxEffect01Dimension[id]['height'];
	var originalWidth  = fadeBoxEffect01Dimension[id]['width'];

	var rel = Math.ceil(originalHeight/steps);
	var stepsWidth = Math.ceil(originalWidth/rel);
	
	elem.style.height="0px";
	elem.style.width="0px";
	elem.style.visibility="visible";

	fadeBoxEffect01Engine(id,speed,steps,1,originalHeight,stepsWidth,1,originalWidth,autoCloseTime);

}

function fadeBoxEffect01Engine(id,speed,pxStepHeight,currentHeight,maxHeight,pxStepWidth,currentWidth,maxWidth,autoCloseTime){

	elem = document.getElementById(id);

	if(currentHeight<maxHeight || currentWidth<maxWidth){
		if(currentHeight<maxHeight){
			elem.style.height=currentHeight+"px";
			currentHeight = currentHeight+pxStepHeight;
		}
		if(currentWidth<maxWidth){
			elem.style.width=currentWidth+"px";
			currentWidth = currentWidth+pxStepWidth;
		}
		window.setTimeout(function(){fadeBoxEffect01Engine(id,speed,pxStepHeight,currentHeight,maxHeight,pxStepWidth,currentWidth,maxWidth,autoCloseTime);},speed);
	}else{
		elem.style.width=maxHeight+"px";
		elem.style.width=maxWidth+"px";
		fadeBoxEffect01AllowToMove[id] = true;
		fadeBoxEffect01Status[id]= true;

		if(typeof(autoCloseTime)!="undefined" && autoCloseTime!="null"){
			autoCloseTime = parseInt(autoCloseTime);
			window.setTimeout(function(){fadeBoxEffect01SimpleOut(id);},autoCloseTime);
		}
	}
}

function fadeBoxEffect01SimpleOut(id){
	document.getElementById(id).style.display='none';
	fadeBoxEffect01Status[id]= false;
}

/*** END   *** Roll-In Effect 02 *** *** *** *** *** *** *** *** *** ***/




/*** BEGIN   *** SHOW layerBackground *** *** *** *** *** *** *** *** *** ***/
function showLayerbackground(){

	var dimension = getBodyDimensionWithScrollDimension();
	var elem = document.getElementById('layerBackground');

	elem.style.display="block";
	elem.style.height=dimension.height+"px";
	elem.style.width=dimension.width+"px";
	elem.style.visibility="visible";

}
/*** END   *** SHOW layerBackground *** *** *** *** *** *** *** *** *** ***/

/*** BEGIN   *** HIDE layerBackground *** *** *** *** *** *** *** *** *** ***/
function hideLayerbackground(){
	hideElement('layerBackground');
}
/*** END   *** HIDE layerBackground *** *** *** *** *** *** *** *** *** ***/

/*** BEGIN   *** HIDE Element *** *** *** *** *** *** *** *** *** ***/
function hideElement(id){
	var elem = document.getElementById(id);
	elem.style.display="none";
	elem.style.visibility="hidden";
}
/*** END   *** HIDE Element *** *** *** *** *** *** *** *** *** ***/