fixbottommenu = function() {
	var counter = 0;
	var c = 0;
	var bottommenu = Ext.select('.footmenuUL > li');
	var firstfive = [];
	var lastfive = [];
	bottommenu.each( function(el) {
		if (counter < 5) {
			c = counter;
			c = c + 5;
			tole = Ext.get(el);
			thele = Ext.get(bottommenu.elements[c]);
			thele.alignTo(tole, 'tl-bl', [
				0, 20
			]);
		}
		counter = counter + 1;
	});
};



fixcoloredthumbarea = function() {
	var coloredareadtable = Ext.select(".coloredareadtable");
	if (coloredareadtable.getCount() >=  1) {
		Ext.get(coloredareadtable.elements[0]).slideIn('r',{useDisplay :true,duration: 2});
	}  
};

fixstartseiteblocks = function (){
	
	var fixstartseiteblocks = Ext.select('.startseiteblocks');
	var h = 0;
	var hsoll = 0; 
	fixstartseiteblocks.each(function(el){
		hsoll =el.getHeight();
		if (hsoll > h ) {
			h = hsoll;
		}
		
	});
	
	fixstartseiteblocks.each(function(el){
		el.setHeight(h);
	});
	
}; 

/*** HIN UND HER ***/ 
var durationSlideIn = 2;
var durationSLideOut = 2;
var onMove = false;
function showPrev() {
	if (onMove == true) {
		return false;
	}
	var initBlocks = Ext.select('.coloredareadtable');
	var totalCount = initBlocks.elements.length;
	var initCount = 0;
	var nextelVis = false;
	var elSlideOut = false;
	var elSlideIn = false;
	for (initCount = totalCount - 1; initCount >= 0; initCount--) {
		var el = Ext.get(initBlocks.elements[initCount]);
		var vis = el.getStyle("display");
		if (vis == "block") {
			elSlideOut = el;
			nextelVis = true;
		}
		if (nextelVis == true && vis == "none") {
			nextelVis = false;
			elSlideIn = el;
		}
	}
	if (elSlideIn == false) {
		elSlideIn = Ext.get(initBlocks.elements[totalCount - 1]);
	}
	onMove = true;
	elSlideOut.dom.style.overflow = "hidden";
	elSlideOut.slideOut('l', {
		easing :'easeOut',
		duration :durationSLideOut,
		remove :false,
		useDisplay :true
	});
	elSlideIn.dom.style.overflow = "hidden";
	elSlideIn.slideIn('r', {
		easing :'easeOut',
		duration :durationSlideIn,
		remove :false,
		useDisplay :true,
		callback : function(el) {
			el.dom.style.overflow = "auto";
			initBlocks.each( function(elems) {
				if (elems.dom.id != el.id && elems.getStyle("display") != "none") elems.setStyle("display", "none");
			})
			onMove = false;
		}
	});
}
function showNext() {
	if (onMove == true) {
		return false;
	}
	var initBlocks = Ext.select('.coloredareadtable');
	var totalCount = initBlocks.elements.length;
	var initCount = 0;
	var nextelVis = false;
	var elSlideOut = false;
	var elSlideIn = false;
	for (initCount = 0; initCount < totalCount; initCount++) {
		var el = Ext.get(initBlocks.elements[initCount]);
		var vis = el.getStyle("display");
		if (vis == "block") {
			elSlideOut = el;
			nextelVis = true;
		}
		if (nextelVis == true && vis == "none") {
			nextelVis = false;
			elSlideIn = el;
		}
	}
	if (elSlideIn == false) {
		elSlideIn = Ext.get(initBlocks.elements[0]);
	}
	onMove = true;
	elSlideOut.dom.style.overflow = "hidden";
	elSlideOut.slideOut('r', {
		easing :'easeOut',
		duration :durationSLideOut,
		remove :false,
		useDisplay :true,
		callback : function() {}
	});
	elSlideIn.dom.style.overflow = "hidden";
	elSlideIn.slideIn('l', {
		easing :'easeOut',
		duration :durationSlideIn,
		remove :false,
		useDisplay :true,
		callback : function(el) {
			el.dom.style.overflow = "auto";
			initBlocks.each( function(elems) {
				if (elems.dom.id != el.id && elems.getStyle("display") != "none") elems.setStyle("display", "none");
			})
			onMove = false;
		}
	});
}
runOnLoad(fixbottommenu);
runOnLoad(fixcoloredthumbarea);
runOnLoad(fixstartseiteblocks);
