﻿ $(document).ready(function(){ 
        $("ul.sf-menu").supersubs({ 
            minWidth:    12,   // minimum width of sub-menus in em units 
            maxWidth:    27,   // maximum width of sub-menus in em units 
            extraWidth:  1     // extra width can ensure lines don't sometimes turn over 
                               // due to slight rounding differences and font-family 
        }).superfish();  // call supersubs first, then superfish, so that subs are 
                         // not display:none when measuring. Call before initialising 
                         // containing tabs for same reason. 

		if ($('#flip-navigation li a').size()>0){
			$('#flip-container').quickFlip();
			
			$('#flip-navigation li a').each(function(){
				$(this).click(function(){
					$('#flip-navigation li').each(function(){
						$(this).removeClass('selected');
					});
					$(this).parent().addClass('selected');
					var flipid=$(this).attr('id').substr(4);
					$('#flip-container').quickFlipper({ }, flipid, 1);
					
					return false;
				});
			});
		}
		
      $("#PartnerLinkek").mbScrollable({
        width:670,
        elementsInPage:3,
        elementMargin:2,
        height:"auto",
        slideTimer:600,
        autoscroll:true,
        scrollTimer:4000
      });


	/* ---------- Galéria egyenlő magasságú előnézeti képek ---------- */
		function CsoportElemekEqualHeight(group) {
			var tallest = 0;
			group.each(function() {
				var thisHeight = $(this).height();
				if(thisHeight > tallest) {
					tallest = thisHeight;
				}
			});
			group.height(tallest);
		}

	/* ---------- Galéria egyenlő magasságú előnézeti képek vége ---------- */

	/* ---------- Galéria megjelenés ---------- */
	/*hs.graphicsDir = '../highslide/graphics/';*/
	hs.graphicsDir = 'bdt_layout/Ventoza/bdt_img/highslide/';
	hs.align = 'center';
	hs.transitions = ['expand', 'crossfade'];
	hs.fadeInOut = true;
	hs.dimmingOpacity = 0.9;
	hs.outlineType = 'rounded-white';
	hs.captionEval = 'this.thumb.alt';
	/*hs.marginBottom = 105; // make room for the thumbstrip and the controls*/
	hs.marginBottom = 110; // make room for the thumbstrip and the controls
	hs.numberPosition = 'caption';

	// Add the slideshow providing the controlbar and the thumbstrip
	hs.addSlideshow({
		//slideshowGroup: 'group1',
		interval: 4000,
		repeat: true,
		useControls: true,
		overlayOptions: {
			className: 'text-controls',
			position: 'bottom center',
			relativeTo: 'viewport',
			offsetY: -60
		},
		thumbstrip: {
			position: 'bottom center',
			mode: 'horizontal',
			relativeTo: 'viewport'
		}
	});
	/* ---------- Galéria megjelenés vége ---------- */

	/* Galeria Accordion */
	function InitGaleriaAccordion() {

			$('ul.CsoportLista > li:not(.CsoportListaGaleriai)').each(function(){
				var CsoportListaElem = $(this).next();
				if($(this).hasClass('Aktiv')){

				}else{
					if( (CsoportListaElem.is('li')) && (CsoportListaElem.hasClass('CsoportListaGaleriai')) ){
						$(CsoportListaElem).hide();
					}
				}
			});

		/*$('ul.CsoportLista > li.Aktiv:').show();*/
		/*$('ul.CsoportLista > li.AccordionFunkcLiBox > a.AccordionFunkc').append("<strong>Hello</strong>");*/


			$('ul.CsoportLista > li.AccordionFunkcLiBox > a.AccordionFunkc').click(
				function() {

					var checkElement = $(this).parent().next();

					if((checkElement.is('li')) && (checkElement.hasClass('CsoportListaGaleriai')) && (checkElement.is(':visible')) ) {
						$('ul.CsoportLista > li.AccordionFunkcLiBox > a.AccordionFunkc').removeClass('AccordionFunkcClose');
						$('ul.CsoportLista > li.AccordionFunkcLiBox > a.AccordionFunkc').addClass('AccordionFunkcOpen');

						$('ul.CsoportLista > li.CsoportListaGaleriai:visible').slideUp('slow');
						$(this).removeClass('AccordionFunkcClose');
						$(this).addClass('AccordionFunkcOpen');
						//return false;
					}

					if((checkElement.is('li')) && (checkElement.hasClass('CsoportListaGaleriai')) && (!checkElement.is(':visible')) ) {
						/*$('#menu ul:visible').slideUp('slow');*/
						$('ul.CsoportLista > li.AccordionFunkcLiBox > a.AccordionFunkc').removeClass('AccordionFunkcClose');
						$('ul.CsoportLista > li.AccordionFunkcLiBox > a.AccordionFunkc').addClass('AccordionFunkcOpen');

						$('ul.CsoportLista > li.CsoportListaGaleriai:visible').slideUp('slow');
						checkElement.slideDown('slow');
						/*$('html, body').animate({scrollTop:0}, 'slow')*/
						var ThisOffset = checkElement.offset();
						/*$('html, body').scrollTop(ThisOffset.top-50);*/
						/*alert(ThisOffset.top);
						alert($(this).parent().outerHeight(true));*/
						$('html, body').animate({scrollTop:ThisOffset.top-($(this).parent().outerHeight(true)*3)}, 'slow')
						/*checkElement.addClass('Nyitva');*/
						$(this).removeClass('AccordionFunkcOpen');
						$(this).addClass('AccordionFunkcClose');
						//return false;
					}

			});
			/*
			$('ul.CsoportLista > li.AccordionFunkcLiBox > a.AccordionFunkcClose').click(
				function() {

					var checkElement = $(this).parent().next();

					if((checkElement.is('li')) && (checkElement.hasClass('CsoportListaGaleriai')) && (checkElement.is(':visible')) ) {
						$('ul.CsoportLista > li.CsoportListaGaleriai:visible').slideUp('slow');
						//return false;
					}


			});
			*/
	}
	InitGaleriaAccordion();
	/* Galeria Accordion vége */


}); 
