function chif() {} var c_zak=[]; $(document).ready(function() { /*$(document).click(function(){ closeBlockMenu(cur_1); });*/ dir_http='/'; cur_prod=0; cur_am=1; var testForIE=0; $('a.GBF').fancybox({ 'padding':3, 'overlayShow':true, 'overlayOpacity':0.7, 'overlayColor':'#000', 'centerOnScroll': true, 'titlePosition':'inside' }); $('.test_am').change(function(){ max=$(this).parent().find('.am_f_t').val()*1; cur=$(this).val()*1; //if (cur>max) $(this).css({'color':'red'}); else $(this).css({'color':''}); }); $('.test_right_am').click(function(){ ok=true; /*$('.test_am').each(function(){ max=$(this).parent().find('.am_f_t').val()*1; cur=$(this).val()*1; if (cur>max) { $(this).css({'color':'red'}); ok=false; } else $(this).css({'color':''}); });*/ if (!ok) { alert('Неверное количество товара'); return false; } $('form[name="forma_perer_price"]').submit(); return false; }); function serialize( mixed_val ) { // Generates a storable representation of a value // // + original by: Ates Goral (http://magnetiq.com) // + adapted for IE: Ilia Kantor (http://javascript.ru) switch (typeof(mixed_val)){ case "number": if (isNaN(mixed_val) || !isFinite(mixed_val)){ return false; } else{ return (Math.floor(mixed_val) == mixed_val ? "i" : "d") + ":" + mixed_val + ";"; } case "string": return "s:" + mixed_val.length + ":\"" + mixed_val + "\";"; case "boolean": return "b:" + (mixed_val ? "1" : "0") + ";"; case "object": if (mixed_val == null) { return "N;"; } else if (mixed_val instanceof Array) { var idxobj = { idx: -1 }; var map = [] for(var i=0; i0) { $('#dialog').find('.info').remove(); $('#dialog').append($('
В кассете '+$('#kaseta').html()+'
')) //$('#dialog').append($('
Количество на складе : '+$('#max_am').val()+'
')); $('#dialog').append($('
Заказано : '+cur_zak+'
')) //} else { //$('#dialog').html('Нет в наличии'); //} }, close: function(event,ui) { cur_am=$('#amount').val(); if (cur_am==undefined) cur_am=1; $('#dialog').html("Укажите количество:"); }, buttons: { "Ок": function() { testForIE=c_zak[cur_prod]*1; if (!testForIE) { c_zak[cur_prod]=$('#cur_zak').val()*1; } var cur_am=$('#amount').val()*1; //var max_am=$('#max_am').val()*1; var cur_zak=c_zak[cur_prod]; //if (cur_am+cur_zak>max_am || cur_am<1 ) alert('Недопустимое количество'); //else if (isNaN(cur_am)) { $(this).dialog("close"); } else { var values = $('input:checkbox:checked.du').map(function () { return this.value; }).get(); var varr=serialize(values); add_ajax_prod_basket(cur_prod,cur_am,varr); $(this).dialog("close"); } }, "Отмена": function() { $(this).dialog("close"); } } }); /*$(document).bind("contextmenu",function(e){ alert('Копирование текстов и иной информации запрещено. Все права защищены.'); return false; }); */ $('#confirm').dialog({ autoOpen: false, width: 300, height:170, modal: true, resizable: false, buttons: { "В корзину": function() { $(this).dialog("close"); document.location='/m/basket/'; }, "Продолжить покупки": function() { $(this).dialog("close"); } } }); $('.test_manager').click(function(){ $name=$('#name').val(); $phone=$('#phone').val(); $mail=$('#mail').val(); $surname=$('#surname').val(); if (!$name || (!$phone && !$mail)) { $('
Вы должны заполнить имя и телефон или e-mail
').dialog({ autoOpen: false, width: 300, height:170, modal: true, resizable: false, buttons: { "Ок": function() { $(this).dialog("close"); } } }).dialog('open'); if (!$name) { $('#name').val('заполните').css({'background-color':'#FFFF00','layer-background-color':'#FFFF00'}); } if (!$phone) { $('#phone').val('заполните').css({'background-color':'#FFFF00','layer-background-color':'#FFFF00'}); } if (!$mail) { $('#mail').val('заполните').css({'background-color':'#FFFF00','layer-background-color':'#FFFF00'}); } return false; } document.location='/m/basket/?savorder=on&act=manager&name='+$name+'&phone='+$phone+'&mail='+$mail+'&surname='+$surname; return false; }); $('.inp').click(function(){ if ($(this).val()=='заполните') $(this).val('').css({'background-color':'#FFFFFF','layer-background-color':'#FFFFFF'}) }); $('.reg_but').css('cursor','pointer'); $('.reg_but').click(function(){ $('#reg_form').submit(); }); $('.show_prices').css('cursor','pointer'); $('.log_but').css('cursor','pointer'); $('.log_but').click(function(){ $('#log_form').submit(); }); $('.send_but').css('cursor','pointer'); $('.send_but').click(function(){ ok=true; $('.inp').each(function(){ ok=(ok && $(this).val()!='' && $(this).val()!='заполните' && $(this).val()!=0); }); if (ok) { oplat=$('.inp[name="type_pay"]:checked').val(); if (oplat==1) { if ($('.paytitle').val()=='') ok=false; } } if (!ok) { $('
Вы должны заполнить все поля
').dialog({ autoOpen: false, width: 300, height:170, modal: true, resizable: false, buttons: { "Ок": function() { $(this).dialog("close"); } } }).dialog('open'); $('.inp:text[value=""]').val('заполните'); $('.inp:text[value="заполните"]').css({'background-color':'#FFFF00','layer-background-color':'#FFFF00'}); } else { $('#form_delivery').submit(); } }); $('#region').change(function(){ $('#city').empty(); $('#city').append($('')); $.get('/include/city.php?region='+$(this).val(),function(data){ $data=$(data); $.each($data.find('option'),function(){ $('#city').append($('')); }); $('#city option:eq(1)').attr('selected', 'selected'); },'xml'); }); function megaHoverOver(){ $(this).find(".sub").stop().fadeTo(500, 1).show(); //Calculate width of all ul's (function($) { jQuery.fn.calcSubWidth = function() { rowWidth = 0; //Calculate row $(this).find("ul").each(function() { rowWidth += $(this).width(); }); }; })(jQuery); if ( $(this).find(".row").length > 0 ) { //If row exists... var biggestRow = 0; //Calculate each row $(this).find(".row").each(function() { $(this).calcSubWidth(); //Find biggest row if(rowWidth > biggestRow) { biggestRow = rowWidth; } }); //Set width $(this).find(".sub").css({'width' :biggestRow}); $(this).find(".row:last").css({'margin':'0'}); } else { //If row does not exist... $(this).calcSubWidth(); //Set Width $(this).find(".sub").css({'width' : rowWidth}); } } function megaHoverOut(){ $(this).find(".sub").stop().fadeTo(500, 0, function() { $(this).hide(); }); } var config = { sensitivity: 2, // number = sensitivity threshold (must be 1 or higher) interval: 100, // number = milliseconds for onMouseOver polling interval over: megaHoverOver, // function = onMouseOver callback (REQUIRED) timeout: 500, // number = milliseconds delay before onMouseOut out: megaHoverOut // function = onMouseOut callback (REQUIRED) }; $("ul#topnav li .sub").css({'opacity':'0'}); $("ul#topnav li").hoverIntent(config); $(".rnd").load(function() { $(this).wrap(function(){ return ''; }); $(this).css("opacity","0"); }); //quick function for tooltip color match function fixToolTipColor(){ //grab the bg color from the tooltip content - set top border of pointer to same $('.fg-tooltip-pointer-down-inner').each(function(){ var bWidth = $('.fg-tooltip-pointer-down-inner').css('borderTopWidth'); var bColor = $(this).parents('.fg-tooltip').css('backgroundColor') $(this).css('border-top', bWidth+' solid '+bColor); }); } //dom ready $(function(){ //fix color fixToolTipColor(); //show/hide them on hover $('.fg-tooltip').hide(); $('.tooltip').hover( function(){ $(this).parent().prev(':hidden').fadeIn().css('display','inline'); }, function(){ $(this).parent().prev(':visible').fadeOut(); } ); //$('.tooltip').parent().parent().css({ 'position': 'relative', 'margin': '80px 80px -40px 100px'}); }); $('.search_button').click(function(){ if ($('.search_field').val()!='искать') $('#search_form').submit(); else alert('Введите строку для поиска'); }); $('.search_field').focus(function(){ if ($(this).val()=='искать') $(this).val(''); }).blur(function(){ if ($(this).val()=='') $(this).val('искать'); }); if ($('#region').html()) { var need_price=false; var current_price=0; var item_amount=$('#region').attr('alt')*1; $('#region').change(function(){ current_price=$('#region option:selected').attr('alt')*1; set_price_field(); }); $('.inp[name="type_delivery"]').click(function(){ set_price_field(); }); var cval=$('.inp[name="type_pay"]:checked').val(); var cprs=$('#zak_st').html(); if (cval==5) { cprs=Math.floor(cprs/1.25); $('#dopcen').html(' (цена будет увеличена на 25% из-за выбранного способа оплаты)'); } $('.inp[name="type_pay"]').click(function(){ if ($('.inp[name="type_pay"]:checked').val()==5) { $('#dopcen').html(' (цена будет увеличена на 25% из-за выбранного способа оплаты)'); $('#zak_st').html(Math.ceil(cprs*1.25)); } else { $('#dopcen').html(''); if (cval==5) $('#zak_st').html(cprs); } cval=$('.inp[name="type_pay"]:checked').val(); set_price_field(); }); if (item_amount<=30) { need_price=true; } function set_price_field() { var upakovka=$('#upakovka').html()*1; if (need_price && ($('.inp[name="type_delivery"]:checked').val()==1)) { if (current_price>0) { $('#dostavk').html(current_price+' руб.'); itog=current_price+$('#zak_st').html()*1+upakovka; } else { $('#dostavk').html('сумму доставки Вам сообщит менеджер'); itog=$('#zak_st').html()*1+upakovka; } } else if ($('.inp[name="type_delivery"]:checked').val()==1) { $('#dostavk').html('сумму доставки Вам сообщит менеджер, после взвешивания посылки'); itog=$('#zak_st').html()*1+upakovka; } else if ($('.inp[name="type_delivery"]:checked').val()==2) { $('#dostavk').html('сумму доставки Вам сообщит менеджер'); itog=$('#zak_st').html()*1+upakovka; } else if ($('.inp[name="type_delivery"]:checked').val()==3) { $('#dostavk').html('оплата за доставку при получении'); itog=$('#zak_st').html()*1+upakovka; } else if ($('.inp[name="type_delivery"]:checked').val()==4) { $('#dostavk').html('без оплаты'); itog=$('#zak_st').html()*1+upakovka; } else if ($('.inp[name="type_delivery"]:checked').val()==5) { $('#dostavk').html('оплата за доставку при получении'); itog=$('#zak_st').html()*1+upakovka; /* $('#dostavk').html('500 рублей при получении заказа.'); itog=500+$('#zak_st').html()*1;*/ } $('#itogo').html(itog); } set_price_field(); } $('.cancel_order').live('click',function(){ $dia=$('
Пожалуйста введите причину отказа от покупки:
').submit(); }, "Отмена": function() { $(this).dialog("close"); } } }); return false; }); });