(function(){
	
	$.fn.slides = function(itmSel) { var sld=$(this); var tot = $(itmSel, sld).size(); var prev = 1; if (tot <= 1) return;		
		$(itmSel, sld).hide(); $(itmSel+':nth-child(1)', sld).show();
		window.setInterval(function(){ showNext(); }, 5000); 
		function showNext() { var cur = prev+1; if (cur > tot) cur = 1;	$(itmSel, sld).hide();
			$(itmSel+':nth-child('+prev+')', sld).show().fadeOut(1000);
			var el=$(itmSel+':nth-child('+cur+')', sld);el.fadeIn(1000);prev = cur;
		}
	};
	
	$.site =  {
		init: function() { 
			$.site.banner(); 
		},
		banner: function() { if ($('.bnr-lnk').size() == 0) return;
			$('.site-banner').slides('.site-banner-item');
			$('.bnr-lnk-itm').each(function(){
				$(this).hover(function(){ $('.bnr-lnk-hov', $(this)).fadeIn(350); 
				}, function() { $('.bnr-lnk-hov', $(this)).fadeOut(150); });
			});
		}
	};
})(jQuery);

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