jQuery(function(a){WCMLExchangeRates={init:function(){a("#online-exchange-rates").on("change","#exchange-rates-automatic",WCMLExchangeRates.toggleManualAutomatic),a("#online-exchange-rates").on("click","#update-rates-manually",WCMLExchangeRates.updateRatesManually),a("#online-exchange-rates").on("change","input[name=exchange-rates-service]",WCMLExchangeRates.selectService),a("#online-exchange-rates").on("change","input[name=update-schedule]",WCMLExchangeRates.updateFrequency),WCMLExchangeRates.selectedService=a("input[name=exchange-rates-service]:checked").val(),a("#online-exchange-rates").on("change","input[name=exchange-rates-service]",WCMLExchangeRates.toggleUpdateManuallyButton),a("#online-exchange-rates").on("change","input[name=lifting_charge]",WCMLExchangeRates.toggleUpdateManuallyButton)},toggleManualAutomatic:function(){"checked"==a(this).attr("checked")?a("#exchange-rates-online-wrap").fadeIn():a("#exchange-rates-online-wrap").fadeOut()},updateRatesManually:function(){var b=a(this);a("#exchange-rates-error").html("").hide(),a("#update-rates-spinner").css({visibility:"visible"}),a(".exchange-rates-sources .notice-error").html("").hide(),b.attr("disabled","disabled"),a.ajax({type:"post",url:ajaxurl,dataType:"json",data:{action:"wcml_update_exchange_rates",wcml_nonce:a("#update-exchange-rates-nonce").val()},success:function(c){if(c.success)a("#exchange-rates-success").fadeIn(),a("#update-rates-time .time").html(c.last_updated);else if(c.error){var d=a("#service-error-"+c.service);d.html(c.error).fadeIn()}a("#update-rates-spinner").css({visibility:"hidden"}),b.removeAttr("disabled");for(code in c.rates)a("#currency_row_"+code+" span.rate").hide().html(c.rates[code]).fadeIn("slow")}})},toggleUpdateManuallyButton:function(){WCMLExchangeRates.selectedService==a(this).val()?a("#update-rates-manually").removeAttr("disabled").next(".wcml-tip").hide():a("#update-rates-manually").attr("disabled","disabled").next(".wcml-tip").show().tipTip(WCML_Tooltip.default_args)},selectService:function(){a(".service-details-wrap").hide(),a(this).parent().find(".service-details-wrap").show()},updateFrequency:function(){a('[name="update-weekly-day"], [name="update-monthly-day"]').attr("disabled","disabled"),a(this).parent().find("select").removeAttr("disabled")}},WCMLExchangeRates.init()});