function errordisp(message, setfocus) {
	alert(message);
	setfocus.focus();
}

function slider_nem_latszik() {
	return (img_latszik == 1 ? 2 : 1);
}

function slider_kovetkezo() {
	var totalnum = promo_kepek.length;

	promo_counter++;

	if(promo_counter >= totalnum) {
		promo_counter = 0;
	}
}

var fade_speed = 250;
var img_latszik = 2;
var promo_counter = 0;

function promo_update() {

	var img_nem_latszik = slider_nem_latszik();

	slider_kovetkezo();

	jQuery(".promo_img_" + img_latszik).css("z-index", "2");
	jQuery(".promo_img_" + img_nem_latszik).css("z-index", "1");

	jQuery(".promo_img_" + img_nem_latszik).show();
	jQuery(".promo_img_" + img_nem_latszik).children("a").children("img").attr("src", promo_kepek[promo_counter]);
	jQuery(".promo_img_" + img_nem_latszik).children("a").attr("href", promo_linkek[promo_counter]);

	jQuery(".promo_img_" + img_latszik).fadeOut(600);

	jQuery('.promo_leiras_container').fadeOut(fade_speed, function() {

		jQuery('.promo_leiras_datum').hide();
		jQuery('.promo_leiras_cim').hide();
		jQuery('.promo_leiras_szoveg').hide();
		jQuery('.promo_leiras_bovebben').hide();

		jQuery(".promo_leiras_datum").html(promo_datumok[promo_counter]);
		jQuery(".promo_leiras_cim").html(promo_cimek[promo_counter]);
		jQuery(".promo_leiras_szoveg").html(promo_leirasok[promo_counter]);
		jQuery(".promo_leiras_bovebben a").attr("href", promo_linkek[promo_counter]);

		jQuery('.promo_leiras_container').fadeIn(fade_speed);
		jQuery('.promo_leiras_datum').delay(200).fadeIn(fade_speed);
		jQuery('.promo_leiras_cim').delay(400).fadeIn(fade_speed);
		jQuery('.promo_leiras_szoveg').delay(600).fadeIn(fade_speed);
		jQuery('.promo_leiras_bovebben').delay(800).fadeIn(fade_speed);

		img_latszik = img_nem_latszik;
	});
}

var timer_is_on = 0;
var timer = "";

function start_timer() {
	if (!timer_is_on) {
		timer = setInterval(function(){promo_update();}, 4000);
		timer_is_on = 1;
	}
}

function pause_timer() {
	if (timer) clearInterval(timer);

	timer_is_on = 0;
}

function mycarousel_scroll_start(id) {
	var carousel = jQuery(id).data('jcarousel');
	carousel.scroll(1);
}

function mycarousel_change_adatlap_num(carousel) {
	jQuery("#mas_termek_lapozo_num").html(carousel.first);
	
	return false;
}

function mycarousel_initCallback(carousel) {
	jQuery("#aktoldal").html(carousel.first);

	return false;
}

function partnerek_show_kategoria_bg(kid, click) {

	var obj = jQuery(".partnereink_kategoria_bg_n[data-kid='"+ kid +"']");

	var offset = obj.offset();

	if(click) {
		tmp_id = akt_kid;

		jQuery('#partnereink_kategoria_bg_h' + akt_kid).fadeOut(200);
		akt_kid = kid;
	}

	else {
		jQuery('.partnereink_kategoria_bg_h').hide();
	}

	jQuery('#partnereink_kategoria_bg_h' + akt_kid).show();
		
	jQuery('#partnereink_kategoria_bg_h' + kid).css({ marginLeft: 0, marginTop: 0, top: (offset.top), left: (offset.left) });

	jQuery('#partnereink_kategoria_bg_h' + kid).css("width", obj.width());

	jQuery('#partnereink_kategoria_bg_h' + kid).html(obj.html());

	jQuery('#partnereink_kategoria_bg_h' + kid).show();


	if(click) {

		elozoh = jQuery("#kat_box" + tmp_id).height();
		kovih = jQuery("#kat_box" + kid).height();

		jQuery(".partnereink_tartalom_box_container").css("height", elozoh);

		if(kovih != elozoh) {
			jQuery("#kat_box" + tmp_id).fadeOut(800, function() {
				jQuery(".partnereink_tartalom_box_container").animate({ "height": kovih }, "800", function() {
					jQuery("#kat_box" + kid).toggle(800);
				});
			});
		}

		else {
			jQuery("#kat_box" + tmp_id).fadeOut(800, function() {
				jQuery(".partnereink_tartalom_box_container").animate({ "height": kovih }, "800", function() {
					jQuery("#kat_box" + kid).toggle(800);
				});
			});
		}
	}
}

function termekek_show_kategoria_anim(kid, tmp_id) {

	var elozoh = jQuery("#termekek_talalat_box" + tmp_id).height();
	var kovih = jQuery("#termekek_talalat_box" + kid).height();
	
	var elozo_tart_cont = jQuery("#termekek_talalat_box" + tmp_id + " .termekek_talalat_box_tartalom_container");
	var elozo_szures_cont = jQuery("#termekek_talalat_box" + tmp_id + " .termekek_talalat_box_szures_container");

	var elozo_tart_shadow = jQuery("#termekek_talalat_box" + tmp_id + " .termekek_talalat_box_tartalom_shadow");
	var elozo_szures_shadow = jQuery("#termekek_talalat_box" + tmp_id + " .termekek_talalat_box_szures_shadow");

	var kovi_tart_cont = jQuery("#termekek_talalat_box" + kid + " .termekek_talalat_box_tartalom_container");
	var kovi_szures_cont = jQuery("#termekek_talalat_box" + kid + " .termekek_talalat_box_szures_container");

	var kovi_tart_shadow = jQuery("#termekek_talalat_box" + kid + " .termekek_talalat_box_tartalom_shadow");
	var kovi_szures_shadow = jQuery("#termekek_talalat_box" + kid + " .termekek_talalat_box_szures_shadow");

	jQuery("#termekek_talalat_box" + tmp_id).hide();

	kovi_szures_shadow.hide();
	kovi_tart_shadow.hide();
	kovi_szures_cont.hide();
	kovi_tart_cont.hide();

	jQuery("#termekek_talalat_box" + kid).show();

	if (kovi_szures_cont.length > 0){
		kovi_szures_shadow.fadeIn(400, function() {
			kovi_szures_cont.toggle(600, function() {
				kovi_tart_shadow.fadeIn(400, function() {
					kovi_tart_cont.toggle(600);

					jQuery("#mycarousel" + akt_kid).jcarousel({
						scroll: 1,
						visible: 1
					});

					elozo_tart_cont.show();
					elozo_szures_cont.show();

					termekek_leptet_ajax_refresh();
				});
			});
		});
	}

	else {
		kovi_tart_shadow.fadeIn(400, function() {
			kovi_tart_cont.toggle(600);

			jQuery("#mycarousel" + akt_kid).jcarousel({
				scroll: 1,
				visible: 1
			});

			elozo_tart_cont.show();
			elozo_szures_cont.show();

			termekek_leptet_ajax_refresh();
		});
	}
}

