function openWindow(p_strLink, p_iWidth, p_iHeight) 
{
	window.open(p_strLink, "upwindow", "toolbar=no,scrollbars=yes,resizable=yes,width=" + p_iWidth + ",height=" + p_iHeight + "");
}

function hideElementGroups ()
{
	var g = 0;
	var n = 0;
	var oElem1;
	var oElem2;
	
	while (oElem1 = getElement("con_" + g + "_" + n))
	{
		var l_bShow = 0;
		classNames1 = oElem1.className.split(' ');
		for (var j = 0; j < classNames1.length; j++)
		{
			if (classNames1[j] == 'showOnLoad')
			{
				l_bShow = 1
			}
		}
		oElem1.style.visibility = "hidden";
		oElem1.style.display = "none";
		if(l_bShow)
		{
			showElement(g,n);
		}
		n++;
		while (oElem2 = getElement("con_" + g + "_" + n))
		{
			l_bShow = 0;
			classNames2 = oElem2.className.split(' ');
			for (var j = 0; j < classNames2.length; j++)
			{
				if (classNames2[j] == 'showOnLoad')
				{
					l_bShow = 1
				}
			}
			oElem2.style.visibility = "hidden";
			oElem2.style.display = "none";
			if(l_bShow)
			{
				showElement(g,n);
			}
			l_bShow = 0;
			n++;
		}
		n = 0;
		g++;
	}
}

var g_arrLastContainer = new Array();
function showElement (p_iConGroup, p_iConIndex)
{
	var oHtml = getElement('con_' + p_iConGroup + '_' + p_iConIndex);
	if(oHtml)
	{
		oHtml.style.visibility = (oHtml.style.visibility=='visible'?'hidden':'visible');
		oHtml.style.display = (oHtml.style.display==''?'none':'');
		if(g_arrLastContainer[p_iConGroup]!=null && g_arrLastContainer[p_iConGroup].id!=oHtml.id)
		{
			g_arrLastContainer[p_iConGroup].style.display = "none";
			g_arrLastContainer[p_iConGroup].style.visibility = "hidden";
		}
		g_arrLastContainer[p_iConGroup] = oHtml;
	}
}

var g_arrLastToggle = new Array();
function toggle(p_oLink, p_iConGroup, p_iConIndex)
{
	var l_oLink = getElement("a_" + p_iConGroup + "_" + p_iConIndex);
	
	//var l_oLastSpan = g_arrLastToggle[p_iConGroup].getElementsByTagName("SPAN")[0];
	l_oLink.className = (l_oLink.className=="toggle") ? "toggleActive" : "toggle";
	l_oLink.className = "toggleActive";
	
	if(g_arrLastToggle[p_iConGroup]!=null)
	{
		var l_oLinkLast = getElement(g_arrLastToggle[p_iConGroup]);
		if(g_arrLastToggle[p_iConGroup] != l_oLink.id | l_oLinkLast.className=="toggleActive")
		{
			l_oLinkLast.className = "toggle"
		}
	}
	g_arrLastToggle[p_iConGroup] = l_oLink.id;
	showElement (p_iConGroup, p_iConIndex);
}

function getMail(p_strMail)
{
	var n=0;
	var y="";
	for(var i=0; i < p_strMail.length; i++) 
	{
		n=p_strMail.charCodeAt(i);
		if (n>=8364)
			n = 128;
		y += String.fromCharCode(n-1);
	}
	return y;
}
function sendMailTo(p_strMail)
{
	location.href=getMail(p_strMail);
}

var g_strHash = g_strHash || null;
function initAnchorCheck()
{
	window.setInterval("checkAnchor()", 300); 
}
function checkAnchor()
{
	if(g_strHash != document.location.hash & document.location.hash != "")
	{
		var l_strUrl = "";
		if(g_strHash == null)
			g_strHash = "#produkteinstieg";
		getElement("TAB_" + g_strHash.substring(1).toUpperCase() + "_ACTIVE").id = "TAB_" + g_strHash.substring(1).toUpperCase();
		g_strHash = document.location.hash;
		getElement("TAB_" + g_strHash.substring(1).toUpperCase()).id = "TAB_" + g_strHash.substring(1).toUpperCase() + "_ACTIVE";
		//default section
		if(g_strHash)
			l_strUrl = "de/academy/" + g_strHash.substring(1) + "/content/text";
		ajaxRequest
		(
			{
				'strUrl': l_strUrl,
				'varTargetElement': 'TAB_CONTENT',
				'strMethod': 'GET',
				'strBusyHTML': '<div style="text-align:center;"><br><br><br><img src="images/ajax-loader.gif"></div>'
			}
		);
	}
}
function setAnchors()
{
	if(document.getElementsByTagName)
	{
		var l_arrLinks = document.getElementsByTagName("a");
		for (var i=0; i < l_arrLinks.length; i++) 
		{
			if (l_arrLinks[i].className.match("ColorfulTab")) 
			{
				var l_arrSplits = l_arrLinks[i].href.split('/');
				l_arrLinks[i].href = "de/academy#" + l_arrSplits[l_arrSplits.length-1];
			}
		}
	}
}

function toggleLanguageSwitch(e)
{
	var e = getEvent(e);
	e.cancelBubble = true;
	var l_oEventTarget = getEventTarget(e);
	
	if(l_oEventTarget.tagName == "A" & l_oEventTarget.onclick == null)
		return true;
	
	var oHtml = getElement("languageSwitch");
	oHtml.style.display = (oHtml.style.display=='block'?'none':'block');
	
	switch(oHtml.style.display)
	{
		case "none":
			window.unhookEvent(document.getElementsByTagName("body")[0], 'click', toggleLanguageSwitch);
			break;
		case "block":
			window.hookEvent(document.getElementsByTagName("body")[0], 'click', toggleLanguageSwitch);
			break;
	}
	
	return false;
}

function formatNumber(p_fNumber, p_iDecimalPlaces, p_bFixDecimal, p_strLang)
{
	if(!window.notNull(p_strLang))
		p_strLang = "EN";
		
	switch (p_strLang)
	{
		case 'EN':
			dec_point = '.';
			thousands_sep = ',';
			break;
		case 'FR':
			dec_point = ' ';
			thousands_sep = ',';
			break;
		default:
			dec_point = ',';
			thousands_sep = '.';
			break;
	}

    if(!p_iDecimalPlaces) p_iDecimalPlaces = 0;
    var neu = '';

	//var dec_point = '.';
	//var thousands_sep = ',';

    // Runden
    var f = Math.pow(10, p_iDecimalPlaces);
    p_fNumber = '' + parseInt(p_fNumber * f + (.5 * (p_fNumber > 0 ? 1 : -1)) ) / f ;

    // Komma ermittlen
    var idx = p_fNumber.indexOf('.');

    // fehlende Nullen einfügen
    if(p_bFixDecimal)
	{
         p_fNumber += (idx == -1 ? '.' : '' )
         + f.toString().substring(1);
    }
	var sign = p_fNumber < 0;
	if(sign) p_fNumber = p_fNumber.substring(1);
    idx = p_fNumber.indexOf('.');

	// Nachkommastellen ermittlen
    if( idx == -1) idx = p_fNumber.length;
    else neu = dec_point + p_fNumber.substr(idx + 1, p_iDecimalPlaces);

    while(idx > 0)
	{
        if(idx - 3 > 0)
        neu = thousands_sep + p_fNumber.substring( idx - 3, idx) + neu;
        else
        neu = p_fNumber.substring(0, idx) + neu;
        idx -= 3;
    }
    return (sign ? '-' : '') + neu;
}

function clearField(p_oElement, p_strDefault)
{
	if(p_oElement.value == p_strDefault)
		p_oElement.value = "";
	else if(p_oElement.value == "")
		p_oElement.value = p_strDefault;
}

function highlightRow (p_oField)
{
	var i, _animatio, l_oRow = p_oField.parentNode.parentNode
	,l_arrCols = l_oRow.getElementsByTagName("TD")
	,l_iFrameRate = Browser.msie ? 25 : 50;
	for(i=0; i<l_arrCols.length; i++)
	{
		if(l_arrCols[i].oAni)
		{
			l_arrCols[i].oAni.stop();
			l_arrCols[i].oAni.animate(['backgroundColor'], ['#dbdbdb'], l_iFrameRate, easeInOutSine);
		}
		else
		{
			_animatio = new animatio(l_arrCols[i], "", false);
			_animatio.stop()
			_animatio.setStyle('backgroundColor','#FFFFFF');
			_animatio.animate(['backgroundColor'], ['#dbdbdb'], l_iFrameRate, easeInOutSine);
		}
	}
}

function dehighlightRow(p_oField)
{
	var i, _animatio, l_oRow = p_oField.parentNode.parentNode
	,l_arrCols = l_oRow.getElementsByTagName("TD")
	,l_iFrameRate = Browser.msie ? 25 : 50;
	for(i=0; i<l_arrCols.length; i++)
	{
		if(l_arrCols[i].oAni)
		{
			l_arrCols[i].oAni.stop();
			l_arrCols[i].oAni.animate(['backgroundColor'], ['#FFFFFF'], l_iFrameRate, easeInOutSine);
		}
	}
}

var fontClassFilters = [];
var Font = function(){this.init.apply(this, arguments)};
Font.prototype = {
	fontPath: '/scripts/',
	init: function(swf, options){
		this.swf = this.fontPath + swf;
		this.setOptions(options || {});
		String.prototype.rgbToHex = this.rgbToHex;
		String.prototype.toHex = this.toHex;
		Array.prototype.indexOf = this.indexOf;
	},
	setOptions: function(o){
		this.options = {
			sizeAdjust: o.sizeAdjust || 0,
			color: o.color || o.sColor,
			bgcolor: o.bgcolor,
			width: o.width,
			height: o.height,
			align: o.align || 'left',
			sWmode: o.sWmode || 'transparent',
			tags: o.tags || '',
			classFilter: o.classFilter || ''
		}
		if(o.classFilter) fontClassFilters[fontClassFilters.length] = o.classFilter;
	},
	replace: function(tags){
		var tags = (tags || this.options.tags).split(',');
		for(var i=0; tag=tags[i]; i++)
			this.replaceTag(tag);
	},
	replaceTag: function(tag){
		this.replaceElements(document.getElementsByTagName(tag));
	},
	replaceElements: function(els){
		for(var i=0; el=els[i]; i++)
			this.replaceElement(el);
	},
	replaceElement: function(el){
		var o = this.options;
		if(!this.hasFlash || el.oldHTML || (!o.classFilter && this.hasClassName(el, fontClassFilters)) || (o.classFilter && el.className.indexOf(o.classFilter)==-1) ) return;
		var c = RGBArrayToHex(getStyle(el, 'color'));
		var width = o.width || (el.offsetWidth + o.sizeAdjust) * .9;//fix for ie floats
		var height = o.height || el.offsetHeight;
		var sVars = 'txt=' + el.innerHTML.replace('&', '%26').replace('"', '%22') + '&amp;textalign=' + o.align + '&amp;textcolor=' + c + '&amp;w=' + width + '&amp;h=' + (height+o.sizeAdjust) + '';
		el.oldHTML = el.innerHTML;
		el.innerHTML = '<embed type="application/x-shockwave-flash" src="' + this.swf + '" quality="best" wmode="' + o.sWmode + '" bgcolor="' + o.bgcolor + '" flashvars="' + sVars + '" width="' + width + '" height="' + height + '" sifr="true"></embed>';
		if(!!DOMParent(el, null, 'A'))
		{
			var flashEmbed = el.childNodes[0];
			var l_oClickArea = createNodeBefore(flashEmbed, 'DIV');
			el.appendChild(l_oClickArea);
			setStyle(l_oClickArea, ['width', 'height'], [1,1]);
			setStyle(l_oClickArea, ['position', 'backgroundColor', 'opacity'], ['absolute', 'black', 0.0001]);
			setStyle(l_oClickArea, ['width', 'height'], getDimensions(flashEmbed));
			setStyle(l_oClickArea, ['left', 'top'], getPosition(flashEmbed).substractEach(getPosition(getPositionParent(flashEmbed))));
		//	setStyle(l_oClickArea, ['left', 'top'], [8,0]);  // geaendert von SE
		}
	},
	hasClassName: function(el, classNames) {
		var classNames = el.className.split(' ');
		for(var i=0; cn=classNames[i]; i++)
			if(classNames.indexOf(cn)) return true;
		return false;
	},
	indexOf: function(needle){
		for(var i=0; val=this[i]; i++)
			if(val == needle) return i;
		return -1;
	},
	hasFlash: function()
	{
		var a=6;
		if(navigator.appVersion.indexOf("MSIE")!=-1&&navigator.appVersion.indexOf("Windows")>-1)
		{
			document.write('<script language="VBScript"\> \non error resume next \nhasFlash = (IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash." & '+a+'))) \n</script\> \n');
			if(window.hasFlash!=null)
			return window.hasFlash
		}
		if(navigator.mimeTypes&&navigator.mimeTypes["application/x-shockwave-flash"]&&navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin)
		{
			var b=(navigator.plugins["Shockwave Flash 2.0"]||navigator.plugins["Shockwave Flash"]).description;
			return parseInt(b.substr(b.indexOf(".")-2,2),10)>=a
		}
		return false
	}
}

function replaceFonts()
{
	new Font('gotham-ultra.swf', {tags:'h2', classFilter:'pageHeader'}).replace();
	new Font('gotham-ultra.swf', {tags:'h2', classFilter:'chapter'}).replace();
	new Font('gotham-condensed.swf', {tags:'span', classFilter:'gotham-condensed', sizeAdjust: 1, align: 'center', color: '#091621'}).replace();
	new Font('gotham-condensed.swf', {tags:'h2', classFilter:'TTHeadline'}).replace();
	new Font('jellyka.swf', {tags:'h3', classFilter:'faqthreadtitle', sizeAdjust: 4, width: 700}).replace();
	new Font('jellyka.swf', {tags:'span', classFilter:'jellyka', sizeAdjust: 4, width: 700}).replace();
}

