$(document).ready(function(){
	//linkek letiltása
	
	$('a[href$="#"]').click(function(event) {
			event.preventDefault();
	});
	$('a[href$="#"]').css('cursor', 'text');

	//balmenu
	$('#balmenu ul.almenu').hide();	
	
	$('#balmenu span.menupont').click(function() { 
		$('#balmenu ul.almenu').slideUp('slow');
		$('#balmenu span.menupont').removeClass('aktiv').addClass('menupont');
		if ($(this).next('ul').is( ":visible" )){
			$(this).removeClass('aktiv').addClass('menupont');
		} else {
			$(this).next('ul').slideDown("slow");
			$(this).addClass("aktiv");
		}
		 
	});
	//infokero
	$('#keppzesinfokeres form').hide();	
	$('span.kepzesinfo').click(function() { 
		$('#keppzesinfokeres form').slideToggle('slow');
	});
	//fődobozok
	$('.fodoboz').hover(function(){
		var distance = $(this).outerWidth();
		$(this).find('.dobozkep').animate({ left : '-'+distance },{queue:false,duration:300});

	}, function(){
		$(this).find('.dobozkep').animate({ left : '0px' },{queue:false,duration:300});
	});
	//hirek dobozok
	$('.harmasdoboz a.hirek').click(function(event) { 
		event.preventDefault();
		$('.harmasdoboz a.hirek').removeClass('aktiv');
		$('.harmasdoboz a.esemenyek').removeClass('aktiv');
		$('.harmasdoboz a.aktualis').removeClass('aktiv');
		$(this).addClass("aktiv");
		$('.harmasdoboz #hirek').show();
		$('.harmasdoboz #esemenyek').hide();
		$('.harmasdoboz #aktualis').hide();		 
	});
	$('.harmasdoboz a.esemenyek').click(function(event) { 
		event.preventDefault();
		$('.harmasdoboz a.hirek').removeClass('aktiv');
		$('.harmasdoboz a.esemenyek').removeClass('aktiv');
		$('.harmasdoboz a.aktualis').removeClass('aktiv');
		$(this).addClass("aktiv");
		$('.harmasdoboz #hirek').hide();
		$('.harmasdoboz #esemenyek').show();
		$('.harmasdoboz #aktualis').hide();		 
	});
	$('.harmasdoboz a.aktualis').click(function(event) { 
		event.preventDefault();										
		$('.harmasdoboz a.hirek').removeClass('aktiv');
		$('.harmasdoboz a.esemenyek').removeClass('aktiv');
		$('.harmasdoboz a.aktualis').removeClass('aktiv');
		$(this).addClass("aktiv");
		$('.harmasdoboz #hirek').hide();
		$('.harmasdoboz #esemenyek').hide();
		$('.harmasdoboz #aktualis').show();		 
	});
	//doku dobozok
	$('.fodoku a.t1').click(function(event) { 
		event.preventDefault();
		$('.fodoku a.t1').removeClass('aktiv');
		$('.fodoku a.t2').removeClass('aktiv');
		$('.fodoku a.t3').removeClass('aktiv');
		$('.fodoku a.t4').removeClass('aktiv');
		$(this).addClass("aktiv");
		$('.fodoku #t1').show();
		$('.fodoku #t2').hide();
		$('.fodoku #t3').hide();
		$('.fodoku #t4').hide();
	});
	$('.fodoku a.t2').click(function(event) { 
		event.preventDefault();
		$('.fodoku a.t1').removeClass('aktiv');
		$('.fodoku a.t2').removeClass('aktiv');
		$('.fodoku a.t3').removeClass('aktiv');
		$('.fodoku a.t4').removeClass('aktiv');
		$(this).addClass("aktiv");
		$('.fodoku #t1').hide();
		$('.fodoku #t2').show();
		$('.fodoku #t3').hide();
		$('.fodoku #t4').hide();
	});	
	$('.fodoku a.t3').click(function(event) { 
		event.preventDefault();										
		$('.fodoku a.t1').removeClass('aktiv');
		$('.fodoku a.t2').removeClass('aktiv');
		$('.fodoku a.t3').removeClass('aktiv');
		$('.fodoku a.t4').removeClass('aktiv');
		$(this).addClass("aktiv");
		$('.fodoku #t1').hide();
		$('.fodoku #t2').hide();
		$('.fodoku #t3').show();	
		$('.fodoku #t4').hide();
	});
	$('.fodoku a.t4').click(function(event) { 
		event.preventDefault();										
		$('.fodoku a.t1').removeClass('aktiv');
		$('.fodoku a.t2').removeClass('aktiv');
		$('.fodoku a.t3').removeClass('aktiv');
		$('.fodoku a.t4').removeClass('aktiv');
		$(this).addClass("aktiv");
		$('.fodoku #t1').hide();
		$('.fodoku #t2').hide();
		$('.fodoku #t3').hide();	
		$('.fodoku #t4').show();
	});
});

//Képzéskereső
$(function(){
			$("#q2").attr("disabled","disabled");
			$("#q3").attr("disabled","disabled");
			$("select#q1").change(function(){
				$("#q2").removeAttr("disabled").attr("enabled","enabled");
				$.getJSON("kereso.php",{q1: $(this).val()}, function(j){
					var options = '';
					for (var i = 0; i < j.length; i++) {
						options += '<option value="' + j[i].optionValue + '">' + j[i].optionDisplay + '</option>';
					}
					$("#q2").html(options);
					$('#q2 option:first').attr('selected', 'selected');
					var options2 = '';
					$("#q3").html(options2);
					$("#q3").removeAttr("enabled").attr("disabled","disabled");
				})
			})
			$("select#q2").change(function(){
				$("#q3").removeAttr("disabled").attr("enabled","enabled");
				$.getJSON("kereso.php",{q2: $(this).val()}, function(j){
					var options = '';
					for (var i = 0; i < j.length; i++) {
						options += '<option value="' + j[i].optionValue + '">' + j[i].optionDisplay + '</option>';
					}
					$("#q3").html(options);
					$('#q3 option:first').attr('selected', 'selected');
				})
			})
		})

