      if($('#placeholder').length>0){
      var pause=1;
      }else{
      var pause=0;
      }
      function addMega(){
          if(pause==1){
	         $('#placeholder').crossSlidePause();
          } 
        $(this).find('.active').css("opacity",1);
        $(this).find(".mainanchor").css("background-color","#51283f");
        $(this).addClass("hovering");
          if(pause==1){
	         $('#placeholder').crossSlideResume();
          } 
        }
 
      function removeMega(){
        if(pause==1){
	         $('#placeholder').crossSlidePause();
          } 
        $(this).find(".mainanchor").css("background-color","transparent");
        $(this).find(".active").css("background-color","#000");
        $(this).find(".activeWhite").css("background-color","#fff");
        $(this).find('.active').css("opacity",0.7);
        $(this).removeClass("hovering");
        if(pause==1){
	         $('#placeholder').crossSlideResume();
          } 
        }
        
      var megaConfig = {
         interval: 0,
         sensitivity: 300,
         over: addMega,
         timeout: 0,
         out: removeMega
        };
 
      var kezd=0;
      
      function clickelj() {
        var mb=$('#fancybox-right');
        if(mb.data('delay')){ clearTimeout(mb.data('delay')); }
        mb.data('delay', setTimeout(function() { $('#fancybox-right').click(); }, 5000));
      }
    
    DD_roundies.addRule('.mainanchor', '8px 8px 1px 1px', true);    
$(document).ready(function() {
    
    $('.menuBar li.main .active').css("opacity",0.7);
    $('.border').pngFix();
    $(".menuBar li.main").hoverIntent(megaConfig);
    
    
    
    
    
    
    
    $('.promo').css("opacity",0.7);
    if($("a.grouped_elements").length>0){
    $("a.grouped_elements").hide();
    $("#galImage0").show();
    
      $("a.grouped_elements").fancybox({
        onStart : function() {
          
          
        },
        onCancel : function() {
          
        },
        onComplete : function(currentArray, currentIndex, currentOpts) {
          clickelj();
          $("a.grouped_elements").hide();
          $("#" + currentArray[currentIndex].id).show();
        },
        onCleanup : function() {  
        },
        onClosed : function(currentArray, currentIndex, currentOpts) {
          
          $("a.grouped_elements").css("z-index","2");
          
          $("#" + currentArray[currentIndex].id).css("z-index","200");
          $(".galNum").html((currentIndex+1));
          
        },
        'padding' : '0',
		    'transitionIn'	:	'elastic',
		    'transitionOut'	:	'elastic',
		    'speedIn'		:	400,
		    'speedOut'		:	400,
		    'overlayShow'	:	true,
        'autoScale' :   true,
        'opacity'   :   false,
        'cyclic'    :   true,
        'centerOnScroll'    :   true,
        'overlayOpacity'    :   0.9,
        'overlayColor'  :   '#000',
        'titlePosition' 		: 'outside'
      });
	   
      $('#galImage0').click();       
    }

    $("a.grouped_elements2").fancybox(
    {
		  'transitionIn'	:	'elastic',
		  'transitionOut'	:	'elastic',
		  'speedIn'		:	400,
		  'speedOut'		:	400,
		  'overlayShow'	:	true,
		  'autoScale' :   true,
		  'opacity'   :   false,
		  'cyclic'    :   true,
		  'centerOnScroll'    :   true,
		  'overlayOpacity'    :   0.9,
		  'overlayColor'  :   '#000',
		  'titlePosition' 		: 'inside'
    });

    
    



    $('#print').click(function() {
       window.print();
    });

    

	});