function termekek_show_kategoria_bg(kid, click) {

	var obj = jQuery(".termekek_kategoria_bg_n[data-kid='"+ kid +"']");
	var akt_obj = jQuery(".termekek_kategoria_bg_n[data-kid='"+ akt_kid +"']");

	var offset = obj.offset();

	if(click) {
		tmp_id = akt_kid;

		akt_obj.children('.termekek_kategoria_bg_h').fadeOut(200);
		akt_obj.css({
		'color' : '#8f676a'
		});

		akt_kid = kid;
	}

	else {
		jQuery('.termekek_kategoria_bg_h').hide();
	}

	akt_obj.children('.termekek_kategoria_bg_h').show();

	obj.children('.termekek_kategoria_bg_h').show();


	if(click) {

		/* JCarousel preload */
	
		jQuery("#termekek_talalat_box" + kid).show();

		jQuery("#mycarousel" + kid).jcarousel({
			scroll: 1,
			visible: 1
		});

		jQuery("#termekek_talalat_box" + kid).hide();

		/* ***************** */
		
		var elozoh = jQuery("#termekek_talalat_box" + tmp_id).height();
		var kovih = jQuery("#termekek_talalat_box" + kid).height();

		var elozo_tart_cont = jQuery("#termekek_talalat_box" + tmp_id + " .termekek_talalat_box_tartalom_container");
		var elozo_szures_cont = jQuery("#termekek_talalat_box" + tmp_id + " .termekek_talalat_box_szures_container");

		var elozo_tart_shadow = jQuery("#termekek_talalat_box" + tmp_id + " .termekek_talalat_box_tartalom_shadow");
		var elozo_szures_shadow = jQuery("#termekek_talalat_box" + tmp_id + " .termekek_talalat_box_szures_shadow");

		var kovi_tart_cont = jQuery("#termekek_talalat_box" + kid + " .termekek_talalat_box_tartalom_container");
		var kovi_szures_cont = jQuery("#termekek_talalat_box" + kid + " .termekek_talalat_box_szures_container");

		var kovi_tart_shadow = jQuery("#termekek_talalat_box" + kid + " .termekek_talalat_box_tartalom_shadow");
		var kovi_szures_shadow = jQuery("#termekek_talalat_box" + kid + " .termekek_talalat_box_szures_shadow");

		if(kovih > elozoh) {
			jQuery(".termekek_talalat_box_bg").animate({ "height": kovih }, 800, function() {
				elozo_tart_shadow.fadeOut(400);

				elozo_tart_cont.fadeOut(400, function() {

					if (elozo_szures_cont.length > 0){

						elozo_szures_shadow.fadeOut(400);

						elozo_szures_cont.fadeOut(400, function() {
							termekek_show_kategoria_anim(kid, tmp_id);
						});
					}

					else {
						termekek_show_kategoria_anim(kid, tmp_id);
					}
				});
			});
		}

		else {
			if(kovih != elozoh) {
				
				jQuery(".termekek_talalat_box_bg").css("height", elozoh);

				elozo_tart_shadow.fadeOut(400);

				elozo_tart_cont.fadeOut(400, function() {

					if (elozo_szures_cont.length > 0){
						elozo_szures_shadow.fadeOut(400);

						elozo_szures_cont.fadeOut(400, function() {
							jQuery(".termekek_talalat_box_bg").animate({ "height": kovih }, 800, function() {
								termekek_show_kategoria_anim(kid, tmp_id);
							});
						});
					}

					else {
						
						jQuery(".termekek_talalat_box_bg").animate({ "height": kovih }, 800, function() {
							termekek_show_kategoria_anim(kid, tmp_id);
						});
					}
				});
			}

			else {
				elozo_tart_shadow.fadeOut(400);

				elozo_tart_cont.fadeOut(400, function() {

					jQuery(".termekek_talalat_box_bg").css("height", elozoh);

					if (elozo_szures_cont.length > 0){

						elozo_szures_shadow.fadeOut(400);
						elozo_szures_cont.fadeOut(400, function() {
							termekek_show_kategoria_anim(kid, tmp_id);
						});
					}

					else {
						termekek_show_kategoria_anim(kid, tmp_id);
					}
				});
			}
		}
	}	
}

function termekek_show_lista() {

	var elozoh = jQuery('#termekek_talalat_box' + akt_kid).height();
	var kovih = jQuery('#termekek_talalat_box_tmp').height();

	var elozo_tart_cont = jQuery("#termekek_talalat_box" + akt_kid + " .termekek_hely");


	if(kovih > elozoh) {
		jQuery(".termekek_talalat_box_bg").animate({ "height": kovih }, 800, function() {
			
			elozo_tart_cont.fadeOut(400, function() {
				termekek_show_lista_anim();
			});
		});
	}

	else {
		if(kovih != elozoh) {
			
			jQuery(".termekek_talalat_box_bg").css("height", elozoh);

			elozo_tart_cont.fadeOut(400, function() {
				jQuery(".termekek_talalat_box_bg").animate({ "height": kovih }, 800, function() {
					termekek_show_lista_anim();
				});
			});
		}

		else {

			jQuery(".termekek_talalat_box_bg").css("height", elozoh);

			elozo_tart_cont.fadeOut(400, function() {
				termekek_show_lista_anim();
			});
		}
	}
}

function termekek_show_lista_anim() {

	var kovi_tart_cont = jQuery("#termekek_talalat_box" + akt_kid + " .termekek_hely");
	var kovi_tart_atfogo = jQuery("#termekek_talalat_box" + akt_kid + " .termekek_hely_atfogo");

	kovi_tart_atfogo.hide(); // tartalom váltás előtt eltüntetjük az átfogó divet
	
	kovi_tart_cont.html(jQuery('#termekek_talalat_box_tmp .termekek_hely').html()); // módosítjuk a tartalmat

	jQuery('#termekek_talalat_box_tmp').html(""); // nincs már szükség a tmp div tartalmára

	kovi_tart_cont.show(); // megjelenítjük a tartalom divet, mert a toggle funkció csak block div esetén működik, ezért is kell az átfogó div mögé
		
	kovi_tart_atfogo.toggle(600); // anim start


	termekek_leptet_ajax_refresh();
}