/** 
	@class Megadropdown Main Class
	@description
	Megadropdown Main Class
*/
var MD = 
{
	oTempContainer	  : [],
	arrItems		  : [],
	oCurrentTopLvl	  : -1,
	iCount			  : 0,
	bActiveElement	  : false,
	bTimerRunning 	  : false,
	iCurrentElement	  : -1,
	waitTime 		  : 50,
	/**
		@description
		<i>Megadropdown Constructor</i><br>
		grabs all topLevel List Elements and generates a navItem Object for it.
	*/
	init  : function()
	{
		MD.oTempContainer = document.getElementsByTagName('LI');
		for(var count = 0;count < MD.oTempContainer.length;count++)
		{
			if(MD.oTempContainer[count].className == "navTopLi" || MD.oTempContainer[count].className == "navTopLi current")
			{
				MD.arrItems[MD.iCount] = new naviItem(MD.oTempContainer[count], MD.iCount);
				MD.arrItems[MD.iCount].fadeOut();
				if(MD.oTempContainer[count].className == "navTopLi current" )
				{
					MD.oCurrentTopLvl = MD.iCount;
				}
				hookEvent(MD.arrItems[MD.iCount].oTopLI, 'mouseout', MD.EVENT_onMouseoutHideDropdown);
				MD.iCount++;
			}
		}
		MD.oTempContainer = null;
		if(Browser.msie)
			MD.waitTime = 20;
	},
	/**
		@description
		shows the current Menuelement after a short delay
		@param pIndex
		the current Menuelement Index
		@param bHasWaited
		Flag indicating that the short delay has expired
	*/
	show : function(pIndex, bHasWaited)
	{	
	try{
		MD.iCurrentElement = pIndex;
		var hasWaited = (bHasWaited)?true:false;
		if(MD.arrItems[pIndex].isHover() && MD.arrItems[pIndex].oTopLI.className == "navTopLi" && MD.arrItems[pIndex].isVisible())
		{	
			MD.setTopLevelClassName(pIndex);
		}
		if(MD.arrItems[pIndex].isVisible())
			return;
		if(!bHasWaited)
		{
			if(!MD.bTimerRunning)
			{
				MD.bTimerRunning = true;
				MD.x_wait(250, pIndex);
				return;
			}
			else
			{
				return;
			}
		}
		else
		{				
			for(var i = 0;i< MD.arrItems.length;i++)
			{
				if(isHover(MD.arrItems[i].oTopLI))
				{
					if(MD.arrItems[i].isVisible() && MD.arrItems[i].isHover())		// Events vom aktuell eingeblendeten Element ignorieren
					{
						return;
					}
					else
					{
						MD.arrItems[pIndex].fadeIn();
						//MD.arrItems[i].fadeIn();
					}
				}
				else if(MD.arrItems[i].isVisible())
				{
					if(MD.arrItems[i].oTopLI.className == "navTopLi")
					{
						MD.setTopLevelClassName(i);	
					}
					if(isHover(MD.arrItems[i].oContainer))
					{
						return;
					}
					else
					{
						MD.arrItems[i].fadeOut(true);
					}
				}
			}
			
			MD.bTimerRunning = false;
		}	}catch(ex){;}
	}, 
	/**
		@description
		hides the current Menu Item after a short delay -> prevent close on accidential mouseout
		@param pIndex
		the current Menuelement Index
		@param bHasWaited
		Flag indicating that the short delay has expired
	*/
	hide	: function(pIndex, hasWaited)
	{
		var l_bHasWaited = (hasWaited)?true:false;
		if(!l_bHasWaited)
		{
			MD.arrItems[pIndex].fadeOut(true);			
			window.setTimeout(function()
			{
				MD.hide(pIndex, true);
			}, 90);
			return;
		}
		else
		{
			MD.arrItems[pIndex].oTopLI.className = "navTopLi";
			if(MD.oCurrentTopLvl>= 0)
				MD.arrItems[MD.oCurrentTopLvl].oTopLI.className = "navTopLi current";
		}
		
	},
	/**
		@description
		additional delay for show Method
		@param steps
		the wait time
		@param pIndex
		the current Menuelement Index
		@param bHasWaited
		Flag indicating that the short delay has expired
	*/
	x_wait : function(steps, pIndex, pHasWaited)
	{
		var l_bHasWaited = (pHasWaited)?true:false;
		var sec = (steps)?steps:200;
		if (!l_bHasWaited) 
		{
			MD.bTimerRunning = true;
			window.setTimeout(function()
			{
				MD.x_wait(steps, pIndex, true);
			}, sec);
			return;
		}
		else
		{
			MD.bTimerRunning = false;
			MD.show(pIndex, true);
			return;
		}
	},
	/**
		@description
		resets the toplevel classname of the current category after menu mouseout
		@param pIndex
		the current Menuelement Index
		@param bHasWaited
		Flag indicating that the short delay has expired
	*/
	resetTopLevelClassName : function(pIndex, pHasWaited)						
	{	
		var l_bHasWaited = (pHasWaited)?true:false;
		if(!l_bHasWaited)
		{
			window.setTimeout(function()
			{
				MD.resetTopLevelClassName(pIndex, true);
			}, 50);
			return;			
		}
		else{
			var activeElements = false;
			for(var i = 0;i< MD.arrItems.length;i++)
			{
				if(MD.arrItems[i].isVisible() && MD.arrItems[i].isHover())
				{
					MD.arrItems[i].oTopLI.className = "navTopLi current";
					activeElements = true;
				}
				else
				{
					MD.arrItems[i].oTopLI.className = "navTopLi";
				}
			}
			if(activeElements)
			{
				return;
			}
			else
			{
				if(MD.oCurrentTopLvl>= 0)
					MD.arrItems[MD.oCurrentTopLvl].oTopLI.className = "navTopLi current";
			}			
		}
	},
	/**
		@description
		(temporarily) highlights the current selected Menuitems TopLevel List 
		@param pIndex
		the current Menuelement Index
	*/
	setTopLevelClassName : function(pIndex)			
	{														
		
		if(MD.oCurrentTopLvl >= 0) 
			MD.arrItems[MD.oCurrentTopLvl].oTopLI.className = "navTopLi";
		for(var i = 0 ; i < MD.arrItems.length;i++)
		{
			if(i != pIndex && MD.arrItems[i].oTopLI.className == "navTopLi current")
			{
				MD.arrItems[i].oTopLI.className = "navTopLi";
			}
		}
		MD.arrItems[pIndex].oTopLI.className = "navTopLi current";
	},
	/**
		@description
		checks, if mouse out, ignores events from children (bubbling) and calls fade out after a short delay 
		@param e
		the mouseout event
	*/
	EVENT_onMouseoutHideDropdown : function(e)
	{
		if(e.stopPropagation)
		{
			e.stopPropagation();
		}
		var l_oEvtTgt = getEventTarget(e);
		if(['content_box', 'navTop', 'navTopLi', 'navTopLi current', 'shadowbox', 'menuSepRight', 'menuSepLeft' , 'shadowbox_side_left', 'shadowbox_side_right', 'shadowbox_bottom_widthpreserver'].inArray(l_oEvtTgt.className))
		{
			window.setTimeout(function()
			{
				if(!MD.arrItems[MD.iCurrentElement].isHover())
					MD.arrItems[MD.iCurrentElement].fadeOut();
				else
				{
					return;
				}
			}, 200);
			return;
		}
		var l_oRelTgt = (e.relatedTarget) ? e.relatedTarget : e.toElement;
		if(!l_oRelTgt)
		{
			return;
		}
		while(!l_oRelTgt && l_oRelTgt != l_oEvtTgt && l_oRelTgt.nodeName != 'BODY')
		{
			l_oRelTgt = l_oRelTgt.parentNode
		}
		if (l_oRelTgt == l_oEvtTgt) return;
	}
};
/**
	@class Megadropdown Navigation Object
	@description
	Megadropdown Navigation Element.<br>
	Represents one top level Entry and its Menubody.<br>
	@param p_oTopLI
	the original Menu Toplevel List entry
	@param id
	internal object id -> also used for animation id
*/
function naviItem(p_oTopLI, id)
{
	this.id 				= id;
	this.oTopLI				= p_oTopLI;
	this.oContainer	 		= getElementsByClass("content_box", p_oTopLI, "div")[0] || null;
	this.hasShadows			= false;
	
	this.posX				= parseInt(getPosition(p_oTopLI)[0]);
	this.posY				= parseInt(getPosition(p_oTopLI)[1]);
	this.width				= parseInt(p_oTopLI.offsetWidth);
	this.height				= parseInt(p_oTopLI.offsetHeight);
	
	this.preservedHeight 	= parseInt(getElementsByClass("heightPreserver", this.oContainer, "div")[0].offsetHeight) + 20 ;	
	this.oContainer.posX 	= parseInt(getPosition(this.oContainer)[0]);
	this.oContainer.posY 	= parseInt(getPosition(this.oContainer)[1]);
	this.oContainer.width 	= parseInt(this.oContainer.offsetWidth);
	this.oContainer.height	= parseInt(this.oContainer.offsetHeight);
	this.animationFrame 	= new animatio(this.oContainer, "ani_" + this.id, false);
	/**
		@description
		checks, whether mouse is over toplist or menu item
		@returns boolean hoverstate
		true is hover, false if not
	*/
	this.isHover = 	function()
	{
		return (isHover(this.oTopLI) || isHover(this.oContainer));							
	}
	/**
		@description
		checks, wheter the element is visible -> visibility, display and height
		@returns boolean
		true if visible else false
	*/
	this.isVisible = function()
	{
		return (this.oContainer.style.visibility == "visible" && this.oContainer.style.display == "block" && parseInt(this.oContainer.offsetHeight) > 0)
	}
	/**
		@description 
		animated fades in the menu body. Calls drawShadows() if shadows weren't already drawn
	*/
	this.fadeIn	= function()
	{
		var speed = (Browser.msie)?5:20;
		if(!this.hasShadows)
		{
			//drawShadows(this.oContainer, "noHeader");
			if(Browser.msie)
				drawShadows(this.oContainer, "noHeader");
			else
			drawShadows(this.oContainer);
			this.hasShadows = true;
		}
		this.animationFrame.setStyle(['visibility' , 'display', 'height'], ['visible' , 'block', 0]);
		this.animationFrame.animate(['height'], [this.preservedHeight], speed, easeInOutSine);
		
		window.setTimeout("MD.setTopLevelClassName(" + this.id + ")", 1);
	}
		/**
		@description 
		animated fades out the menu body
		@param bForce
		optional: can be used to speed up fading out the menu body
	*/
	this.fadeOut = function(bForce)
	{
		var speed_normal = (Browser.msie)?6:25;
		var speed_fast   = (Browser.msie)?4:15;
		var force = (bForce)?bForce:false;
		if(!bForce && this.isHover())
			return;
		var speed 		 = (force)?speed_fast:speed_normal;
		this.animationFrame.enqueue('animate', [['[\'height\', \'padding-bottom\']'], ['[0, 0]'], speed, easeInOutSine], 0);
		this.animationFrame.enqueue('animate', [['[\'visibility\' , \'display\', \'height\']'], ['[\'hidden\' , \'none\', '+ this.preservedHeight +']'], 1, easeInOutSine], 1);
		
		this.animationFrame.next();
		MD.resetTopLevelClassName(this.id);		
	}
}
/**
	@function Shadow Function
	@description
	draws shadows around an element<br>
	wraps an element into a number of DIV containers containing the shadow graphics
	@param element
	the element to be wrapped / drawn shadows around
	@param draw_header
	optional parameter, if used all sides, including top will have shadow, else shadows will only be drawn on left, right, bottom sides
*/
function drawShadows(element, draw_header)
{
	hasHeader = draw_header || "header";

	var heightPreserver 				= getElementsByClass("heightPreserver", element, "div")[0];
	var shadowbox 						= document.createElement("div");
	var shadowbox_widthpreserver 		= document.createElement("div");
	var shadowbox_side_left 			= document.createElement("div");
	var shadowbox_side_right 			= document.createElement("div");
	var shadowbox_bottom_Middle 		= document.createElement("div");
	shadowbox.className 				= "shadowbox";
	shadowbox_widthpreserver.className 	= "shadowbox_widthpreserver";
	shadowbox_side_left.className		= "shadowbox_side_left";
	shadowbox_side_right.className 		= "shadowbox_side_right";
	shadowbox_bottom_Middle.className 	= "shadowbox_bottom_Middle";

	element.appendChild(shadowbox);
	
	if(hasHeader == "header")
	{	
		var shadowbox_header_middle = document.createElement("div");
		shadowbox_header_middle.className = "shadowbox_header_middle";
		
		shadowbox.appendChild(shadowbox_header_middle);
		shadowbox_header_middle.innerHTML =   '<div class=\"shadowbox_header_cLeft\"></div>'
											+ '<div class=\"shadowbox_header_widthPreserver\"></div>'
											+ '<div class\="shadowbox_header_cRight\"></div>';
	}
	shadowbox.appendChild(shadowbox_widthpreserver);
	shadowbox_widthpreserver.appendChild(shadowbox_side_left);
	shadowbox_widthpreserver.appendChild(shadowbox_side_right);
	shadowbox.appendChild(shadowbox_bottom_Middle);
	shadowbox_bottom_Middle.innerHTML 		= 	'<div class=\"shadowbox_bottom_cLeft\"></div>'
											+	'<div class=\"shadowbox_bottom_widthpreserver\" ></div>'
											+	'<div class=\"shadowbox_bottom_cRight\" ></div>';
	shadowbox_widthpreserver.insertBefore(heightPreserver, shadowbox_side_right);

	element.style.marginLeft = (parseInt(element.style.marginLeft))?parseInt(element.style.marginLeft) -9 + "px": "-9px";
	element.style.paddingLeft = "9px";
}
/* <-- END Megadropdown */

/** 
	@class Application Gallery Slider Class
	@description
	Application Gallery <br>
	Animation Code for application gallery slider
	
*/
var ag = 
{
	itemPane    : null,
	ctrlFwd     : null,
	ctrlBack    : null,
	oContainer  : [],
	arrElements : [],
	iElCount    : 0,
	pos			: 0,
	iSize 		: 105,
	aniObject 	: null,
	iCount 		: 0,
	/**
		<i>application gallery constructor</i><br>
		grabs all relevant elements, adds events and sets picture width
	*/
	init : function () 
	{
		ag.itemPane   = 0;
		ag.iElCount   = 0;
		ag.itemPane   = getElement("applicationGallery_ctrlContainer");
		ag.oContainer = document.getElementsByTagName("li");
		for(ag.iCount = 0; ag.iCount < ag.oContainer.length;ag.iCount++)
		{
			if(ag.oContainer[ag.iCount].className == "galleryItem" || ag.oContainer[ag.iCount].className == "galleryItem current" )
			{
				ag.arrElements[ag.iElCount++] = ag.oContainer[ag.iCount];
			}
		}
		ag.aniObject = new animatio(ag.itemPane, "aniObj", false);
		ag.ctrlFwd   = document.getElementsByClassName("galleryNavButton forward")[0];
		ag.ctrlBack  = document.getElementsByClassName("galleryNavButton back")[0];
		ag.pos 	 	 = ag.itemPane.offsetLeft;
		if(ag.pos >= 0)
			ag.ctrlBack.style.backgroundPosition = "0px - 450px";			
		ag.ctrlFwd.style.backgroundPosition = (ag.pos > (730 - ((ag.arrElements.length) * ag.iSize)))?"0px -90px":"0px -180px";
	},
	/**
		@description
		moves the item pane 'one picture width' to the left, revealing the next image at the rightmost position. If the current rightmost image is already shown, ignore
	*/
	step_forward : function()
	{
		ag.pos = ag.itemPane.offsetLeft;
		if(ag.pos > (730 - ((ag.arrElements.length) * ag.iSize)))
		{
			ag.ctrlFwd.style.backgroundPosition = "0px -90px";
			ag.aniObject.animate(["left"], [(parseInt(ag.itemPane.offsetLeft) - ag.iSize)], 20, easeOutSine);
			ag.ctrlBack.style.backgroundPosition = "0px -360px";	
		}
		else
		{
			ag.ctrlFwd.style.backgroundPosition = "0px -180px";					
		}
		window.setTimeout(function()
		{
			if(isHover(getElement("gallery_fwd")))
			{
				ag.step_forward();
			}
		}, 100);	
	},
	/**
		@description
		moves the item pane 'one picture width' to the right, revealing the previous image at the leftmost position. If the current leftmost image is the first image in the row, ignore
	*/
	step_back : function()
	{
		ag.pos = ag.itemPane.offsetLeft;
		if(ag.pos < 0)
		{
			ag.ctrlBack.style.backgroundPosition = "0px -360px";
			ag.ctrlFwd.style.backgroundPosition  = "0px -90px";	
			ag.aniObject.animate(["left"], [(parseInt(ag.itemPane.offsetLeft) + ag.iSize)], 20, easeOutSine);
		}
		else
		{
			ag.ctrlBack.style.backgroundPosition = "0px -450px";
		}
		window.setTimeout(function()
		{
			if(isHover(getElement("gallery_bck")))
			{
				ag.step_back();
			}
		}, 80);		
	},
	/**
		@description
		resets hoverstate of the gallery buttons
	*/
	resetHoverState : function(element)
	{
		ag.pos = ag.itemPane.offsetLeft;
		if(element.className == "galleryNavButton forward")
		{
			element.style.backgroundPosition = (ag.pos <= (730 - ((ag.arrElements.length) * ag.iSize)))?"0px -180px":"0px -1px";
		}
		else if(element.className == "galleryNavButton back")
		{
			element.style.backgroundPosition = (ag.pos >= 0)?"0px -450px":"0px -360px";
		}		
	}
}
/* <-- END Application Gallery */

