jQuery(document).ready(function(){

    /***************** KATEGÓRIÁK ***************************/
    jQuery('.kategoriak .level1').hover(
        function(){
       
            jQuery('.kategoriak  ul ul ').stop(true,true).slideDown();
            jQuery('.categoryHead').addClass('open');
        },
        function(){
            jQuery('.kategoriak  ul ul').stop(true,true).hide();
            jQuery('.categoryHead').removeClass('open');
        }
        )

  /******************* SLIDEREK  *******************************/ 
  /*jQuery('#topScroll').jcarousel({
        scroll :1,
        wrap:'circular',
        initCallback: topcarousel_initCallback,
        // This tells jCarousel NOT to autobuild prev/next buttons
        buttonNextHTML: null,
        buttonPrevHTML: null

    });*/
    $("#scroller").scrollable({
        circular: true
        }).navigator();    
        
    $(".popularScroll").scrollable({
        circular: true, 
        next: ".p_next",
        prev: ".p_prev"
        }).autoscroll(7000).mousewheel(); 
        
    $(".brandScroller").scrollable({
        circular: true, 
        next: ".b_next",
        prev: ".b_prev"
        }).autoscroll(5000).mousewheel();  
        
     $(".noveltyScroller").scrollable({
        circular: true, 
        next: ".n_next",
        prev: ".n_prev"
        }).mousewheel();       /*.autoscroll(3500)*/  
        
        


    
    /***************** CART  ********************************************/
    /*
    jQuery('.cartBlock li').hover(
    function(){
        jQuery(this).find('.control').show();
    },
    function(){
        jQuery(this).find('.control').hide();
    }
    )*/
    //.cartBlock .control
    /*
    jQuery('.cartBlock .controlButton').hover(
        function(){
            thisPos=jQuery(this).position();
            controlPos=jQuery(this).parent().position();
            liPos=jQuery(this).parent().parent().position();
            
            
            toolTipLeft= liPos.left + controlPos.left + thisPos.left;
            toolTipTop= liPos.top + controlPos.top + thisPos.top;            
            // jQuery('.cartBlock .tooltip').css({left:toolTipLeft, top:toolTipTop});
            jQuery('.cartBlock h2').html(liPos.left +'-' +  controlPos.left +'-' + thisPos.left)
            
        }
    ); */
   
   /******************************** KOSÁR TÖRLÉS *********************************************/
   
     
    jQuery('.cartCheckout ul li').hover(
        function(){
       jQuery(this).find('.delete').stop(true,true).fadeIn();
        },
        function(){
            jQuery('.cartBody  .delete').stop(true,true).hide();

        }
        )
    /************************* SHIPPING FORM  *****************************************/
    jQuery('#shipping_shipping_method_id').change(function(){
        if(jQuery(this).val()==2){
           jQuery('.shippingAddress .hideForm').fadeIn()
        }
        else {
            jQuery('.shippingAddress .hideForm').fadeOut()            
        }
    })
    shippingMethod = jQuery('#shipping_shipping_method_id').val();
    if (shippingMethod == 2 ){
        jQuery('.shippingAddress .hideForm').fadeIn()
    }
     else {
            jQuery('.shippingAddress .hideForm').fadeOut()            
        }

 
   /*************************FANCYBOX  *****************************************/
   jQuery('.fancybox').fancybox();
   
    /*************************  POPUP  *****************************************/  
    jQuery('#popup_wrapper').width('500px'); 
    winHeight = jQuery(document).height();
    wrapperHeight=jQuery('#popup_wrapper').height();
    wrapperWidth=jQuery('#popup_wrapper').width();      
    jQuery('#popUp_overLay').height(winHeight);        
   
    jQuery('#loginButton').click(function(){
        jQuery('#popUp_overLay').fadeIn();
        jQuery('#popup_wrapper').fadeIn().width( wrapperWidth).html(jQuery('#loginForm')).css({
            'left':'50%',
            'margin-left':-1*wrapperWidth/2,
            'top':'150px'
        });
        jQuery('#loginForm').show();
        
            jQuery('#popUp_overLay, #loginForm .closer').click(function(){
               jQuery('#popUp_overLay').fadeOut();
               jQuery('#popup_wrapper').fadeOut();
            });
    });
   
 
       jQuery('.markak .opener').click(function(){
        thisIntro = jQuery(this).parent().find('.intro');
        
        if (thisIntro.is(':hidden')) {
            jQuery('.markak .intro').slideUp();
            thisIntro.slideDown();
        }
    });



/*****************************************************************************************************/
});
    function topcarousel_initCallback(carousel) {
    jQuery('.jcarousel-control a').bind('click', function() {
        jQuery('.jcarousel-control a').removeClass("active");
        carousel.scroll(jQuery.jcarousel.intval(jQuery(this).attr('rel')));
        jQuery(this).addClass('active');

        return false;
    });

/* var blackShadow = {
  x:      1, 
  y:      2, 
  radius: 3,
  color:  "#999"
}

jQuery("#topScroll h2").textShadow( blackShadow );
jQuery("#topScroll .subTitle").textShadow( blackShadow ); */



    
};