function termekek_leptet(lapszam) {
	jQuery.ajaxSetup ({  
		cache: false  
	});


	var offset = jQuery("#termekek_talalat_box" + akt_kid + " .lapozo_container_rel2 a").last().offset();

	jQuery("#szures_loading_lapozo").css({
		'margin-left' : offset.left + 50 + "px",
		'margin-top' : offset.top + 5 + "px"
	});

	jQuery("#szures_loading_lapozo").fadeIn(300);


	if(jQuery("#termekek_talalat_box" + akt_kid + " .termekek_talalat_box_szures_container").length > 0) {

		jQuery("#termekek_szures_form" + akt_kid).ajaxSubmit({

			url: 'ajax_termekek_lapozo.php?kid=' + akt_kid + '&lapszam=' + lapszam,

			success: function(responseText, statusText, xhr, $form) {
				if(statusText == "success") {

					jQuery("#termekek_talalat_box_tmp").html(jQuery('#termekek_talalat_box' + akt_kid).html());

					jQuery('#termekek_talalat_box_tmp .termekek_hely').html(responseText);

					fut = false;

					var offset = jQuery("#termekek_talalat_box" + akt_kid).offset();

					jQuery(window.opera?'html':'html, body').animate({ scrollTop: offset.top-15 }, "slow", function() {

						if(!fut) { // valamiért 2x fut le, ha ezt kiveszem

							jQuery("#szures_loading_lapozo").fadeOut(300);

							termekek_show_lista();
						}

						fut = true;
					});
				}

				else {
					alert("szerver hiba!");
				}
			}
		});

		//return false; 
	}

	else {

		jQuery("#termekek_talalat_box_tmp").html(jQuery('#termekek_talalat_box' + akt_kid).html());

		jQuery('#termekek_talalat_box_tmp .termekek_hely')
			.load('ajax_termekek_lapozo.php?kid=' + akt_kid + '&lapszam=' + lapszam,
				function(responseText, textStatus, req) {  
					if (textStatus != "error") {

						fut = false;

						var offset = jQuery("#termekek_talalat_box" + akt_kid).offset();

						jQuery(window.opera?'html':'html, body').animate({ scrollTop: offset.top-15 }, "slow", function() {

							if(!fut) { // valamiért 2x fut le, ha ezt kiveszem

								jQuery("#szures_loading_lapozo").fadeOut(300);

								termekek_show_lista();
							}

							fut = true;
						});
					}

					else {
						alert('Szerver Hiba 0075!');
					}
				}
			);
	}
}

function show_nagyito_in_center(obj) {

	var nagyito = obj;

	var h_center = "-" + Math.round(nagyito.width() / 2) + "px";
	var v_center = "-" + Math.round(nagyito.height() / 2) + "px";

	nagyito.css({
	'left' : '50%',
	'top' : '50%',
	'margin-left' : h_center,
	'margin-top' : v_center
	});

	if (jQuery.browser.msie) {
		nagyito.show();
	}

	else {
		nagyito.stop().fadeTo(200, 1);
	}
}

function hide_nagyito(obj) {

	var nagyito = obj;

	if (jQuery.browser.msie) {
		nagyito.hide();
	}

	else {
		nagyito.stop().fadeTo(200, 0);
	}
}

function termekek_leptet_ajax_refresh() {

	jQuery("#termekek_talalat_box" + akt_kid + " .lapozo_container_rel2 a").click(function() {

		var src = jQuery(this).text();

		if(src.indexOf(">") == -1 && src.indexOf("<") == -1) {
			jQuery("#termekek_talalat_box" + akt_kid + " .lapozo_container_rel2 a").css("border-color", "#daac81");

			jQuery(this).css("border-color", "#cc0d24");
		}
	});

	jQuery('.termekekbox_marka_img_bg').mouseenter(function() {

		show_nagyito_in_center(jQuery(this).children(".nagyito2"));
	});

	jQuery('.termekekbox_marka_img_bg').mouseleave(function() {

		hide_nagyito(jQuery(this).children(".nagyito2"));
	});

	jQuery("a[rel^='lightbox']").colorbox();
}

function referenciak_leptet_ajax_refresh() {

	jQuery('.referenciakbox_img_bg').mouseenter(function() {

		show_nagyito_in_center(jQuery(this).children(".nagyito2"));
	});

	jQuery('.referenciakbox_img_bg').mouseleave(function() {

		hide_nagyito(jQuery(this).children(".nagyito2"));
	});

	jQuery("a[rel^='lightbox']").colorbox();
}

function change_termek_szin(szin_id, termek_id) {

	jQuery('#termekek_talalat_box_tmp')
		.load('ajax_change_termek_szin.php?kid=' + akt_kid + '&szin_id=' + szin_id + '&termek_id=' + termek_id,
			function(responseText, textStatus, req) {  
				if (textStatus != "error") {

					var termek_szinek_carousel_tmp = jQuery('#termek_szinek_carousel_tmp').html();
					var elso_szin_megnevezes_tmp = jQuery('#elso_szin_megnevezes_tmp').html();
					var elso_szin_kep_nagy_tmp = jQuery('#elso_szin_kep_nagy_tmp').html();
					var mas_termek_szin_tmp = jQuery('#mas_termek_szin_tmp').html();
					var talalatbox = jQuery("#adatlap_tartalom_atfogo .termekek_talalat_box_tartalom_container").length;


					jQuery('#termekek_talalat_box_tmp').html(""); // töröljük, hogy ne legyen duplázódás


					var offset = jQuery(".kapcsolat_tartalom_behuz").offset();

					jQuery(window.opera?'html':'html, body').animate({ scrollTop: offset.top-15 }, "slow", function() {

						jQuery('#elso_szin_megnevezes').html(elso_szin_megnevezes_tmp);
						jQuery('.termekek_adatlap_img_cont').html(elso_szin_kep_nagy_tmp);   
						jQuery('.termek_adatlap_szinek').html(termek_szinek_carousel_tmp);

						if(jQuery("#mycarousel_adatlap_mas_szin").length > 0) {
							jQuery("#mycarousel_adatlap_mas_szin").jcarousel({
								scroll: 2,
								visible: 2
							});
						}

						if(mas_termek_szin_tmp != "") {

							if(talalatbox > 0) {

								jQuery("#adatlap_tartalom_atfogo").css("height", jQuery("#adatlap_tartalom_atfogo").height());

								jQuery(".termekek_talalat_box_tartalom_container").fadeOut(300, function() {
									
									jQuery("#adatlap_tartalom_atfogo").html(mas_termek_szin_tmp);

									jQuery(".termekek_talalat_box_tartalom_container").fadeIn(300);

									if(jQuery("#mycarousel_adatlap_mas_termek_szin").length > 0) {
										jQuery("#mycarousel_adatlap_mas_termek_szin").jcarousel({
											scroll: 1,
											visible: 1,
											itemLoadCallback: mycarousel_change_adatlap_num
										});
									}

									termekek_leptet_ajax_refresh();

									createImgHovers("");
								});
							}

							else {
								jQuery("#adatlap_tartalom_atfogo").html(mas_termek_szin_tmp);

								jQuery("#adatlap_tartalom_atfogo").slideDown(600);

								if(jQuery("#mycarousel_adatlap_mas_termek_szin").length > 0) {
									jQuery("#mycarousel_adatlap_mas_termek_szin").jcarousel({
										scroll: 1,
										visible: 1,
										itemLoadCallback: mycarousel_change_adatlap_num
									});
								}

								termekek_leptet_ajax_refresh();

								createImgHovers("");
							}
						}

						else {
							if(jQuery(".termekek_talalat_box_tartalom_container").length > 0) {

								jQuery(".termekek_talalat_box_bg").css("height", "auto");
							
								jQuery("#adatlap_tartalom_atfogo").slideUp(600, function() {
									jQuery('#adatlap_tartalom_atfogo').html("");
									jQuery('#termekek_talalat_box_tmp').html("");
								});
							}
						}
					});
				}

				else {
					alert('Szerver Hiba 0075!');
				}
			}
		);
}

