250) {
alert('Вы превысили длину текста в 250 символов');
return false;
}
vote2_info.html('
').fadeIn();
},
success: function(msg){
vote2_info.html(msg.message);
if(msg.status == 1) {
vote2_new.val('');
count_chars.text(0);
}
},
timeout: 3000 // тайм-аут
};
// привязываем событие submit к форме
$('#vote2Form').submit(function() {
$(this).ajaxSubmit(options_vote2);
return false;
});
//if mask is clicked
$('#mask, #compare_mask').click(function () {
$(this).hide();
$('.window').hide();
});
$('.close').click(function (e) {
e.preventDefault();
$('#mask, #compare_mask, .window').hide();
});
// вкладки на странице продуктов
// пример вкладок с куками http://dimox.name/examples/universal-jquery-tabs-script/cookies.html
$('ul.tabs').delegate('li:not(.current)', 'click', function() {
$(this).addClass('current').siblings().removeClass('current')
.parents('div.section').find('div.box').hide().eq($(this).index()).fadeIn(150);
})
// отправка отзыва во вкладке отзывы
var options_review = {
target: "#review_inform",
beforeSubmit: function()
{
$('#review_inform').html('
').fadeIn();
},
success: function(){
$('#reviewform').css('display', 'none');
//$('#review_inform').text( $('#review_inform').find('.errors').text());
},
timeout: 3000 // тайм-аут
};
// привязываем событие submit к форме
$('#reviewform').submit(function() {
$(this).ajaxSubmit(options_review);
return false;
});
var options_opt_form = {
target: "#OptFormInfo",
beforeSubmit: function()
{
$('#OptFormInfo').html('
');
},
success: function(){
var cap_field = $('#captcha_opt');
cap_field.val(cap_field.attr('defaultValue'));
$('#c_img').attr('src', '/verif/index.php?PHPSESSID=' + Math.random());
},
timeout: 3000 // тайм-аут
};
// привязываем событие submit к форме
$('#OptForm').submit(function() {
$(this).ajaxSubmit(options_opt_form);
return false;
});
$("a.ancLinks").click(function () {
var elementClick = $(this).attr("href");
var destination = $(elementClick).offset().top;
$("html:not(:animated),body:not(:animated)").animate({ scrollTop: destination}, 1100 );
return false;
});
$('#hide_good_link').toggle(function(){
$(this).text('Показать');
$('.productstable').each(function(){
var count_children_no_good2 = $(this).find('.no_Good_jq');
var count_children_no_good = count_children_no_good2.size();
var count_children = $(this).children('tbody').children('tr').size();
if(count_children_no_good == count_children) {
$(this).parent().fadeOut();
} else {
count_children_no_good2.fadeOut();
}
});
//$(this).css({'background-image':'url(/img/p_label.gif)','background-position':'-33px -208px'});
return false;
}, function(){
$(this).text('Скрыть');
$('.no_Good_jq, .corner_container').fadeIn();
//$(this).css({'background-image':'url(/img/p_label.gif)','background-position':'-33px -181px'});
return false;
});
$('.del_basket').click(function(e){
e.preventDefault();
var drop_img = $(this).html();
var link_img = $(this);
if(err_mes = $(this).next()) err_mes.remove();
$.ajax({
type: 'POST',
url: '/includes/delete_from_basket.php',
data: 'orderid_kill=' + link_img.attr('value'),
dataType: 'json',
beforeSend: function()
{
link_img.html('
');
},
success: function(msg){
link_img.html(drop_img);
if(msg.code) {
link_img.parent().parent().hide('slow').remove();
} else {
link_img.after('Ошибка удаления
');
}
}
}); // конец аякс
});
// добавление товара в корзину на ajax
var URL = '/includes/ajax_basket.php';
var atc = $('.add_to_cart');
//atc.unwrap();
atc.click(function(){
var pid = $(this).attr('id');
var outPut = $(this);
$(this).attr('title', '');
var quant = $(this).prev().children('.qnt_text').val();
$.ajax({
type: 'POST',
url: URL,
data: 'productid=' + pid + '&qnt=' + quant,
//data: 'productid=' + pid + '&cache=' + (new Date().getTime()),
dataType: 'json',
beforeSend: function()
{
outPut.prev('.ainfo').remove();
outPut.html('
').fadeIn();
},
success: function(msg){
outPut.html('');
if(msg.tastes){
outPut.before('' + msg.info + msg.tastes + msg.cont + '
');
} else{
outPut.before('' + msg.info + msg.cont + '
').prev('.ainfo').delay(3000).fadeOut(400);
$('#b_count3', '#basket_ajax').text(msg.count);
$('#b_sum3', '#basket_ajax').text(msg.sum);
//alert('Товар добавлен');
}
$('.tdright').delegate('.cont', 'click', function(event){
event.preventDefault();
$('.ainfo').remove();
//$(this).hide("slow");
});
}
}); // конец аякса
});
// \\ добавление товара в корзину на ajax
// выбор вкусов на ajax
$('.tdright').delegate("select", "change", function(){
var pid = $(this).prev().val();
var prop = $(this).val(); // вкус, размер, цвет
var outPut = $(this).parent().parent();
var quant = $(this).parent().parent().prev().children('.qnt_text').val();
$.ajax({
type: 'POST',
url: URL,
data: 'productid=' + pid + '&taste=' + prop + '&qnt=' + quant,
dataType: 'json',
beforeSend: function()
{
outPut.html('
').fadeIn();
},
success: function(msg){
outPut.html(msg.info + msg.cont).delay(3000).fadeOut(400);;
$('#b_count3', '#basket_ajax').text(msg.count);
$('#b_sum3', '#basket_ajax').text(msg.sum);
//alert('Товар добавлен');
}
}); // конец аякса
});
// эффект моргания картинк продуктов
// $('.content-subtitle-noshade-size10 img').mouseenter(function () { $(this).animate({opacity: 0.7},10).animate({opacity: 1},300)});
$('.zoom1').mouseenter(function () { $(this).animate({opacity: 0.5},200).animate({opacity: 1},100)});
// скрытиый помощник
var current_index = null;
$('#help-button').click(function(){
$('#help-panel').toggle(300);
});
var title_obj = $('a.title');
title_obj.click(function(){
if(current_index != title_obj.index(this)){
$('.collapse:visible').slideUp(500);
title_obj.removeClass('selected');
}
var collapse_block = $(this).parent().next();
if(collapse_block.attr('class') == 'collapse'){
if(collapse_block.is(":hidden")){
$(this).addClass('selected');
} else if(collapse_block.is(":visible")) {
$(this).removeClass('selected');
}
collapse_block.slideToggle(500);
}
current_index = title_obj.index(this);
});
// \\скрытиый помощник
// 3D облако тегов
var rnumber = Math.floor(Math.random()*9999999);
var so = new SWFObject("/img/tagcloud.swf?r="+rnumber, "tagcloudflash", "200", "150", "9");
var tags = new String('Аминокислоты Аксессуары Батончики Витамины и минералы Гейнеры Протеиновые коктейли Жиросжигатели Креатин Карнитин Тестостерон Протеины Препараты Спортивная одежда Энергетики Распродажа Inkospor Multipower MuscleTech PowerBar Powerblock Powerhouse Universal nutrition VP Laboratory Weider Bodieforz Cytogenix');
tags = tags.replace(/"/g,"'");
tags = tags.replace(/"/g,"'");
tags = tags.replace(/