/* AJAX Pagination */
var g_oElement, g_strHash;
/**
	@class 
	Ajax Pagination Main Class
	@description
	Ajax Pager Class<br>
*/

var pager = 
{
	g_oElement : null,
	g_strHash  : null,
	categories : {NEWS:'NEWS', DOWNLOADS:'DOWNLOADS', APPLICATION_STORE: 'APPLICATION_STORE', HISTORY:'HISTORY',
					LEARNING_CENTER : 'LEARNING_CENTER'},
	l_strTarget		: 'CONTENT_TABLE',
	l_strCategory	: '',
	/**
		@description
		<i>the pagers constructor</i><br>
		sets the pager.hashkeeper interval and extracts information from the current window.location.hash
	
	*/
	init: function(p_strTarget, p_strCategory)
	{
		if(!!p_strTarget && typeof p_strTarget == "string")
			pager.l_strTarget = p_strTarget;
		if(!!p_strCategory && typeof p_strCategory == "string")
			pager.l_strCategory = p_strCategory;

		pager.getLinks();
		
		pager.g_strHash = (window.location.hash)?window.location.hash.split('#'):window.location.search;
		if(pager.g_strHash.length > 0)
			pager.g_strHash = window.location.pathname + ( window.location.hash.split('#')[1]); 
		pager.g_strHash = (window.location.hash)?window.location.hash.split('#'):window.location.search;
		window.setInterval(pager.hashkeeper, 1000);
		
		if(pager.l_strCategory == pager.categories.APPLICATION_STORE)
			pager.updateBreadcrumb();
		if(pager.l_strCategory == pager.categories.APPLICATION_STORE)
			pager.initTabs();
		
			
	},
	setTarget: function(p_strTarget)
	{
		pager.l_strTarget = p_strTarget;
	},
	/**
		@description
		loads another Page depending on the given hash value
		@param pStrURL
		the URL of the next Page
		@param pTarget
		optional Parameter, if not used Assume CONTENT_TABLE as target for the ajax requests result
		@param pElement
		used for news page pagination (arrow Tabs)
	*/
	loadPage : function(pStrURL, pTarget, pElement)
	{
		pager.g_oElement = (pElement)?pElement:null;
		ajaxRequest
		(
			{	
				'strUrl'			: window.location.pathname +  pStrURL + '&o=1',
				'varTargetElement'	: pager.l_strTarget,
				'strMethod'	 	  	: 'GET',
				'bShowThrobber'		: true,
				'onAfterLoad'		: function()
				{
					window.location.hash = pStrURL;
					switch(pager.l_strCategory)
					{
						case pager.categories.APPLICATION_STORE:
							pager.updateBreadcrumb();
							pager.initTabs();
							ss.smoothScroll(getElement("storeNavbar"));
						break;
						case pager.categories.NEWS:
							ss.smoothScroll(getElement('NEWS_SUBNAVIGATION'));
							if(pElement)
							{
								var newscontainer 	  = getElement("NEWS_SUBNAVIGATION");
								var arrowTabContainer = getElementsByClass("arrowTabActive", newscontainer, "a");
								for(var i = 0;i< arrowTabContainer.length;i++)
								{
									arrowTabContainer[i].className = "arrowTab";
								}
								pager.g_oElement.className="arrowTabActive";
							}	
						break;
						case pager.categories.HISTORY:
							ss.smoothScroll(getElement('storeNavbar'));
							ah.init();
						break;
						default:
							ss.smoothScroll(getElementsByClass('BODY_FULL', document, "body")[0]);
						break;
					}
					pager.getLinks();
				}
			}
		);
		pager.g_strHash = pStrURL;
		return false;
	},
	/**
		@methodOf pager
		@description
		handles muse clicks on the pager buttons (page numbers)
		strips informations from the given links and passes them to the window.location hash, so that pagwer.hashkeepr can use them to load a new page
		@param e
		the click event used to get the clicked link
	*/
	click : function(e)
	{
		e.preventDefault ? e.preventDefault() : e.returnValue = false;
		var l_strNewsCategory, l_strNewHash;
		var l_oTarget = getEventTarget(e);
		if(l_oTarget)
		{
			l_strNewsCategory = l_oTarget.pathname.split('/news/')[1];	
			if(l_oTarget.search)
				l_strNewHash = l_oTarget.search;
			else if(l_oTarget.pathname.split('~')[1])
				l_strNewHash = '?' + l_oTarget.pathname.split('~')[1];
			else if(l_oTarget.href.split('?i')[1])
				l_strNewHash = '?i' + l_oTarget.href.split('?i')[1];
			else
				l_strNewHash = '?i=0&r=10';
			l_strNewHash +=  (l_strNewsCategory)? ('&c=' + l_strNewsCategory):"";
		}
		window.location.hash = l_strNewHash;
		return false;
	},
	/**
		@methodOf pager
		@description
		hashkeeper Method for ajax pagination, checks the current window.location.hash against a stored version,
		if not equal the new hash will be loaded
	*/
	hashkeeper: function()
	{
		var l_oCurrentLocation = (window.location.hash)?window.location.hash.split('#')[1]:window.location.search;
		if(l_oCurrentLocation != pager.g_strHash)
		{
			pager.loadPage(l_oCurrentLocation);
			pager.g_strHash = l_oCurrentLocation;
		}
	},
	/**
		@methodOf pager
		@description
		initialize AppStore Application Sort Tabs
	*/
	initTabs : function()
	{
		if(!getElement("PAGINATION_TABS")) return;
		var tabs = getElement("PAGINATION_TABS").getElementsByTagName("a");
		for(var i = 0 ; i < tabs.length;i++)
		{
			if(tabs[i].className == "AppSort" || tabs[i].className == "AppSort active")
			{
				hookEvent(tabs[i], 'click', pager.click);
			}
		}
	},
	/**
		@methodOf pager
		@description
		write back the chosen category to breadcrumb bar after switching it via aAppsort Tabs
	*/
	updateBreadcrumb : function()
	{
		var bcLinks    = (getElement("storeNavbar"))?getElement("storeNavbar").getElementsByTagName("a"):false;
		if(!bcLinks) return;
		var tabLinks   = getElement("PAGINATION_TABS").getElementsByTagName("a");
		var currentTab = "";
		var entries    = [];
		for(var i = 0; i < tabLinks.length;i++)
		{
			entries.push(tabLinks[i].innerHTML);
			if(tabLinks[i].className == "AppSort active")
				currentTab = tabLinks[i];
		}
		if(!entries.inArray(bcLinks[1].innerHTML))
			return;
		if(bcLinks[1].innerHTML != currentTab.innerHTML && currentTab)
		{
			bcLinks[1].innerHTML = currentTab.innerHTML;
			bcLinks[1].href 	 = currentTab.href;
		}
	},
	/**
		@methodOf pager
		@description
		add Events for current shown pagenumbers and forward / back Buttons
	*/
	getLinks : function()
	{
		if(!getElement("PAGINATION_CONTAINER")) return;
		var l_oContainer = getElement("PAGINATION_CONTAINER").getElementsByTagName("a");
		for(var i = 0;i < l_oContainer.length;i++)
		{
			if(l_oContainer[i].className == "pager" || l_oContainer[i].className == "pagerActive" || l_oContainer[i].className == "bck" || l_oContainer[i].className == "fwd" )
			{
				hookEvent(l_oContainer[i], 'click', pager.click);
			}
		}
	}
}


/* <-- END AJAX Pagination */
/**
	@function
	@description
	wraps all matching embed elements in a div container and sets additional Parameters on the flash object so the natural HTML z-Index works again
 
 */
function setFlashVideoZIndex() // wrap embedded flash video objects in div container add additional parameters and set z-index
{
	var arrVideos = getElementsByClass("flashVideo", document, "div");
	for(var i = 0; i < arrVideos.length;i++)
	{
		var tempContainer = arrVideos[i].children[0];
		var newParam 	  = document.createElement("param");
		newParam.setAttribute('name', 'wmode');
		newParam.setAttribute('value', 'transparent');
		tempContainer.appendChild(newParam);
		for(var j = 0; j < tempContainer.children.length;j++)
		{
			if (tempContainer.children[j].tagName == "embed" || tempContainer.children[j].tagName == "EMBED") 
			{
				var embedTag = tempContainer.children[j];
				embedTag.setAttribute('wmode', 'transparent');
			}	
		}
	}
}
/* <-- setFlashVideoZIndex*/

function formPt1 ()
{
	l_oCustomTable	= getElement("customfields");
	l_oDefaultTable	= getElement("defaultform");
	l_oToolbar1		= getElement("frmToolbar1");
	l_oToolbar2		= getElement("frmToolbar2");
	l_oBackButton	= getElement("frmBackBtn");
	var l_strBrowserName = navigator.appName;
	
	if (l_strBrowserName=="Microsoft Internet Explorer")
		l_oCustomTable.style.display	= "block";
	else
		l_oCustomTable.style.display	= "table";
		
	l_oCustomTable.style.visibility		= "visible";
	
	l_oDefaultTable.style.display		= "none";
	l_oDefaultTable.style.visibility	= "hidden";
	
	if (l_strBrowserName=="Microsoft Internet Explorer")
		l_oToolbar1.style.display		= "block";
	else
		l_oToolbar1.style.display		= "table";
	l_oToolbar1.style.visibility		= "visible";
	
	l_oToolbar2.style.display			= "none";
	l_oToolbar2.style.visibility		= "hidden";
	
	l_oBackButton.style.display			= "none";
	l_oBackButton.style.visibility		= "hidden";
}

function formPt2 ()
{
	l_oCustomTable	= getElement("customfields");
	l_oDefaultTable	= getElement("defaultform");
	l_oToolbar1		= getElement("frmToolbar1");
	l_oToolbar2		= getElement("frmToolbar2");
	l_oBackButton	= getElement("frmBackBtn");
	var l_strBrowserName = navigator.appName;
	
	hide(l_oCustomTable);
	
	if (l_strBrowserName=="Microsoft Internet Explorer")
		l_oDefaultTable.style.display	= "block";
	else
		l_oDefaultTable.style.display	= "table";
	l_oDefaultTable.style.visibility	= "visible";
	
	hide(l_oToolbar1);
	
	if (l_strBrowserName=="Microsoft Internet Explorer")
		l_oToolbar2.style.display		= "block";
	else
		l_oToolbar2.style.display		= "table";
	l_oToolbar2.style.visibility		= "visible";
	
	l_oBackButton.style.display			= "inline";
	l_oBackButton.style.visibility		= "visible";
}


var g_arrFields = ['Salutation', 'Firstname', 'Lastname', 'EMailSignup', 'EMail', 'Phone', 'Password', 'ConfirmPassword', 'BillingCompany', 'BillingStreet', 'BillingZIP', 'BillingCity', 'BillingCountry', 'Company', 'Street', 'ZIP', 'City', 'Country', 'Workstations', 'Herkunft', 'EigeneHerkunft', 'Origin', 'VatID', 'Terms'];
function initializeForm()
{
	for(var i=0;i<g_arrFields.length;i++)
	{
		hookEvent(getElement(g_arrFields[i]), ['keyup','click'], validateInput);
		hookEvent(getElement(g_arrFields[i]), 'blur', EVENT_onblurNotice);
	}
	hookEvent(getElement('registrationformular'), 'submit', validateInput);
}

function validateInput(e)
{
	if(e.type == "submit")
	{
		for(var i=0;i<g_arrFields.length;i++)
		{
			var l_oField = getElement(g_arrFields[i]);
			if(l_oField != null && (hasClass(l_oField, "Needed")))
			{
				if(l_oField.value == "" || (l_oField.name == 'Terms' && l_oField.checked == false))
				{
					var l_bRequired = true;
					break;
				}
			}	
		}
	}
	else
	{
		var l_oField = getElement(getEvent(e));
	}
	var l_strFieldValue = getValue(l_oField);
	
	if(l_oField.tagName == 'OPTION') return;
		ajaxRequest
		(
			{																									
				'strUrl': '?a=1002&rq_name=' + l_oField.name + '&rq_value=' + encodeURIComponent(getValue(l_oField)) + ((l_oField.name == "ConfirmPassword") ? ('&rq_valueconfirm=' + encodeURIComponent(getElement('Password').value)) : '' + ((l_bRequired == true) ? '&rq_required=true' : '')),
				'strMethod': 'GET',
				'onAfterLoad': 
				function(response)
				{
					var l_oReference = l_oField;
					if((l_strFieldValue == l_oField.value || (l_oField.name == 'Terms' && l_oField.checked != true)) && (![' ',''].inArray(response) || (l_bRequired && (l_oField.value == "" ))))
					{
						new notice(l_oReference, response, "NE", 230);
					
						if(hasClass(l_oReference, "zip"))
							addClass(l_oReference, "formErrorZip");
						else if(hasClass(l_oReference, "city"))
							addClass(l_oReference, "formErrorCity");
						else if(hasClass(l_oReference, "longField"))
							addClass(l_oReference, "formErrorLongField");
						else if(hasClass(l_oReference, "selectionList"))
							addClass(l_oReference, "formErrorSelectionList");
						else if(hasClass(l_oReference, "registration3"))
							addClass(l_oReference, "formError2");
						else
							addClass(l_oReference, "formError");
					}
					else 
					{
						if(l_oReference.oNotice)
							l_oReference.oNotice.close();
							
						removeClass(l_oReference, "formErrorZip");
						removeClass(l_oReference, "formErrorCity");
						removeClass(l_oReference, "formErrorLongField");
						removeClass(l_oReference, "formErrorSelectionList");
						removeClass(l_oReference, "formError2");
						removeClass(l_oReference, "formError");
					}
				}
			}
		);
	if(l_bRequired)
		return false;
}