function refresh_adatlap() {
	if(jQuery("#mycarousel_adatlap_mas_szin").length > 0) {
		jQuery("#mycarousel_adatlap_mas_szin").jcarousel({
			scroll: 2,
			visible: 2
		});
	}

	if(jQuery("#mycarousel_adatlap_mas_termek_szin").length > 0) {
		jQuery("#mycarousel_adatlap_mas_termek_szin").jcarousel({
			scroll: 1,
			visible: 1,
			itemLoadCallback: mycarousel_change_adatlap_num
		});
	}

	termekek_leptet_ajax_refresh();

	createImgHovers("");
}

function change_termek_adatlap(szin_id, termek_id) {
	
	jQuery('#termekek_talalat_box_tmp')
		.load('ajax_change_termek_adatlap.php?kid=' + akt_kid + '&szin_id=' + szin_id + '&termek_id=' + termek_id,
			function(responseText, textStatus, req) {  
				if (textStatus != "error") {

					var offset = jQuery(".kapcsolat_tartalom_behuz").offset();

					fut = false;

					jQuery(window.opera?'html':'html, body').animate({ scrollTop: offset.top-15 }, "slow", function() {

						if(!fut) { // valamiért 2x fut le, ha ezt kiveszem

							jQuery('#termekek_talalat_box_tmp').html(""); // töröljük, hogy ne legyen duplázódás

						
							var elozoh = jQuery('#termekek_teljes_box_atfogo').height();
							
							var elozo_tart_cont = jQuery('#termekek_teljes_box_atfogo');
							

							jQuery('.termekek_talalat_box_bg').css("height", elozoh);


							elozo_tart_cont.fadeOut(400, function() {

								elozo_tart_cont.html(responseText);

								elozo_tart_cont.show();
								

								if(jQuery("#mycarousel_adatlap_mas_szin").length > 0) {
									jQuery("#mycarousel_adatlap_mas_szin").jcarousel({
										scroll: 2,
										visible: 2
									});
								}

								if(jQuery("#mycarousel_adatlap_mas_termek_szin").length > 0) {
									jQuery("#mycarousel_adatlap_mas_termek_szin").jcarousel({
										scroll: 1,
										visible: 1,
										itemLoadCallback: mycarousel_change_adatlap_num
									});
								}

								elozo_tart_cont.hide();
			

								

								var kovih = elozo_tart_cont.height();

								

								if(kovih != elozoh) {
									jQuery(".termekek_talalat_box_bg").animate({ "height": kovih }, 800, function() {

										elozo_tart_cont.fadeIn(400);
									
										refresh_adatlap();
									});
								}

								else {
									elozo_tart_cont.fadeIn(400);

									refresh_adatlap();
								}
							});
							
						}

						fut = true;
					});
				}
			});

}

function referencia_auto_refresh(termek_id, szin_id, helyszin_id) {

	jQuery.ajaxSetup ({  
		cache: false  
	}); 

	jQuery('#ajax_tmp')
		.load('ajax_referencia_select_refresh.php?termek_id=' + termek_id,
			function(responseText, textStatus, req) {  
				if (textStatus != "error") {

					jQuery('#szin_select_container').html(jQuery('#szin_select_tmp').html());
					//jQuery('#helyszin_select_container').html(jQuery('#helyszin_select_tmp').html());

					jQuery('#ajax_tmp').html("");


					jQuery('#ajax_tmp')
						.load('ajax_referencia_helyszin_select_refresh.php?szin_id=' + szin_id + '&termek_id=' + termek_id,
							function(responseText, textStatus, req) {  
								if (textStatus != "error") {

									jQuery('#helyszin_select_container').html(jQuery('#helyszin_select_tmp').html());

									jQuery('#ajax_tmp').html("");

									jQuery('select[name="termek"]').val(termek_id);
									jQuery('select[name="szin"]').val(szin_id);
									jQuery('select[name="helyszin"]').val(helyszin_id);

									referenciak_refresh_carousel(false);
								}

								else {
									alert('Szerver Hiba 0075!');
								}
							}
						);
				}

				else {
					alert('Szerver Hiba 0075!');
				}
			}
		);
}

function referencia_select_refresh(termek_id) {

	jQuery.ajaxSetup ({  
		cache: false  
	});  
	
	jQuery('#ajax_tmp')
		.load('ajax_referencia_select_refresh.php?termek_id=' + termek_id,
			function(responseText, textStatus, req) {  
				if (textStatus != "error") {
					jQuery('#szin_select_container').html(jQuery('#szin_select_tmp').html());
					jQuery('#helyszin_select_container').html(jQuery('#helyszin_select_tmp').html());

					jQuery('#ajax_tmp').html("");
				}

				else {
					alert('Szerver Hiba 0075!');
				}
			}
		);
}

