// JavaScript Document
jQuery(function() {
	
	
	// =======================================
	// Вещи и гаджеты. Переключалка картинок
	jQuery("#gallery_5007").attr("style", "float:right; width:270px");
	
	// Preload gallery images
	jQuery("#gallery_5007").find("a").each(function(){
			jQuery("<img>").attr({
					"src": this.href
				});
		});
	
	first_img_src = jQuery("#gallery_5007").find("a:first").attr("href");
	jQuery(".gallery_5007_preview").attr({
					"src": first_img_src,
					"style": "display:block"
				});
	
	jQuery("#gallery_5007 > .image-block > a").click(function(){
			jQuery(".gallery_5007_preview").attr({
					"src": this.href,
					"style": "display:block"
				});
			return false;
		});
	
	
	// =======================================
	// Листалка журнала
	
	// Display navigation on hover
	jQuery("#pagesContainer").hover( function() {
				jQuery("#pagesContainer > .image_navigation").show();
			}, function() {
				jQuery("#pagesContainer > .image_navigation").hide();
			} );
	jQuery("#next-img-cover, #magazine-cover").hover( function() {
				jQuery("#next-img-cover").show();
			}, function() {
				jQuery("#next-img-cover").hide();
			} );
	
	// =======================================
	// Timer
	
	// Display alco-timer
	jQuery(".show-timer").click(function(){
			jQuery($(this).attr('href')).fadeIn("fast");
			return false;
		});
	
	jQuery(".timer-extended-form .timer-close").click(function(){
			$(this).parent('.timer-extended-form').fadeOut("fast");
			return false;
		});
});


// Листалка журнала	
var smoothness = 10; // lower is smoother, but slower [recommended 10]
var flipTime = 1000; // in ms [recommended 1000]