function notice(p_varObject, p_strNotice, p_strOrientation, p_iWidth)
{
	if ([' ', ''].inArray(p_strNotice)) return;
	var p_strOrientation = p_strOrientation || "EN";
	var p_iWidth 		 = p_iWidth || 200;
	this.oReference 	 = p_varObject = getElement(p_varObject);
	if(p_varObject.oNotice)
	{
		p_varObject.oNotice.update(p_strNotice);
	}
	else
	{
		this.oHTMLNotice = document.createElement("DIV");
		this.oHTMLNotice.innerHTML = '<div class="noticeBox"><img src="/images/cms/ALL/icons/32/about.png"><span></span></div>';
		window.document.body.appendChild(this.oHTMLNotice);
		this.oHTMLNotice.className = 'noticeContainer';

		this.oSpan = this.oHTMLNotice.getElementsByTagName('SPAN')[0];
		this.update(p_strNotice);
		l_oAniNotice = new animatio(this.oHTMLNotice,'Notice', false);
		l_oAniNotice.setStyle('width', p_iWidth); 
		l_arrReferenceItemPosition = getPosition(p_varObject);
		switch (p_strOrientation)
		{
			case 'NE':
				var l_strArrowClass 	= "arrow4";
				var l_arrNoticePosition = [l_arrReferenceItemPosition[0] + p_varObject.offsetWidth-this.oHTMLNotice.offsetWidth, l_arrReferenceItemPosition[1] - this.oHTMLNotice.offsetHeight-15];
				var l_arrArrowPosition 	= [this.oHTMLNotice.offsetWidth-35,this.oHTMLNotice.offsetHeight-15];	//-15 = padding-bottom
				
				break;
			case 'EN':
				var l_strArrowClass 	= "arrow4";
				var l_arrNoticePosition = [l_arrReferenceItemPosition[0]+p_varObject.offsetWidth+5, l_arrReferenceItemPosition[1]-10];
				var l_arrArrowPosition 	= [0, 20]
				break;
			case 'N':
				var l_strArrowClass 	= "arrow7";
				var l_arrNoticePosition = [l_arrReferenceItemPosition[0] + p_varObject.offsetWidth/2 - this.oHTMLNotice.offsetWidth/2, l_arrReferenceItemPosition[1] - this.oHTMLNotice.offsetHeight-15];
				var l_arrArrowPosition 	= [this.oHTMLNotice.offsetWidth/2 - 15,this.oHTMLNotice.offsetHeight-15];
				break;
			case 'NW':
				var l_strArrowClass 	= "arrow3";
				var l_arrNoticePosition = [l_arrReferenceItemPosition[0] - 15, l_arrReferenceItemPosition[1] - this.oHTMLNotice.offsetHeight-15];
				var l_arrArrowPosition 	= [35,this.oHTMLNotice.offsetHeight-15];
				break;
		}
		
		var l_oArrow 		= this.oArrow = document.createElement("DIV");
		l_oArrow.className 	= l_strArrowClass;
		this.oHTMLNotice.appendChild(l_oArrow);
		var l_oAniArrow 	= new animatio(getElementsByClass(l_strArrowClass,this.oHTMLNotice,'DIV')[0], 'Notice Arrow', false);
		
		l_oAniNotice.setPosition(l_arrNoticePosition);
		l_oAniArrow.setPosition(l_arrArrowPosition);
		
		l_oAniNotice.fadeIn(window.ie ? 6 : 3);
		l_oAniArrow.fadeIn(window.ie ? 6 : 3);
		p_varObject.oNotice = this;
	}
}
notice.prototype.close  = closeNotice;
notice.prototype.update = updateNotice;

function closeNotice()
{
	if(this.oHTMLNotice)
	{
		this.oArrow.oAni.stop().restore();
		this.oHTMLNotice.oAni.stop().restore();
		this.oReference.oNotice = null;
		this.oHTMLNotice = null;
		delete this.oHTMLNotice;
	}
	//else alert(this)
}

function updateNotice(p_strNotice)
{
	if(this.oSpan)
		this.oSpan.innerHTML = p_strNotice;
}

function EVENT_onblurNotice(e)
{
	var l_oElement = getElement(e);
	if(l_oElement.oNotice)
		l_oElement.oNotice.close();
	
}

/*	Signup Formular	*/
function justifySignupFieldDescription()
{
	//Versteckt die Umsatzsteuerid
	if(getElement('VatID') && getElement('VatID').value == '')
	{
		var l_oVatIdDiv	= getElement('VatIdContainer');
		l_oVatIdDiv.style.display = "none";
		l_oVatIdDiv.style.visiblity = "hidden";
	}
	
	var arrSpans = getElementsByClass('pos', null, "SPAN");
	for(var i = 0; i < arrSpans.length; i++)
	{
		addClass(arrSpans[i], 'bottomSpace');
	}
	
	// Versteckt alle Fehler die in einem DisplayError Span sind
	var arrSpans = getElementsByClass('displayError', null, "SPAN");
	for(var i = 0; i < arrSpans.length; i++)
	{
		addClass(arrSpans[i], "Hide");
	}
	hookEvent(getElement('separateAdress'), 'click', changeAdressStatus);
	hookEvent(getElement('BillingCountry'), 'change', showVatIdField);
}

function inputFieldsWatermarks()
{
	//Versteckt die Feldtittel 
	var l_oInput;
	var arrLabels = getElementsByClass('fieldDescription', null, "LABEL");
	for(var i = 0; i < arrLabels.length; i++)
	{
		removeClass(arrLabels[i], "fieldDescription");
		addClass(arrLabels[i], "fieldDescription2");
		l_oInput = getElement(arrLabels[i].htmlFor);
		
		if(!hasClass(arrLabels[i].parentNode, 'pos'))
			wrap([arrLabels[i], l_oInput], 'SPAN', 'pos');
		
		// Wenn das Input Feld nicht leer ist, zeige kein Label an!
		if(l_oInput.value != '')
			hideSignupFieldDescription(l_oInput);
		
		hookEvent(arrLabels[i], 'mousedown', hideSignupFieldDescription);
		hookEvent(l_oInput, 'keyup', hideSignupFieldDescription);
		hookEvent(l_oInput, 'change', hideSignupFieldDescription);			
	}
}


function hideSignupFieldDescription(e)
{
	// wir brauchen das label um es auszublenden und wir brauchen das feld um ein onclick darauf anzuwenden
	e = getEvent(e);
	var l_oElement = getEventTarget(e) || getElement(e);
	var l_oInput = null;
	var l_oLabel = null;
	
	if(l_oElement.htmlFor != null)
	{
		//Label ist bekannt
		l_oInput = getElement(l_oElement.htmlFor);
		l_oLabel = l_oElement;
		e.preventDefault();
	}
	else
	{
		//Inputfeld ist bekannt
		l_oInput = l_oElement;
		l_oLabel = l_oElement.parentNode.children[0];
	}
	
	if(l_oElement.click)
		l_oInput.click();
	
	if(l_oLabel)
	{
		if(l_oInput.value != "")
			addClass(l_oLabel, "Hide");		//l_oLabel.style.display = "none";
		else
			removeClass(l_oLabel, "Hide");	//l_oLabel.style.display = "";
	}
}


function showVatIdField(e)
{
	var l_oBillingCountry = getElement('BillingCountry');
	if(!l_oBillingCountry)
		return;
	var l_bIsEUCountry = l_oBillingCountry[l_oBillingCountry.selectedIndex].value in oc(['AT', 'BE', 'BG', 'CY', 'CZ', 'DK', 'EE', 'ES', 'FI', 'FR', 'GB', 'GR', 'HU', 'IE', 'IT', 'LT', 'LU', 'LV', 'MT', 'NL', 'PL', 'PT', 'RO', 'SE', 'SI', 'SK']);
	var l_oAniVatIdContainer = getAni("VatIdContainer", "ShowHideVatIDContainer", false);
	
	if(l_bIsEUCountry && l_oAniVatIdContainer.getStyle("height") <= 0)
	{
		l_oAniVatIdContainer.setStyle(["height", "display", "opacity"], [0, "block", 0.00001]);
		l_oAniVatIdContainer.enqueue('animate', [['[\'height\']'], 	['[38]'], 20, easeOutCirc], 1);
		l_oAniVatIdContainer.enqueue('animate', [['[\'opacity\']'], ['[1]'], 50, easeOutCirc], 1);
		l_oAniVatIdContainer.next();
	}
	else if(!l_bIsEUCountry && l_oAniVatIdContainer.getStyle("height") > 0)
	{
		l_oAniVatIdContainer.setStyle(["height", "display", "opacity"], [38, "block", 0.00001]);
		l_oAniVatIdContainer.enqueue('animate', [['[\'opacity\']'], ['[0.0000001]'], 20, easeOutCirc], 1);
		l_oAniVatIdContainer.enqueue('animate', [['[\'height\']'],  ['[0]'], 30, easeOutCirc], 1);
		l_oAniVatIdContainer.enqueue('animate', [['[\'display\']'], ['["none"]'], 0, easeOutCirc], 1);
		l_oAniVatIdContainer.next();
	}	
}

function changeAdressStatus(e)
{
	var l_oSeperateAddress = getElement('separateAdress');
	if(!l_oSeperateAddress)
		return;

	var l_oShippingAddressContainer = getElement('shippingAddress');
	var l_oCompany 	= getElement('Company');
	var l_oStreet 	= getElement('Street');
	var l_oZIP 		= getElement('ZIP');
	var l_oCity 	= getElement('City');
	var l_oCountry 	= getElement('Country');
	
	if(l_oSeperateAddress.checked)
	{
		removeClass(l_oShippingAddressContainer, "Hide");
		addClass(l_oCompany, 	"Needed");
		addClass(l_oStreet, 	"Needed");
		addClass(l_oZIP, 		"Needed");
		addClass(l_oCountry, 	"Needed");
		addClass(l_oCity, 		"Needed");
	}
	else
	{
		addClass(l_oShippingAddressContainer, "Hide");
		removeClass(l_oCompany, "Needed");
		removeClass(l_oStreet, 	"Needed");
		removeClass(l_oZIP, 	"Needed");
		removeClass(l_oCity, 	"Needed");
		removeClass(l_oCountry, "Needed");
	}
}

   /**
	@function Enum
	@param constantsList
	List of String Constants representing your Enumeration
	@description
	Emulate the missing enum Keyword<br>
	usage:<br>
	<code>
		var colors = new Enum(['RED', 'BLUE', 'GREEN']); <br>
		var myColor = colors.BLUE;  // returns 1			 <br>
		var myColor = colors.GREEN; // returns 2			 <br>
	</code>
	@author PeterS
*/
function Enum(constantsList) 
{
    for (var i in constantsList) 
	{
        this[constantsList[i]] = i;
    }
}
/**
	@function contains
	@param searchString
	@description
	<code>String.contains('searchString')</code><br>
	returns true, if searchString is part of String (index >= 0), else returns false (index == -1)
	@author PeterS
	the String to be matched
*/
if(typeof String.prototype.contains !== 'function') 
{
	String.prototype.contains = function(term) 
	{
		return (this.search(term) != -1)?true:false; 
	}
}

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
/*	
 *		 Referenzkundenportal
 */
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////


