function hideAll(){$(".left-menu-list-item").hide();$(".myprofile-data-container").hide();$(".myprofile-data").hide();$(".myprofile-address-book-section").hide();$(".myprofile-bonus-container").hide();$(".myprofile-data-wish-list-container").hide()}function checkMobile(){return isBrowserMobile()}function showEditAddressForm(n){resetAddressesView();selectedAddressType=n;n==="billing"?($(".myprofile-address-book-summary-billing").hide(),$("#billingAddressForm").toggleClass("hidden")):($(".myprofile-address-book-summary-shipping").hide(),$("#shippingAddressForm").toggleClass("hidden"))}function hideEditAddressForm(){selectedAddressType==="billing"?$(".myprofile-address-book-summary-billing").show():$(".myprofile-address-book-summary-shipping").show()}function toggleOrderDetail(n){var t="orderDetail-"+$(n).data("id");$("div[id^='orderDetail-']").not(document.getElementById(t)).slideUp();t="#"+t;$(t).slideToggle()}function toggleRmaDetail(n){var t="rma-"+$(n).data("rmaid");$("div[id^='rma-']").not(document.getElementById(t)).slideUp();t="#"+t;$(t).slideToggle()}function openCreateRma(n){var t="#myprofile-order-returns-"+$(n).attr("data-id");hideAll();checkMobile()&&($(".myprofile-menu-container").hide(),$(".myprofile-title-container").show(),$(".left-menu-list-item").show());$(".myprofile-data-orders-list-container > div:first-child").hide();$(".myprofile-data-orders-list-container").show();$(t).show();$("body,html").animate({scrollTop:$("body").offset().top})}function ConfirmConfirmCCDeleted(){$("#profileCreditCardRemoveConfirm").modal("hide");$("#profileCreditCardRemovedMessage").modal("show")}function ConfirmRmaCreated(n){hideAll();checkMobile()&&($(".myprofile-menu-container").hide(),$(".myprofile-title-container").hide(),$(".left-menu-list-item").show());$(".myprofile-data-orders-list-container").show();$("#myprofile-order-returns-sent-"+n).show();$("body,html").animate({scrollTop:$("body").offset().top})}function setActiveMenuVoice(){$(".left-menu-list .active-menu").removeClass("active-menu").addClass("left-menu-list-item-description");$(this).addClass("active-menu")}function enableCCSave(){$(this).val()==="Y"?($("#ccSumbmit").removeClass("disabled"),$("#ccSumbmit").removeAttr("disabled")):($("#ccSumbmit").addClass("disabled"),$("#ccSumbmit").attr("disabled",!0))}function showNewAddressForm(){resetAddressesView();$(".myprofile-address-book-shipping").hide();$(".myprofile-address-book-billing").hide();$(".new-address").removeClass("ng-hide").show();var n=$(this).data("addresstype");$("#profileAddressForm-0 input[value='"+n+"']").click();$("#profileAddressForm-0").offset()!=null&&$(window).scrollTop($("#profileAddressForm-0").offset().top)}function hideNewAddressForm(){resetAddressesView();$(".myprofile-address-book-shipping").show();$(".myprofile-address-book-billing").show();$(".new-address").addClass("ng-hide")}function showPwdButton(){$("#profileChangePassword input[name='OldPassword']").attr("type","text");$(this).hide();$("#hidePwd").show()}function hidePwdButton(){$("#profileChangePassword input[name='OldPassword']").attr("type","password");$(this).hide();$("#showPwd").css("display","block")}function showPwdNewButton(){$("#profileChangePassword input[name='NewPassword']").attr("type","text");$(this).hide();$("#hideNewPwd").css("display","block")}function hidePwdNewButton(){$("#profileChangePassword input[name='NewPassword']").attr("type","password");$(this).hide();$("#showNewPwd").show()}function clearPassword(){$("#profileSettingsForm input[name='NewPassword']").val("");$("#profileSettingsForm input[name='Password']").val("********").attr("disabled",!0)}function checkBeforeSubmit(){var i=$("#profileChangePassword").data("formValidation"),r,u,t;if(i.validate(),i.isValid()){var n,f=$("#disabled-email").val(),e=$("#profileChangePassword input[name='OldPassword']").val();$.ajax({url:"/Account/CheckPassword",method:"POST",async:!1,data:{email:f,password:e},success:function(t){t.errorMessage.length>0?($(".wrong-pwd").html(t.errorMessage).show(),$(".wrong-pwd").parent().find(".glyphicon-ok").removeClass("glyphicon-ok").addClass("glyphicon-remove"),$(".wrong-pwd").parent().addClass("has-error"),n=!1):n=!0},error:function(){n=!1}});n&&(r=$("#profileChangePassword input[name='NewPassword']").val(),u=$("#profileChangePassword input[name='RepeatNewPassword']").val(),r!==u?(t=$("#profileChangePassword input[name='RepeatNewPassword']").parent(),t.addClass("has-error").removeClass("has-success"),t.find(".glyphicon-ok").removeClass("glyphicon-ok").addClass("glyphicon-remove"),t.find(".pwd-no-match").show()):$("#profileChangePassword input[type='submit']").click())}else return!1}function closeCCForm(){$("#profileCreditCard")[0].reset();$("#profileCreditCard").data("formValidation").resetForm();$("#creditCards").click()}function resetAddressesView(){$("#profileAddressForm-0")[0]!=null&&($("#profileAddressForm-0")[0].reset(),$("#profileAddressForm-0").data("formValidation").resetForm());$("#profileAddressForm-2")[0]!=null&&($("#profileAddressForm-2")[0].reset(),$("#profileAddressForm-2").data("formValidation").resetForm());$("#profileAddressForm-1")[0]!=null&&($("#profileAddressForm-1")[0].reset(),$("#profileAddressForm-1").data("formValidation").resetForm());$(".edit-form").addClass("hidden");hideEditAddressForm();$(".myprofile-address-book-add").show()}function closeReturnForm(){hideAll();checkMobile()&&($(".myprofile-menu-container").hide(),$(".myprofile-title-container").show(),$(".myprofile-section-title").show());$(".myprofile-data-orders-list-container > div:first-child").show();$(".myprofile-data-orders-list-container").show();$(".myprofile-orders-list").show();var n=$(this).data("order"),t=$(".myprofile-orders-list-attribute-value:contains('"+n+"')").offset().top;$(window).scrollTop(t)}function checkBeforeSubmitProfile(){var f=$("#profileSettingsForm").data("formValidation"),u,o,s,a,v;if(f.validate(),f.isValid()){var t=$.trim($("#profileSettingsForm input[name='City']").val()),n=$.trim($("#profileSettingsForm_StateProvince").val()),i=$.trim($("#profileSettingsForm input[name='ZipCode']").val()),r=$.trim($("#profileSettingsForm textarea[name='AddressLine1']").val()),e=!1;if($("#profileRegistrationAddressErrorMessage").css("display","none"),(t!=""||i!=""||r!="")&&(u=$("#profileSettingsForm #AddressRegistration_CountryId :selected").data("provinceregexp"),u!=null&&u!=""&&!n.length>0&&(e=!0),t==""||i==""||r==""||e))return $("#profileRegistrationAddressErrorMessage").css("display","block"),$("#profileRegistrationAddressErrorMessage")[0].scrollIntoView(!0),$("#profileSettingsSave").removeAttr("disabled"),!1;if(o=$("#profileSettingsForm input[name='VATNumber']").val(),s=$("select[name='CountryId'] option:selected").data("iso2letter"),o===""&&s==="RO")return $("#profileSettingsForm input[name='VATNumber'] ~ small").show(),!1;var h=$("#profileSettingsForm select[name='DateOfBirthDay']").val(),c=$("#profileSettingsForm select[name='DateOfBirthMonth']").val(),l=$("#profileSettingsForm select[name='DateOfBirthYear']").val();typeof h=="undefined"&&typeof c=="undefined"&&typeof l=="undefined"?(!t.length>0&&!i.length>0&&!r.length>0&&n.length>0&&(n="",$("#profileSettingsForm_StateProvince").val("")),$("#profileSettingsForm input[type='submit']").removeAttr("disabled"),$("#profileSettingsForm input[type='submit']").click()):(a="/Account/CheckDate",$.ajax({url:a,method:"POST",async:!1,data:{gg:h,mm:c,aaaa:l},success:function(u){u.errorMessage.length>0?($(".date-no-match").html(u.errorMessage).show(),$(".date-no-match").parent().addClass("has-error"),$(window).scrollTop($("#profileSettingsForm select[name='DateOfBirthDay']").offset().top-30),$("#profileSettingsSave").removeAttr("disabled"),v=!1):(!t.length>0&&!i.length>0&&!r.length>0&&n.length>0&&(n="",$("#profileSettingsForm_StateProvince").val("")),$("#profileSettingsForm input[type='submit']").removeAttr("disabled"),$("#profileSettingsForm input[type='submit']").click())},error:function(){v=!1;$("#profileSettingsSave").removeAttr("disabled")}}))}else return showError(),$("#profileSettingsSave").removeAttr("disabled"),!1}function showError(){if(typeof $(".help-block:visible").offset()!="undefined"){var n=$(".help-block:visible").offset().top;$(window).scrollTop(n-100)}}function checkBeforeSaveAddress(n){var t,i,r;return n.preventDefault(),t=$(n.target).closest("form"),i=t.data("formValidation"),i.validate(),i.isValid()?t.find("input[name='addressTypeId']:checked").length>0||t.find("input[name='Id']").val()!=="0"?(r=t.attr("action"),$.ajax({url:r,method:"POST",async:!1,data:t.serialize(),success:function(n){var t=$("#profileAddressAddedMessage"),i;n.isError?(t.find(".request-error").show(),t.find(".request-ok").hide(),t.modal("show")):(t.find(".request-ok").show(),t.find(".request-error").hide(),t.modal("show"),$(".profileShippingAddressBook").show(),$(".profileBillingAddressBook").show(),i=angular.element($("#myprofile-page-container")[0]).scope(),i.profile.getUserProfileInfo($("#ocz").val(),$("#disabled-email").val()),hideNewAddressForm())},error:function(){var n=$("#profileAddressAddedMessage");n.find(".request-error").show();n.find(".request-ok").hide();n.modal("show")}})):(t.find(".no-type").css("display","block"),showError()):(showError(),i.$invalidFields["0"].focus()),!1}function deleteUserAccount(){var n=$(this).data("email"),t;(n!==""||typeof n=="undefined")&&(t="/Account/AjaxDeleteUserAccount",$.ajax({url:t,method:"POST",async:!1,data:{userEmail:n},success:function(n){n.Ok===!0?($("#userProfileRemoveModal").modal("hide"),$("#userProfileRemoveResultModal #myModalLabelResult").html(n.ErrorMessage[0]),$("#userProfileRemoveResultModal #myModalMessageResult").html(n.ErrorMessage[1]),$("#userProfileRemoveResultModal").modal("show")):($("#userProfileRemoveModal").modal("hide"),$("#userProfileRemoveResultModal #myModalMessageResult").html(n.ErrorMessage[0]),$("#userProfileRemoveResultModal").modal("show"))},error:function(){$("#userProfileRemoveModal").modal("hide");$("#userProfileRemoveResultModal #myModalMessageResult").html(data.ErrorMessage[0]);$("#userProfileRemoveResultModal").modal("show")}}))}function deleteUserAddress(){var n=$(this).data("addressid"),t;return $("#profileAddressRemoveConfirm").modal("hide"),n!==""||typeof n=="undefined"?(t="/Account/AjaxDeleteUserAddres",$.ajax({url:t,method:"POST",async:!1,data:{addressId:n},success:function(n){if(n==null||n.isError)$("#profileAddressRemovedMessage").modal("show"),$("#profileAddressRemovedMessage .request-error").show();else{$("#profileAddressRemovedMessage").modal("show");$("#profileAddressRemovedMessage .request-ok").show();var t=angular.element($("#myprofile-page-container")[0]).scope();t.profile.getUserProfileInfo($("#ocz").val(),$("#disabled-email").val());resetAddressesView()}},error:function(){$("#profileAddressRemovedMessage").modal("show");$("#profileAddressRemovedMessage .request-error").show()}})):void 0}function _addFormGroupFocus(n){var t=$(n);t.closest(".form-group").addClass("is-focused").removeClass("is-empty")}function _removeFormGroupFocus(n){$(n).closest(".form-group").removeClass("is-focused")}function displayTaxCode(){var n=$("select[name='CountryId'] option:selected").data("iso2letter");n==="RO"?$("#VATNumberContainer").removeClass("ng-hide"):$("#VATNumberContainer").addClass("ng-hide")}function userAccountDeleted(){$("body").append("<div class='block-overlay'><\/div>");logOff()}var selectedAddressType="";$(document).ready(function(){function f(){hideAll();$(".myprofile-title-container").show();$(".myprofile-menu-container").show();checkMobile()||($(".myprofile-data-settings-container").show(),$(".myprofile-profile-settings-summary").show(),$("body,html").animate({scrollTop:$("body").offset().top}))}function e(n){var t=$(n);!checkMobile()||$.trim(t.val()).length===0?t.parent().removeClass("myprofile-attribute-value-form-full"):t.parent().addClass("myprofile-attribute-value-form-full")}function t(n){$(n).hasClass("link-plus")?($(n).removeClass("link-plus"),$(n).addClass("link-minus")):$(n).hasClass("link-minus")&&($(n).removeClass("link-minus"),$(n).addClass("link-plus"))}function i(n){var t=window.location.protocol+"//"+window.location.hostname+(window.location.port?":"+window.location.port:"");document.location=t+document.location.pathname+"?menuSection="+n}function r(n){n?($("#profilePassword").attr("type","text"),$(".myprofile-password-show").html("NASCONDI")):($("#profilePassword").attr("type","password"),$(".myprofile-password-show").html("MOSTRA"))}function n(n){$("#profilePassword").removeClass("myprofile-password-edit-displayed myprofile-password-edit-hidden myprofile-password-edit-void").addClass(n)}var u=$(".left-menu-list .active-menu");$(document).on("click","#submitChangePassword",checkBeforeSubmit);$(document).on("click",".left-menu-list .left-menu-list-item-description",setActiveMenuVoice);$(document).on("change","input[name='savecreditcard']",enableCCSave);$(document).on("click","#showPwd",showPwdButton);$(document).on("click","#hidePwd",hidePwdButton);$(document).on("click","#showNewPwd",showPwdNewButton);$(document).on("click","#hideNewPwd",hidePwdNewButton);$(document).on("click","#profileSettingsEdit",clearPassword);$(document).on("click","#profileCreditCardCancel",closeCCForm);$(document).on("click","#profileOrderReturnsCancel",closeReturnForm);$(document).on("click","#removeUserAccountConfirm",deleteUserAccount);$(document).on("hide.bs.modal","#userProfileRemoveResultModal",userAccountDeleted);$(document).on("click","#profileAddressSave",checkBeforeSaveAddress);$(document).on("click","#profileReturnsList",function(){i("returnsList")});$(document).on("click","#profileSettingsDelete",function(){$("#userProfileRemoveModal").modal("show")});$(".myprofile-title-help-button").mouseenter(function(){$(".address-tooltip").show()}).mouseleave(function(){$(".address-tooltip").hide()});$(document).on("click",".myprofile-address-book-add button",showNewAddressForm);$(document).on("shown.bs.modal","#changePasswordModal",function(){$("#profileChangePassword")[0].reset();$("#profileChangePassword").data("formValidation").resetForm();$(".wrong-pwd").hide();$(".pwd-no-match").hide();$(".modal-profile-content.modal-content").show()});$(document).on("change","#profileSettingsForm select[name='DateOfBirthDay'], #profileSettingsForm select[name='DateOfBirthMonth'], #profileSettingsForm select[name='DateOfBirthYear']",function(){$(".date-no-match").html("").hide();$(".date-no-match").parent().removeClass("has-error")});$(document).on("keypress","#profileChangePassword",function(){if(event.keyCode===10||event.keyCode===13)return checkBeforeSubmit(),!1});$(document).on("keypress","form[id^='profileAddressForm-']",function(n){if(event.keyCode===10||event.keyCode===13)return checkBeforeSaveAddress(n),!1});$(document).on("keypress","#profileSettingsForm",function(){if(event.keyCode===10||event.keyCode===13)return checkBeforeSubmitProfile(),!1});$(document).on("click","#profileAddressForm-1 #profileAddressCancel, #profileAddressForm-2 #profileAddressCancel",resetAddressesView);$(document).on("click","#profileAddressForm-0 #profileAddressCancel",hideNewAddressForm);$("#profileChangePassword input[name='RepeatNewPassword']").click(function(){$("#profileChangePassword .pwd-no-match").hide()});$("#profileChangePassword input[name='OldPassword']").click(function(){$("#profileChangePassword .wrong-pwd").hide()});$(document).on("click","#profileChangePasswordBtn",function(){$("#changePasswordModal").modal("show");setupFormValidation("#profileChangePassword",".form-control")});setTimeout(function(){checkMobile()||u.click()},500);$(document).on("click",".item-active",function(n){n.preventDefault();checkMobile()&&($(".myprofile-container .page-title").show(),$(this).removeClass("item-active").addClass("item-inactive"),$(".my-profile-nav li").addClass("item-visible"),$(".myprofile-data-container").hide())});$(document).on("click",".item-inactive",function(n){n.preventDefault();var t=$(this).find("a").attr("id");typeof t!="undefined"&&i(t)});$(document).on("click","#profileSettingsEdit",function(){hideAll();$(".myprofile-data-settings-container").show();$(".myprofile-profile-settings-form").show();$("body,html").animate({scrollTop:$(".myprofile-profile-settings-form").offset().top});checkZipCode("#profileSettingsForm","AddressRegistration_CountryId","ZipCode")});$("#profilePassword").on("change keyup input",function(){$(this).val()?$(this).hasClass("myprofile-password-edit-void")&&(n("myprofile-password-edit-hidden"),r(!1),$(".myprofile-password-show").show()):(n("myprofile-password-edit-void"),$(".myprofile-password-show").hide())});$(".myprofile-password-show").on("click",function(){var t=$("#profilePassword").attr("type")==="password";n(t?"myprofile-password-edit-displayed":"myprofile-password-edit-hidden");r(t)});$(".profileAddressEditOLL").on("click",function(){$("#profileAddressCancel").click();var n=$(this).data();$(this).closest(".myprofile-address-book-summary").hide();$(this).parent().parent().children(".myprofile-address-book-add").hide();$("#"+n.show).toggleClass("hidden")});$(".profileAddressAdd").on("click",function(){var n=$(this).data();$("#"+n.show).removeClass("hidden ng-hide").show()});$("#profileAddressConfirmRemove").on("click",deleteUserAddress);$("#profileAddressBookShippingAddress").on("click",function(){$(this).hasClass("link-plus")?$(".myprofile-address-book-shipping-data").show():$(this).hasClass("link-minus")&&$(".myprofile-address-book-shipping-data").hide();t(this)});$("#profileAddressBookBillingAddress").on("click",function(){$(this).hasClass("link-plus")?$(".myprofile-address-book-billing-data").show():$(this).hasClass("link-minus")&&$(".myprofile-address-book-billing-data").hide();t(this)});$(document).on("click","#profileCreditCardAdd",function(){hideAll();$(".myprofile-data-credit-cards-container").show();$(".myprofile-credit-card-form").show();$("body,html").animate({scrollTop:$("body").offset().top})});$(document).on("click","#profileCreditCardSave",function(){$("#profileCreditCardAddedMessage").modal("show")});$("#profileCreditCardAddedMessage").on("hidden.bs.modal",function(){hideAll();$(".myprofile-credit-cards-none").hide();$(".myprofile-data-credit-cards-container").show();$(".myprofile-credit-cards-list").show();$(".myprofile-data-credit-cards-list").show();$("body,html").animate({scrollTop:$("body").offset().top})});$(document).on("click","#btn-remove-credit-card",function(){$("#profileCreditCardRemoveConfirm").modal("show")});$(".profileMenu").on("click",function(){f()});$(".myprofile-attribute-value-form-input, .myprofile-attribute-value-form-select").on("change keyup paste click",function(){e(this)});$("#profileSettingsChangedMessage").modal("show");$("#profileCreditCardAddedMessage").modal("show")});$(document).on("focusin",".form-control",function(){_addFormGroupFocus(this)}).on("keyup change",".form-control",function(){var n=$(this),t=n.closest(".form-group");n.val()===""?t.addClass("is-empty"):t.removeClass("is-empty")}).on("change",".form-group input",function(){var t=$(this),n,i;t.attr("type")!="file"&&(n=t.closest(".form-group"),i=t.val(),i?n.removeClass("is-empty").addClass("is-full"):(n.addClass("is-empty"),n.removeClass("is-full")))});$(document).on("focusout",".form-control",function(){_removeFormGroupFocus(this)})