// Home Slider
function viewEvent(margina){
	$("#homeEventsOverflower").animate({ marginLeft: margina+"px" }, 800 );
}

function viewBrend(margina){
	$("#brends").animate({ marginLeft: margina+"px" }, 800 );
}

// Home Tabs
var TabbedContent = {
	init: function() {	
		$(".tab_item").mouseover(function() {
		
			var background = $(this).parent().find(".moving_bg");
			
			$(background).stop().animate({
				left: $(this).position()['left']
			}, {
				duration: 300
			});
			
			TabbedContent.slideContent($(this));
			
		});
	},
	
	slideContent: function(obj) {
		
		var margin = $(obj).parent().parent().find(".slide_content").width();
		margin = margin * ($(obj).prevAll().size() - 1);
		margin = margin * -1;
		
		$(obj).parent().parent().find(".tabslider").stop().animate({
			marginLeft: margin + "px"
		}, {
			duration: 300
		});
	}
}

$(document).ready(function() {
	TabbedContent.init();
});


// Prikaz listinga
$(document).ready(function(){
 
	$("a.switch_thumb").toggle(function(){
	  $(this).addClass("swap"); 
	  $("ul.display").fadeOut("fast", function() {
	  	$(this).fadeIn("fast").addClass("thumb_view"); 
		 });
	  }, function () {
      $(this).removeClass("swap");
	  $("ul.display").fadeOut("fast", function() {
	  	$(this).fadeIn("fast").removeClass("thumb_view");
		});
	}); 

});


// Informacije
$(document).ready(function() {
			$(".fadeNext").click(function(){   
  				$(this).next().fadeSliderToggle()
 				 return false;
 			})
 		});


// Korpa slide

$(document).ready(function(){

	$(".btn-slide").click(function(){
		$("#panel").slideToggle("slow");
		$(this).toggleClass("active"); return false;
	});
	
	 
});


// Shop
$(document).ready(function(){
			$("a.cart").fancybox({
				'overlayOpacity'	:	0.7,
				'overlayColor'		:	'#000000',
				'frameWidth'		:	850,
				'frameHeight'		:	450,
				'centerOnScroll'	:	false
			});
});


// Cart expand

        $(document).ready(function(){
            $("#report tr:odd").addClass("odd");
            $("#report tr:not(.odd)").hide();
            $("#report tr:first-child").show();
            
            $("#report tr.odd").click(function(){
                $(this).next("tr").toggle();
                $(this).find(".arrow").toggleClass("up");
            });
            //$("#report").jExpand();
        });

// News ticker
$(document).ready(
	function()
	{
		$("#news").newsTicker();
		
	}
);
