$(document).ready(function() {




	$("#fm-mysearch_tour, #fm-event_tour").css({
		"width"		: 	"220px"
	});
	

jQuery(function($){
	$.datepicker.regional['hu'] = {
		closeText: 'bezárás',
		prevText: '&laquo;&nbsp;vissza',
		nextText: 'előre&nbsp;&raquo;',
		currentText: 'ma',
		monthNames: ['Január', 'Február', 'Március', 'Április', 'Május', 'Június',
		'Július', 'Augusztus', 'Szeptember', 'Október', 'November', 'December'],
		monthNamesShort: ['Jan', 'Feb', 'Már', 'Ápr', 'Máj', 'Jún',
		'Júl', 'Aug', 'Szep', 'Okt', 'Nov', 'Dec'],
		dayNames: ['Vasárnap', 'Hétfö', 'Kedd', 'Szerda', 'Csütörtök', 'Péntek', 'Szombat'],
		dayNamesShort: ['Vas', 'Hét', 'Ked', 'Sze', 'Csü', 'Pén', 'Szo'],
		dayNamesMin: ['V', 'H', 'K', 'Sze', 'Cs', 'P', 'Szo'],
		weekHeader: 'Hé',
		dateFormat: 'yy-mm-dd',
		firstDay: 1,
		isRTL: false,
		showMonthAfterYear: false,
		yearSuffix: ''};
	$.datepicker.setDefaults($.datepicker.regional['hu']);
});

  $(document).ready(function () {
	$("#fm-event_dateStart").datepicker({
		onSelect: function(dateText, inst) { $('#fm-event_dateStart').val(dateText); }
	});		
	$("#fm-event_dateStart").focus(function() {
		$("#datepicker_begin").toggle("slow");
	});
	$("#fm-event_dateStart").blur(function() {
		$("#datepicker_begin").toggle("slow");
	});

});



	$("#div-mysearch_district").hide();
	$(".mysearchBoxOff").hide();
	
	$("#fm-mysearch_county").change(function() {
		var selected = $("#fm-mysearch_county option:selected");
		if (selected.val() == "20") {
			$("#div-mysearch_district").show();
			$("#fm-mysearch_city").html("<option value='392'>Budapest</option>");
		}
		else {
			$("#div-mysearch_district").hide();
			$.ajax({
				type: "GET",
				url: "/ajax.php?mod=registration&cla=registration&fun=access&ajax=getCityFromMegyeID&pid="+selected.val(),
				success: function(answer){
					$("#fm-mysearch_city").html(answer);	
				}
			});			
		}
	});	
	
	$("#fm-event_county").change(function() {
		var selected = $("#fm-event_county option:selected");
		if (selected.val() == "20") {
			$("#fm-event_city").html("<option value='392'>Budapest</option>");
		}
		else {
			$("#div-event_district").hide();
			$.ajax({
				type: "GET",
				url: "/ajax.php?mod=registration&cla=registration&fun=access&ajax=getCityFromMegyeID&pid="+selected.val(),
				success: function(answer){
					$("#fm-event_city").html(answer);	
				}
			});			
		}
	});		
	
	
	
	$(".mysearchBoxOpen").each(function() {
		$(this).click(function() {
			var ez = $(this);
			var formID = ez.parent().parent().parent().attr('id');
			if (ez.hasClass("mysearchBoxOpenStatusOff")) {
				ez.removeClass("mysearchBoxOpenStatusOff");
				ez.addClass("mysearchBoxOpenStatusOn");
				var cch = $(".leftmenu_content").height();

				var w = $(".wrapper").height();
				$(".leftmenu_content").height(cch-500);  
				$(".wrapper").height(w-500);  
				
				$("#mysearchBoxOpen_"+formID).hide();
			}
			else if (ez.hasClass("mysearchBoxOpenStatusOn")) {
				ez.removeClass("mysearchBoxOpenStatusOn");
				ez.addClass("mysearchBoxOpenStatusOff");	

				var cch = $(".leftmenu_content").height();

				var w = $(".wrapper").height();
				$(".leftmenu_content").height(cch+500);  
				$(".wrapper").height(w+500);  
				
				$("#mysearchBoxOpen_"+formID).show();
			}			
		});
	});
	
	
	$(".mysearchList").each(function() {
		$(this).click(function() {
			var ez = $(this);
			var az = ez.children(".mysearchListNameHref");
			if (az.hasClass("mysearchBoxOpenStatusOff")) {
				az.removeClass("mysearchBoxOpenStatusOff");
				az.addClass("mysearchBoxOpenStatusOn");
				ez.parent().children(".mysearchListDatas").hide();
			}
			else if (az.hasClass("mysearchBoxOpenStatusOn")) {
				az.removeClass("mysearchBoxOpenStatusOn");
				az.addClass("mysearchBoxOpenStatusOff");				
				ez.parent().children(".mysearchListDatas").show();
			}					
		});
	});
	
	
	if ($(".submenu").height() == "10") $(".submenu").height("0");

	
	});
	

