/*jshint curly:true, browser: true,
  forin:true, immed:true, latedef:true,
  newcap:true, noarg: true, noempty:true,
  nonew:true, regexp:true, undef:true,
  trailing:true, eqnull:true, laxbreak:true,
  lastsemic:true, globalstrict:true */
/*global jQuery:false */

"use strict";


jQuery(document).ready(function ($) {
	$(document).delegate('.parrot', 'mouseenter', function (event) {
		$(event.currentTarget).addClass('flyyyy');
	});
});

jQuery(document).ready(function ($) {
	$('ul.gallery-strip').each(function (i) {
		var $this = $(this);
		$this.find('li > a')
			.attr('rel', 'gallery-' + i)
			.attr('target', '_blank')
			.colorbox({
				rel: 'gallery-' + i,
				loop: false,
				photo: true,
				maxWidth: '100%',
				maxHeight: '100%',
				current: "{current} из {total}",
				previous: "назад",
				next: "далее",
				close: "закрыть"
			});
		$this.parent().children('.gallery-preview').find('a')
			.click(function (event) {
				var target = $(event.currentTarget).closest('a').attr('href');
				if (!target) {
					target = '';
				}
				var x = $this.find('li > a').filter(function () {
					var attr = ($(this).attr('href') || '');
					return attr && attr.indexOf(target) != -1;
				}).first().trigger('click');
				event.preventDefault();
			});
	});
});