function referencia_helyszin_select_refresh(szin_id) {

	jQuery.ajaxSetup ({  
		cache: false  
	});

	var termek_id = jQuery('select[name="termek"]').val();
	
	jQuery('#ajax_tmp')
		.load('ajax_referencia_helyszin_select_refresh.php?szin_id=' + szin_id + '&termek_id=' + termek_id,
			function(responseText, textStatus, req) {  
				if (textStatus != "error") {
					jQuery('#helyszin_select_container').html(jQuery('#helyszin_select_tmp').html());

					jQuery('#ajax_tmp').html("");
				}

				else {
					alert('Szerver Hiba 0075!');
				}
			}
		);
}

function referenciak_refresh_carousel(scroll) {

	jQuery.ajaxSetup ({  
		cache: false  
	});

	var termek_id = jQuery('select[name="termek"]').val();
	var szin_id = jQuery('select[name="szin"]').val();
	var helyszin_id = jQuery('select[name="helyszin"]').val();

	jQuery('#ajax_tmp')
		.load('ajax_referenciak_refresh_carousel.php?szin_id=' + szin_id + '&termek_id=' + termek_id + '&helyszin_id=' + helyszin_id,
			function(responseText, textStatus, req) {
				if (textStatus != "error") {

					jQuery('#ajax_tmp').html("");


					if(scroll) {

						var offset = jQuery(".referenciak_talalat_box_tartalom_container").offset();

						jQuery(window.opera?'html':'html, body').animate({ scrollTop: offset.top }, "slow", function() {

							jQuery(".referenciak_csuszka_cont .rcsc").fadeOut(400, function() {
								jQuery(".referenciak_csuszka_cont .rcsc").html(responseText);

								jQuery(".referenciak_csuszka_cont .rcsc").fadeIn(400);

								if(jQuery("#mycarousel_ref").length > 0) {
									jQuery("#mycarousel_ref").jcarousel({
										scroll: 1,
										visible: 6
									});
								}

								searchLocations("");
							});
						});
					}

					else {

						jQuery(".referenciak_csuszka_cont .rcsc").html(responseText);
						

						if(jQuery("#mycarousel_ref").length > 0) {
							jQuery("#mycarousel_ref").jcarousel({
								scroll: 1,
								visible: 6
							});
						}

						searchLocations("");
					}
				}

				else {
					alert('Szerver Hiba 0075!');
				}
			}
		);
}

function referenciak_refresh_carousel_google_map(adatok) {

	jQuery.ajaxSetup ({  
		cache: false  
	});

	split = adatok.split("|");

	jQuery('#ajax_tmp')
		.load('ajax_referenciak_refresh_carousel.php?szin_id=-&termek_id=-&helyszin_id=' + split[0],
			function(responseText, textStatus, req) {
				if (textStatus != "error") {

					jQuery('#ajax_tmp').html("");


					var offset = jQuery(".referenciak_talalat_box_tartalom_container").offset();

					jQuery(window.opera?'html':'html, body').animate({ scrollTop: offset.top }, "slow", function() {

						jQuery(".referenciak_csuszka_cont .rcsc").fadeOut(400, function() {
							jQuery(".referenciak_csuszka_cont .rcsc").html(responseText);

							jQuery(".referenciak_csuszka_cont .rcsc").fadeIn(400);

							if(jQuery("#mycarousel_ref").length > 0) {
								jQuery("#mycarousel_ref").jcarousel({
									scroll: 1,
									visible: 6
								});
							}

							searchLocations(adatok);
						});
					});
				}

				else {
					alert('Szerver Hiba 0075!');
				}
			}
		);
}

function scollTofocim() {
	var offset = jQuery("a[name='tc']").offset();

	jQuery(window.opera?'html':'html, body').animate({ scrollTop: offset.top-15 }, "slow");
}

function referenciak_change_big_picture(small_pic, big_pic, rid) {
	jQuery.ajaxSetup ({  
		cache: false  
	});

	jQuery('.referenciak_adatlap_img_cont')
		.load('ajax_referencia_adatlap_lightbox.php?rid=' + rid + '&big_pic=' + big_pic,
			function(responseText, textStatus, req) { 
				if (textStatus != "error") {
					referenciak_leptet_ajax_refresh();
				}

				else {
					alert('Szerver Hiba 0075!');
				}
			}
		);
}

function change_referencia_adatlap(merre) {
	jQuery.ajaxSetup ({  
		cache: false  
	});

	ossznum = jQuery('.referenciak_adatlap_lepteto_num #ossz').html();
	akt = jQuery('.referenciak_adatlap_lepteto_num #akt').html();

	if(merre == "f") {

		akt++;

		if(akt > ossznum) {
			akt = 1;
		}
	}

	else {
		akt--;

		if(akt <= 0) {
			akt = ossznum;
		}
	}

	jQuery('.referenciak_adatlap_lepteto_num #akt').html(akt);
	
	jQuery('#ajax_tmp')
		.load('ajax_change_referencia_adatlap.php?akt=' + akt,
			function(responseText, textStatus, req) { 
				if (textStatus != "error") {

					jQuery('#ajax_tmp').html("");


					var elozoh = jQuery('#referenciak_adatlap_atfogo').height();
							
					var elozo_tart_cont = jQuery('#referenciak_adatlap_atfogo');
					

					jQuery('.referenciak_talalat_box_bg').css("height", elozoh);


					elozo_tart_cont.fadeOut(400, function() {

						elozo_tart_cont.html(responseText);

						elozo_tart_cont.show();
						

						if(jQuery("#mycarousel_ref").length > 0) {
							jQuery("#mycarousel_ref").jcarousel({
								scroll: 1,
								visible: 6
							});
						}
						

						var kovih = elozo_tart_cont.height();


						jQuery('.referenciak_talalat_box_szures_shadow').hide();
						jQuery('.referenciak_talalat_box_szures_container').hide();
						jQuery('.referenciak_talalat_box_tartalom_shadow').hide();
						jQuery('.referenciak_talalat_box_tartalom_container').hide();
	
						
						if(kovih != elozoh) {
							jQuery(".termekek_talalat_box_bg").animate({ "height": kovih }, 800, function() {

								jQuery('.referenciak_talalat_box_szures_shadow').fadeIn(400, function() {
									jQuery('.referenciak_talalat_box_szures_container').toggle(400, function() {
										jQuery('.referenciak_talalat_box_tartalom_shadow').fadeIn(400, function() {
											jQuery('.referenciak_talalat_box_tartalom_container').toggle(400, function() {

												referenciak_leptet_ajax_refresh();
											});
										});
									});
								});
							});
						}

						else {
							jQuery('.referenciak_talalat_box_szures_shadow').fadeIn(400, function() {
								jQuery('.referenciak_talalat_box_szures_container').toggle(400, function() {
									jQuery('.referenciak_talalat_box_tartalom_shadow').fadeIn(400, function() {
										jQuery('.referenciak_talalat_box_tartalom_container').toggle(400, function() {

											referenciak_leptet_ajax_refresh();
										});
									});
								});
							});
						}
					});
				}

				else {
					alert('Szerver Hiba 0075!');
				}
			}
		);
}

