// globals
var accordion = null;

// INIT MENU EFFECTS
window.addEvent('domready', function(){
	
	var szNormal = 0, szSmall  = 0, szFull   = 200;
	 
	var kwicks_top = $$(".tarkettm_top");
	var kwicks = $$(".tarkettm");
	var fx = new Fx.Elements(kwicks, {wait: false, duration: 300, transition: Fx.Transitions.Circ.easeInOut});
	
	// init szFull array with default values
	var szFull = new Array;
	kwicks.each(function(kwick, i) {
		szFull[i] = kwick.getStyle("height");
		kwick.style.height = 0;
		kwick.style.borderBottom = 'none';
		//kwick.style.borderBottom = '1px solid #baccda';
		//alert(szFull[i]);1px solid #baccda;
	});

	// observe menu rootine
	kwicks_top.each(function(kwick, i) {
		kwick.addEvent("mouseenter", function(event) {
			//kwick.style.backgroundColor = '#FFFFFF';
			//kwick.style.color = '#c41130';
						
			kwicks.each(function(kwick, i) {
				kwick.style.borderBottom = "1px solid #baccda";
			});
			
			//kwick.className += "_sfhover";
			//alert(kwick.className);
			
			var o = {};
			o[i] = {height: [kwick.getStyle("height").toInt(), szFull[i]]}
			kwicks.each(function(other, j) {
				if(i != j) {
					var w = other.getStyle("height").toInt();
					if(w != szSmall) {o[j] = {height: [w, szSmall]};}
					else {other.style.borderBottom = "none";}
				}
			});
			fx.start(o);
		});
	});

	// observe sub menu rootine
/*
	kwicks.each(function(kwick, i) {
		kwick.addEvent("mouseenter", function(event) {
			var o = {};
			o[i] = {height: [kwick.getStyle("height").toInt(), szFull[i]]}
			kwicks.each(function(other, j) {
				if(i != j) {
					var w = other.getStyle("height").toInt();
					if(w != szSmall) o[j] = {height: [w, szSmall]};
				}
			});
			fx.start(o);
		});
	});
*/

	// hide menu rootine
	$("tarkettmenu_container").addEvent("mouseleave", function(event) {
		var o = {};
		kwicks.each(function(kwick, i) {
			//o[i] = {height: [kwick.getStyle("height").toInt(), szNormal]}
			o[i] = {height: [kwick.getStyle("height").toInt(), szNormal]}
			kwick.style.borderBottom = "none";
		});
		fx.start(o);
	})


});