/**
 * --------------------------------------------------------------------
 * jQuery-Plugin "pngFix"
 * Version: 1.1, 11.09.2007
 * by Andreas Eberhard, andreas.eberhard@gmail.com
 *                      http://jquery.andreaseberhard.de/
 *
 * Copyright (c) 2007 Andreas Eberhard
 * Licensed under GPL (http://www.opensource.org/licenses/gpl-license.php)
 */
eval(function(p,a,c,k,e,r){e=function(c){return(c<62?'':e(parseInt(c/62)))+((c=c%62)>35?String.fromCharCode(c+29):c.toString(36))};if('0'.replace(0,e)==0){while(c--)r[e(c)]=k[c];k=[function(e){return r[e]||e}];e=function(){return'([237-9n-zA-Z]|1\\w)'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(s(m){3.fn.pngFix=s(c){c=3.extend({P:\'blank.gif\'},c);8 e=(o.Q=="t R S"&&T(o.u)==4&&o.u.A("U 5.5")!=-1);8 f=(o.Q=="t R S"&&T(o.u)==4&&o.u.A("U 6.0")!=-1);p(3.browser.msie&&(e||f)){3(2).B("img[n$=.C]").D(s(){3(2).7(\'q\',3(2).q());3(2).7(\'r\',3(2).r());8 a=\'\';8 b=\'\';8 g=(3(2).7(\'E\'))?\'E="\'+3(2).7(\'E\')+\'" \':\'\';8 h=(3(2).7(\'F\'))?\'F="\'+3(2).7(\'F\')+\'" \':\'\';8 i=(3(2).7(\'G\'))?\'G="\'+3(2).7(\'G\')+\'" \':\'\';8 j=(3(2).7(\'H\'))?\'H="\'+3(2).7(\'H\')+\'" \':\'\';8 k=(3(2).7(\'V\'))?\'float:\'+3(2).7(\'V\')+\';\':\'\';8 d=(3(2).parent().7(\'href\'))?\'cursor:hand;\':\'\';p(2.9.v){a+=\'v:\'+2.9.v+\';\';2.9.v=\'\'}p(2.9.w){a+=\'w:\'+2.9.w+\';\';2.9.w=\'\'}p(2.9.x){a+=\'x:\'+2.9.x+\';\';2.9.x=\'\'}8 l=(2.9.cssText);b+=\'<y \'+g+h+i+j;b+=\'9="W:X;white-space:pre-line;Y:Z-10;I:transparent;\'+k+d;b+=\'q:\'+3(2).q()+\'z;r:\'+3(2).r()+\'z;\';b+=\'J:K:L.t.M(n=\\\'\'+3(2).7(\'n\')+\'\\\', N=\\\'O\\\');\';b+=l+\'"></y>\';p(a!=\'\'){b=\'<y 9="W:X;Y:Z-10;\'+a+d+\'q:\'+3(2).q()+\'z;r:\'+3(2).r()+\'z;">\'+b+\'</y>\'}3(2).hide();3(2).after(b)});3(2).B("*").D(s(){8 a=3(2).11(\'I-12\');p(a.A(".C")!=-1){8 b=a.13(\'url("\')[1].13(\'")\')[0];3(2).11(\'I-12\',\'none\');3(2).14(0).15.J="K:L.t.M(n=\'"+b+"\',N=\'O\')"}});3(2).B("input[n$=.C]").D(s(){8 a=3(2).7(\'n\');3(2).14(0).15.J=\'K:L.t.M(n=\\\'\'+a+\'\\\', N=\\\'O\\\');\';3(2).7(\'n\',c.P)})}return 3}})(3);',[],68,'||this|jQuery||||attr|var|style||||||||||||||src|navigator|if|width|height|function|Microsoft|appVersion|border|padding|margin|span|px|indexOf|find|png|each|id|class|title|alt|background|filter|progid|DXImageTransform|AlphaImageLoader|sizingMethod|scale|blankgif|appName|Internet|Explorer|parseInt|MSIE|align|position|relative|display|inline|block|css|image|split|get|runtimeStyle'.split('|'),0,{}))

function log(a){$("#ie_debug").append(a+"<br/>")}function showcart(){cart.show()}function add2cart(a){cart.add(a)}function SWFPopup(a){var b=(screen.width-640)/2;var c=(screen.height-480)/2;var d="left="+b+",top="+c+",width=640,height=480,location=0,menubar=0,statusbar=0,resizable=0";window.open(a,"swfpopup",d)}function formSubmit(a){if(a)document.getElementById("CITY_ID").value=a;else document.getElementById("CITY_ID").value="all";document.getElementById("city_form").submit()}function HideShow2(){var a=document.getElementById("show_block");var b=document.getElementById("show_block2");if(a.style.display=="")a.style.display="none";if(b.style.display=="none")b.style.display="";else b.style.display="none"}function HideShow(){var a=document.getElementById("show_block");var b=document.getElementById("show_block2");if(b&&b.style.display=="")b.style.display="none";if(a.style.display=="none")a.style.display="";else a.style.display="none"}function HideDiv(a){if(a==undefined)a=window.event;if(a==undefined)return;var b=a.target;if(b==undefined)b=a.srcElement;if(b.tagName=="A"||b.tagName=="SPAN"){return}var c=document.getElementById("show_block");var d=document.getElementById("show_block2");if(c.style.display!="none")c.style.display="none";if(d&&d.style.display!="none")d.style.display="none"}function search_tag(){document.getElementById("s_q").value=document.getElementById("tag_hide").value}function winRes(){var a=document.documentElement.clientWidth?document.documentElement.clientWidth:document.body.clientWidth;if(a==documentWidth)return;documentWidth=a;if(documentWidth<1200){$("#right_col").hide();$("#main_content, #main_cont_pipm, #footer").width(780);$("#main_content_cr").height($("#lc").height());$("#s_f").width(270);$("#s_q").width(220);$("#banner").hide();$(".cti-vline,.spi-vline").css("background-position","98% 25px");$("#jobs-ui .jobs").width(480);$("#jobs-ui>.top>.line").width(667);$("#order_form_id .line").width(740);$("#cities-list-vertical").hide();$("#cities-list-bottom").fadeIn();if(gCityID==159||gCityID==940){$("#catmenu .item .icon img").each(function(){if($(this).width()>58){$(this).width(58)}});$("#catmenu").css("width","")}}else{$("#right_col").show();$("#main_content, #main_cont_pipm, #footer").width(1e3);$("#main_content_cr").height($("#lc").height());$("#s_f").width(465);$("#s_q").width(415);$("#banner").show();$(".cti-vline,.spi-vline").css("background-position","90% 25px");$("#jobs-ui .jobs").width(680);$("#jobs-ui>.top>.line").width(882);$("#order_form_id .line").width(882);$("#cities-list-bottom").hide();$("#cities-list-vertical").fadeIn();if(gCityID==159||gCityID==940){$("#catmenu .item .icon img").css("width","");$("#catmenu").css("width","94%")}}}var documentWidth=0;var cart={content:[],content_loaded:false,current:null,changed:false,delete_id:null,list_limit:5,rowh:null,tpl:{oos:'<span class="price" style="color:#f00;">Нет в наличии</span>',n_border:'<tr class="n-border"><td class="line-1" style="height:1px;border-top:1px #c6c6c6 solid;padding:0;" colspan="5">'+'<div class="line-2" style="height:1px;border-top:1px #e8e8e8 solid;margin:0;padding:0;"></div>'+"</td></tr>",d_border:'<tr class="d-border"><td class="line-1" style="height:1px;border-bottom:1px #e8e8e8 solid;padding:0;" colspan="5">'+'<div class="line-2" style="height:3px;border-bottom:1px #c6c6c6 solid;margin:0;padding:0;">'+'<div class="line-3" style="height:1px;border-bottom:1px #c6c6c6 solid;margin:1px 0 0 0;padding:0;"></div>'+"</div>"+"</td></tr>"},add:function(a,b){cart.disable_button();if(b==undefined){b=function(a){if(a.code==0){cart.content=a.result.content;cart.update_html();cart.update_button();cart.show()}else{cart.update_button()}}}$.ajax({url:"/personal/cart/ajax.php",type:"post",dataType:"json",data:{act:"add",id:a},success:b})},show:function(){cart.changed=false;if(!cart.content_loaded){cart.disable_button();$.ajax({url:"/personal/cart/ajax.php",type:"post",dataType:"json",data:{act:"getcart",type:"json"},success:function(a){if(a.code==0){cart.content=a.result.content;cart.sum=a.result.sum;cart.content_loaded=true;cart.show()}},error:function(){}})}else{var a,b,c,d,e;var f=cart.calc_height();var g='<div id="cart-popup" style="margin:0 10px;">'+'<div class="header" style="height:30px;color:#006fba;font-size:20px;">Моя корзина</div>'+'<div class="header"><table style="width:100%;"><tr style="height:25px;text-align:center;font-size:14px;">'+'<td style="width:350px;text-align:left;">Товар</td>'+'<td style="width:100px;">Количество</td>'+'<td style="width:120px;">Сумма</td>'+'<td style=""></td>'+"</tr>"+cart.tpl.n_border+"</table></div>"+'<div class="content" style="'+(cart.content.length>cart.list_limit&&$.browser.msie&&parseInt($.browser.version)<=6?"width:620px;":"")+"overflow:hidden;margin-bottom:10px;height:"+f+'px;">'+'<table style="width:100%;" cellpadding="1" cellspacing="1">';for(a=0;a<cart.content.length;a++){b=cart.content[a];g+='<tr id="item-'+b.ID+'" style="height:98px;">'+'<td style="width:100px;"><a href="'+b.URL+'" class="name">'+'<img border="0" class="preview" src="'+b.IMAGE.SRC+'" alt="" style="width:'+b.IMAGE.WIDTH+"px;"+"height:"+b.IMAGE.HEIGHT+'px;"/></a></td>'+'<td style="width:250px;"><a href="'+b.URL+'" id="name" style="font-size:12px;font-weight:bold;">'+b.NAME+"</a><br/>"+(b.PRICE>0?'<span class="price" style="color:#006fba;">'+'<span class="value" style="font-size:14pt;font-weight:100;">'+b.PRICE+"</span>"+'<span class="curr" style="font-size:10pt;"> руб.</span>'+"</span>":"")+"</td>"+'<td style="width:auto;text-align:center;">'+'<img class="button" style="cursor:pointer" src="/images/shans/shop/minus.png" onclick="cart.qminus('+b.ID+');"/> '+'<input class="quantity" type="text" style="width:16px;text-align:right;" readonly="readonly" value="'+b.QUANTITY+'"/> '+'<img class="button" style="cursor:pointer" src="/images/shans/shop/plus.png" onclick="cart.qplus('+b.ID+');"/>'+"</td>"+'<td style="width:120px;text-align:right;padding-right:15px;">'+(b.PRICE>0?'<span class="sum" style="color:#006fba;">'+'<span class="value" style="font-size:14pt;font-weight:bold;">'+b.PRICE*b.QUANTITY+"</span>"+'<span class="curr" style="font-size:10pt;"> руб.</span>'+"</span>":cart.tpl.oos)+"</td>"+'<td><img title="Удалить" class="button" style="cursor:pointer" src="/images/shans/shop/delete.png" onclick="cart.del('+b.ID+');"/>'+"</tr>"+(a+1==cart.content.length?cart.tpl.d_border:cart.tpl.n_border)}g+="</table></div>"+'<div class="controls" style="height:30px;float:left;padding-left:10px;">'+(cart.is_order_page()?'<div style="float:left;"><img style="cursor:pointer;" src="/images/shans/shop/continue.png" onclick="cart.update();" border="0" alt=""/></div>':'<div style="float:left;"><img style="cursor:pointer;" src="/images/shans/shop/order.png" onclick="cart.order();" border="0" alt=""/></div>'+'<div style="font-size:12px;padding-top:6px;margin-left:10px;float:left;"><u style="color:#006fba;"><a href="javascript:void(0);" style="color:#006fba;" onclick="cart.update();">Продолжить покупки</a></u></div>')+"</div>"+'<div class="total" style="color:#006fba;height:30px;float:right;padding-right:43px;">'+'<span style="font-size:16pt;font-weight:bold;margin-right:20px;">Итого:</span>'+'<span class="value" style="text-align:right;font-size:16pt;font-weight:bold;">'+cart.total()+"</span>"+'<span class="curr" style="font-size:10pt;margin-right:2px;"> руб.</span>'+"</div>";$.fancybox({modal:false,showCloseButton:true,hideOnOverlayClick:false,content:g,width:640,height:cart.calc_height()+120,autoDimensions:false,centerOnScroll:true,enableEscapeButton:true,overlayOpacity:.6,onCleanup:function(){$("#cart-popup .content").css("overflow-y","hidden");cart.update_button();if(cart.is_order_page()){if(cart.content.length>0){if(cart.changed){submitForm()}}else{window.location.href="/personal/cart/"}}},onComplete:function(){$("#cart-popup .content").css("overflow-y","auto");if($.browser.msie&&parseInt($.browser.version)<=7){$(".line-1,.line-3",$("#cart-popup .n-border,#cart-popup .d-border")).height(1).css({"line-height":"1px"});$(".line-2",$("#cart-popup .d-border")).height(2).css({"line-height":"2px"})}}})}},del:function(a){cart.changed=true;cart.delete_id=a;$.ajax({url:"/personal/cart/ajax.php",type:"post",dataType:"json",data:{act:"del",id:a},success:function(a){if(a.code==0){var b;if(cart.is_last(cart.delete_id)&&!cart.is_first(cart.delete_id)){b=$("#cart-popup #item-"+cart.delete_id).prev()}if(!cart.is_last(cart.delete_id)){b=$("#cart-popup #item-"+cart.delete_id).next()}cart.content=a.result.content;cart.sum=a.result.sum;if(cart.content.length==0){$.fancybox.close()}else{$("#cart-popup #item-"+cart.delete_id).fadeOut(function(){b.remove();$(this).remove();cart.resize();$("#cart-popup .total .value").html(cart.sum)})}cart.update_html();cart.update_button()}}})},set_quantity:function(a,b){var c=$("#item-"+a+" .quantity",$("#cart-popup"));var d=parseInt($(c).val());var e=$("#item-"+a+" .sum>.value",$("#cart-popup"));if(b=="+"){cart.set_quantity_request(a,d+1,c,e)}else if(b=="-"){if(d==1){cart.del(a);return false}cart.set_quantity_request(a,d-1,c,e)}},set_quantity_request:function(a,b,c,d){cart.changed=true;$.ajax({url:"/personal/cart/ajax.php",type:"post",dataType:"json",data:{act:"setq",id:a,value:b},success:function(b){if(b.code==0){var e=parseInt(b.result);var f;for(f=0;f<cart.content.length;f++){if(cart.content[f].ID==a){cart.content[f].QUANTITY=e}}$(c).val(e);$(d).html(parseInt(cart.price(a))*e);$("#cart-popup .total .value").html(cart.total());cart.update_html()}}})},price:function(a){var b,c;for(b=0;b<cart.content.length;b++){c=cart.content[b];if(cart.content[b].ID==a){return parseInt(cart.content[b].PRICE)}}return 0},qminus:function(a){this.set_quantity(a,"-")},qplus:function(a){this.set_quantity(a,"+")},qupdate:function(a){console.log(a)},update:function(){cart.update_save(function(a){cart.content=a.result.content;cart.sum=a.result.sum});$.fancybox.close();cart.content_loaded=false},update_save:function(a,b){var c={act:"upd"},d,e,f=false;$("#cart-popup tr").each(function(){for(i=0;i<cart.content.length;i++){d=parseInt($(this).attr("id").replace("item-",""));e=parseInt($("input.quantity",$(this)).val());if(d==parseInt(cart.content[i].ID)&&e!=cart.content[i].QUANTITY){c[$(this).attr("id")]=e;f=true}}});if(f){cart.changed=true;if(a==undefined){a=function(){}}$.ajax({url:"/personal/cart/ajax.php",type:"post",dataType:"json",data:c,success:function(b){if(b.code==0){cart.update_button();cart.update_html();a(b)}}})}if(b){a({})}},update_html:function(){$("#smallcart").html('<div style="text-align:center;padding-top:20px;">'+'<img src="/images/ajax-loader.gif" alt=""/></div>');$.ajax({url:"/personal/cart/ajax.php",type:"post",dataType:"html",data:{act:"getcart",type:"html"},success:function(a){$("#smallcart").parent().html(a)}})},update_button:function(){var a,b,c=false;$(".buy>a").each(function(){a=parseInt($(this).parent().attr("id").replace("buy-",""));$(this).unbind("click");$(this).click(function(){var a=parseInt($(this).parent().attr("id").replace("buy-",""));cart.add(a)});$("img",$(this)).attr("src","/images/shans/shop/buy.png")});for(i=0;i<cart.content.length;i++){a=parseInt(cart.content[i].PRODUCT_ID);b=$(".buy#buy-"+a+">a");b.unbind("click");b.click(function(){cart.show()});$("img",b).attr("src","/images/shans/shop/incart.png");if(!c&&cart.current_product_id==a){c=true}}$("#one-click-order").unbind("click").text(c?"Оформить заказ":"Отложите, я подъеду!").click(c?cart.order:cart.oneclick)},disable_button:function(){$(".buy>a").unbind("click")},order:function(){cart.update_save(function(a){$.fancybox.close();if(!cart.is_order_page()){setTimeout(function(){window.location.href="/personal/order/make/"},300)}},true)},oneclick:function(){cart.add(cart.current_product_id,function(a){cart.order()})},total:function(){var a,b=0;for(a=0;a<cart.content.length;a++){b+=parseInt(cart.content[a].PRICE)*parseInt(cart.content[a].QUANTITY)}return b},calc_height:function(){if(cart.rowh==null){if($.browser.msie&&parseInt($.browser.version)<=7){cart.rowh=120}else{cart.rowh=104}}return cart.content.length>=cart.list_limit?cart.list_limit*cart.rowh+4:cart.content.length*cart.rowh+4},resize:function(){h=cart.calc_height();if($.browser.msie&&parseInt($.browser.version)<7){$("#cart-popup>.content").width(cart.content.length<cart.list_limit?600:620)}$("#cart-popup>.content").height(h);$("#cart-popup").height(h+120);$.fancybox.resize()},is_first:function(a){var b;for(b=0;b<cart.content.length;b++){if(cart.content[b].ID==a&&b==0){return true}}return false},is_last:function(a){var b;for(b=0;b<cart.content.length;b++){if(cart.content[b].ID==a&&b+1==cart.content.length){return true}}return false},is_order_page:function(){return/personal\/order\/make/.test(window.location.href)}};$(window).load(function(){winRes();$("#icq_ekaterina").attr("src","http://status.icq.com/online.gif?icq=411503635&img=27");$("a.fancy").fancybox({hideOnContentClick:true,titlePosition:"inside",overlayOpacity:.5});$("#ie_debug").click(function(){$(this).toggle()});$("td.city_normal").bind({mouseover:function(){$(this).addClass("city_hover")},mouseout:function(){$(this).removeClass("city_hover")}});$("#body_footer").click(HideDiv);var a=$(".city>.current>a");if(a.length>0){var b=$("#show_block2");var c=a.offset().top+a.height()+5;var d=a.offset().left+a.width()/2-b.width()/2-10;$("#show_block2").appendTo("body").css({top:c+"px",left:d+"px","z-index":1})}if($.browser.msie){document.title=document.title.split("#")[0];if(parseInt($.browser.version)<8){$(".catalog-top-item").css("width","32%");$(".super-price-item").css("width","32%")}if(parseInt($.browser.version)<7){$(".sp-strike,.sp-strike-detail").each(function(){$(this).css({"margin-top":-(parseInt($(this).css("height"))/2.3)}).css({height:"9px"});$(this).prev().css("margin-top",0)});$("#left-col .striked .line").css("margin-top","-24px");$(".spi-vline-short,.cti-vline-short").css("background-position","90% 10px")}$(".ie6-pngfix").pngFix()}});window.onresize=winRes