function bemutatkozas_ref_show_kategoria_bg(kid, click) {

	var obj = jQuery(".bemutatkozas_ref_kategoria_bg_n[data-kid='"+ kid +"']");
	var akt_obj = jQuery(".bemutatkozas_ref_kategoria_bg_n[data-kid='"+ akt_kid +"']");

	var offset = obj.offset();

	if(click) {
		tmp_id = akt_kid;

		akt_obj.children('.bemutatkozas_ref_kategoria_bg_h').fadeOut(200);
		akt_obj.css({
		'color' : '#8f676a'
		});

		akt_kid = kid;
	}

	else {
		jQuery('.bemutatkozas_ref_kategoria_bg_h').hide();
	}

	akt_obj.children('.bemutatkozas_ref_kategoria_bg_h').show();

	obj.children('.bemutatkozas_ref_kategoria_bg_h').show();


	if(click) {
		jQuery.ajaxSetup ({  
			cache: false  
		});
	
		jQuery('#ajax_tmp')
			.load('ajax_change_bemutatkozas_ref_carousel.php?kid=' + kid,
				function(responseText, textStatus, req) { 
					if (textStatus != "error") {

						jQuery('#ajax_tmp').html("");

					
						var elozoh = jQuery('.bemutatkozas_ref_talalat_box_bg').height();
						var elozo_tart_cont = jQuery('#bemutatkozas_ref_carousel_cont');
								
						
						jQuery('.bemutatkozas_ref_talalat_box_bg').css("height", elozoh);


						jQuery('.bemutatkozas_ref_tartalom_lepteto_num').fadeOut(400);

						elozo_tart_cont.fadeOut(400, function() {

							jQuery('#bemutatkozas_ref_carousel_cont').html(responseText);

							jQuery('.bemutatkozas_ref_tartalom_lepteto_num #osszsor').html(osszsor);
							jQuery('.bemutatkozas_ref_tartalom_lepteto_num #aktoldal').html("1");
							

							jQuery('.bemutatkozas_ref_tartalom_lepteto_num').fadeIn(400);
							elozo_tart_cont.fadeIn(400);

							jQuery("#mycarousel").jcarousel({
								scroll: 1,
								visible: 1,
								itemLoadCallback: mycarousel_initCallback
							});

							termekek_leptet_ajax_refresh();
						});
							
					}

					else {
						alert('Szerver Hiba 0075!');
					}
				}
			);
		
	}	
}

function validat_kapcsolatfelvetel() {
	ok = true;
	message = "Hiba! \n";
	setfocus = "";

	var nev = document.forms.kapcsolatfelvetel.nev;

	if (nev.value == "")  {
		message += "- A név mező kitöltése kötelező. \n";
		if (setfocus == "")  {setfocus = nev}
		ok = false;
	}


	var email = document.forms.kapcsolatfelvetel.email;

	if (email.value == "")  {
		message += "- Az E-Mail cím mező kitöltése kötelező. \n";
		if (setfocus == "")  {setfocus = email}
		ok = false;
	} else {
		var reg = /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/;
		var address = email.value;

		if(reg.test(address) == false) {
			message += "- Az E-Mail cím nem megfelelő. \n";
			if (setfocus == "")  {setfocus = email}
			ok = false;
		} 
	}


	var captcha = document.forms.kapcsolatfelvetel.ell_kod;

	if (captcha.value == "")  {
		message += "- A captcha mező kitöltése kötelező. \n";
		if (setfocus == "")  {setfocus = captcha}
		ok = false;
	}

	else {
		if(captcha.value.length != 5) {
			message += "- Az ellenőrző kód 5 karakterből áll. \n";
			if (setfocus == "")  {setfocus = captcha}
			ok = false;
		}
	}

	
	var uzenet = document.forms.kapcsolatfelvetel.uzenet;

	if (uzenet.value == "")  {
		message += "- Az üzenet mező kitöltése kötelező. \n";
		if (setfocus == "")  {setfocus = uzenet}
		ok = false;
	}


	if (ok == false)  {
		errordisp(message, setfocus);
	}	else { 
		return 1;
	}
}

function kapcsolatfelvetel() {

	if(validat_kapcsolatfelvetel()) {

		jQuery("#kapcsolatfelvetel_form").ajaxSubmit({

			success: function(responseText, statusText, xhr, $form) {
				if(statusText == "success") {

					if (responseText == 0) {

						alert('Az adatait sikeresen elküldtük, kollégáink hamarosan jelentkezni fognak!');

						jQuery('#kapcsolatfelvetel_form').clearForm();

						hideit('kapcsolatfelvetel_popup');
					}

					if (responseText == 1) {
						alert('Hiba történt a rögzítés során!');
					}

					if (responseText == 2) {
						alert('Kérem töltse ki a kötelező mezőket!');
					}

					if (responseText == 3) {
						alert('A megadott E-Mail cím nem megfelelő!');
					}

					if (responseText == 4) {
						alert('A megadott ellenőrző kód hibás!');
					}
				}

				else {
					alert("szerver hiba!");
				}
			}
		});

		//return false; 
	}
}


function validat_vendegkonyv() {
	ok = true;
	message = "Hiba! \n";
	setfocus = "";

	var nev = document.forms.vendegkonyv.nev;

	if (nev.value == "")  {
		message += "- A név mező kitöltése kötelező. \n";
		if (setfocus == "")  {setfocus = nev}
		ok = false;
	}


	var email = document.forms.vendegkonyv.email;

	if (email.value != "")  {
		var reg = /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/;
		var address = email.value;

		if(reg.test(address) == false) {
			message += "- Az E-Mail cím nem megfelelő. \n";
			if (setfocus == "")  {setfocus = email}
			ok = false;
		} 
	}


	var captcha = document.forms.vendegkonyv.ell_kod;

	if (captcha.value == "")  {
		message += "- A captcha mező kitöltése kötelező. \n";
		if (setfocus == "")  {setfocus = captcha}
		ok = false;
	}

	else {
		if(captcha.value.length != 5) {
			message += "- Az ellenőrző kód 5 karakterből áll. \n";
			if (setfocus == "")  {setfocus = captcha}
			ok = false;
		}
	}

	
	var bejegyzes = document.forms.vendegkonyv.bejegyzes;

	if (bejegyzes.value == "")  {
		message += "- Az bejegyzés mező kitöltése kötelező. \n";
		if (setfocus == "")  {setfocus = bejegyzes}
		ok = false;
	}


	if (ok == false)  {
		errordisp(message, setfocus);
	}	else { 
		return 1;
	}
}

