function initialize() {
      if (GBrowserIsCompatible()) {
        var map = new GMap2(document.getElementById("map_canvas"));
	var point = new GLatLng(47.431313, 19.076455);
	map.addOverlay(new GMarker(point));
        map.setCenter(new GLatLng(47.431313, 19.076455), 15);
        map.setUIToDefault();
      }
    }

var service = 'e1bd62e6';

service_selector = function(servi)
{
	service = servi;

	$.post("/PHP/sheduler.php",{fn: 'szolgaltatas_valaszto', 'service': service}, function(data){
		$('#footer').html(data);
		$('#sel_service').click(function(){
			if( $('#service_list').is(':hidden'))
			{
				$('#service_list').show();
			}
			else
			{
				$('#service_list').hide();
			}
		});
		$('.calendar').find('.calendar-day').each(function(i){
			if(!$(this).hasClass('inactive'))
			{
				$(this).click(function(){
					var nap = $(this).attr('id');
					$('.selected-day').removeClass('selected-day');
					$(this).addClass('selected-day');
					$.post("/PHP/sheduler.php",{fn: 'nap_valaszto', 'nap': nap, 'service': service}, function(data){
						var bont = data.split('###ELVALASZTO###');
						$('.selected-time').html(bont[0]);
						$('.timeline').html(bont[1]);
						$('.timeline2').html(bont[2]);
						if( $('.timeline').is(':hidden'))
						{
							$('.timeline2').hide();
							$('.timeline').show();
						}
						$('.timeline').find('.time-big').each(function(i){
							$(this).click(function(){
								var idopont = $(this).attr('id');
								$.post("/PHP/sheduler.php",{fn: 'idopont_valaszto', 'idopont': idopont, 'service': service}, function(data){
									var bont = data.split('###ELVALASZTO###');
									$('.selected-time').html(bont[0]);
									$('.timeline2').html(bont[1]);
									$('.timeline2').show();
									$('.timeline').hide();
								});
							});
						});
					});
				});
			}
		});

		$('.timeline').find('.time-big').each(function(i){
			$(this).click(function(){
				var idopont = $(this).attr('id');
				$.post("/PHP/sheduler.php",{fn: 'idopont_valaszto', 'idopont': idopont, 'service': service}, function(data){
					var bont = data.split('###ELVALASZTO###');
					$('.selected-time').html(bont[0]);
					$('.timeline2').html(bont[1]);
					$('.timeline2').show();
					$('.timeline').hide();
					$('.timeline2').find('.timeline-row-item').each(function(i){
						if (!$(this).hasClass('timeline-red'))
						{
							$(this).click(function(){
								var idopont = $(this).attr('id');
								$('.timeline-green').removeClass('timeline-green');
								$(this).addClass('timeline-green');
								$.post("/PHP/sheduler.php",{fn: 'idopont_valaszto2', 'idopont': idopont, 'service': service}, function(data){
									var bont = data.split('###ELVALASZTO###');
									$('.selected-time').html(bont[0]);
									$('#idopont').val(bont[1]);
								});
							});
						}
					});
				});
			});
		});

	});
	
}


calendar_lapozo = function(eltolas)
{
	$.post("/PHP/sheduler.php",{fn: 'honap_valaszto', 'eltolas': eltolas, 'service': service}, function(data){
		$('.calendar').html(data);
		$('.calendar').find('.calendar-day').each(function(i){
			if(!$(this).hasClass('inactive'))
			{
				$(this).click(function(){
					var nap = $(this).attr('id');
					$('.selected-day').removeClass('selected-day');
					$(this).addClass('selected-day');
					$.post("/PHP/sheduler.php",{fn: 'nap_valaszto', 'nap': nap, 'service': service}, function(data){
						var bont = data.split('###ELVALASZTO###');
						$('.selected-time').html(bont[0]);
						$('.timeline').html(bont[1]);
						$('.timeline2').html(bont[2]);
						if( $('.timeline').is(':hidden'))
						{
							$('.timeline2').hide();
							$('.timeline').show();
						}
						$('.timeline').find('.time-big').each(function(i){
							$(this).click(function(){
								var idopont = $(this).attr('id');
								$.post("/PHP/sheduler.php",{fn: 'idopont_valaszto', 'idopont': idopont, 'service': service}, function(data){
									var bont = data.split('###ELVALASZTO###');
									$('.selected-time').html(bont[0]);
									$('.timeline2').html(bont[1]);
									$('.timeline2').show();
									$('.timeline').hide();
								});
							});
						});
					});
				});
			}
		});
	});
}