/**
	@class Reference Customer Portal Control Bar
	@description
	reference customer portal control bar<br>
	contains buttons for switching between company profile and case study (if available), homepage link and
	a pause / play button (handled by rcButton class)
*/
var rcControlBar =
{
	bar  : null,
	link : null,
	/**
		@description
		grab button links after page load and add events for ajax requests by rcControlBar.switchTab
	*/
	update : function()
	{
		try
		{
			rcControlBar.bar = document.getElementById("CS_Info_switch").getElementsByTagName("li");
			for(var i = 0; i < rcControlBar.bar.length;i++)
			{
				hookEvent(rcControlBar.bar[i].children[0],   'click', rcControlBar.switchTab);
			}
		}
		catch(ex){;/* ignore if no Links found -> Customer w/o CaseStudy */}
		rcButton.show();
	},
	/**
		@description
		strips informations from the clicked link and changes window.location.hash<br>
		-> haskeeper then loads the correct link via ajax request
	*/
	switchTab : function(e)
	{
		e.preventDefault ? e.preventDefault():e.returnValue = false;
		try{
			rcb.bSlideshow = false;
		}
		catch(ex){
			throw new Error("rcb not initialized..");
		}
		rcControlBar.link = getElement(e).pathname;
		if(rcControlBar.link.trim().match(/\/?(de|en)\/(referenzen|references)\//))
		{
			window.location.hash = rcControlBar.link.trim().replace(/\/?(de|en)\/(referenzen|references)\//, '');
			
		}
		else if(rcControlBar.link.trim().match(/\/?(de|en)\/cases\//))
		{
			window.location.hash = rcControlBar.link.trim().replace(/\/?(de|en)\/cases\//, '') + '/caseStudy';
		}
	}
}
/**
	@class Reference Customer Portal Play / Pause Button
	@description
	reference customer portal play/pause button
*/
var rcButton = 
{
	btn 	: null,
	throbber: null,
	/**
		shows the 'play / pause' button on controlbar, if not already visible -> default invisible for no script users
	*/
	show: function()
	{
		rcButton.btn = document.getElementById("RC_PAUSE_BUTTON");
		// disable 'start / pause' slideshow button, if case study tab is active
		if(window.location.href.match(/\/caseStudy/) || (window.location.href.trim().match(/\/(de|en)\/cases\//) && window.location.hash.trim().length == 0))
		{
			rcButton.btn.className.replace(/inactive/g, '');
			rcButton.btn.className =  rcButton.btn.className + 'inactive';
		}
		// show button, if not already visible -> invisible as default for no script users
		if(rcButton.btn.className.contains("hidden"))
		{
			rcButton.btn.className = rcButton.btn.className.replace(/hidden/g, '').trim();
			hookEvent(rcButton.btn, 'click', rcButton.click);
		}
		if(!rcb.bSlideshow)
		{
			rcButton.btn.className = rcButton.btn.className.replace(/running/g, 'paused');
			rcButton.btn.title = pauseButton_Title[0];
		}
		else
		{
			rcButton.btn.className =  rcButton.btn.className.replace(/paused/g, "running");
			rcButton.btn.title = pauseButton_Title[1];
		}
	},
	/**
		handles click events on the play / pause button -> changes class and starts or pauses the slideshow using the rcb.bSlideshow flag
	*/
	click: function()
	{
		if(window.location.href.match(/\/caseStudy/) || (window.location.href.trim().match(/\/(de|en)\/cases\//) && window.location.hash.trim().length == 0)){
			return;
		}
		if(!rcButton.btn)
			rcButton.show();
		if(rcButton.getClass().trim() == "pause_sprite paused")
		{
			rcButton.setClass("pause_sprite running");
			rcButton.btn.title = pauseButton_Title[1];
			rcButton.showThrobber();
			rcb.bSlideshow = true;
		}
		else
		{
			rcButton.setClass("pause_sprite paused");
			rcButton.btn.title = pauseButton_Title[0];
			rcb.bSlideshow = false;
		}
	},
	/**
		set class 
		@param p_strClassName
		the new className
	*/
	setClass : function(p_strClassName)
	{
		rcButton.btn.className = p_strClassName;
	},
	/**
		get the buttons className
		@returns String rcButton.btn.className
	*/
	getClass : function()
	{
		return rcButton.btn.className;
	},
	/**
		@description
		shows a little throbber while the slide show has not already restarted
	*/
	showThrobber : function()
	{
		rcButton.throbber = document.getElementById("RC_PLAY_PAUSE_THROBBER");
		rcButton.throbber.className = rcButton.throbber.className.replace(/hidden/g, 'visible');
	}
}
/**
	
	@class 
	Reference Customer Portal Hashkeeper Method
	@augments rcb
	@description
	Reference Customer Portal Hashkeeper.<br>
	The Hashkeeper stores the hash for the current location and checks it every second for changes.<br> 
	If it is changed the hashkeeper loads a new page via ajax request, depending on hashvalue
	@author PeterS
	@version 1.1
*/
var keeper = 
{
	strHash    	: '',					// stored Hash for comparison with current Hash-Value
	bFirstload 	: false,				// is Page loaded by direct Link
	tInterval  	: null,					// 
	bReady	   	: false,				// signals keeper's ready state
	initializing: false,				//
	bShowCase  	: false,				// Page is loaded with showCase Parameter
	/**
	@methodOf keeper
	@description
	<i>keeper constructor</i><br>
	  initializes hashkeeper Method and sets the hash check interval
	*/
	init : function()
	{
		if(!keeper.initializing)		// Disallow multiple instances of keeper
			keeper.initializing = true;	// to be created by CMS.Template and showcases.php
		else if(keeper.initializing)
			return;
		if(window.location.hash.trim().length > 0)
		{
			keeper.strHash = window.location.hash.trim();
			keeper.loadPage(window.location.hash);
			try{
				var btn 	   = document.getElementById("RC_PAUSE_BUTTON");
				rcb.bSlideshow = false;
				rcButton.setClass("pause_sprite paused");
			}
			catch(ex){
				//throw new Error("rcb not initialized..");
			}
		}
		else	// Bookmark or new Tab Jump
		{
			if(!window.location.pathname.match(/^\/(de|en)\/(referenzen|references)$/))
			{
				rcb.highlight_and_out(getElementsByClass("infobutton", document.getElementById("CS_Info_switch"), "a")[0]);
				try{rcb.bSlideshow = false;}catch(ex){throw new Error("rcb not initialized..");}
			}
			else{
				rcb.bSlideshow = true;
			}
		}
		keeper.tInterval = window.setInterval(keeper.check, 1000);	
		keeper.bReady = true;
	},
	/**
		@methodOf keeper
		@description
		checks current Hash and calls loadPage, if Hash was changed
	*/
	check : function()
	{		
		if(window.location.hash.trim().length > 0)
		{
			var tempHash = window.location.hash.replace(/\/caseStudy/, '');
			if(keeper.strHash != window.location.hash)
			{
				keeper.strHash = window.location.hash;
				keeper.loadPage(keeper.strHash);
			}
		}
		else
		{
			return;
		}
	},
	/**
		@methodOf keeper
		@description
		loads Page, depending on Hashvalue
		@version 1.2
		@param pStrURL
		the Hash prepared and stored by keeper.check Method
	*/
	loadPage : function(pStrURL)
	{	
		var l_strURL = pStrURL.split('#')[1];
		if(!rcb.urlnames.inArray(l_strURL.replace(/\/caseStudy/, '')))
		{
			return;
			
		}
		if(!pStrURL){
			throw new Error("Target URL not defined");
		}
		if(l_strURL.match(/\/caseStudy/)){
			l_strURL = g_strLang + "/cases/" + l_strURL.replace(/\/caseStudy/, '');
		}
		else{
			l_strURL = g_strURL + l_strURL;
		}
		ajaxRequest
		(
			{	
				'strUrl'			: l_strURL + '/text',
				'varTargetElement'	: 'AREA_TEXT',
				'strMethod'	 	  	: 'GET',
				'bShowThrobber'		: true,
				'onAfterLoad' 		: function()
				{
					rcb.flyIn();
					rcControlBar.update();
				}
			}
		); 
	}
}
/**
	@class reference customer portal main class
	@description
	namespace rcb
	general reference customer portal namespace
	contains methods for correct initialization of all elements, eventhandling, slideshow,etc.
	@author PeterS
	@version 1.1
*/
var rcb = 
{
	arrLinks	: [],		// All Sidebar Links
	arrCat		: [],		// Sidebar Category Headlines
	arrHeights 	: [],		// stored Category Heights
	bDirectLoad : false,	// Page is loaded by direct Link / deeplink
	iCrntCat	: -1,		// current expanded Category
	bSlideshow	: true,		// Slideshow is active
	iCrntItm 	: 0,		// current highlighted Sidebar Link
	intval		: null,
	urlnames	: [],
	throbber 	: null,
	btn			: null,
	initialized : false,
	areaText 	: null,
	/**
		@description
		<i>rcb constructor</i>
		initializes all links in the sidebar and handel
	*/
	init : function()	
	{
		var l_oCont = getElement("CONTENT_SIDEBAR").getElementsByTagName("a");
		var j 		= 0;
		rcb.btn 	= document.getElementById("RC_PAUSE_BUTTON");
		for(var i = 0; i <l_oCont.length;i++)
		{
			if(l_oCont[i].className == "sidebarItem even" || l_oCont[i].className == "sidebarItem uneven")
			{
				rcb.arrLinks.push(l_oCont[i]);
				rcb.urlnames.push(l_oCont[i].href.split(g_strURL)[1]);
				hookEvent(rcb.arrLinks[j++], 'click', rcb.loadPage);
			}
		}
		rcb.arrCat = getElementsByClass("sidebarCategory", getElement("CONTENT_SIDEBAR"), "div");
		for(var i = 0; i < rcb.arrCat.length;i++)
		{
			rcb.arrHeights[i] = rcb.arrCat[i].offsetHeight;
			rcb.arrCat[i].style.height = "34px";
			
			hookEvent(rcb.arrCat[i], 'click', rcb.catOut);
		}
		rcb.intval = window.setInterval(rcb.slideshow, 7500);
		if(rcb.bDirectLoad)
		{
			var l_strItem = window.location.hash.split('#')[1] || window.location.href.split(g_strURL)[1]
			for(var i = 0; i < rcb.arrLinks.length;i++)
			{
				if(rcb.arrLinks[i].href.split(g_strURL)[1] == l_strItem)
				{
					rcb.catOut(rcb.arrLinks[i]);
					rcb.highlight(rcb.arrLinks[i]);											
					return;
				}									
			}
		}
		if(!keeper.bReady)
			keeper.init();
	},
	/**
	highlight current Sidebar Entry after loading page
	@author PeterS
	@param el
	the Sidebar Link to be higlighted
	*/
	highlight :function(el)	//highlight current Sidebar Entry after loading page
	{
		el = (el.href)?el.href:el;
		if(el.split)
			el = (el.split(g_strURL)[1])?el.split(g_strURL)[1].split("/")[0]:el.split(g_strURL)[1]; // strip option showCase, if exists
		for(var i = 0;i < rcb.arrLinks.length;i++)
		{
			rcb.arrLinks[i].style.color = (rcb.arrLinks[i].href.split(g_strURL)[1] == el)?"#E95D0E":"#646464";
		}
	},
	/**
	changes Hash to next Page to be loaded by Hashkeeper Function 
	@author PeterS
	@param e
	the link to be loaded
	*/
	loadPage: function(e) // 
	{
		e.preventDefault ? e.preventDefault() : e.returnValue = false; //prevent default Link Action
		rcb.bSlideshow 	 = false;
		var l_strNewHash = getEventTarget(e).href.split(g_strURL)[1];
		keeper.bShowCase = false;
		window.location.hash = l_strNewHash;
		rcb.highlight(getElement(e));
	},
	/**
		Method, used to highlight and show current Category after direct page jump (e.g bookmark, deeplink etc.)
		@author PeterS
		@param el 
		the Link of the current page, which is to be higlighted in sidebar an dto be looked up in categories
	*/
	highlight_and_out : function(el)
	{
		rcb.highlight(el);
		var correspondingSBLink = null;
		for(var i = 0; i < rcb.arrLinks.length;i++)
		{
			if(rcb.arrLinks[i].href == el.href)
				correspondingSBLink = rcb.arrLinks[i];
		}
		rcb.catOut(correspondingSBLink);
	},
	/**
		the slide show mehtod. walks through all sidebar entries
	*/
	slideshow: function(e)
	{
		if(rcb.bSlideshow)
		{
			rcb.catOut(rcb.arrLinks[rcb.iCrntItm]);
			rcb.highlight(rcb.arrLinks[rcb.iCrntItm]);
			window.location.hash = rcb.arrLinks[rcb.iCrntItm].href.split(g_strURL)[1];
			rcb.iCrntItm = (rcb.iCrntItm < rcb.arrLinks.length-1)?rcb.iCrntItm+1:0;		// next Element or first in List
		}
		else
		{
			return;
		}
	},
	/**
		expand current Sidebar-Category, Argument can be an Event (onclick) or Element
		(function slideshow(). Walks through an Array of sidebar-Entries an calls catOut with currentElement)
		@author PeterS
		@param e
		Parameter e can be an Event (onclick) or Element
	*/
	catOut : function(e)	// expand current Sidebar-Category, Argument can be an Event (onclick) or Element
	{						// (function slideshow(). Walks through an Array of sidebar-Entries an calls catOut with currentElement
		if(getType(e) == 'event'){rcb.bSlideshow = false;}
		var l_oTgt = getElement(e);
		var id;
		try
		{	
			if( l_oTgt.tagName.toLowerCase() == "a" && getType(e) == 'event'){return;}	// prevent Child-Links contracting current Category
			while(l_oTgt.tagName.toLowerCase() != "div" && l_oTgt.tagName.toLowerCase() != "body")
			{
				l_oTgt = l_oTgt.parentNode;
			}
			for(i in rcb.arrCat)
			{
				if(l_oTgt == rcb.arrCat[i])
					id = i;
			}
			if(rcb.iCrntCat != -1 && rcb.iCrntCat != id)
			{
				var oldAni = getAnimatioByName("anFrm_"+rcb.iCrntCat);
				oldAni.animate(["height"], [34], 20, easeInOutSine);
				var heading 	  = oldAni.oElement.getElementsByTagName("h3")[0];
				heading.className = "refCustomerCategory closed";
			}
			var l_oAniFrm = new animatio(l_oTgt, "anFrm_" + id, false);
			var heading   = l_oAniFrm.oElement.getElementsByTagName("h3")[0];
			heading.className = "refCustomerCategory " + ((rcb.arrCat[id].offsetHeight >= rcb.arrHeights[id] && getType(e) == 'event')?"closed":"open");
			l_oAniFrm.animate(["height"],[ ((rcb.arrCat[id].offsetHeight >= rcb.arrHeights[id] && getType(e) == 'event')?34:rcb.arrHeights[id])  ],20, easeInOutSine);
			rcb.iCrntCat = id;
		}catch(ex)
		{
			rcb.iCrntItm = 0;
			rcb.catOut(rcb.arrLinks[rcb.iCrntItm]);
		}
	},
	/**
		@function flyIn
		@description
		animation code for reference customer portal -> company info tab
	*/
	flyIn : function()
	{
		try{
			var l_iBckgr  	= ((window.ie)?20:70);
			var l_iName   	= ((window.ie)?20:80);
			var l_iDescr   	= ((window.ie)?15:60);
			var l_iLink   	= ((window.ie)?15:60);
			/* Animation Queue Speed Setttings*/
			var l_iBgNext 	= 10;
			var l_iNameNext	= 100;
			var l_iDscNext 	= 1600;
			var l_iLnkNext 	= 3000;
			
			if (Browser.mobileSafari) 
			{ 					
				l_iBckgr  	= 5;	l_iName   	= 3;
				l_iDescr   	= 5;	l_iLink   	= 5;
				l_iBgNext 	= 30;	l_iNameNext = 60;
				l_iDscNext 	= 800;	l_iLnkNext 	= 1000;
			}
			var l_oCont  	= getElement("rcContent");
			var l_oName 	= getElementsByClass("rcName",  l_oCont, "div")[0];			// Company Name
			var l_oDsc 	 	= getElementsByClass("rcDescr", l_oCont, "div")[0];			// Description / Demand Field
			var l_oLnk 	 	= getElementsByClass("rcLinks", l_oCont, "div")[0];			// Link-Box
			var l_oBg   	= getElementsByClass("rcBackground", l_oCont, "img")[0];	// Background-Image
			var l_oAniName  = new animatio(l_oName, "AniName",  false);
			var l_oAniBg 	= new animatio(l_oBg, "AniBackground", false);
			var l_iNameLeft = parseInt(l_oName.offsetLeft);
			var l_oCSLnk;
			if(window.opera)
			{
				var l_strBgColor = "#fdfdfd";
				if(l_oLnk)
				{
					l_oLnk.style.backgroundColor = l_strBgColor;
					l_oLnk.style.opacity = "1";
				}
				if(l_oDsc) 
				{
					l_oDsc.style.backgroundColor = l_strBgColor;
					l_oDsc.style.opacity = "1";
				}
				l_oName.style.backgroundColor = l_strBgColor;
				l_oName.style.opacity = "1";
			}
			if(l_oLnk) // animate Link-Container, if exists
			{
				l_oCSLnk = getElementsByClass("csbutton",getElement("CS_Info_switch"), "a")[0];
				var l_oAniLnk    = new animatio(l_oLnk, "AniLink", false);
				var l_iLnkHeight = l_oLnk.offsetHeight;
				l_oAniLnk.setStyle(["height"], [0]);
			}
			if(l_oDsc) // animate Description-Container, if exists
			{
				var l_oAniDsc    = new animatio(l_oDsc, "AniDesc", false);
				var l_iDscHeight = l_oDsc.offsetHeight;
				l_oAniDsc.setStyle(["height"], [0]);
			}
			if(keeper.bShowCase) // if Page is loaded with option showCase, skip animating link- and description-boxes
			{
				try{rcb.highlight(l_oCSLnk.href);}catch(ex){;}
			}
			else
			{
				if(l_oAniName)
				{
					l_oAniName.setStyle(["left"],[999]);
					if(l_oAniBg)
					{
						l_oAniBg.setStyle(["opacity"], [0.00001]);
						l_oAniBg.enqueue('animate', [['[\'opacity\']'], ['[ 1 ]'], l_iBckgr, easeInOutSine], l_iBgNext);
						l_oAniBg.next();
					}
					l_oAniName.enqueue('animate', [['[\'left\']'], ['[ ' + l_iNameLeft + ']'], l_iName, easeInOutSine], l_iNameNext);
					l_oAniName.next();
				}
				if(l_oDsc)
				{
					l_oAniDsc.enqueue('animate', [['[\'height\']'], ['[ ' + l_iDscHeight + ']'], l_iDescr, easeInOutSine], l_iDscNext);
					l_oAniDsc.next();
				}
				if(l_oLnk)
				{
					l_oAniLnk.enqueue('animate', [['[\'height\']'], ['[ ' + l_iLnkHeight + ']'], l_iLink, easeInOutSine], l_iLnkNext);
					l_oAniLnk.next();
				}
			}
		}catch(ex){/* ignore Exception -> loaded Case Study instead Company Profile */}
	}
};

   
/*	<--Referenzkunden Portal */

/*  Newsticker -->*/
/**
@class Newsticker
@description 
Newsticker Class for the Homepages Newsticker
*/
var NT = 
{
	Index: 0,
	Timeout: null,
	Items: [],
	init: function()
	{
		this.oContainer = getElement('NT');
		this.Items = getElementsByClass('item', this.oContainer, 'div');
		for(var i=0; i<this.Items.length; i++)
		{
			this.Items[i].strFullText = this.Items[i].getElementsByTagName("SPAN")[0].innerHTML;
			getAni(this.Items[i], 'TickerItem' + i, false);
			this.Items[i].style.top = '0px';
			if(i) hide(this.Items[i]);
		}
		this.Timeout = window.setInterval('NT.next()', 6000);
	},
	next: function()
	{
		this.Items[this.Index].oAni.stop();
		this.Items[this.Index].oAni.fadeOut(4);
		this.Index = this.Items.length > this.Index+1 ? this.Index+1 : 0;
		this.Items[this.Index].oAni.stop();
		this.Items[this.Index].oAni.enqueue('fadeIn', [4], 300);
		this.Items[this.Index].oAni.next();
	},
	pause: function()
	{
		window.clearTimeout(this.Timeout);
	}
};
/* <-- Newsticker */


/**
	@field
	@description
	Keyboard KeyCode Table, field of average KeyCodes and symbolic equivalents
*/
var KEY = 
{
	UP: 38, DOWN: 40, LEFT: 37, RIGHT: 39, SPACE: 32, ENTER: 13, TAB: 9, ALT: 18, STRG: 17, BCKSPC: 8,
	SHIFT: 16, PGUP: 33, PGDOWN: 34, POS1 :36, END: 35, INS: 45, DEL: 46, PAUSE: 19, CAPSLOCK: 20, ESC: 27,
	ZERO:48, ONE:49, TWO:50, THREE:51, FOUR:52, FIVE:53, SIX:54, SEVEN:55, EIGHT:56, NINE:57, a:65, b:66, 
	c:67, d:68, e:69, f:70, g:71, h:72, i:73,j:74, k:75, l:76, m:77, n:78, o:79, p:80, q:81, r:82, s:83, t:84, 
	u:85, v:86, w:87, x:88, y:89, z:90, WINLEFT:91, WINRIGHT:92, SELECT:93, NUM_0:96, NUM_1:97, NUM_2:98, 
	NUM_3:99, NUM_4:100, NUM_5:101, NUM_6:102, NUM_7:103, NUM_8:104, NUM_9:105, MUL:106, ADD:107, SUB:109, 
	DECPT:110, DIV:111, F1:112, F2:113, F3:114, F4:115, F5:116, F6:117, F7:118, F8:119, F9:120, F10:121, F11:122, 
	F12:123, NUMLOCK:144, SCRLOCK:145, SEMICOL:186, EQUALS:187, COMMA:188, DASH:189, PERIOD:190, SLASH:191, 
	ACCENT_GRV:192, BRAC_OPEN:219, BACKSLASH:220, BRAC_CLOSE:221, SING_QUOT:222
}
/**
	@function
	@description
	Simple parseInt Alias, allowing a shorter form of writing an explicit cast<br>
	@param value
	the value to be casted
	@returns Integer
	the result of the parseInt Function call
	<code>usage:<br>
	var a = Int(b);<br>
*/
/**
	@function
	@description
	shorthand for parseInt
*/
function Int(val){return parseInt(val);}
/**
	@function multiple css assignments
	@description
	loops through a given list of css property / value pairs and adds them to the given element<br>
	<code>
	usage:<br>
		css(myElement, [["color", "red"], ["top", "5px"]]);<br>
	</code>
	@param element
	the element to be styled
	@param styles
	a list of strings used to style the element
*/
function css(element, styles)
{
	for(var i = 0; i < styles.length;i++){element.style[styles[i][0]] = styles[i][1];}
}
/**
	@class Combobox
	@description
*  Java Script Combobox <br>
*	<br>
 *	Usage: <br>
 *	&lt;select name="" id="" combobox="uniqe_identifier" editable="true|false" filter="true|false"&gt;<br>
 *		&lt;option value=""&gt;&lt;/option&gt;<br>
 *		&lt;option value=""&gt;&lt;/option&gt;<br>
 *	&lt;/select&gt;<br>
 *<br>
 *  ...<br>
 * call:<br>
 *		sb.init();<br>
 * <br>
 * editable == true marks box as editable combobox, editable == false -> normal select box<br>
 * filter  -> allows to prefilter new entries, if set true, the filter strips <>/%'"; from user input<br>
 *</code>
*/
var cb = 
{
	iBoxes 		 : 0,		// Combobox Counter, used to determine needed max. z-index
	oWindow		 : null,	// Crossbrowser Alias for Window
	oBoxes		 : null,	// Hashmap with all Comboboxes oBoxes[ObjectID]=>[Combobox-Object]
	strIdCurrent : null,	// ObjectID associated with the current shown Combobox-List
	/**
		<i>Combobox Constructor</i><br>
		searches for all select Boxes with a combobox Attribute and generates comboboxes for each matching select box
		
	*/
	init: function()
	{
		cb.oBoxes  = new Object();
		cb.oWindow = (document.all)?document.getElementsByTagName("body")[0]:window;
		var l_arrAllBoxes = document.getElementsByTagName("select");
		for(var i = 0; i < l_arrAllBoxes.length;i++)
		{
			if(l_arrAllBoxes[i].getAttribute("combobox") && ++cb.iBoxes)
				cb.oBoxes[l_arrAllBoxes[i].getAttribute("combobox")] = new combobox(l_arrAllBoxes[i]);		
		}
		for(var i in cb.oBoxes){if(!!cb.oBoxes[i].ul){cb.oBoxes[i].ul.toHTML().style.zIndex = 10 + cb.iBoxes--;}}	// set z-index, to prevent overlapping
	},
	/**
		@param e
		the keyboard event
		@description
		helper method, checks for keyboard events and ignores them, if keyCode is the ENTER Key -> prevents accidantial submit on Enter
	*/
	chkEnter : function(e)		// prevent default action for Textfield
	{
		if(e.keyCode == KEY.ENTER){e.preventDefault ? e.preventDefault() : e.returnValue = false;}
	},
	/**
	@param e 
	the keyboard event used to extract the key code from
	@description
	general keyboard actions, enables to navigate through the comboboxes list (up, down), filter, select and to add new entries
	*/
	keyBoardActions: function(e)
	{
		var l_oBox  = cb.oBoxes[cb.strIdCurrent];
		switch(e.keyCode)
		{
			case KEY.UP:
				l_oBox.ul.highlight(l_oBox.ul.previous());
			break;
			case KEY.DOWN:
				l_oBox.ul.highlight(l_oBox.ul.next());
				break;
			case KEY.ESC:
				l_oBox.show_hide();
			break;
			case KEY.ENTER:
				if(!l_oBox.ul.contains(l_oBox.txt.text()))	//	generate additional Entry
				{
					l_oBox.ul.push(l_oBox.ul.toHTML(), l_oBox.txt.text());
					hookEvent(l_oBox.ul.toHTML().children[l_oBox.ul.toHTML().children.length-1], 'mouseover', l_oBox.ul.highlight);
					hookEvent(l_oBox.ul.toHTML().children[l_oBox.ul.toHTML().children.length-1], 'click', cb.pick);
					l_oBox.push(l_oBox.txt.text());
				}
				cb.pick();
			break;
			default:
				if(l_oBox.txt.editable())
					l_oBox.ul.filter(l_oBox.txt.text());
			break;
		}
	},
	/**
		@description
		hides the list, if mouse events target is not a member of the combobox
	*/
	mouseActions : function(e)
	{
		var id = cb.strIdCurrent;
		var el = getElement(e);
		if(!el.id || (!el.id.match(/(ul_)|(txt_)|(btn_)|(box_)/)))	// if Event was not fired from a Combobox Element, hide current List
		{
			cb.oBoxes[id].show_hide();
		}
	},
	/**
		@description
		select the list element at which the mouse event is fired
	*/
	pick: function(e)
	{
		var l_oBox = cb.oBoxes[cb.strIdCurrent];
		l_oBox.txt.text(l_oBox.ul.getCurrent().innerHTML);
		l_oBox.ul.parent().selectedIndex = l_oBox.ul.currentIndex();
		l_oBox.show_hide();
	}
}
/**
@class Combobox
@description
general Combobox Class -> handles assaociated Elements like textfield, button, list and original select box 
*/
function combobox(el)
{
	this.parent 	= el;				// the original Select Box, that is wrapped into and managed from the new generated Combobox Container
	var id  		= el.getAttribute("combobox");
	this.isEditable = (el.getAttribute("editable") && el.getAttribute("editable") == "true")?true:false;
	var list 		= null;
	var textbox 	= null;
	var l_oBtn 		= null;
	/**
	 <i>Combobox Contructor</i><br>
	 generates a new combobox and sets the events for it
	 
	*/
	this.init = function()
	{
		var l_oBox 	= document.createElement("div");
		l_oBox.id 	= "box_" + id;
		this.btn 	= document.createElement("div");
		l_oBtn 		= this.button = this.btn;
		this.btn.id = "btn_" + id;
		this.txt 	= new inputBox(this.parent.options[this.parent.selectedIndex].innerHTML, this.isEditable);
		textbox 	= this.txt;
		this.ul 	= new navigableListElement(this.parent);
		list 		= this.ul;
		this.txt.toHTML().id 		= "txt_" + id;
		this.ul.toHTML().id  		= "ul_"  + id;
		l_oBox.className 			= "combobox"
		this.btn.className 			= "cbButton";
		this.txt.toHTML().className = "cbInput";
		this.ul.toHTML().className  = "cbList";
		l_oBox.appendChild(this.txt.toHTML());
		l_oBox.appendChild(this.btn);
		l_oBox.appendChild(this.ul.toHTML());
		this.parent.appendChild(l_oBox);
		this.parent.parentNode.insertBefore(l_oBox, this.parent);
		l_oBox.appendChild(this.parent);
		css(l_oBox, [["position", (el.style.display.toLowerCase() == "absolute")?"absolute":"relative"],		// Additional Styling, according to the original Box' dimensions
					 ["width", 	  (Int(el.offsetWidth)  - 2)  + "px"],
					 ["height",	  (Int(el.offsetHeight) - 2)  + "px"],
					 ["left",  	  Int(el.offsetLeft)  + "px"],
					 ["top",   	  Int(el.offsetTop)   + "px"]]);
		css(this.btn, [["height", (Int(el.offsetHeight)) + "px"]]);
		css(this.txt.toHTML(), [["width",  Int(el.offsetWidth) - 22  + "px"], ["height", Int(el.offsetHeight)  - 6   + "px"]]);
		if(!this.txt.editable())	// additional marginTop for non-editable Elements (<span>)
			css(this.txt.toHTML(), [["marginTop",  "-4px"]]);
		css(this.ul.toHTML(),  [["width",  Int(el.offsetWidth) - 2   + "px"]]);
		el.style.display = "none";
		hide(this.parent);
		hide(this.ul.toHTML());
		this.attachEvents();
	}
	/**
		@description
		handles show and hide actions for the list.
	*/
	this.show_hide = function(e)
	{
		if(list.toHTML().style.display == "none")
		{
			show(list.toHTML());
			if(!!cb.strIdCurrent)
				cb.oBoxes[cb.strIdCurrent].show_hide();
			cb.strIdCurrent = id;
			if(textbox.editable())
				hookEvent(textbox.toHTML(), 'keydown', cb.chkEnter);
			hookEvent(((textbox.editable())?textbox.toHTML():cb.oWindow), 'keyup', cb.keyBoardActions);
			hookEvent(cb.oWindow, 'click', cb.mouseActions);
		}
		else
		{
			hide(list.toHTML());
			if(textbox.editable())
			{
				if(textbox.text().trim().length==0)
					textbox.text(el[el.selectedIndex].innerHTML);
				textbox.toHTML().blur();
				textbox.toHTML().className = "cbInput";
			}
			cb.strIdCurrent = null;
			list.filter("");
			unhookEvent(((textbox.editable())?textbox.toHTML():cb.oWindow), 'keyup', cb.keyBoardActions);
			unhookEvent(cb.oWindow, 'click', cb.mouseActions);
		}
	}
	/**
		@description
		attaches events to the textfield (depending on its editable state) and to the list button
	*/
	this.attachEvents = function()
	{
		if(this.isEditable)
		{
			var txt = this.txt;
			hookEvent(this.txt.toHTML(), 'click', (function(text){txt.text("");txt.toHTML().className = "cbInput active";}));
			hookEvent(this.btn, 'click', (function(text){txt.text("");}));
			hookEvent(this.btn, 'click', (function(text){txt.toHTML().focus();}));
			hookEvent(this.txt.toHTML(), 'focus', (function(text){txt.text("");txt.toHTML().className = "cbInput active"}));
			hookEvent(this.txt.toHTML(), 'focus', this.show_hide);
		}
		for(var i = 0; i < list.toHTML().children.length;i++)
		{
			hookEvent(list.toHTML().children[i], 'mouseover', list.highlight);
			hookEvent(list.toHTML().children[i], 'click', cb.pick);
		}
	}
	/**
		@param txtval
		text-value of the new created element
		@description
		adds a new element at the end of the list. Parameter txtval contains the text vaule for the new element.
		Updates the original select box and sets the selectedIndex value to the new created elements index.
	
	*/
	this.push  = function(txtval)
	{
		var newOption = new Option(txtval, txtval, false, true);
		this.parent.options[this.parent.options.length] = newOption;
		this.parent.selectedIndex = this.parent.options.length;
		list.count++;
		list.currentIndex(list.toHTML().children.length-1);
	}
	this.init();
}
/**
	@class InputBox
	@description
	generalized text element 
*/
function inputBox(value, bEditable, bAutocomplete)
{
	var textContent  = value 	 	 || "";
	var isEditable   = bEditable 	 || false;
	var autocomplete = bAutocomplete || false;
	/**
		@description
		inputbox konstruktor
	*/
	this.init = function()
	{
		this.me = (isEditable)?document.createElement("input"):document.createElement("span");
		if(!bAutocomplete)
			this.me.setAttribute( "autocomplete","off" );
		if(isEditable)
			this.me.type = "text";
		this.text(value);
	}
	/**
		 @param value
		 @returns String
		 @description
		returns a String with the text content of the input element (can be innerHTML or value depending on the input element type defined by the editable state of the box)
	*/
	this.text = function(value)
	{
		textContent = (!!value)?value:((value == "")?"":((isEditable)?this.me.value:this.me.innerHTML));
		if(isEditable)
			this.me.value = textContent;
		else
			this.me.innerHTML = textContent;
		return textContent;
	}
	/**
		@returns boolean
		@description
		returns true, if the inputBox is editable, else false
	*/
	this.editable = function(){return !!isEditable;}
	/**
		@returns HTMLElement
		@description
		returns the HTMLElement generated by the inputBox constructor -> can be an input type="text" element or a span<br>
		used for attaching events to the InputBox
	*/
	this.toHTML   = function(){return this.me;}
	this.init();
}
/** 
	@class generalized navigable list element
	@description
	list element with filter and methods to walk through the list 
*/
function navigableListElement(element)
{
	if(!element){throw new Error("Element is not defined");}
	var list 	   = element;
	var ul   	   = null;
	var l_iCurrent = 0;
	this.count     = 0;
	/**
		<i>listelement constructor</i>
	*/
	this.init = function()
	{
		ul = document.createElement("ol");
		this.count = (element.tagName.toLowerCase() == "select")?element.options.length:element.children.length;
		for(var i = 0; i < this.count ;i++){this.push(ul, this.child(i).innerHTML);}
	};
	/**
		@param parent
		the list to which the new element is to be added
		@param el
		the new element for the list
		@description
		add a new element at the end of the list.
	*/
	this.push = function(parent, el)
	{
		var li = document.createElement("li");
		li.innerHTML = el;
		parent.appendChild(li);
		parent.insertBefore(li, parent.children[parent.children.length-1]);
	}
	/**
		@returns HTMLElement
		the next List Element in a row
		@description
		examines and returns the next list element, when walking through the list
	*/
	this.next = function()
	{
		try{l_iCurrent = (l_iCurrent +1 < this.count)?++l_iCurrent:0;
		if(ul.children[l_iCurrent].style.display == "none"){this.next()};
		return (ul.children[l_iCurrent]);}catch(ex){;}
	}
	/**
		@returns HTMLElement
		the previous List Element in a row
		@description
		examines and returns the previous list element, when walking through the list
	*/
	this.previous = function()
	{
		try{l_iCurrent = (l_iCurrent -1 >= 0)?--l_iCurrent:this.count-1;
		if(ul.children[l_iCurrent].style.display == "none"){this.previous()};
		return (ul.children[l_iCurrent]);}catch(ex){;}
	}
	/**
		@param e
		e is the keyup or mouseover Event fired on the list element to be highlighted
		@description
		highlights (i.e. changes class name) of a list element and ensures, that only one element at a time is highlighted, stores the current highlighted element index.
	*/
	this.highlight = function(e)
	{
		for(var i = 0; i < ul.children.length;i++)
		{
			ul.children[i].className = (ul.children[i] == getElement(e))?"hover":"";
			if(ul.children[i] == getElement(e))
				l_iCurrent = i;
		}
	}
	/**
		@param strTerm
		@description
		
	*/
	this.filter = function(strTerm)
	{
		for(var i  = 0; i < ul.children.length;i++)	// match first letters in text.value -> sear*
		{
			(strTerm.trim().length == 0)?show(ul.children[i])
				:((!ul.children[i].innerHTML.toLowerCase().split(strTerm.toLowerCase())[0])?show:hide)(ul.children[i]);
		}
	}
	/**
		@returns boolean
		@description
		returns true, if liost is empty, else false
	*/
	this.isEmpty	  = function(){return (ul.children.length > 0)?false:true;}
	/**
		@returns HTMLElement
		@param i
		element index
		@description
		returns the child element indicated by the i parameter. the element can be an option (if original list was in fact a select box) or a list element (if parent is an unordered or ordered list)
		
	*/
	this.child 	  	  = function(i){return (list.tagName.toLowerCase == "select")?list.options[i]:list.children[i];}
	/**
		@returns l_iCurrent
		@param newVal
		@description
		if newVal Parameter is set it sets the current list index to newVal.
		returns the current selected index of the list 
	*/
	this.currentIndex = function(newVal){l_iCurrent = (!!newVal)?newVal:l_iCurrent;return l_iCurrent;}
	/**
		@returns l_iCurrent
		returns the current selected index of the list
	*/
	this.getCurrent   = function(){return ul.children[l_iCurrent];}
	/**
		@returns HTMLElement
		@description
		returns the parent element -> the original list or select box
	*/
	this.parent 	  = function(){return list;}
	/**
		@returns HTMLElement
		@description
		returns the internal used list as HTML Element (used for attaching Events to the List)
	*/
	this.toHTML 	  = function(){return ul;}
	/**
		@param	term
		@returns boolean
		@description
		returns true, if the string in term matches to one or more elements in the  list
	*/
	this.contains 	  = function(term){return(!!ul.innerHTML.toLowerCase().split(term.toLowerCase())[1]);}
	this.init();
}
/* <-- JavaScript Combobox */

/**
	@param str
	String to be tested
	@param arr_terms
	the array of possible KEY Codes to be matched
	@returns boolean
	true, if the Key code in str matches to at least one Code in arr_terms (first match counts)
	@description
	matches a String or KeyCode Object against a list of possible Key Codes (Constants in var KEY)
	and returns true, if at least one Key Code matched
*/
function isInKeyMap(str, arr_terms)
{
	var meToString  = '' + str;
	meToString 		= meToString.toLowerCase();
	for(var i in arr_terms)
	{
		if(meToString == arr_terms[i])
			return true;
	}
	return false;
}
/**
	@description
	Constant Field for HTTP Methods POST and GET
*/
var METHOD 	  = {GET: 'GET', POST : 'POST'};

/**
	@class 
	Ajax Suggests
	@param p_oTxt
	the input field containing the search string
	@param p_oLst
	the list with the suggestions, if no list is defined a new one is creaed
	@param p_strURL
	the url for the ajax request to get new values for the suggestion list
	@description
	Ajax Suggestions class
	shows a list of Entries matching to the value of the input field
*/
function ajaxSuggestions(p_oTxt, p_oLst, p_strURL)
{
	var method;		// Method for Ajax Request
	var url;		// URL for the Ajax Request
	var txt;		// The input filed to gather data from
	var lst;		// the list (target) for the Results from Ajax Request
	var iCurrent;	// the current hovered item (active list index)
	var oWindow;
	/**
	@public
	@methodOf ajaxSuggestions
	@description 
	<i>Ajax Suggestions - Constructor</i><br>
	initializes the object, grabs all necessary elements, and sets events to the list, textbox and listelements
	*/
	init = function()
	{
		oWindow = (document.all)?document.getElementsByTagName("body")[0]:window;
		switch(typeof p_oTxt)
		{
			case "string":
				txt = getElement(p_oTxt);
			break;
			case "object":
				txt = p_oTxt;
			break;
			default:
				throw new Error("can't find Element referencing to p_oTxt");
				return;
			break;
		}
		switch(typeof p_oLst)
		{
			case "string":
				lst = getElement(p_oLst);
			break;
			case "object":
				lst = p_oLst;
			break;
			default:	// if no list found, create a new one
				lst 	= document.createElement("ul");
				lst.id  = "LIST_FOR_" + txt.id;
				txt.parentNode.appendChild(lst);
				insertAfter(txt.parentNode, lst, txt);
			break;
		}
		if(!!p_strURL)
			setURL(p_strURL);
		setMethod();
		if(!!txt && lst && url)
		{
			hookEvent(txt, 'keydown', chkEnter);
			hookEvent(txt, 'keyup',   keyEvent);
			hookEvent(txt, 'focus',   showList);
			txt.setAttribute("autocomplete", "off");
			setListEvents();
		}
	}
	/**
	@methodOf ajaxSuggestions
	@description
	sets Events for all List Childelements
	*/
	setListEvents = function()
	{
		for(var i = 0; i < lst.children.length;i++)
		{
			hookEvent(lst.children[i], 'mouseover', mouseover);
		}
	}
	/**
	@methodOf ajaxSuggestions
	@description
		helper method to prevent accidential submit on Enter
	*/
	chkEnter = function(e)
	{
		if(e.keyCode == KEY.ENTER)
			e.preventDefault ? e.preventDefault() : e.returnValue = false;
	}
	/**
		@methodOf ajaxSuggestions
		@description
		shows the List and attaches click Event to window (click anywhere to close)
	*/
	showList = function()
	{
		if(lst.children.length == 0)
			return
		else
		{
			show(lst);
			hookEvent(oWindow, 'click', hideList);
		}
	}
	/**
		@methodOf ajaxSuggestions
		@description
		removes the click event from window, closes and clears the list (i.e. removes all child elements)
	*/
	hideList = function(e)
	{
		if(getElement(e) == txt)return;
		window.setTimeout("hide('" + lst.id + "');", 350);
		for(var i = lst.children.length-1; i >= 0; i--)
		{
			unhookEvent(lst.children[i], 'mouseover', mouseover);
			lst.removeChild(lst.children[i]);
		}
		iCurrent = null;
		unhookEvent(oWindow, 'click', hideList);
	}
	/**
		@methodOf ajaxSuggestions
		@description
		examines which list element is to be highlighted.
	*/
	mouseover = function(e)
	{
		var el = getElement(e);
		var l_oListElement = (el == lst || el.parentNode == lst || el.parentNode.parentNode == lst || el.parentNode.parentNode.parentNode == lst || el.parentNode.parentNode.parentNode.parentNode == lst);
		if(l_oListElement)
		{
			var li;
			var current = el;
			var search  = true;
			while(search)
			{
				if(current.parentNode == lst || current == document.body)
				{
					li 		= current;
					search  = false;
					break;
				}
				else
					current = current.parentNode;
			}
			if(li.children[0].name == "error")return;	// ignore empty lists
			highlight(li);
		}
	}
	/**
		@methodOf ajaxSuggestions
		@description
		highlights the element passed to the Method (changes the class Name to hover) and sets iCurrent to the corresponding list element index
	*/
	highlight = function(el)
	{
		for(var i = 0; i < lst.children.length;i++)
		{
			if(lst.children[i] == el)
			{
				iCurrent = i;
				lst.children[i].className ="hover";
			}
			else
				lst.children[i].className ="";
		}
	}
	/**
		@methodOf ajaxSuggestions
		@description
		fetches a new list from the server and sets list elements for the newly created list items
	*/
	updateList = function()
	{
		if(txt.value.trim().length == 0)return;
		ajaxRequest
		(
			{
				'strUrl'			: url +  txt.value.trim(),
				'varTargetElement'	: lst.id,
				'strMethod'	 	  	: method,
				'onAfterLoad'		: function()
				{
					if(lst.children.length > 0 && txt.value.trim().length > 0)
					{
						setListEvents();
						if(lst.style.display != "block")
							showList();
					}
					else if(lst.style.display != "none")
						hideList();
				}
			}
		);
	}
	/**
		@methodOf ajaxSuggestions
		@description
		keyboard Navigation for the Suggestion list.
		
	*/
	keyEvent = function(e)
	{
		e.preventDefault ? e.preventDefault() : e.returnValue = false;
		if(isInKeyMap(e.keyCode, [KEY.STRG, KEY.ALT, KEY.SHIFT, KEY.CAPSLOCK, KEY.PAUSE, KEY.PGDOWN, KEY.PGUP, KEY.POS1, KEY.END, KEY.RIGHT, KEY.LEFT]))
			return;
		
		switch(e.keyCode)
		{
			case KEY.UP:
			if(lst.children.length==0)return;
			if(lst.children.length > 0 && lst.children[0].getElementsByTagName("a")[0].name == "error")return;	// ignore empty lists
				iCurrent = (iCurrent != null) ? iCurrent : 0;		
				if(iCurrent-1 < 0)
					iCurrent = lst.children.length;	
				lst.children[--iCurrent].className = "hover";		
				lst.children[(iCurrent >= lst.children.length-1)?0:iCurrent+1].className = "";
			break;
			case KEY.DOWN:
				if(lst.children.length==0)return;
				if(lst.children.length > 0 && lst.children[0].getElementsByTagName("a")[0].name == "error")return;	// ignore empty lists
				iCurrent = (iCurrent != null) ? iCurrent : -1;		
				if(iCurrent+1 > lst.children.length-1)
					iCurrent = -1;
				lst.children[++iCurrent].className = "hover";			
				lst.children[(iCurrent-1 < 0)?lst.children.length-1:iCurrent-1].className = "";
				if(lst.children.length == 1)
					lst.children[iCurrent].className = "hover";
				break;
			case KEY.ENTER:
				if(iCurrent == null)		// if no list element selected pass ENTER to the oroginal form i.e. submit form
					txt.parentNode.submit();
				else						// get the item link and change window locaation to the item links href value
				{	
					var newLocation = getElementsByClass("axItemLink", lst.children[iCurrent], "a")[0].href;
					if(!!newLocation)
						window.location.replace(newLocation);
				}
				break;
			case KEY.ESC: 
				hideList();
				break;
			default:
				if(txt.value.trim().length == 0)
					hideList();
				updateList();
				break;		
		}
	}
	/** 
	@methodOf ajaxSuggestions
	@public
	@description
	sets the Method for the ajax request (GET or POST)
	*/
	setMethod = function(p_strMethod){method = (!!p_strMethod)?p_strMethod:METHOD.GET;}
	/**
		@methodOf ajaxSuggestions
		@public
		@description
		sets the URL to the Server
	*/
	setURL 	  = function(p_stRURL){url = p_stRURL;}
	/* make methods public available */
	this.setURL 	= setURL;
	this.setMethod 	= setMethod;
	this.init 		= init;
	/* initialize, if all necessary Informationa are available*/
	if((!!p_oTxt) && (!!p_oLst) && (!!p_strURL))
		init();
}

/* <-- Appstore Ajax Suggestions*/
	
function selectEdition(p_iEdition, p_strLink)
{
	var l_oCompactSelector 		= getElement('editionSelectorCompact');
	var l_oProfessionalSelector = getElement('editionSelectorProfessional');
	var l_oPriceCompact 		= getElement('priceCompact');
	var l_oPriceProfessional 	= getElement('priceProfessional');
	var l_oSelectedEdition 		= getElement('selectedEdition');
	
	var l_oEditionSelectorNote 	= getElement('editionSelectorNote');
	var l_oAddToCart 			= getElement('addToCart');
	var l_oCartButton 			= l_oAddToCart.getElementsByTagName("img")[0];
	
	switch(p_iEdition)
	{
		case 1: // Compact
			l_oCompactSelector.className 	  	  = "editionSelector compactActive";
			l_oProfessionalSelector.className 	  = "editionSelector professional";
			l_oPriceCompact.style.visibility  	  = '';
			l_oPriceProfessional.style.visibility = 'hidden';
			l_oSelectedEdition.innerHTML 		  = "Compact";
			break;
		case 2:  // Professional
			l_oCompactSelector.className 			= "editionSelector compact";
			l_oProfessionalSelector.className 		= "editionSelector professionalActive";
			l_oPriceCompact.style.visibility 		= 'hidden';
			l_oPriceProfessional.style.visibility 	= '';
			l_oSelectedEdition.innerHTML 			= "Professional";
			break;
			
	}
	l_oAddToCart.style.display 			 = 'block';
	hookEvent(l_oCartButton, "click", function(){window.location = p_strLink;})
	l_oCartButton.style.cursor 			 = "hand";
	l_oCartButton.style.cursor 			 = "pointer";
	l_oEditionSelectorNote.style.display = "none";
	return false;
}
/* SHOW PURCHASES Filter */
	function updateSearchfield(hasWaited)
	{
		if(!hasWaited)
		{
			window.setTimeout(function()
			{
				updateSearchfield(true);
			}, 500);
			return;
		}
		else
		{
			var l_oForm = document.getElementById("application_filter");
			if(window.location.search.split('s=')[1] && window.location.search.split('s=')[1].length > 0)
			{
				l_oForm.value = window.location.search.split('s=')[1];
				l_oForm.focus();
			}
		}
	}
	function appFilter(p_oInput, hasWaited)
	{
		if(!hasWaited)
		{
			window.setTimeout(function()
			{
				appFilter(p_oInput, true)
			}, 800);
			return;
		}
		var l_oForm  = getElement("filter");
		var l_strValue = p_oInput.value;
		var string = l_strValue;
		l_iValue = encodeURIComponent(l_strValue);
		window.location.hash = "?a=32&i=0&r=10&s=" + l_strValue;
	}

/* SHOW ACCOUNT INFORMATION Formvalidation */

function switchEdite(p_oTD)
	{
		var l_oTR = p_oTD.parentNode.parentNode;
		
		if(typeof l_oTR.children[3] != "undefined")
		{
			var l_oSpan = l_oTR.children[3];	
		}
		else
		{
			var l_oSpan = l_oTR.children[1];
		}
		
		if(l_oSpan.children[1].style.display == 'none')
		{
			l_oSpan.children[0].style.display = 'none';
			l_oSpan.children[1].style.display = 'block';
		}
		else
		{
			l_oSpan.children[0].style.display = 'block';
			l_oSpan.children[1].style.display = 'none';
		}
	}

	function copyAddress()
	{
		var l_oBillingAddress = document.getElementById("billingAddress");
		var l_oBillingZip = document.getElementById("billingZip");
		var l_oBillingCity = document.getElementById("billingCity");
		var l_oBillingCountry = document.getElementById("billingCountry");
		
		var l_oStreet = document.getElementById("street");
		var l_oZip = document.getElementById("zip");
		var l_oCity = document.getElementById("city");
		var l_oCountry = document.getElementById("country");
		
		l_oStreet.value	= l_oBillingAddress.value;
		l_oZip.value = l_oBillingZip.value;
		l_oCity.value = l_oBillingCity.value;
		l_oCountry.value = l_oBillingCountry.value;
		return true;
	}
	
	function hideFormular()
	{
		var l_arrSpan = document.getElementsByTagName("SPAN");
		var l_arrDiv = document.getElementsByTagName("DIV");
		
		for(var i = 0; i < l_arrSpan.length; i++)
		{
			if(l_arrSpan[i].className == "hiding")
			{
				l_arrSpan[i].style.display = 'block';
			}
		}
		
		for(var i = 0; i < l_arrDiv.length; i++)
		{
			if(l_arrDiv[i].className == "hiding")
			{
				l_arrDiv[i].style.display = 'none';
			}
		}
		return true;
	}
	
/**
	@namespace ah
	@description
	Application-Store Personal History Page Actions
	-> delete single items or clear whole history and reload History Table via Ajax Request
*/
var ah = 
{
	init : function()
	{
		var l_oTarget =  getElement("CONTENT_TABLE");
		var l_arrLnks = getElementsByClass("linkDeleteItem",   l_oTarget, "a")		// get all 'delete item' Links from List
		l_arrLnks.push(	getElementsByClass("linkClearHistory", l_oTarget, "a")[0]);	// add single 'delete all item' Link
		for(var i = 0; i < l_arrLnks.length;i++)
		{
			hookEvent(l_arrLnks[i], 'click', ah.linkAction);
		}
	},
	linkAction : function(e)
	{
		e.preventDefault ? e.preventDefault() : e.returnValue = false;
		var l_strUrl = getElement(e).href + '&o=1';	
		ajaxRequest
		(
			{
				'strUrl'			: l_strUrl,
				'varTargetElement'	: 'CONTENT_TABLE',
				'strMethod'	 	  	: 'GET',
				'bShowThrobber'		: true,
				'onAfterLoad'		: function()
				{
					if((window.location.hash.length > 0 && window.location.hash.split('#').length > 0) && (!getElement("ITEM_TABLE") && (window.location.hash.split('i=')[1].split('&r=')[0] != 0)))
					{
						window.location.hash = window.location.hash.split('?i=')[0] + '?i=0&r=' + window.location.hash.split('&r=')[1];
					}
					ah.init();
					pager.getLinks();
				}
			}
		);
	}
}


function initProductDisplayBoxes()
{
	var _strName
	, l_arrLinks = Array()
	, l_arrContainers = getElementsByClass('productDisplayBox', document, 'DIV')
	, l_oNavigationContainer = getElementsByClass('productDisplayBoxNavigation', l_arrContainers[i], 'DIV')[0];
	
	for(var i = 0; i<l_arrContainers.length;i++)
	{
		_strName = getElementsByClass('content', l_arrContainers[i], 'DIV')[0].getAttribute('data-name');
		l_arrLinks[i] = createNodeBefore(l_oNavigationContainer, 'A', '', _strName);
		l_oNavigationContainer.appendChild(l_arrLinks[i]);
		hookEvent(l_arrLinks[i], 'click', showProductDisplayBox);
		l_arrLinks[i].oBox = l_arrContainers[i];
		l_arrContainers[i].oLink = l_arrLinks[i];
	}
	showProductDisplayBox(l_arrLinks[0]);
}

function showProductDisplayBox(e)
{
	var l_arrContainers = getElementsByClass('productDisplayBox', document, 'DIV')
	, l_oCorner = getElement('product_display_box_corner')
	, l_oLinkElement = getElement(e)
	, l_iLeft = l_oLinkElement.offsetLeft
	, l_iWidth = l_oLinkElement.offsetWidth / 2 -10
	, l_iHeight = l_oLinkElement.offsetHeight / 2 -20
	, l_oAniCorner = getAni(l_oCorner, 'corner', false)
	, l_oAniLinkElement = getAni(l_oLinkElement, 'Link', false)
	, _oAniContainers
	, _oAniContainersVisible;
	
	for(var i = 0; i<l_arrContainers.length;i++)
	{
		l_iLeftPositionEnd = l_iLeft + l_iWidth;
		l_iTopPositionEnd = l_iTop + l_iHeight;
		setStyle(l_arrContainers[i].oLink, 'color', '#dbdbdb');
		_oAniContainer = getAni(l_arrContainers[i], 'productDisplayBoxContainer'+i, false);
		if (_oAniContainer.getStyle('visibility') == 'visible')
			_oAniContainer.fadeOut(window.ie ? 12 : 7);
	}
	_oAniContainersVisible = getAni(l_oLinkElement.oBox, 'productDisplayBoxContainerVisible', false);
	_oAniContainersVisible.stop().fadeIn(window.ie ? 12 : 7);
	l_oAniCorner.animate(['left'], [l_iLeftPositionEnd], 20, easeInOutSine);
	l_oAniLinkElement.setStyle('color', '#ffffff');
}
/**
@namespace smFlt
	Seminar Filter
@description
	allows users to filter i.e. search Seminar Dates by Keywords
	us3es ajax request to process search
*/
var smFlt = 
{
	txt : null,
	form : null,
	search : null,
	init : function()
	{
		smFlt.form  = document.getElementById("formFilterSeminars");
		smFlt.txt 	= document.getElementById("txtFilterSeminars");
		hookEvent(smFlt.txt, 'keyup', smFlt.changed);
		smFlt.txt.focus();
		if(smFlt.search != null)
			smFlt.txt.value = smFlt.search;		
	},
	changed : function(e)
	{
		e.preventDefault ? e.preventDefault() : e.returnValue = false;
		if(isInKeyMap(e.keyCode, [KEY.STRG, KEY.ALT, KEY.SHIFT, KEY.CAPSLOCK, KEY.PAUSE, KEY.PGDOWN, KEY.PGUP, KEY.POS1, KEY.END, KEY.RIGHT, KEY.LEFT]))
			return;
		smFlt.search = smFlt.txt.value;
		ajaxRequest
		(
			{
				'strUrl'			: smFlt.form.action + '&s=' + smFlt.txt.value + '&o=1',
				'varTargetElement'	: 'LEARNING_CENTER_CONTAINER',
				'strMethod'	 	  	: 'GET',
				'onAfterLoad'		: function()
				{
					smFlt.init();	// re-set events and fill textfield with value
				}
			}
		);
	}
}
/**
	@description
	returns a collection of table cells based on their Column Number(s)
	example: getCellsByColNumber(document.getElementById('mytable'), [0, 2, 4])
	returns all cells in columns 0, 2, 4 from selected table
*/
function getCellsByColNumber(table, arrColumns)
{
	var table = getElement(table);
	var rows = table.getElementsByTagName("tr");
	var ret  = Array();
	for(var i = 0; i < rows.length;i++)
	{
		var cols = rows[i].getElementsByTagName("td");
		for(var j = 0; j < cols.length;j++)
		{
			for(var k = 0; k < arrColumns.length;k++)
			{
				ret.push(cols[arrColumns[k]]);
			}
		}
	}
	return ret;
}
/**
	getTableColumnsByOffset
	returns an Object with all matching cells in a column specified by the passed selectors

*/
function getTableColumnsByOffset(table, arrColumns)
{
	var table = getElement(table);
	var rows  = table.getElementsByTagName("tr");
	var cells = new Object();
	for(var n = 0; n < arrColumns.length;n++)
	{
		cells[arrColumns[n]] = Array();
	}
	var ret  = Array();
	for(var i = 0; i < rows.length;i++)
	{
		var cols = rows[i].getElementsByTagName("td");
		for(var j = 0; j < cols.length;j++)
		{
			for(var k = 0; k < arrColumns.length;k++)
			{
				cells[arrColumns[k]].push(cols[arrColumns[k]]);
			}
		}
	}
	return cells;
}
/**
	check if a given object is an Array
*/
function isArray(a)
{
	return Object.prototype.toString.apply(a) === '[object Array]';
}
/* Mietmodelle ---->  */

var rnt = 
	{
		arrIds 		 : [],		// the IDs for the different Calculator Panels
		oWindow 	 : null,	// x-browser alias for window (ie)
		oLinks 		 : null,	// the shopping links
		oResults	 : null,	// element used to display the current price
		oTable 		 : null,	// 
		oCalc		 : null,
		oInputBoxes  : null,
		current 	 : "",		// holds the id of the current displayed calculator panel
		MIN_VALUE	 : 50,
		MAX_VALUE	 : 5000,
		prices 		 : 
		{
			GROUP		: 5.49,
			PLUS		: 5.99,
			ENTERPRISE	: 6.49
		},
		init: function()
		{
			rnt.oWindow 	= (document.all)?document.getElementsByTagName("body")[0]:window;
			rnt.oTable 		= document.getElementById("RENT_TABLE");
			rnt.oCalc 		= new Object();
			rnt.oLinks 		= new Object();
			rnt.oResults 	= new Object();
			rnt.oInputBoxes = new Object();
			var buttons 	= getElementsByClass("rent_buttons", rnt.oTable, "td");
			var inputs 		= getElementsByClass("txt_calc", document, "input");
			
			for(var i = 0; i < buttons.length;i++)
			{
				var id 	= buttons[i].id.split('_')[1];
				rnt.arrIds.push(id);
				rnt.oCalc[id] 		= document.getElementById("CALC_" 	  + id);
				rnt.oResults[id] 	= document.getElementById("RESULT_"   + id);
				rnt.oLinks[id] 		= document.getElementById("SHOPLINK_" + id);
				rnt.oInputBoxes[id] = inputs[i];
				rnt.current 		= id;
				hide(rnt.oCalc[id]);
				removeClass(rnt.oCalc[id], "hide");
				
			//	hookEvent(document.getElementById("INCR_" + id), 'click', rnt.increase);	//	TODO: Buttons for increasind and decreasing value in Textfield
			//	hookEvent(document.getElementById("DECR_" + id), 'click', rnt.decrease);	//
				hookEvent(buttons[i], 'click', rnt.show);
			}
		},
		/**
			show the current calculator panel and hide the other table columns
		*/
		show : function(e)
		{
			e.preventDefault ? e.preventDefault() : e.returnValue = false;		
			var el 			= getElement(getEvent(e));
			rnt.current 	= el.id.split('_')[1];
			var currentBox 	= rnt.oInputBoxes[rnt.current];
			var offset 		= null;
			
			for(var j = 0; j < rnt.arrIds.length;j++)
			{
				if(rnt.arrIds[j] == rnt.current){
					offset = j;
					break;
				}
			}
			var allCells = getElementsByClass("feature", rnt.oTable, "td");
			for(var i = 0; i < allCells.length;i++)
			{
				addClass(allCells[i], "hidden");
			}
			var cols = getTableColumnsByOffset(rnt.oTable, [(offset+1)]);
			for(var n in cols)
			{
				if(isArray(cols[n]))
				{
					for(var k = 0; k < cols[n].length;k++)
					{
						removeClass(cols[n][k], "hidden");
					}
				}
			}
			show(rnt.oCalc[rnt.current]);
			currentBox.focus();
			rnt.calculate(e);
			hookEvent(rnt.oWindow, 'keyup', rnt.chkKey);
			hookEvent(rnt.oInputBoxes[rnt.current], 'keyup', rnt.calculate);
			hookEvent(rnt.oInputBoxes[rnt.current], 'blur', rnt.checkOnBlur);
			hookEvent(rnt.oWindow, 'click', rnt.hide);
		},
		/**
			hide the current calculator Pane
		*/
		hide : function(e)
		{
			var el = getElement(getEvent(e));
			if(rnt.arrIds.inArray(el.id.split('_')[1]) || hasClass(el, "slider-handle") || hasClass(el, "packetPrices") || hasClass(el, "packetName") || hasClass(el, "lblPrice") || hasClass(el, "lblLicenceCount"))
				return;
			else
			{
				rnt.oInputBoxes[rnt.current].blur();
				window.focus();
				unhookEvent(rnt.oInputBoxes[rnt.current], 'keyup', rnt.calculate);
				unhookEvent(rnt.oInputBoxes[rnt.current], 'blur',  rnt.checkOnBlur);
				hide(rnt.oCalc[rnt.current]);
				rnt.current  = "";
				var allCells = getElementsByClass("feature", rnt.oTable, "td");
				for(var i = 0; i < allCells.length;i++)
				{
					removeClass(allCells[i], "hidden");
				}
			}
			unhookEvent(rnt.oWindow, 'keyup', rnt.chkKey);
			unhookEvent(rnt.oWindow, 'click', rnt.hide);
		},
		/**
			refresh the result shown on calculator pane based on the current licencing model
		*/
		calculate : function(e)
		{
			var evnt = getEvent(e);
			
			// position cursor after text
			if(!evnt.keyCode){	
				var t = rnt.oInputBoxes[rnt.current].value;
				rnt.oInputBoxes[rnt.current].value = "";
				rnt.oInputBoxes[rnt.current].value = t;
			}
			evnt.preventDefault();
			if(evnt.keyCode == KEY.ESC)
				rnt.hide(getElement("AREA_MAIN"));
			else if(isInKeyMap(evnt.keyCode, [KEY.STRG, KEY.ALT, KEY.SHIFT, KEY.CAPSLOCK, KEY.PAUSE, KEY.PGDOWN, KEY.PGUP, KEY.POS1, KEY.END, KEY.RIGHT, KEY.LEFT, KEY.BCKSPC, KEY.DEL]))
				return;
			else
			{
				var txt   = rnt.oInputBoxes[rnt.current];
				txt.value = txt.value.replace(/[^0-9]/g, '');
				var val   = (isNaN(parseInt(txt.value)) || parseInt(txt.value) < rnt.MIN_VALUE)?rnt.MIN_VALUE:parseInt(txt.value);
				
				if(evnt.keyCode == KEY.UP)
					txt.value = (val < rnt.MAX_VALUE)?val + 1:rnt.MAX_VALUE;
				else if(evnt.keyCode == KEY.DOWN)
					txt.value = (val > rnt.MIN_VALUE)?(val-1):rnt.MIN_VALUE;
				else if(val > rnt.MAX_VALUE)
					txt.value = rnt.MAX_VALUE;
				else if(txt.value.trim().length ==0)
					txt.value = rnt.MIN_VALUE;
				
				val = (parseInt(txt.value) > rnt.MIN_VALUE)?parseInt(txt.value):rnt.MIN_VALUE;
				rnt.oLinks[rnt.current].href 		= rnt.oLinks[rnt.current].href.replace(/n=\d*/, 'n=' + val);
				rnt.oResults[rnt.current].innerHTML = formatNumber(val * rnt.prices[rnt.current], 2, true, USER['strLanguage'] ) + "&nbsp;&euro;";
				
				if(evnt.keyCode == KEY.ENTER)	// go to cart
					window.location.href = rnt.oLinks[rnt.current].href;
			}
		}, 	
		/**
			@description
			increase the current license count by one (for +, - buttons)
			-> not used yet 
		*/
		increase:function(e)
		{
			var val = ( parseInt(rnt.oInputBoxes[rnt.current].value.trim()) +1 < rnt.MAX_VALUE)?parseInt(rnt.oInputBoxes[rnt.current].value.trim())+1:rnt.MAX_VALUE;
			rnt.oInputBoxes[rnt.current].value = val;
			rnt.oLinks[rnt.current].href = rnt.oLinks[rnt.current].href.replace(/n=\d*/, 'n=' + val);
		},
		/**
			@description
			increase the current license count by one (for +, - buttons)
			-> not used yet 
		*/
		decrease: function(e)
		{
			var val = ( parseInt(rnt.oInputBoxes[rnt.current].value.trim()) -1 > rnt.MIN_VALUE)?parseInt(rnt.oInputBoxes[rnt.current].value.trim())-1:rnt.MIN_VALUE;
			rnt.oInputBoxes[rnt.current].value = val;
			rnt.oLinks[rnt.current].href = rnt.oLinks[rnt.current].href.replace(/n=\d*/, 'n=' + val);
		},
		chkKey : function(e)	// just in case that esc is hit, when the input field has no focus
		{
			if(getEvent(e).keyCode == KEY.ESC)
				rnt.hide(getElement("AREA_MAIN"));
		},
		checkOnBlur: function(e)
		{
			var txt = rnt.oInputBoxes[rnt.current];
			if(txt.value.trim().length ==0 || (parseInt(txt.value) < rnt.MIN_VALUE))
				txt.value = rnt.MIN_VALUE;
		}
	}


/* <--- Mietmodelle   */
