jQuery(document).ready(function($){
	// Replace Digits at Molengo font in Menu and Headers
	$('.menu-left a, h1, h2, h3, h4, h5').each(function(indx, item_){
		var item = $(item_).find('a');
		if(!item.size()) item = $(item_);
		var text = item.text(),
			textNew = item.text().replace(/(\d+)/g, "<span class=\"digit\">$1</span>");
		if(text != textNew) item.html( textNew );
	});
	
	// Apply Shadowbox to enlargeble image
	if(typeof(Shadowbox) != 'undefined') Shadowbox.init({
		slideshowDelay: 3,
		continuous: true
	});
	
	// Init slider albums
	if(typeof($.fn.tinycarousel) != 'undefined') $('.slider').tinycarousel({
		pager: true,
		interval: true,
		intervaltime: 5000
	});
	
	// Содержимое раздела: подствека парного элемента по наведении
	$('#headernav a').each(function(indx, item){
		var anchor = $(this),
			pageId = item.id.split('-')[2],
			anchorImg = $('#page-anchor_img-' + pageId);
		anchor.hover(function(){
			anchorImg.addClass('hover');
		}, function(){
			anchorImg.removeClass('hover');
		});
		anchorImg.hover(function(){
			anchor.addClass('hover');
		}, function(){
			anchor.removeClass('hover');
		});
	});
});

jQuery(window).load(function($){
	// Question Button
	var questionBtn = jQuery('#question a');
	questionBtn.attr('href', questionBtn.attr('url'));
});