;(function($){
	$(document).ready(function(){

		$('#sel_service').click(function(){
			if( $('#service_list').is(':hidden'))
			{
				$('#service_list').show();
			}
			else
			{
				$('#service_list').hide();
			}
		});


	$('.calendar').find('.calendar-day').each(function(i){
		if(!$(this).hasClass('inactive'))
		{
			$(this).click(function(){
				var nap = $(this).attr('id');
				$('.selected-day').removeClass('selected-day');
				$(this).addClass('selected-day');
				$.post("/PHP/sheduler.php",{fn: 'nap_valaszto', 'nap': nap, 'service': service}, function(data){
					var bont = data.split('###ELVALASZTO###');
					$('.selected-time').html(bont[0]);
					$('.timeline').html(bont[1]);
					$('.timeline2').html(bont[2]);
					if( $('.timeline').is(':hidden'))
					{
						$('.timeline2').hide();
						$('.timeline').show();
					}
					$('.timeline').find('.time-big').each(function(i){
						$(this).click(function(){
							var idopont = $(this).attr('id');
							$.post("/PHP/sheduler.php",{fn: 'idopont_valaszto', 'idopont': idopont, 'service': service}, function(data){
								var bont = data.split('###ELVALASZTO###');
								$('.selected-time').html(bont[0]);
								$('.timeline2').html(bont[1]);
								$('.timeline2').show();
								$('.timeline').hide();
								$('.timeline2').find('.timeline-row-item').each(function(i){
									if (!$(this).hasClass('timeline-red'))
									{
										$(this).click(function(){
											var idopont = $(this).attr('id');
											$('.timeline-green').removeClass('timeline-green');
											$(this).addClass('timeline-green');
											$.post("/PHP/sheduler.php",{fn: 'idopont_valaszto2', 'idopont': idopont, 'service': service}, function(data){
												var bont = data.split('###ELVALASZTO###');
												$('.selected-time').html(bont[0]);
												$('#idopont').val(bont[1]);
											});
										});
									}
								});
							});
						});
					});
				});
			});
		}
	});


	$('.timeline').find('.time-big').each(function(i){
		$(this).click(function(){
			var idopont = $(this).attr('id');
			$.post("/PHP/sheduler.php",{fn: 'idopont_valaszto', 'idopont': idopont, 'service': service}, function(data){
				var bont = data.split('###ELVALASZTO###');
				$('.selected-time').html(bont[0]);
				$('.timeline2').html(bont[1]);
				$('.timeline2').show();
				$('.timeline').hide();
				$('.timeline2').find('.timeline-row-item').each(function(i){
					if (!$(this).hasClass('timeline-red'))
					{
						$(this).click(function(){
							var idopont = $(this).attr('id');
							$('.timeline-green').removeClass('timeline-green');
							$(this).addClass('timeline-green');
							$.post("/PHP/sheduler.php",{fn: 'idopont_valaszto2', 'idopont': idopont, 'service': service}, function(data){
								var bont = data.split('###ELVALASZTO###');
								$('.selected-time').html(bont[0]);
								$('#idopont').val(bont[1]);
							});
						});
					}
				});
			});
		});
	});


}); 
	
})(jQuery);
