var timeout_opacity_1 = new Array ();
var timeout_opacity_2 = new Array ();

function opacity(id, opacStart, opacEnd, millisec) {
	//speed for each frame
	var speed = Math.round(millisec / 100);
	var timer = 0;

	//determine the direction for the blending, if start and end are the same nothing happens
	if(opacStart > opacEnd) {
		for(i = opacStart; i >= opacEnd; i = i - 2) {
			timeout_opacity_1[i] = setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
			timer = timer + 2
		}
	} else if(opacStart < opacEnd) {
		for(i = opacStart; i <= opacEnd; i = i + 2)
			{
			timeout_opacity_2[i] = setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
			timer = timer + 2
		}
	}
}

//change the opacity for different browsers
function changeOpac(opacity, id) {
	var object = document.getElementById(id).style; 
	object.opacity = (opacity / 100);
	object.MozOpacity = (opacity / 100);
	object.KhtmlOpacity = (opacity / 100);
	object.filter = "alpha(opacity=" + opacity + ")";
}

var timeout_fade_1 = new Array ();
var timeout_fade_2 = new Array ();
var style_z_index = 1;
function fader(id, fadeStart, fadeEnd, millisec) {
	//speed for each frame
	var speed = Math.round(millisec / 100);
	var timer = 0;

	//determine the direction for the blending, if start and end are the same nothing happens
	if(fadeStart > fadeEnd) {
		for(i = fadeStart; i >= fadeEnd; i = i - 2) {
			timeout_fade_1[i] = setTimeout("changeFading(" + i + ",'" + id + "')",(timer * speed));
			timer = timer + 2
		}
	} else if(fadeStart < fadeEnd) {
		for(i = fadeStart; i <= fadeEnd; i = i + 2)
			{
			timeout_fade_2[i] = setTimeout("changeFading(" + i + ",'" + id + "')",(timer * speed));
			timer = timer + 2
		}
	}
	style_z_index++;
}

//change the fadeity for different browsers
function changeFading(fade, id) {
	var object = document.getElementById(id).style; 
	object.top = fade + 'px';
	object.zIndex = style_z_index;
	
}





function shiftOpacity(id, millisec) {
	//if an element is invisible, make it visible, else make it ivisible
	if(document.getElementById(id).style.opacity == 0) {
		opacity(id, 0, 100, millisec);
	} else {
		opacity(id, 100, 0, millisec);
	}
}

function blendimage(divid, imageid, imagefile, millisec) {
	var speed = Math.round(millisec / 100);
	var timer = 0;
	
	//set the current image as background
	document.getElementById(divid).style.backgroundImage = "url(" + document.getElementById(imageid).src + ")";
	
	//make image transparent
	changeOpac(0, imageid);
	
	//make new image
	document.getElementById(imageid).src = imagefile;

	//fade in image
	for(i = 0; i <= 100; i++) {
		setTimeout("changeOpac(" + i + ",'" + imageid + "')",(timer * speed));
		timer++;
	}
}

function currentOpac(id, opacEnd, millisec) {
	//standard opacity is 100
	var currentOpac = 100;
	
	//if the element has an opacity set, get it
	if(document.getElementById(id).style.opacity < 100) {
		currentOpac = document.getElementById(id).style.opacity * 100;
	}

	//call for the function that changes the opacity
	opacity(id, currentOpac, opacEnd, millisec)
}


	var slider_startwert = 0;
	var hoehe_gesammt = 0;
	var hoehe_aktuell = 0;
	var richtung = 1;
	var slide_timer = -1;
	var slide_millisec = 1000;
	var slide_speed = Math.round(slide_millisec / 100);
	var slide_timer = 0;

	var timeout_slider_1 = new Array ();
	var timeout_slider_2 = new Array ();

	function pixel_menue_slider () {
		hoehe_gesammt = document.getElementById('liste_cont_2').offsetHeight;
		hoehe_aktuell = document.getElementById('liste_cont').offsetHeight;
		slide_timer = 0;
		
		if (hoehe_aktuell <= 50 && slider_startwert == 0) {
			richtung = 1;
			slider_startwert = 1;
		} else if (hoehe_aktuell > 50 && slider_startwert == 0) {
			richtung = 0;
			slider_startwert = 1;
		}
		
		for (i = 0 ; i <= 100 ; i++) {
			if (timeout_slider_1[i]) { clearTimeout(timeout_slider_1[i]); }
			if (timeout_slider_2[i]) { clearTimeout(timeout_slider_2[i]); }
		}
		
		//determine the direction for the blending, if start and end are the same nothing happens
		if (richtung == 0) {
			for(i = 100; i >= 1; i = i - 2) {
				timeout_slider_1[i] = setTimeout("pixel_menue_slider_hoch(" + i + ")",(slide_timer * slide_speed));
				slide_timer = slide_timer + 2
			}
			timeout_slider_1[i] = setTimeout("pixel_menue_slider_hoch(" + i + ")",(slide_timer * slide_speed));
			richtung = 1;
		} else if (richtung == 1) {
			for(i = 1; i <= 100; i = i + 2)
				{
				timeout_slider_2[i] = setTimeout("pixel_menue_slider_runter(" + i + ")",(slide_timer * slide_speed));
				slide_timer = slide_timer + 2
			}
			timeout_slider_2[i] = setTimeout("pixel_menue_slider_runter(" + i + ")",(slide_timer * slide_speed));
			richtung = 0;
		}

	}
	
		//change the opacity for different browsers
	function pixel_menue_slider_runter (slide_step) {
		
		document.getElementById('liste_cont').style.height = (hoehe_gesammt/100*slide_step) + 'px';
		
	}
	function pixel_menue_slider_hoch (slide_step) {
		
		if (slide_step != 0) {
			document.getElementById('liste_cont').style.height = (hoehe_gesammt/100*slide_step) + 'px';
		} else {
			document.getElementById('liste_cont').style.height = '1px';
		}
		
	}
	

