function bigslider(carousel) {
    //$('#big-slider-nav a:first').addClass('active');
    $('#big-slider-nav a').bind('click', function() {    	
        carousel.scroll($.jcarousel.intval($(this).text()));
        return false;
    });
};

function setActive(carousel,oLi,index,state){
    if (index>countBigSlider || index < 1){
    	index = index - Math.floor(index/countBigSlider)*countBigSlider;
    }
	$('#big-slider-nav a').removeClass('active');
    $('#big-slider-nav a').eq(index-1).addClass('active');
}

$(function(){
	
    // Окошки фреймы
    $("a.frameRegistration").fancybox({     
        'autoScale'         : false,
        'transitionIn'      : 'none',
        'transitionOut'     : 'none',
        'type'              : 'iframe',
        'overlayColor'      : '#000000',
        'overlayOpacity'    : '0.7',
        'width'				: 502,
        'height'			: 320
    });
    
    // Окошки: Вход
    $("a.frameEnter").fancybox({     
        'autoScale'         : false,
        'transitionIn'      : 'none',
        'transitionOut'     : 'none',
        'type'              : 'iframe',
        'overlayColor'      : '#000000',
        'overlayOpacity'    : '0.7',
        'width'				: 502,
        'height'			: 202
    });       
    
    // Основной слайдер
	countBigSlider = $('#bigslider li').length;	
    $('#bigslider').jcarousel({
        scroll: 1,
        auto: 10,
        wrap:'circular', 
        initCallback: bigslider,
        itemFirstInCallback: {        
            onBeforeAnimation: setActive
        },
        buttonNextHTML:'<div id="big-slider-next"></div>', 
        buttonPrevHTML:'<div id="big-slider-prev"></div>',        
    });
    
    // Скроллинг новостей
    $('.scroll-pane').jScrollPane({showArrows:true});
       
    // Слайдер звезд
    $('#starslider').jcarousel({
        scroll: 1,        
        wrap:'circular', 
        buttonNextHTML:'<div id="starslider-next"></div>', 
        buttonPrevHTML:'<div id="starslider-prev"></div>', 
    });
    
    // Подсветка поиска
    $('#ajaxSearch_input').focus(function(){    	
    	$(this).css('color','#fff');
    });
    
    
    // Баг youtube
    $("iframe").each(function(){
        var ifr_source = $(this).attr('src');
        var wmode = "?wmode=transparent";
        $(this).attr('src',ifr_source+wmode);
    });
    
});
