$(function() {
	$('#slider').slider({
		width:      600,
		height:     235,
		randomize:  true
	});
});

function mCustomScrollbars(){
	$("#mcs_container").mCustomScrollbar("vertical",400,"easeOutCirc",1.05,"auto","yes","yes",10); 
}

/* function to load new content dynamically */
function LoadNewContent(id,file){
	$("#"+id+" .customScrollBox .content").load(file,function(){
		mCustomScrollbars();
	});
}

//accardionnnnnnn
$(function() {
	
		activeItem1 = $("#accordionEditor li:first");
		$(activeItem1).addClass('active');
	
		$("#accordionEditor li").click(function(){
			$(activeItem1).animate({width: "44px"}, {duration:300, queue:false});
			$(this).animate({width: "509px"}, {duration:300, queue:false});
			$("#accordionEditor li").removeClass('active');
			$(this).addClass('active');
			activeItem1 = this;
		});

		
		activeItem = $("#accordionTop li:first");
		$(activeItem).addClass('active');
	
		$("#accordionTop li").mouseenter(function(){
			$(activeItem).animate({width: "26px"}, {duration:300, queue:false});
			$(this).animate({width: "238px"}, {duration:300, queue:false});
			activeItem = this;
		});
});

//reklamastolbbbbbb
$(function() {            
    $('#ad_1 > div').each(function(i,e){
        rotate($(this),450,3500,i);
    });
    function rotate(elem1,speed,timeout,i){
        elem1.animate({'marginLeft':'15px','width':'0px'},speed,function(){
            var other;
            if(elem1.parent().attr('id') == 'ad_1')
                other = $('#ad_2').children('div').eq(i);
            else
                other = $('#ad_1').children('div').eq(i);
                other.animate({'marginLeft':'0px','width':'28px'},speed,function(){
                var f = function() { rotate(other,speed,timeout,i) };
                setTimeout(f,timeout);
            });
        });
    }
});
