var highLightedIds = null;
var highIDs = null;
var activeTimeout = null;
var highLightDelay = 300;

function createBackground()
{
}

function highOn(me, e)
{
	if(highLightedIds == null)
		highOn2(e + "," + me.id);
	else
	{
		if(activeTimeout)
		{
			clearTimeout(activeTimeout);
			activeTimeout = null;
		}
		activeTimeout = setTimeout("highOn2('" + e + "," + me.id + "')",highLightDelay);
	}
}

function highOn2(e)
{
	highOff2(highLightedIds);
	highLightedIds = e;
	var ids = e.split(",");
	for(var i=0; i < ids.length; i++)
	{
		try
		{
			var e = document.getElementById(ids[i]);
//			e.className="marked";
			e.style.backgroundImage="url(/Image/Viewer/loesung-high.gif)";
		}
		catch(ex)
		{}
	}
	activeTimeout=null;
}

function highOff()
{
}

function highOff2(highIDs)
{
	if(highIDs)
	{
		var ids = highIDs.split(",");
		for(var i=0; i < ids.length; i++)
		{
			try
			{
				var e = document.getElementById(ids[i]);
//				document.getElementById(ids[i]).className="normal";
				e.style.backgroundImage="url()";
			}
			catch(ex)
			{}
		}
	}
}

function fadeInOut(fadeInID,fadeOutID)
{
	if (fadeInID == fadeOutID)
	{
		alert ('Sie muessen die IDs zweier unterschiedlicher HTML-Elemente angeben!');
		return;
	}
	var fadeIn = document.getElementById (fadeInID);
	var fadeOut = document.getElementById (fadeOutID);
	if(fadeIn.style.display="none")
	{
		if(!fadeIn.filters)			// Not IE
		{
			fadeIn.style.opacity=0;
			fadeOut.style.opacity=1;
			fadeIn.style.display="inline";
			fadeOut.style.display="inline";
		}
		else
		{
			fadeIn.style.filter="Alpha(opacity=0)";
			fadeOut.style.filter="Alpha(opacity=100)";
			fadeIn.style.display="inline";
			fadeOut.style.display="inline";
		}
	}
	fade(fadeInID, fadeOutID);
}
function fade(fadeInID, fadeOutID)
{
	if(fadeInID == fadeOutID)
		return;
	var fadeIn = document.getElementById (fadeInID);
	var fadeOut = document.getElementById (fadeOutID);
	if(!fadeIn.filters)
	{
		opacity1 = parseFloat (fadeOut.style.opacity);
		opacity2 = parseFloat (fadeIn.style.opacity);
		opacity1 -= 0.05;
		opacity2 += 0.05;
		fadeOut.style.opacity = opacity1;
		fadeIn.style.opacity = opacity2;
	}
	else
	{
		opacity1 = parseFloat (fadeOut.filters.alpha.opacity);
		opacity2 = parseFloat (fadeIn.filters.alpha.opacity);
		opacity1 -= 5;
		opacity2 += 5;
		fadeOut.filters.alpha.opacity = opacity1;
		fadeIn.filters.alpha.opacity = opacity2;
	}
	if(opacity1 > 0)
		setTimeout("fade('"+fadeInID+"','"+fadeOutID+"')", 10);
}
// IntToHex: konvertiere integer zwischen 0-255 in 2 stellige hex strings.
function IntToHex(n)
{
	var result = n.toString(16);
	if (result.length==1) result = "0"+result;
	return result;
}
// HexToInt: konvertiere 2 stellige hex strings in integer.
function HexToInt(hex)
{
	return parseInt(hex, 16);
}

/*
fifo.prototype = new Array();
fifo.prototype.push = function(element)
{
	this.push(element);
}
fifo.prototype.pop = function()
{
	var first = this[0];
	for(var i=1;
}
*/