function vendegkonyv() {

	if(validat_vendegkonyv()) {

		jQuery("#vendegkonyv_form").ajaxSubmit({

			success: function(responseText, statusText, xhr, $form) {
				if(statusText == "success") {

					if (responseText == 0) {

						alert('Bejegyzését sikeresen rögzítettük!');

						jQuery('#vendegkonyv_form').clearForm();
					}

					if (responseText == 1) {
						alert('Hiba történt a rögzítés során!');
					}

					if (responseText == 2) {
						alert('Kérem töltse ki a kötelező mezőket!');
					}

					if (responseText == 3) {
						alert('A megadott E-Mail cím nem megfelelő!');
					}

					if (responseText == 4) {
						alert('A megadott ellenőrző kód hibás!');
					}
				}

				else {
					alert("szerver hiba!");
				}
			}
		});

		//return false; 
	}
}


function getCenterPosition(width, height) {
	var properties = [];

	var windowWidth = jQuery(window).width();
	var windowHeight = jQuery(window).height();

	var posX = jQuery(window).scrollLeft();
	var posY = jQuery(window).scrollTop();

	var left = parseInt(windowWidth/2) - parseInt(width/2) + posX;
	var top = parseInt(windowHeight/2) - parseInt(height/2) + posY;

	properties["left"] = left;
	properties["top"] = top;

	return properties;
}

function showit(id) {

	var width = jQuery("#" + id).width();
	var height = jQuery("#" + id).height();
	
	var center_pos = getCenterPosition(width, height);
	var pageHeight = jQuery(document).height();

	jQuery("#" + id).css("left", center_pos["left"]);
	jQuery("#" + id).css("top", center_pos["top"]);

	jQuery("#fade").height(pageHeight);

	if (jQuery.browser.msie) {		
		jQuery("#fade").show();

		jQuery("#" + id).show();
	}

	else {
		jQuery("#fade").fadeIn(300);

		jQuery("#" + id).fadeIn(300);
	}
}

function hideit(id) {
	if (jQuery.browser.msie) {		
		jQuery("#fade").hide();

		jQuery("#" + id).hide();
	}

	else {
		jQuery("#fade").fadeOut(300);

		jQuery("#" + id).fadeOut(300);
	}
}

function refresh_captcha(mellik) {
	jQuery("#" + mellik + "_form #captcha_img").attr("src", "classes/captcha/class_captcha.php?width=115&height=27&characters=5&rand=" + Math.random()+"&mellik="+mellik);
}

function vendegkonyv_lapoz(merre) {

	aktpage = jQuery("#vendegkonyv_page_tmp").attr("value");

	jQuery.ajaxSetup ({  
		cache: false  
	});

	jQuery('#ajax_tmp')
		.load('ajax_vendegkonyv_lapoz.php?merre=' + merre + '&lapszam=' + aktpage,
			function(responseText, textStatus, req) { 
				if (textStatus != "error") {

					var elozoh = jQuery('#idezet_container').height();
					var kovih = jQuery('#ajax_tmp').height();

					jQuery('#ajax_tmp').html("");
							
					var elozo_tart_cont = jQuery('#idezet_container');
					

					jQuery('.idezet_atfogo').css("height", elozoh);


					elozo_tart_cont.fadeOut(400, function() {

						elozo_tart_cont.html(responseText);

						if(kovih != elozoh) {
							jQuery('.idezet_atfogo').animate({ "height": kovih }, 800, function() {

								elozo_tart_cont.fadeIn(400);
							});
						}

						else {
							elozo_tart_cont.fadeIn(400);
						}
					});
						
				}

				else {
					alert('Szerver Hiba 0075!');
				}
			}
		);
}

var timer_is_on_vendegkonyv = 0;
var timer_vendegkonyv = "";

function start_timer_vendegkonyv() {
	if (!timer_is_on_vendegkonyv) {
		timer_vendegkonyv = setInterval(function(){vendegkonyv_lapoz("f");}, 8000);
		timer_is_on_vendegkonyv = 1;
	}
}

function pause_timer_vendegkonyv() {
	if (timer_vendegkonyv) clearInterval(timer_vendegkonyv);

	timer_is_on_vendegkonyv = 0;
}

function jump_letoltes_focsop(focsop_id) {
	var offset = jQuery("#letoltes_focsop_cim" + focsop_id).offset();

	jQuery(window.opera?'html':'html, body').animate({ scrollTop: offset.top-15 }, "slow");
}

