function sizing(){
	var i = 0, a, b, h = 0, box = document.box;
	for (i; i < box.length; i += 2){
		box[i + 1].style.paddingBottom = "0px";	
		a = box[i].offsetHeight;
		h = (a > h) ? a : h;
	}
	for (i = 0; i < box.length; i += 2){
		a = box[i].offsetHeight;
		if (h > a){
			b = h - a;
			box[i + 1].style.paddingBottom = b + "px";
		}
	}
}

function execute(){
	var i = 0, a, b, c, arg = execute.arguments;
	document.box = new Array();
	var box = document.box;
	for (i; i < arg.length; i += 2){
//		nev = "#"+arg[i];
//		a = $(nev);
		a = document.getElementById(arg[i]);
		b = a.getElementsByTagName(arg[i + 1]);
		c = b[b.length - 1];
		box[box.length] = a;
		box[box.length] = c;
	}
	sizing();
}

function onFocus(){
	var i = 0, j = 0, c, f = document.forms;
	for(i; i < f.length; i++){
		c = f[i].elements;
		for(j; j < c.length; j++){
			if(c[j].type == "text" || c[j].type == "password"){
				if(c[j].value == ""){
					c[j].focus();
					return;
				}
			}
		}
		j = 0;
	}
}

function showContent( kateg, t )
	{		
	$.ajax({
		type: "POST",
		url: "pages/boltalmenu.php",
		data: "szulo="+kateg+"&t="+t,
		success: function(data, textStatus){
			document.getElementById("alkategoria").innerHTML=data;
		}
	}); 
	$("#alkategoria").show();
}

function zarnyit(id){
	idnev = "#"+id;
	$(idnev).toggle();
}

function neon_on(id){
	document.getElementById(id).style.backgroundColor = "#969696";
}

function neon_off(id){
	document.getElementById(id).style.backgroundColor = "#fff";
}

var tmenu_timeout		= 500;
var tmenu_closetimer	= 0;
var tmenu_ddmenuitem	= 0;

function tmenu_open(){
	tmenu_canceltimer();
	tmenu_close();
	tmenu_ddmenuitem = $(this).find('ul').eq(0).css('visibility', 'visible');
}

function tmenu_close(){
	if(tmenu_ddmenuitem)
		tmenu_ddmenuitem.css('visibility', 'hidden');
}

function tmenu_timer(){
	tmenu_closetimer = window.setTimeout(tmenu_close, tmenu_timeout);
}

function tmenu_canceltimer(){
	if(tmenu_closetimer){
		window.clearTimeout(tmenu_closetimer);
		tmenu_closetimer = null;
	}
}

$(document).ready(function(){
	$('#tmenu > li').bind('mouseover', tmenu_open);
	$('#tmenu > li').bind('mouseout',  tmenu_timer);

	if ( document.getElementById("content_left") ){
		execute("content_left", "div", "content_center", "div", "content_right", "div");
	}
	if(document.forms.length > 0){
		onFocus();
	}
});

document.onclick = tmenu_close;

