jQuery(document).ready(function() {
var h = jQuery('#main-body div.right').height()
jQuery('#main-body div.decker').height(h)

});
var lastList
/***/

/***/
function showSubmenu(obj) {
	var oldMouseOver = obj.onmouseover
	//obj.onmouseover = function() {}
	
	var arrEle = []
	var list = obj.parentNode.getElementsByTagName('ul');
	list = list[0]
	if(!list) {
		return;
	}
	if(lastList) {
		clearInterval(lastList.iv)
		lastList.style.display = 'none';
	}
	lastList = list			
	var i = -1;
	//if(document.all) {
		list.style.display = 'block';
	//}
	
	//obj.onmouseover = oldMouseOver
	obj.onmouseout = function () {
		var dontClose = false
		var ele = list.getElementsByTagName('li');
		var n = -1
		while(++n < ele.length) {
			ele[n].onmouseover = function() {
				dontClose = true
			}
			ele[n].onmouseout = function() {
				dontClose = false
				clearInterval(list.iv);
				list.iv = setInterval(function(){
					if(!dontClose) {
						clearInterval(list.iv);
						list.style.display = 'none';
					}
				}, 400)
			}
		}
		
		list.iv = setInterval(function(){
			if(!dontClose) {
				clearInterval(list.iv);
				list.style.display = 'none';
			}
		}, 400)
	}
}
function showSubmenu_dyn(obj) {
	var oldMouseOver = obj.onmouseover
	obj.onmouseover = function() {
	}
	
	var arrEle = []
	var list = obj.parentNode.getElementsByTagName('ul');
	list = list[0]
	if(!list) {
		return;
	}
	if(lastList!=undefined) {
		clearInterval(lastList.iv)
		lastList.style.display = 'none';
	}
	lastList = list			
	var i = -1;
	//if(document.all) {
		list.style.display = 'block';
	//}
	
	var ele = list.getElementsByTagName('li');
	var n = -1;
	while(++n < ele.length) {
		ele[n].style.display = 'none';
		arrEle[arrEle.length] = ele[n]
	}
	
	var lastEle = arrEle[arrEle.length-1];
	lastEle.style.display = 'block';
	
	var i = arrEle.length;
	var maxHeight
	while(--i > -1) {
		maxHeight = (26)
		ele = arrEle[i]
		ele.style.display = 'block'
		//ele.firstChild.style.display = 'none'
		if(document.all) {
			move(ele, {startY:-26,y: maxHeight}, 20);	
		} else {
			move(ele, {startY:-26,y: maxHeight}, 60);	
		}
		
	}
	
			
	list.parentNode.onmouseout = function() {
	}
	arrEle[0].onReady = function() {
		obj.onmouseover = oldMouseOver
			var dontClose = false
//		if(document.all) {
			var iv2
			var list = arrEle[0].parentNode
			arrEle[0].parentNode.onmouseout = function(){
				//alert("bye")
				clearInterval(iv2)
				clearInterval(this.iv);

				var n = -1
	
				while(++n < arrEle.length) {
					arrEle[n].onmouseover = function() {
						dontClose = true
					}
					arrEle[n].onmouseout = function() {
						dontClose = false
						clearInterval(list.iv);
						list.iv = setInterval(function(){
							if(!dontClose) {
								clearInterval(list.iv);
								list.style.display = 'none';
							}
						}, 400)
					}
				}
				this.iv = setInterval(function(){
					if(!dontClose) {
						clearInterval(list.iv);
						list.style.display = 'none';
					}
				}, 400)
			}
			list.parentNode.onmouseover = function() {
				dontClose = true
			}
			list.parentNode.onmouseout = arrEle[0].parentNode.onmouseout
//		}
	}
/*	obj.onmouseover = oldMouseOver*/
}

function closeList(list) {
	clearInterval(list.iv);
	list.isOpen = false
	list.style.display = 'none';
}
/**	HTML Element von a nach b bewegen */
move = function(boxId, pos, speed, counter) {
	counter =(!counter) ? 0 : counter
	counter++
	var speed = (!speed) ? 90 : speed

	var box;
	if(!boxId.style) {
		box = document.getElementById(boxId);
	} else {
		box = boxId
	}
	
	if(!box) {
		return
	}
	pos['startY'] = (!pos['startY']) ? box.style.top : pos['startY']
	if( pos['y'] && counter < speed) {
		var cy = (box.style.top=='') ? 0 : box.style.top
		cy = cy.toString().replace(/(px|pt|em|xm)/, '');
		if( isNaN(cy) ) {
			//	Damit keine Fehler erzeugt werden 
			return
		}
		//var ny = Elastic.easeOut(counter, cy, pos['y'], speed)
		var ny = RPEasing(counter, cy, pos['y'], speed, 'Quart.easeOut')
		if( isNaN(ny) ) {
			//	Damit keine Fehler erzeugt werden 
			return 
		}
		//box.style.top = Number(ny) + pos['startY']
		

		var foo = parseInt(ny) + parseInt(pos['startY'])
		if(document.all) {
			box.style.marginTop = foo
		} else {
			box.style.marginTop = foo + "px;"
		}
		setTimeout(function(foo){
			move(boxId, pos, speed, counter)
		}, 10);
	} else {
		if(box.onReady) {
		box.onReady()
		}
	}
	
}


