SITE_URL = 'mikhed.com';
$('.js-slideshow-switch').click(function() {
current = $(this).siblings('.switch-on');
current_index = current.index();
if (current_index != -1)
{
current.removeClass('switch-on');
current.addClass('switch-off');
$(this).removeClass('switch-off');
$(this).addClass('switch-on');
parent = $(this).parents('.js-slideshow-area');
img = parent.children('img');
img.attr('src', $(this).attr('data-id'));
}
});
$('.js-slideshow-area img').click(function() {
parent = $(this).parent();
slideshow = parent.find('.js-slideshow-switch');
current = slideshow.siblings('.switch-on');
if (current.index() >= slideshow.size()-1)
next = 0;
else
next = current.index()+1;
current.removeClass('switch-on');
current.addClass('switch-off');
next = slideshow.siblings().eq(next);
next.removeClass('switch-off');
next.addClass('switch-on');
$(this).attr('src', next.attr('data-id') );
});
$('.currency-tooltip').click(function() {
$(this).trigger('hover');
});
// Overlay
$('.js-nav-tag').click(function() {
tag_name = $(this).attr('data-tag');
if (typeof tag_name === typeof undefined)
{
tag_name = $(this).html();
}
$('#list-of-entries').html('

');
$('#overlay').fadeIn(50);
$('#nav-tag-name').html(tag_name);
/*$('#overlay-box').animate({'top':'160px'},50);*/
$.ajax(
{
type: "POST",
url: '//' + SITE_URL + '/ajax/search-tags.php',
data: 'tag=' + encodeURIComponent( tag_name ),
success: function(result_string)
{
$('#list-of-entries').html(result_string);
},
error: {}
});
});
$('#box-close').click(function() {
$('#overlay').fadeOut(50); // и теперь убираем оверлэй
});
$('#overlay').click(function() {
$('#overlay').fadeOut(50);
});
$('.js-show-comments').click(function() {
$('.js-show-comments').hide();
$('.js-comments-title').show();
$('.js-comment-section').show();
return false;
});
$('.js-hide-comments').click(function() {
$('.js-show-comments').show();
$('.js-comments-title').hide();
$('.js-comment-section').hide();
return false;
});
$('.js-send-comment').click(function() {
page_id = $(this).siblings('.js-comment-page-id').val();
parent = $(this).siblings('.js-comment-parent').val();
language = $(this).siblings('.js-comment-language').val();
text = $(this).siblings('.js-comment-text');
comment_name = $(this).siblings('.js-comment-name');
comment_result = $(this).siblings('.js-comment-result');
if (text.val().length)
{
text.removeClass('form-error');
$.ajax(
{
type: "POST",
url: '//' + SITE_URL + '/ajax/comments.php',
data: 'name=' + encodeURIComponent( comment_name.val() ) + '&text=' + encodeURIComponent(text.val()) + '&page_id=' + encodeURIComponent(page_id) + '&parent=' + encodeURIComponent(parent) + '&language=' + encodeURIComponent(language),
success: function(result_string)
{
var result = jQuery.parseJSON(result_string);
if (result.success == true)
{
comment_name.val('');
text.val('');
comment_result.html(result.message);
comment_result.addClass('alert-success');
comment_result.show();
}
else
{}
},
error:
{
}
});
}
else
text.addClass('form-error');
});