jQuery(window).load(function() {

	createImgHovers("");

	jQuery("a[rel^='lightbox']").colorbox();


	jQuery('.promo_bg').mouseenter(function() {
		pause_timer();
	});

	jQuery('.promo_bg').mouseleave(function() {
		start_timer();
	});


	jQuery('.hir_lista_kep').children(".border").mouseenter(function() {

		show_nagyito_in_center(jQuery(this).children("a").children(".nagyito"));
	});

	jQuery('.hir_lista_kep').children(".border").mouseleave(function() {

		hide_nagyito(jQuery(this).children("a").children(".nagyito"));
	});


	jQuery('.hir_kepek').children(".border").mouseenter(function() {

		show_nagyito_in_center(jQuery(this).children("a").children(".nagyito"));
	});

	jQuery('.hir_kepek').children(".border").mouseleave(function() {

		hide_nagyito(jQuery(this).children("a").children(".nagyito"));
	});

	jQuery('.publikaciok_kategoria_bg_n').mouseenter(function() {

		jQuery(this).children(".publikaciok_kategoria_bg_h").show();
		jQuery(this).css("color", "#7d333a");
	});

	jQuery('.publikaciok_kategoria_bg_n').mouseleave(function() {
		fid = jQuery(this).attr("data-fid");

		if(fid != akt_fid) {
			jQuery(this).children(".publikaciok_kategoria_bg_h").hide();
			jQuery(this).css("color", "#8f676a");
		}
	});

	jQuery('.publikaciok_kategoria_bg_n').click(function() {
		var fid = jQuery(this).attr("data-fid");

		var osszsor = jQuery(this).attr("data-osszsor");

		if(fid != akt_fid) {
			jQuery('.publikaciok_kategoria_bg_n[data-fid="'+akt_fid+'"]').children(".publikaciok_kategoria_bg_h").fadeOut(200);
			jQuery(".publikaciok_kategoria_bg_n").css("color", "#8f676a");

			jQuery(this).children(".publikaciok_kategoria_bg_h").show();
			jQuery(this).css("color", "#7d333a");

			jQuery(".publikaciok_tartalom_lepteto_num").fadeOut(200);
			jQuery("#publikaciok_tartalom_box" + akt_fid).fadeOut(200, function() {

				jQuery("#osszsor").html(osszsor);

				jQuery("#publikaciok_tartalom_box" + fid).fadeIn(200);
				jQuery(".publikaciok_tartalom_lepteto_num").fadeIn(200);

				jQuery("#mycarousel" + fid).jcarousel({
					scroll: 1,
					visible: 1,
					itemLoadCallback: mycarousel_initCallback
				});

				mycarousel_scroll_start("#mycarousel" + fid);
			});
		}

		akt_fid = fid;
	});


	akt_kid = 1;

	jQuery('.partnereink_kategoria_bg_n').mouseenter(function() {
		var kid = jQuery(this).attr("data-kid");

		partnerek_show_kategoria_bg(kid, false);
	});

	jQuery('.partnereink_kategoria_bg_h').mouseleave(function() {
		jQuery('.partnereink_kategoria_bg_h').hide();
		jQuery('#partnereink_kategoria_bg_h' + akt_kid).show();
	});

	jQuery('.partnereink_kategoria_bg_h').click(function() {
		var kid = jQuery(this).attr("id");
		
		kid = kid.charAt(kid.length-1);

		if(kid != akt_kid) {
			partnerek_show_kategoria_bg(kid, true);
		}
	});

	jQuery('.publikaciok_tartalom_box_kep').mouseenter(function() {

		jQuery(this).children("div").css("border-color", "#cc0d24");
	});

	jQuery('.publikaciok_tartalom_box_kep').mouseleave(function() {

		jQuery(this).children("div").css("border-color", "#e2c0a7");
	});


	jQuery('.termekek_kategoria_bg_n').mouseenter(function() {
		var kid = jQuery(this).attr("data-kid");

		termekek_show_kategoria_bg(kid, false);

		if(kid != akt_kid) {
			jQuery(this).css({
			'color' : '#7d333a'
			});
		}
	});

	jQuery('.termekek_kategoria_bg_n').mouseleave(function() {
		var akt_obj = jQuery(".termekek_kategoria_bg_n[data-kid='"+ akt_kid +"']");
		var kid = jQuery(this).attr("data-kid");

		jQuery('.termekek_kategoria_bg_h').hide();
		akt_obj.children('.termekek_kategoria_bg_h').show();

		if(kid != akt_kid) {
			jQuery(this).css({
			'color' : '#8f676a'
			});
		}
	});

	jQuery('.termekek_kategoria_bg_n').click(function() {

		var kid = jQuery(this).attr("data-kid");

		if(curr_page == "termekek") {
		
			if(kid != akt_kid) {
				termekek_show_kategoria_bg(kid, true);

				jQuery(this).css({
				'color' : '#7d333a'
				});
			}
		}
	});

	jQuery('.bemutatkozas_ref_kategoria_bg_n').mouseenter(function() {
		var kid = jQuery(this).attr("data-kid");

		bemutatkozas_ref_show_kategoria_bg(kid, false);

		if(kid != akt_kid) {
			jQuery(this).css({
			'color' : '#7d333a'
			});
		}
	});

	jQuery('.bemutatkozas_ref_kategoria_bg_n').mouseleave(function() {
		var akt_obj = jQuery(".bemutatkozas_ref_kategoria_bg_n[data-kid='"+ akt_kid +"']");
		var kid = jQuery(this).attr("data-kid");

		jQuery('.bemutatkozas_ref_kategoria_bg_h').hide();
		akt_obj.children('.bemutatkozas_ref_kategoria_bg_h').show();

		if(kid != akt_kid) {
			jQuery(this).css({
			'color' : '#8f676a'
			});
		}
	});

	jQuery('.bemutatkozas_ref_kategoria_bg_n').click(function() {

		var kid = jQuery(this).attr("data-kid");

		if(kid != akt_kid) {
			bemutatkozas_ref_show_kategoria_bg(kid, true);

			jQuery(this).css({
			'color' : '#7d333a'
			});
		}
		
	});

	jQuery('.termekek_alakzat_szures_cont img').click(function() {
		
		var id = jQuery(this).attr("data-id");
		var kep_n = jQuery(this).attr("data-n");
		var kep_h = jQuery(this).attr("data-h");
		var src = jQuery(this).attr("src");

		if(src.indexOf("_h.jpg") == -1) {
			jQuery(this).attr("src", "upload/" + kep_h);

			jQuery("[name='alakzat" + id + "']").attr("value", "1");
		}

		else {
			jQuery(this).attr("src", "upload/" + kep_n);

			jQuery("[name='alakzat" + id + "']").attr("value", "0");
		}
	});

	jQuery('.szures_button').click(function() { 

		jQuery("#szures_loading" + akt_kid).fadeIn(400);

		jQuery("#termekek_szures_form" + akt_kid).ajaxSubmit({

			success: function(responseText, statusText, xhr, $form) {
				if(statusText == "success") {

					jQuery(".termekek_talalat_box_bg").css("height", "auto");

					jQuery("#termekek_talalat_box" + akt_kid + " .termekek_hely").html(responseText);

					jQuery("#termekek_talalat_box" + akt_kid + " #talalatok_szama").html(osszsor);

					if(jQuery("#mycarousel" + akt_kid).length > 0){

						jQuery("#mycarousel" + akt_kid).jcarousel({
							scroll: 1,
							visible: 1
						});
					}

					termekek_leptet_ajax_refresh();

					jQuery("#szures_loading" + akt_kid).fadeOut(400);
				}

				else {
					alert("szerver hiba!");
				}
			}
		});

		return false;
		
	});

	jQuery('.idezet_atfogo').mouseenter(function() {
		pause_timer_vendegkonyv();
	});

	jQuery('.idezet_atfogo').mouseleave(function() {
		start_timer_vendegkonyv();
	});


	termekek_leptet_ajax_refresh();

	start_timer(); // promo box auto rotate
});

jQuery.noConflict(); // anti prototype