/**
 *	Methode aus dem Robert Penner Easing Package aufrufen
 *	@param c Counter
 *	@param a Startwert
 *	@param b Endwert
 *	@param s Speed
 *	@param methodName Methoden Name
 */
function RPEasing(c, a, b, s, methodName) {
	methodName = (!methodName) ? 'Elastic.easeOut' : methodName
	var className = methodName.split('.')[0]
	//	Erlaubte Klassen die mit eval ausgefuehrt werden
	switch( className ) {
		case 'Elastic': case 'Quart': case 'Quad':
		case 'Cubic': case 'Circ': case 'Sine':
			ret = eval( methodName )(c, a, b, s)
		break;
	}
	return ret
}



/**
	Code Translation from robertpenner's actionscript Ease Package
	www.robertpenner.com/easing
 */


Elastic = function() {}
Elastic.easeIn = function (t, b, c, d, a, p) {
	if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
	var s
	if (!a || a < Math.abs(c)) { a=c; s=p/4; }
	else s = p/(2*Math.PI) * Math.asin (c/a);
	return -(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
}
Elastic.easeOut = function (t, b, c, d, a, p) {
	if (t==0) return b;  if ((t/=d)==1) return b+c;  if (!p) p=d*.3;
	var s
	if (!a || a < Math.abs(c)) { a=c; s=p/4; }
	else s = p/(2*Math.PI) * Math.asin (c/a);
	return (a*Math.pow(2,-10*t) * Math.sin( (t*d-s)*(2*Math.PI)/p ) + c + b);
}
Elastic.easeInOut = function(t, b, c, d, a, p) {
	if (t==0) return b;  if ((t/=d/2)==2) return b+c;  if (!p) p=d*(.3*1.5);
	var s
	if (!a || a < Math.abs(c)) { a=c; s=p/4; }
	else s = p/(2*Math.PI) * Math.asin (c/a);
	if (t < 1) return -.5*(a*Math.pow(2,10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )) + b;
	return a*Math.pow(2,-10*(t-=1)) * Math.sin( (t*d-s)*(2*Math.PI)/p )*.5 + c + b;
}



Quart = function() {}
Quart.easeIn = function(t, b, c, d) {
	return c*(t/=d)*t*t*t + b;
}
Quart.easeOut = function(t, b, c, d) {
	return -c * ((t=t/d-1)*t*t*t - 1) + b;
}
Quart.easeInOut = function(t, b, c, d) {
	if ((t/=d/2) < 1) return c/2*t*t*t*t + b;
		return -c/2 * ((t-=2)*t*t*t - 2) + b;
}



Quad = function() {}
Quad.easeIn = function(t, b, c, d) {
	return c*(t/=d)*t + b;
}
Quad.easeOut = function(t, b, c, d) {
	return -c *(t/=d)*(t-2) + b;
}
Quad.easeInOut = function(t, b, c, d) {
	if ((t/=d/2) < 1) return c/2*t*t + b;
	return -c/2 * ((--t)*(t-2) - 1) + b;
}


Cubic = function (){}
Cubic.easeIn = function(t, b, c, d) {
	return c*(t/=d)*t*t + b;
}
Cubic.easeOut = function(t, b, c, d) {
	return c*((t=t/d-1)*t*t + 1) + b;
}
Cubic.easeInOut = function(t, b, c, d) {
	if ((t/=d/2) < 1) return c/2*t*t*t + b;
	return c/2*((t-=2)*t*t + 2) + b;
}


Circ = function(){}
Circ.easeIn = function(t, b, c, d) {
	return -c * (Math.sqrt(1 - (t/=d)*t) - 1) + b;
}
Circ.easeOut = function(t, b, c, d) {
	return c * Math.sqrt(1 - (t=t/d-1)*t) + b;
}
Circ.easeInOut = function(t, b, c, d) {
	if ((t/=d/2) < 1) return -c/2 * (Math.sqrt(1 - t*t) - 1) + b;
	return c/2 * (Math.sqrt(1 - (t-=2)*t) + 1) + b;
}


Sine = function(){}
Sine.easeIn = function(t, b, c, d) {
	return -c * Math.cos(t/d * (Math.PI/2)) + c + b;
}
Sine.easeOut = function(t, b, c, d) {
	return c * Math.sin(t/d * (Math.PI/2)) + b;
}
Sine.easeInOut = function(t, b, c, d) {
	return -c/2 * (Math.cos(Math.PI*t/d) - 1) + b;
}


