function callService(n,t,i,r){return $.ajax({url:n,cache:!1,data:JSON.stringify(t),error:function(n,t,i){if(r)return r(n,t,i)},success:function(n){if(i)return i(n.d)},type:"POST",dataType:"json",contentType:"application/json"})}function serviceProxy(n,t){this._path=this._pathBase+n.toLowerCase()+this._pathSuffix;for(i in t)this.addMethod(t[i])}function execByName(n){for(var t=window,f=Array.prototype.slice.call(arguments,1),r=n.split("."),u=r.pop(),i=0;i<r.length;i++)t=t[r[i]];if(t&&typeof t[u]=="function")return t[u].apply(t,f)}function GetTown(n,t){var r=!1,i;$("#"+t+" option:selected").each(function(){$(this).val()=="35286"&&(r=!0)}),i="",r?$.ajax({type:"POST",url:"/order/region_actions.aspx?action=anyCountry",data:"",success:function(t){var f,r,u;for(i+=' или <select name="anyCountry">',i+='<option value="в городе с курьерской доставкой OZON.ru" selected="selected">в городе с курьерской доставкой OZON.ru</option>',f=t.split("|"),r=0;r<f.length;r++)one=f[r],u=one.split(","),i+='<option value="'+u[0]+'">'+u[1]+"</option>";i+="</select>",$("#"+n).html(i)}}):$("#"+n).html(i)}var Ozon={addService:function(n,t){this[n]=new serviceProxy(n,t)}};serviceProxy.prototype._path="",serviceProxy.prototype._pathBase="/json/",serviceProxy.prototype._pathSuffix=".asmx/",serviceProxy.prototype.get_path=function(){return this._path},serviceProxy.prototype.addMethod=function(n){this[n]=function(t,i,r){return callService(this.get_path()+n.toLowerCase(),t,i,r)}},Ozon.addService("Cart",["Add"]),Ozon.addService("Detail",["SaleBlock","AddTags","AddComment","GetCommentPreview","Subscribe","IHaveIt","LikeIt","VoteComment","SaveClientViewDetail","GetDownloadUrl"]),$(function(){$(".js_saleblock .js_add").live("click",function(){var u=$(this),i=u.parents(".js_saleblock"),n=i.find(".iteminfo"),t=u.hasClass("js_notify")?1:0,e=n.attr("js_list")?n.attr("js_list"):0,o=(t?"waitadd_":"cartadd_")+n.attr("js_event"),s=t?"event4":"scAdd",f=n.attr("js_cb"),r=t?"Soobshchit' o postuplenii v prodazhu ":"Dobavlenie tovara v korzinu";return Ozon.Cart.Add({itemId:n.attr("js_itemId"),notify:t,clientListItemId:u.hasClass("js_list")?e:0,type:n.attr("js_type")?""+n.attr("js_type"):"",isDigital:n.attr("js_digital")?""+n.attr("js_digital"):"",eventName:n.attr("js_event")?""+n.attr("js_event"):""},function(u){if(u.error){var e=i.find(".js_error");e.html(u.error),e.show()}else t||i.addClass("bought"),SetOmnitureCode(r,null,r,r,s,";"+n.attr("js_itemId"),o,null,null,u.error,1),f?execByName(f,u):u.data&&u.data!=""&&(i.html(""),i.html(u.data))},null,null),!1})}),$(document).ready(function(){GetTown("MainContent_ctl03_FrameWithoutAbsolutePosition1_RepeaterRegionList_AnotherTown_3","MainContent_ctl03_FrameWithoutAbsolutePosition1_RepeaterRegionList_DropDownListNewAddress_3")})
