$(window).load(function() { var url = window.location.pathname; if ((~url.indexOf("/address")) && !(~url.indexOf("account/address")) ) { var isready = "false"; var billing_set = "false"; var billing_id = ""; var delivery_set = "false"; var delivery_id = ""; var is_hidden = "false"; setInterval(function(){ if (($('select[name="billingAddresses"]').length > 0) && ($('select[name="deliveryAddresses"]').length > 0) && (isready == "false")) { $('#companyCheckbox').trigger('click'); $('#ina-adresa-checkbox').trigger('click'); $('.form-address input').prop('disabled', true); $('.form-address checkbox').prop('disabled', true); isready = "true"; } },500); setInterval(function(){ if ((isready == "true") && (billing_set == "false") && ($('select[name="billingAddresses"]').val() != billing_id)) { $('label[for="billingAddresses"] span').html('Faktur. adresa'); $('label[for="deliveryAddresses"] span').html('Dodací adresa'); $('select[name="billingAddresses"] option').each(function() { var obsah = $(this).text(); if ((~obsah.indexOf("Fakturační adresa")) && (billing_set == "false")) { var fakturacni = $(this).val(); $('select[name="billingAddresses"]').val(fakturacni); $('select[name="billingAddresses"]').trigger('change'); billing_set = "true"; billing_id = $(this).val(); } }); } if ((isready == "true") && (delivery_set == "false") && ($('select[name="deliveryAddresses"]').val() != delivery_id)) { $('select[name="deliveryAddresses"] option').each(function() { var obsah = $(this).text(); if ((~obsah.indexOf("Adresa pro doručení")) && (delivery_set == "false")) { var dodaci = $(this).val(); $('select[name="deliveryAddresses"]').val(dodaci); $('select[name="deliveryAddresses"]').trigger('change'); delivery_set = "true"; delivery_id = $(this).val(); } }); } },500); /*setInterval(function(){ if ((billing_set == "true") && ($('select[name="billingAddresses"]').val() == billing_id) && (delivery_set == "true") && ($('select[name="deliveryAddresses"]').val() == delivery_id)) { setTimeout(function() { var DIC = $('#billingAddresscompanyVAT').val(); if (DIC.length > 2) { if (!(~DIC.indexOf("CZ"))) { $('#billingAddresscompanyVAT').val(""); $('#billingAddresscompanyVAT').trigger('change'); } } },500); } },500);*/ $( ".order-fwd" ).hover(function() { var DIC = $('#billingAddresscompanyVAT').val(); if (DIC.length > 2) { if (!(~DIC.indexOf("CZ"))) { $('#billingAddresscompanyVAT').val(""); $('#billingAddresscompanyVAT').trigger('change'); } } }); $( ".order-fwd" ).click(function() { var DIC = $('#billingAddresscompanyVAT').val(); if (DIC.length > 2) { if (!(~DIC.indexOf("CZ"))) { $('#billingAddresscompanyVAT').val(""); $('#billingAddresscompanyVAT').trigger('change'); } } }); } });