(function($) {
	// Sets the height of child div using the height of parent
	$.fn.setChildHeightFromParent = function () {
		var h = $(this).parent().height();
		return this.each(function() {
			if ($(this).find("div").height() < h) {
				$(this).find("div").height(h);
			}
		});
	};

	// Find the max height, sets it to all elements
	$.fn.equalHeight = function () {
		var maxheight = 0;
		this.each(function() {
			if ($(this).height() > maxheight) {
				maxheight = $(this).height();
			}
		});
		return this.each(function() {
			$(this).height(maxheight);
		});
	};
})(jQuery);


$(function() {

	// nyitón dobozmagasságok beállítása
//	$("> div.narrow_column", "div.narrow_column_holder").setChildHeightFromParent();
	// termék elosztón services doboz beállítása
	$(".product_column div.services_box", "div#mainwidecontent").equalHeight();


	// E-mail küldés, modal layer
	if( $(".kuldjetovabb").length ){
		$(".kuldjetovabb").click(function(e) {

			e.preventDefault();

			$.fn.colorbox( {
				transition : "none",
				speed : 400,
				initialWidth : "520",
				width : "540",
				resize : true,
				preloading: true,
				scrolling: false,
				open: false,
				href : $(this).attr("href"),
				iframe: false,
				escKey: true
			});

		});
	}

	// telco benefit oldali dobozok
	jQuery(".telco_benefit #mainwidecontent, .telco_benefit #relatedcontent").equalHeight();
	jQuery(".telco_benefit .brand_container").height(jQuery(".telco_benefit #mainwidecontent").height() - 15);

});

$(window).load(
	function() {

		// nyitón dobozmagasságok beállítása
		$("> div.narrow_column", "div.narrow_column_holder").setChildHeightFromParent();
	}
);

jQuery(document).ready(function(){
	jQuery('.virtual_walk_box a').fancybox({
		'overlayColor': '#000',
		'overlayOpacity': '0.8',
		'showNavArrows': false,
		'width': 1067,
		'height': 600
	});
});


