function T(t){return document.getElementById(t);}
function mezo_torlese(a){T(a).value='';}
function elfogad(i){var b='index.php?rovat=';var u=i.options[i.selectedIndex].value;if(u.indexOf('http')==-1)u=b+u;location.href=u;}
function email(){var l='';var link=document.links.length;for(i=0;i<link;i++){l=document.links[i];if(l.innerHTML=='email'){var r='';for(j=l.rel.length-1;j>=0;j--)r+=l.rel.charAt(j);l.rel=r;l.rel=l.rel.replace('//','@');for(j=0;j<3;j++)l.rel=l.rel.replace('/','.');l.href='mailto:'+l.rel;l.innerHTML=l.rel;}}}
function getObject(o){var theObj;if(document.all)if(typeof o=='string')return document.all(o);else return o.style;if(document.getElementById)if(typeof o=='string')return document.getElementById(o);else return o.style;return null}
function Contar(entrada,salida,texto,caracteres){var entradaObj=getObject(entrada);var salidaObj=getObject(salida);var longitud=caracteres-entradaObj.value.length;if(longitud<=0){longitud=0;texto='<span> '+texto+' </span>';entradaObj.value=entradaObj.value.substr(0,caracteres)}salidaObj.innerHTML=texto.replace('{CHAR}',longitud)}
$(document).ready(function(){
	email();
	$('textarea').elastic();
	$('a.fancybox').fancybox();
	$('form').validationEngine();
	//$("form").autohelp("#autohelp");
	$('.sugo a[title]').tooltip('#sugo');
	
	$("a#faliujsag").fancybox({"frameWidth":800,"frameHeight":600,"zoomOpacity":true,"zoomSpeedIn":500,"zoomSpeedOut":500});
	$('a#sth_forum').fancybox({'frameWidth':940,'frameHeight':450,'zoomOpacity':true,'zoomSpeedIn':500,'zoomSpeedOut':500});
	$('a#sth_kalapok').fancybox({'frameWidth':940,'frameHeight':620,'zoomOpacity':true,'zoomSpeedIn':500,'zoomSpeedOut':500});
	$("a#statisztika_hely").fancybox({'frameWidth':380,'frameHeight':550,'zoomOpacity':true,'zoomSpeedIn':500,'zoomSpeedOut':500});
	actmenu = 0;
	$("#nav .menu").css({'height':'0px','visibility':'visible'});
	$("#nav .items .item").mouseover(function() {
		if ($(this).attr('id') !== undefined) {
			var id = $(this).attr('id');
			$("#nav .items .item .a").stop(true).animate({'opacity': '1'}, 200);
			$(this).find('.a').stop(true).animate({'opacity': '0'}, 100);
			if (actmenu && $("#"+actmenu+"_menu").length != 0) {
				$("#"+actmenu+"_link").css({'background':'#6f9294'});
				$("#"+id+"_link").css({'background':'#374949'});
				if ($("#"+id+"_menu").length != 0) {
					$("#"+id+"_menu").stop(true).animate({'height':'102px'},100);
				}
				$("#"+actmenu+"_menu").stop(true).animate({'height':'0px'},200);
			}
			actmenu = id;
			$("#"+actmenu+"_link").css({'background':'#374949'});
			if ($("#"+actmenu+"_menu").length != 0) {
				$("#"+actmenu+"_menu").stop(true).animate({'height':'102px'},100);
			}
		} else {
			$("#nav .items .item .a").stop(true).animate({'opacity': '1'}, 200);
			$(this).find('.a').stop(true).animate({'opacity': '0'}, 100);
			if (actmenu && $("#"+actmenu+"_menu").length != 0) $("#"+actmenu+"_menu").stop(true).animate({'height':'0px'},200);
			actmenu = 0;
		}
	});
	$('#nav').mouseleave(function() {
		$("#"+actmenu+"_link").css({'background':'#6f9294'});
		$("#nav .items .item .a").stop(true).animate({'opacity': '1'}, 100);
		if (actmenu) $("#"+actmenu+"_menu").stop(true).animate({'height':'0px'},200);
	});
});