var kdd = ['m9' , 'm12', 'm16']; var ckdd = 'm9'; var akdd = [['m9', '9m3', '0', '0', { extraMargin: '0' }], ['m12', '12m3', '1290', '20', { extraMargin: '0' }], ['m16', '16m3', '2890', '20', { extraMargin: '0' }]]; var bpv = ['hp120', 'hp140', 'hp160']; var cbpv = 'hp120'; var abpv = [['hp120', '120 HP', '0', '0', { extraMargin: '0' }], ['hp140', '140 HP', '1720', '20', { extraMargin: '0' }], ['hp160', '160 HP', '3210', '20', { extraMargin: '0' }]]; var bpg = ['mech', 'auto']; var cbpg = 'mech'; var abpg = [['mech', 'Mehāniskā (bāzes)', '0','0', { extraMargin: '0' }], ['auto', 'Automātiskā (Hi Matic)', '2680', '20', { extraMargin: '0' }]]; var finans = ['taip', 'ne']; var cfinans = null; var gr = ['v1', 'v2', 'v3', 'v4', 'v5']; var cgr = 'v1'; var agr = [['v1', 'Standarta garantija', '0'], ['v2', 'Paplašinātā garantija +1 gads', '1150'], ['v3', 'Paplašinātā garantija +2 gadi', '720'], ['v4', 'Paplašinātā garantija +1 gads', '980'], ['v5', 'Paplašinātā garantija +2 gadi', '520'], ]; var kp = ['BUSSINES', 'EVOLUTION', 'CONNECT-MANUAL', 'BUSSINES-PREMIUM', 'DELIVERY', 'DELIVERY-PLUS', 'DELIVERY-REGIONAL', 'DELIVERY-URBAN', 'WINTER', 'HI-DRIVE', 'BUSSINES-EXCLUSIVE'] var kpbussines = false; var kpbussinespremium = false; var kpdelivery = false; var kpdeliveryplus = false; var kpwinter = false; var kphidrive = false; var kpbussinesplus = false; var kpbussinesexclusive = false; var kphidriveauto = false; var kpevolution = false; var kpconnecthimatic = false; var kpconnectmanual = false; var kpdeliveryurban = false; var kpdeliveryregional = false; var ckp = '0'; var disc = 0; var akp = [ // DEFAULT is preselected even though it is not shown anywhere ['DEFAULT', '', 380, 20, ['po79300', 'po72619', 'po72623']], ['BUSSINES', 'BUSSINES', '2090', '20',['po05925', 'po07196', 'po72619', 'po76104', 'po79246', 'po79300', 'po02463', 'po06555']], ['EVOLUTION', 'EVOLUTION', '4020', '20', ['po05925', 'po07196', 'po72619', 'po79297', 'po00258', 'po75082', 'po06650', 'po79246', 'po79300', 'po76747', 'po02443', 'po72623', 'po02463', 'po04383', 'po06555']], ['CONNECT-HI-MATIC', 'CONNECT HI MATIC', '5780', '20', ['po05925', 'po07196', 'po72619', 'po79297', 'po00259', 'po75082', 'po06650', 'po72801', 'po79300', 'po76747', 'po02443', 'po72623', 'po72803', 'po75681', 'po01902', 'po06555', 'po72625']], ['CONNECT-MANUAL', 'CONNECT MANUAL', '5780', '20', ['po05925', 'po07196', 'po72619', 'po79297', 'po00259', 'po75082', 'po06650', 'po72801', 'po79300', 'po76747', 'po02443', 'po72623', 'po14522', 'po75681', 'po01902', 'po06555', 'po72625']], ['DELIVERY-URBAN', 'DELIVERY URBAN', '1930', '20', ['po02210po00726','po14864', 'po77742', 'po08628', 'po06344', 'po72623', 'po72806', 'po01012', 'po06767', 'po78981', 'po08650', 'po00732']], ['DELIVERY-REGIONAL', 'DELIVERY REGIONAL', '2310', '20', ['po02210po00726','po14864', 'po77742', 'po08628', 'po06344', 'po72623', 'po72805', 'po01012', 'po06767', 'po72811', 'po78981', 'po08650', 'po00732']], // ['BUSSINES-PREMIUM', 'BUSSINES PREMIUM', '3230', '30', ['po72619','po79297','po06627','po75082','po06650','po79246','po79247','po76747','po02443','po72623','po02463']], ['DELIVERY', 'DELIVERY', '700', '20', ['po06767','po06775','po78981','po08650']], ['DELIVERY-PLUS', 'DELIVERY PLUS', '1590', '20', ['po77742','po08628','po75681','po06767','po06775','po78981','po08650']], ['WINTER', 'WINTER', '1820', '20', ['po00262', 'po08767', 'po00685', 'po06654', 'po72841']], ['HI-DRIVE', 'HI-DRIVE', '1720', '20', ['po72623','po14522','po72805','po72806','po72811','po04383','po72839','po72841','po02471']], // ['BUSSINES-PLUS', 'BUSSINES PLUS', '2800', '30', ['po72619', 'po08091', 'po76104', 'po79245', 'po02443', 'po02463', 'po72625']], // ['BUSSINES-EXCLUSIVE', 'BUSSINES EXCLUSIVE', '3950', '30', ['po72619', 'po79297', 'po06627', 'po75082', 'po06650', 'po79246', 'po79247', 'po02443', 'po02463', 'po72625']], ['HI-DRIVE-AUTO', 'HI-DRIVE', '1720', '30', ['po72623','po72803','po72805','po72806','po72811','po04383','po72839','po72841','po02471']]]; var po = [ ['po08640', '~100 l degvielas bāka', '200', '20', '08640'], ['po14864', 'Bez riepu remonta komplekta (gaisa kompresors un hermētiķis)', '-12', '20', '14864'], ['po07820po06520', 'Āķis piekabei ar 3500 kg kopējo masu, 13 polu el. savienojums', '450', '20', '07820+06520'], ['po02308', 'Viegla alumīnija sakausējuma diski', '560', '20', '02308'], ['po77702', 'Dekoratīvie diski (pilna izmēra)', '110', '20', '77702'], ['po02210po00726', 'Rezerves ritenis ar stiprinājumu ārpusē aiz aizmugurējās ass starp rāmja sijām', '350', '20', '02210+00726'], ['po72813', 'TRACTION+ & HILL DESCENT CONTROL – saķeri ar ceļa segumu uzlabojoša elektroniskā vilces kontroles sistēma un vadības sistēma braukšanai slīpumā lejup', '220', '20', '72813'], //7 ['po06555', 'Priekšējie miglas lukturi (ieslēdzas pagriešanas virzienā)' , '220', '20', '06555'], ['po08650', 'Aizmugurējā pakāpiena apgaismojums virs aizmugurējām durvīm ', '280', '20', '08650'], ['po08651', 'Aizmugures skata kamera un aizmugurējā pakāpiena apgaismojums virs aizmugurējām durvīm', '580', '20', '08651'], ['po72839', 'Automātiskā tālo / tuvo gaismu pārslēgšanas sistēma (AHBC)', '270', '20', '72839'], ['po72841', 'Automātiskie logu tīrītāji un tuvo gaismu ieslēgšanas sistēma', '240', '20', '72841'], ['po72625', 'FULL LED – Priekšējie LED lukturi  un gabarīta lukturi, kā arī priekšējie miglas lukturi (ja ir komplektācijā)', '1020', '20', '72625'], ['po78981', 'Iekšējais kravas nodalījuma LED apgaismojums','180', '20', '78981'], //14 ['po08795', 'Rezerves atslēga ar integrētu centrālās durvju atslēgas (un signalizācijas, ja uzstādīta rūpnīcā) vadību', '120', '20', '08795'], ['po72805', 'LDWS + PLKA – joslu maiņas brīdinājuma sistēma + prognozējošā aizsardzības pret joslu maiņu palīdzības sistēma', '1020', '20', '72805'], ['po07638', 'Ārējais atpakaļgaitas brīdinājuma signāls', '110', '20', '07638'], ['po00685', 'Priekšējā stikla apsilde zem tīrītājiem', '270', '20', '00685'], ['po08656', 'Savienojums virsbūves meistariem', '60', '20', '08656'], ['po72806', 'AEBS + CITY BRAKE – progresīvā avārijas bremzēšanas sistēma, kas pasargā no frontālās sadursmes vai mazina šādas sadursmes sekas, braucot ar lielu ātrumu + autonomā avārijas bremzēšana, ja ātrums ir neliels (darbojas no ~5 km/h), sistēma vēro transportlīdzekļa priekšpusi un konstatē šķēršļus ', '860', '20', '72806'], ['po08742', 'Aizmugurējie parkošanās sensori', '470', '20', '08742'], //21 ['po79246', 'Radio ar digitālā radio signāla (DAB) uztvērēju, vadību uz stūres, Bluetooth® brīvroku ierīce ar balss atpazīšanu, USB un AUX savienojumiem, saskarne ar IVECO BUSINESS UP™ lietotni', '750', '20', '79246'], ['po72801', 'HI-CONNECT – radio ar digitālā radio signāla (DAB) uztvērēju, ar 7” diagonāles skārienjutīgu daudzfunkcionālu ekrānu un vadību uz stūres, Bluetooth® brīvroku ierīci ar balss atpazīšanu, USB un AUX savienojumiem, vietu atpakaļskata kameras pievienošanai. Android Auto un Apple CarPlay. TOM TOM navigācijas sistēma', '1660', '20', '72801'], ['po02463', 'Ātrumtures sistēma (Cruise control)', '290', '20', '02463'], ['po14522', 'ACC (Adaptive cruise control) – adaptīvā ātruma un attāluma uzturēšanas sistēma (tikai ar mehānisko pārnesumkārbu)', '1020', '20', '14522'], ['po76104po07196', 'Mechaninis oro kondicionierius ( 1,300) + 170 cm3 kompresorius oro kondicionieriui ( 400)', '1820', '20', '76104+07196'], ['po06650po07196', 'Automatinė klimato kontrolė ( 1,600) + 170 cm3 kompresorius oro kondicionieriui ( 400)', '2140', '20', '06650+07196'], ['po06890', 'Rūpnīcas signalizācija ar atslēgā integrētu tālvadību', '270', '20', '06890'], ['po05407', 'Smēķētāja pakete (izņemams pelnu trauks un piesmēķētājs)', '60', '20', '05407'], ['po02443', 'Ar dabīgo ādas stūri', '230', '20', '02443'], ['po04383', 'Elektriskā stāvbremze', '490', '20', '04383'], //31 ['po06628po08767', '3 kryptimis regul. šild. vairuotojo sėdynė su atlošo išlinkio reguliavimu + Šildoma vairuotojo sėdynė', '580', '20', '06628+08767'], ['po06628po08767po06644po00614', 'Vairuotojo ir keleivio šildomos sėdynės, keleivio atskira sėdynė', '680', '20', '06628+08767+06644+00614'], ['po00614', 'Vienvietė standartinė keleivio sėdynė', '-260', '20', '00614'], //['po04496', 'Saugos oro pagalvės vairuotojui ir keleiviui', '330', '30', '04496'], //34 ['po06784', 'Koka (līmēta saplākšņa) kravas nodalījuma grīdas apdare', '1050', '20', '6784'], ['po06767', '~270 grādu leņķī atveramas aizmugures durvis', '410', '20', '06767'], ['po20407', 'M+S padangos TYRES 225/65 R16 ON/SNOW', '180', '20', '20407'], //37 ['po79300','OPEN STORAGE + USB','60', '20', '79300'], ['po72619','2 ADJ. STEERING WHEEL','110', '20', '72619'], ['po72623','TFT CLUSTER KM/H','250', '20', '72623'], //40 ['po72811', 'CROSSWIND (CWA) – automobiļa stabilitātes nodrošināšana, ja pūš stiprs sānu vējš', '210', '20', '72811'], ['po75681','Komunikācijas funkciju bloks','610', '20', '75681'], ['po72803',"ACC (Adaptive cruise control) – adaptīvā ātruma un attāluma uzturēšanas sistēma + QUEUE ASSIST – rindā stāvēšanas palīgsistēma (tikai ar HI-MATIC)",'1130','20','72803'], ['po76104','Mehāniskais kabīnes gaisa kondicionieris','1400','20','76104'], ['po06650','Automātiskais kabīnes gaisa kondicionieris','1720','20','06650'], //45 ['po01902','Elektriskā stāvbremze un glabāšanas nodalījums vadītāja sēdekļa labajā pusē','570','20','01902'], ['po77742','Rokturi pie priekšējo durvju statņiem ērtākai iekāpšanai kabīnē','100','20','77742'], ['po06628','Apsildāms vadītāja sēdeklis ar roku balstu labajā pusē. Regulējams slīpuma leņķis, augstums, garenvirziens, atzveltnes stāvoklis un izliekums. Atbilstoši vadītāja svaram regulējama sēdekļa amortizācija','580','20','06628'], ['po08091','Vadītāja sēdeklis ar roku balstu labajā pusē. Regulējams slīpuma leņķis, augstums, garenvirziens, atzveltnes stāvoklis un izliekums','120','20','08091'], ['po06644','Apsildāms pasažiera sēdeklis ar roku balstu kreisajā pusē. Regulējams slīpuma leņķis, augstums, garenvirziens, atzveltnes stāvoklis un izliekums. Atbilstoši pasažiera svaram regulējama sēdekļa amortizācija','380','20','06644'], ['po72894','Pasažiera sēdeklis ar roku balstu kreisajā pusē. Regulējams slīpuma leņķis, augstums, garenvirziens, atzveltnes stāvoklis un izliekums. Atbilstoši pasažiera svaram regulējama sēdekļa amortizācija','140','20','72894'], ['po75082','Neregulējams dubultais sēdeklis pasažieriem ar atliecamu galdiņu un mantu glabāšanas kasti zem sēdekļa','200','20','75082'], ['po04496','Priekšējais drošības gaisa spilvens pasažieriem','330','20','04496'], ['po06627','Vadītāja sēdeklis ar roku balstu labajā pusē. Regulējams slīpuma leņķis, augstums, garenvirziens, atzveltnes stāvoklis un izliekums. Atbilstoši autovadītāja svaram regulējama sēdekļa amortizācija','420','20','06627'], ['po20737','M+S Riepas 225/65R16 FOUR SEASON','260','20','20737'], ['po','','','30',''], ['po00262','Komfortabls apsildāms vadītāja sēdeklis ar poliuretāna putām, rokturi un pēc vadītāja svara regulējamu sēdekļa amortizāciju','580','20','00262'], ['po00267','Komfortabls pasažiera sēdeklis ar poliuretāna putām, rokturi un pēc vadītāja svara regulējamu sēdekļa amortizāciju','140','20','00267'], ['po00272','Komfortabls apsildāms pasažiera sēdeklis ar poliuretāna putām, rokturi un pēc vadītāja svara regulējamu sēdekļa amortizāciju','380','20','00272'], ['po79297','Sēdekļu galvas balsti ar tekstila pārvalkiem','110','20','79297'], ['po08728','Ar audumu klāti galvas balsti','810','20','08728'], ['po01012', 'Aizmugures videokamera', '310', '20', '01012'], ['po06344', 'Aizmugurējie parkošanās sensori', '440', '20', '06344'], ['po20408', 'Ziemas riepas 235/65 R16 ON SNOW', '260', '20', '20408'], ['po00317','Amazon Alexa asistents automašīnas vadīšanai ar balsi ','200', '20', '00317'], ['po14864+','Bez riepu remonta komplekta (gaisa kompresors un hermētiķis)','20', '20', '14864+'] ] var po8 = false; var cpo = []; //var navigantion = ['link-baz-par', 'link-kom-pak', 'link-pap-ira', 'link-spalva', 'link-garan', 'link-finans', 'link-patv', 'link-uzk-pat']; var color = [ ['balta', 'Balta', '0','0'], ['melyna', 'ZILA', '0','0'], ['raudona','SARKANA','0','0'], ['pilka','PELĒKA','0','0'], ['oranzine','ORANŽA','0','0'], ['juoda','MELNA BLACK TO BLACK','400','30']]; var ccolor = 'balta'; var miestas = ['vilnius', 'kaunas', 'klaipeda', 'siauliai', 'panevezys']; var ltmiestas = ['Vilnius', 'Kaunas', 'Klaipėda', 'Šiauliai', 'Panevėžys']; var cmiestas = ''; var jbasicpricestandart = '45590'; var jbasicprice = '45590'; var jstockequipmentprice = '380'; var jbasicaddon = '0'; var jbasicdiscount = '20'; var jbassicdiscount2 = '24.5'; var jbassicmarza = '3540'; var jtotalprice = Number(jbasicprice) + Number(jbasicaddon); var jtotaldiscountprice = '0'; var jkaina = '30332'; var jminusprice = '0'; var qdaily = true; var po08651m = false; var po06650po07196m = false; var po76104po07196m = false; var po72801m = false; var po02463m = false; var po76104m = false; var po06650m = false; var po06628m = false; var discountprice = 0; // 79300 - OPEN STORAGE + USB (EUR 50.00) // 72619 - 2 ADJ. STEERING WHEEL (EUR 100.00) // 72623 - TFT CLUSTER KM/H (EUR 150.00) //Combo prices are for engines, m3 and gear type picks, they may change according to combo pick function setComboPricesInView(arr) { arr.forEach(function(e) { $('#'+e[0] + '-price').text(e[4].comboPrice); }) } function resetComboPrice(arr) { arr.forEach(function(e) { e[4].comboPrice = 0; e[4].comboPriceAfterDiscount = 0; e[4].comboDiscountPrice = 0; }); } function calculateComboPrices(arr) { arr.forEach(function(e) { e[4].comboPrice = Number(percentagedisc(jbasicdiscount, e[2])) + Number(e[4].extraMargin); e[4].comboPriceAfterDiscount = Number(percentagedisc(jbasicdiscount, e[2])) - Number(percentage(jbassicdiscount2, e[2])) + Number(e[4].extraMargin) e[4].comboDiscountPrice = 0; //e[4].comboMockPrice = }); setComboPricesInView(arr); } function discountsum(){ var comboElements = akdd.concat(abpv).concat(abpg); resetComboPrice(comboElements); if(ckdd == 'm9' && cbpv == 'hp120' && cbpg == 'mech'){ jbassicdiscount2 = '24.5'; jbassicmarza = '2700'; jkaina = '30632'; } else if(ckdd == 'm12' && cbpv == 'hp120' && cbpg == 'mech'){ jbassicdiscount2 = '25.5'; jbassicmarza = '3000'; jkaina = '30831'; } else if(ckdd == 'm16' && cbpv == 'hp120' && cbpg == 'mech'){ jbassicdiscount2 = '25.5'; jbassicmarza = '3000'; jkaina = '31648'; } else if(ckdd == 'm9' && cbpv == 'hp140' && cbpg == 'mech'){ jbassicdiscount2 = '25.5'; jbassicmarza = '2700'; jkaina = '31049'; } else if(ckdd == 'm12' && cbpv == 'hp140' && cbpg == 'mech') { jbassicdiscount2 = '26.5'; jbassicmarza = '3000'; jkaina = '31219'; } else if(ckdd == 'm16' && cbpv == 'hp140' && cbpg == 'mech'){ jbassicdiscount2 = '26.5'; jbassicmarza = '3000'; jkaina = '32021'; } else if(ckdd == 'm9' && cbpv == 'hp140' && cbpg == 'auto'){ jbassicdiscount2 = '24'; jbassicmarza = '2700'; jkaina = '33156'; } else if(ckdd == 'm12' && cbpv == 'hp140' && cbpg == 'auto'){ jbassicdiscount2 = '25'; jbassicmarza = '3000'; jkaina = '33320'; } else if(ckdd == 'm16' && cbpv == 'hp140' && cbpg == 'auto'){ jbassicdiscount2 = '25'; jbassicmarza = '3000'; jkaina = '34145'; } else if(ckdd == 'm9' && cbpv == 'hp160' && cbpg == 'mech'){ jbassicdiscount2 = '25.5'; jbassicmarza = '2700'; jkaina = '31812'; } else if(ckdd == 'm12' && cbpv == 'hp160' && cbpg == 'mech'){ jbassicdiscount2 = '26.5'; jbassicmarza = '3000'; jkaina = '31968'; } else if(ckdd == 'm16' && cbpv == 'hp160' && cbpg == 'mech'){ jbassicdiscount2 = '26.5'; jbassicmarza = '3000'; jkaina = '32770'; } else if(ckdd == 'm9' && cbpv == 'hp160' && cbpg == 'auto'){ jbassicdiscount2 = '24'; jbassicmarza = '2700'; jkaina = '33940'; } else if(ckdd == 'm12' && cbpv == 'hp160' && cbpg == 'auto'){ jbassicdiscount2 = '25'; jbassicmarza = '3000'; jkaina = '34090'; } else if(ckdd == 'm16' && cbpv == 'hp160' && cbpg == 'auto'){ jbassicdiscount2 = '25'; jbassicmarza = '3000'; jkaina = '34915'; } else { jbassicdiscount2 = '24.5'; } calculateComboPrices(comboElements); basicdiscount(); calculateaddon(); } function basicdiscount(){ //36560 if(jbasicdiscount > 0) { nuolaida = Number(jbasicdiscount) + Number(jbassicdiscount2); normalPriceWithoutMargin = Number(percentagedisc(nuolaida, jbasicprice)) + Number(percentagedisc(jbasicdiscount, jstockequipmentprice)) normalPriceShow = normalPriceWithoutMargin + Number(jbassicmarza); show = jkaina; //jbasicprice = Number(percentagedisc(jbasicdiscount, jbasicprice)) + Number(percentage(jbassicdiscount2, jbasicprice)) + Number(2500) + Number(300); //discountprice = Number(percentage(jbasicdiscount, jbasicpricestandart)) + Number(percentage(jbassicdiscount2, jbasicpricestandart)); //discountprice = jbasicdiscount; jtotalprice = Number(percentagedisc(jbasicdiscount, jbasicpricestandart)) - Number(percentage(jbassicdiscount2, jbasicpricestandart)) + Number(percentagedisc(jbasicdiscount, jstockequipmentprice)) - Number(percentage(jbassicdiscount2, jstockequipmentprice)) + Number(jbassicmarza); jtotalprice = jkaina; jtotaldiscountprice = jtotalprice; disc = Number(normalPriceShow - show); //disc = Number(percentage(jbassicdiscount2, jbasicpricestandart)); $('#jbasic-price').html(jkaina.toLocaleString() + ' EUR'); $('#jbasic-price2').html(jkaina.toLocaleString() + ' EUR'); $('#jtotal-price').html(jkaina.toLocaleString() + ' EUR*'); $('#jtotal-price2').html(jkaina.toLocaleString() + ' EUR'); $('#jtotal-price2').html(jkaina.toLocaleString() + ' EUR'); $('#jtotal-price3').html(jkaina.toLocaleString() + ' EUR'); $('#jbasic-discount').html(disc.toLocaleString() + ' EUR'); $('#jbasic-discount2').html(disc.toLocaleString() + ' EUR'); //$('#jdiscount-price').html(discountprice.toLocaleString() + ' EUR'); } } function discount(){ $.each(akp, function( index, value ) { if(value[3] > 0){ if(jbassicdiscount2 > 0){ $('#' + value[0] + '-price').html(percentagedisc(Number(value[3])+Number(jbassicdiscount2), value[2] )+" EUR") } else { $('#' + value[0] + '-price').html(percentagedisc(value[3], value[2])+" EUR"); } } }); $.each(po, function( index, value ) { if(value[3] > 0){ $('#'+value[0]+'-price').html(percentagedisc(Number(value[3])+Number(jbassicdiscount2), value[2])+" EUR"); } }); $.each(abpv, function( index, value ) { if(value[3] > 0){ $('#'+value[0]+'-price').html(percentagedisc(Number(value[3])+Number(jbassicdiscount2), value[2])+" EUR"); } }); $.each(akdd, function( index, value ) { if(value[3] > 0){ $('#'+value[0]+'-price').html(percentagedisc(Number(value[3])+Number(jbassicdiscount2), value[2])+" EUR"); } }); $.each(abpg, function( index, value ) { if(value[3] > 0){ $('#'+value[0]+'-price').html(percentagedisc(Number(value[3])+Number(jbassicdiscount2), value[2])+" EUR"); } }); $.each(color, function( index, value ) { if(value[3] > 0){ $('#'+value[0]+'-price').html(percentagedisc(Number(value[3])+Number(jbassicdiscount2), value[2])+" EUR"); } }); } function percentage(percent, total) { return ((percent/ 100) * total).toFixed(0) } function percentagedisc(percent, total) { per = 100 - percent return (per * total / 100).toFixed(0) } function calculateaddon(){ discountprice = 0; if(jbasicdiscount > 0) { discountprice = disc; //Number(show - totalprice) basicTotalPrice = Number(percentagedisc(jbasicdiscount, jbasicpricestandart)) - Number(percentage(jbassicdiscount2, jbasicpricestandart)) + Number(percentagedisc(jbasicdiscount, jstockequipmentprice)) - Number(percentage(jbassicdiscount2, jstockequipmentprice)) + Number(jbassicmarza); basicTotalPrice = jkaina; //discountprice = Number(show - basicTotalPrice); } turis = calculateaddonsum(ckdd, akdd); variklis = calculateaddonsum(cbpv, abpv); deze = calculateaddonsum(cbpg, abpg); //var jComboAddon = Number(turis) + Number(variklis) + Number(deze); var jComboAddon = 0; jbasicaddon = jComboAddon jtotalprice = Number(jtotaldiscountprice) + Number(jbasicaddon); jtotalprice = Number(jkaina); var jComboAddonMockPrice = (Number(jtotalprice) - jkaina); var jComboPrice = 0; //$.each(akdd, function (index, value) { // if(value[0] == ckdd){ // jComboPrice += value[4].comboPrice; // var localTotalPrice = Number(jtotaldiscountprice) + Number(turis); // var localComboAddonMockPrice = (Number(localTotalPrice) - jkaina); // value[4].salesPrice = localComboAddonMockPrice; // } //}); //$.each(abpv, function (index, value) { // if(value[0] == cbpv){ // jComboPrice += value[4].comboPrice; // var localTotalPrice = Number(jtotaldiscountprice) + Number(variklis); // var localComboAddonMockPrice = (Number(localTotalPrice) - jkaina); // value[4].salesPrice = localComboAddonMockPrice; // } //}); //$.each(abpg, function (index, value) { // if(value[0] == cbpg){ // jComboPrice += value[4].comboPrice; // var localTotalPrice = Number(jtotaldiscountprice) + Number(deze); // var localComboAddonMockPrice = (Number(localTotalPrice) - jkaina); // value[4].salesPrice = localComboAddonMockPrice; // } //}); var comboExtraDiscount = jComboAddon - jComboAddonMockPrice; var comboExtraDiscount2 = jComboPrice - jComboAddonMockPrice; paketas = calculateaddonsum(cgr, agr); //paketas = calculateaddonsum(ckp, akp); if(kpbussines){ paketas = Number(paketas) + Number(calculateaddonsum("BUSSINES", akp)); } if(kpbussinespremium){ paketas = Number(paketas) + Number(calculateaddonsum("BUSSINES-PREMIUM", akp)); } if(kpdelivery){ paketas = Number(paketas) + Number(calculateaddonsum("DELIVERY", akp)); } if(kpdeliveryplus){ paketas = Number(paketas) + Number(calculateaddonsum("DELIVERY-PLUS", akp)); } if(kpwinter){ paketas = Number(paketas) + Number(calculateaddonsum("WINTER", akp)); } if(kphidrive){ paketas = Number(paketas) + Number(calculateaddonsum("HI-DRIVE", akp)); } if(kpbussinesplus){ paketas = Number(paketas) + Number(calculateaddonsum("BUSSINES-PLUS", akp)); } if(kpbussinesexclusive){ paketas = Number(paketas) + Number(calculateaddonsum("BUSSINES-EXCLUSIVE", akp)); } if(kphidriveauto){ paketas = Number(paketas) + Number(calculateaddonsum("HI-DRIVE-AUTO", akp)); } if(kpevolution){ paketas = Number(paketas) + Number(calculateaddonsum("EVOLUTION", akp)); } if(kpconnecthimatic){ paketas = Number(paketas) + Number(calculateaddonsum("CONNECT-HI-MATIC", akp)); } if(kpconnectmanual){ paketas = Number(paketas) + Number(calculateaddonsum("CONNECT-MANUAL", akp)); } if(kpdeliveryurban){ paketas = Number(paketas) + Number(calculateaddonsum("DELIVERY-URBAN", akp)); } if(kpdeliveryregional){ paketas = Number(paketas) + Number(calculateaddonsum("DELIVERY-REGIONAL", akp)); } papildiniai = 0; $.each(cpo, function( index, value ) { papild = calculateaddonsum(value, po); papildiniai = Number(papildiniai) + Number(papild); }); spalva = calculateaddonsum(ccolor, color); //jtotalprice = Number(jtotaldiscountprice) + Number(jbasicaddon); jbasicaddon = jComboAddon + Number(paketas) + Number(papildiniai) + Number(jminusprice) + Number(spalva); jtotalprice = Number(jtotaldiscountprice) + Number(jbasicaddon); jbasicaddon -= comboExtraDiscount; discountprice += comboExtraDiscount2; $('#jbasic-addon').html(Math.round(jbasicaddon).toLocaleString() + ' EUR'); $('#jbasic-addon2').html(Math.round(jbasicaddon).toLocaleString() + ' EUR'); $('#jtotal-price').html(Math.round(jtotalprice).toLocaleString() + ' EUR*'); $('#jtotal-price2').html(jtotalprice.toLocaleString() + ' EUR'); var vat = Math.round(jtotalprice * 0.21); $('#jtotal-price2-vat').html(vat.toLocaleString() + ' EUR'); $('#jtotal-price2-with-vat').html((jtotalprice + vat).toLocaleString() + ' EUR'); $('#jtotal-price3').html(jtotalprice.toLocaleString() + ' EUR*'); $('#jbasic-discount').html(Math.round(discountprice).toLocaleString() + ' EUR'); $('#jbasic-discount2').html((discountprice).toLocaleString() + ' EUR'); } function findinpack(poitem){ var packtur = false; if(kpbussines && packcont('BUSSINES', akp, poitem)) { return true; } if(kpevolution && packcont('EVOLUTION', akp, poitem)) { return true; } if(kpconnecthimatic && packcont('CONNECT-HI-MATIC', akp, poitem)) { return true; } if(kpconnectmanual && packcont('CONNECT-MANUAL', akp, poitem)) { return true; } if(kpdeliveryurban && packcont('DELIVERY-URBAN', akp, poitem)) { return true; } if(kpdeliveryregional && packcont('DELIVERY-REGIONAL', akp, poitem)) { return true; } if(kpwinter && packcont('WINTER', akp, poitem)) { return true; } //if(kpbussines && packcont('BUSSINES', akp, poitem)) { return true; } //if(kpbussinespremium && packcont('BUSSINES-PREMIUM', akp, poitem)) { return true;} //if(kpdelivery && packcont('DELIVERY', akp, poitem)) { return true; } //if(kpdeliveryplus && packcont('DELIVERY-PLUS', akp, poitem)) { return true; } //if(kpwinter && packcont('WINTER', akp, poitem)) { return true; } //if(kphidrive && packcont('HI-DRIVE', akp, poitem)) { return true; } //if(kpbussinesplus && packcont('BUSSINES-PLUS', akp, poitem)) { return true; } //if(kpbussinesexclusive && packcont('BUSSINES-EXCLUSIVE', akp, poitem)) { return true; } //if(kphidriveauto && packcont('HI-DRIVE-AUTO', akp, poitem)) { return true; } return packtur; } function packcont(idel, mass, poitem){ var val = false; $.each(mass, function ( index, value) { if(idel == value[0]) { $.each(value[4], function (index, item) { if(item == poitem){ val = true; } }); } }); return val; } function modaltablepo(name, modalid) { var content = ''; var iscreated = false; var noneAreCheckedWithoutPack = true; $("input[name='"+name+"[]']").each(function () { var checked = $(this).is(':checked'); if ($(this).attr('id') === 'po08640') { } if (checked) { var vid = $(this).attr('id'); $.each(po, function (index, value) { if(value[0] == vid){ if(!findinpack(vid)) { noneAreCheckedWithoutPack = false; if(!iscreated){ if(modalid == 'modalvaziuokle'){ content = 'ŠASIJA
'; } else if(modalid == 'modalsviesos'){ content = 'ELEKTRĪBA UN GAISMAS
'; } else if(modalid == 'modalkabinosisore'){ content = 'KABĪNES ĀRPUSE
'; } else if(modalid == 'modalkabinosvidus'){ content = 'KABĪNES IEKŠPUSE
'; } else if(modalid == 'modalsedynes'){ content = 'SĒDEKĻI
'; } else if(modalid == 'modalkrovininedalis'){ content = 'KRAVAS NODALĪJUMS
'; } else if(modalid == 'modalpadangos'){ content = 'RIEPAS
'; } content = content + "" iscreated = true; } if(value[3] > 0){ numberd = percentagedisc(value[3], value[2]); content += ''; } else { //number = Number(value[2]); content += ''; } } } }); } }); if (noneAreCheckedWithoutPack) { content = "" + "
' + value[4] + '' + value[1] + '' + numberd + ' EUR
' + value[4] + '' + value[1] + '' + value[2] + ' EUR
"; $('#' + modalid).html(content); } if (iscreated) { content = content + ""; $('#' + modalid).html(content); } } function removepackcheck(){ //$.each(kp, function( index, value ) { // //$('#'+value).removeClass('active'); // $.each(akp, function ( index, value) { // $.each(value[4], function ( index, item) { // $('#'+item).prop( "checked", false ); // $('#'+item).prop("disabled", false); // // }); // }); //}); $('.extra-options input[type="checkbox"]').each(function() { $(this).prop("checked", false); $(this).prop("disabled", false); }); cpo = []; modaltablepo('vaziuoklebox', 'modalvaziuokle'); modaltablepo('sviesosbox', 'modalsviesos'); modaltablepo('kabinosisore', 'modalkabinosisore'); modaltablepo('kabinosvidus', 'modalkabinosvidus'); modaltablepo('sedynesbox', 'modalsedynes'); modaltablepo('krovinedalisbox', 'modalkrovininedalis'); modaltablepo('padangosbox', 'modalpadangos'); jminusprice = 0; if(cbpg == 'auto'){ $('#po14522').attr("disabled", true); } else { $('#po72803').attr("disabled", true); } } function calculateaddonsum(item, mass) { var number = 0; $.each(mass, function (index, value) { if(value[0] == item){ if (item == 'po14864' || item =='po14864+') { if(value[3] > 0){ if(jbassicdiscount2 > 0){ number = percentagedisc((Number(value[3])), value[2]); discountprice = Number(discountprice) + Number(percentage(Number(jbassicdiscount2), value[2])); } else { number = percentagedisc(value[3], value[2]); discountprice = Number(discountprice) + Number(percentage(value[3], value[2])); } } else { number = Number(value[2]); } } else if (item == 'po02210po00726' && (kpdeliveryurban || kpdeliveryregional)) { if(value[3] > 0){ if(jbassicdiscount2 > 0){ number = 0; discountprice = Number(discountprice) } else { number = 0; discountprice = Number(discountprice) } } else { number = Number(value[2]); } } else if((item == 'po06650po07196' || item == 'po76104po07196') && (kpbussines || kpbussinespremium)) { number = Number(value[2]) - 400; } else if (value[4] && value[4].comboPriceAfterDiscount >= 0) { number = Number(value[4].comboPriceAfterDiscount); discountprice = Number(discountprice) + Number(value[4].comboDiscountPrice); } else { if(value[3] > 0){ if(jbassicdiscount2 > 0){ number = percentagedisc((Number(value[3]) + Number(jbassicdiscount2)), value[2]); discountprice = Number(discountprice) + Number(percentage(Number(jbassicdiscount2), value[2])); } else { number = percentagedisc(value[3], value[2]); discountprice = Number(discountprice) + Number(percentage(value[3], value[2])); } } else { number = Number(value[2]); } } } }); return number; } function modaltableprice(item, mass, modalid){ $.each(mass, function (index, value) { if(value[0] == item){ if (value[4] && value[4].comboPriceAfterDiscount >= 0) { number = Number(value[4].comboPriceAfterDiscount); discountPrice = Number(discountprice) + Number(value[4].comboDiscountPrice); $('#modal' + modalid + 'desc').html(value[1]); $('#modal' + modalid + 'price').html(value[4].comboPriceAfterDiscount + ' EUR'); } else { $('#modal' + modalid + 'desc').html(value[1]); $('#modal' + modalid + 'price').html(value[2]+ ' EUR'); if(value[3] > 0){ if(jbassicdiscount2 > 0){ numberd = percentagedisc((Number(value[3]) + Number(jbassicdiscount2)), value[2]); $('#modal' + modalid + 'price').html(numberd+ ' EUR'); //discountprice = Number(discountprice) + Number(percentage(Number(jbassicdiscount2), value[2])); } else { numberd = percentagedisc(value[3], value[2]); $('#modal' + modalid + 'price').html(numberd+ ' EUR'); //discountprice = Number(discountprice) + Number(percentage(value[3], value[2])); } } else { //number = Number(value[2]); $('#modal' + modalid + 'price').html(value[2]+ ' EUR'); } } } }); } function poarray(item, del = false){ if(del == true){ if(jQuery.inArray(item, cpo) != -1) { cpo.splice($.inArray(item, cpo), 1); $('#jbasic-discount-last').html("0 EUR"); $('#jbasic-discount-last2').html("0 EUR"); } } else { if(jQuery.inArray(item, cpo) != -1) { } else { cpo.push(item); $('#jbasic-discount-last').html(calculateaddonsum(item, po) +" EUR"); $('#jbasic-discount-last2').html(calculateaddonsum(item, po) +" EUR"); } } } function checkpo(item){ $('#'+item).prop( "checked", true ); } function fancyclose(){ $('.modal').modal('hide'); $.fancybox.close() $('html, body').animate({ scrollTop: $('.link-uzk-pat').offset().top }, 2000); } window.onbeforeunload = function() { return "Your work will be lost."; }; window.history.forward(); function noBack() { window.history.forward(); } $( document ).ready(function() { $('#myLargeModalLabel').on('show.bs.modal', function(e) { window.location.hash = "modal"; }); $(window).on('hashchange', function (event) { if(window.location.hash != "#modal") { $('#myLargeModalLabel').modal('hide'); } }); $('#aprasymasModalCenter').on('show.bs.modal', function(e) { window.location.hash = "aprasymas"; }); $(window).on('hashchange', function (event) { if(window.location.hash != "#aprasymas") { $('#aprasymasModalCenter').modal('hide'); } }); $('#po72803').attr("disabled", true); discountsum(); //basicdiscount(); discount(); calculateComboPrices(akdd.concat(abpv).concat(abpg)); var fancyopen = false; $(document).ready(function() { $(".fancybox").fancybox({ fitToView: false, // won't shrink to fit in the viewport maxWidth: "90%", // need to explain? mobile : { clickSlide : "close" }, beforeShow : function(){fancyopen = true}, afterClose : function(){fancyopen = false}, }); }); $.fancyConfirm = function( opts ) { opts = $.extend( true, { title : 'Are you sure?', message : '', okButton : 'OK', noButton : 'Cancel', callback : $.noop, removeNoButton: false, }, opts || {} ); $.fancybox.open({ type : 'html', src : '
' + '

' + opts.title + '

' + '

' + opts.message + '

' + '

' + (opts.removeNoButton ? '' : '' + opts.noButton + '') + '' + '

' + '
', opts : { animationDuration : 350, animationEffect : 'material', modal : true, baseTpl : '', afterClose : function( instance, current, e ) { var button = e ? e.target || e.currentTarget : null; var value = button ? $(button).data('value') : 0; opts.callback( value ); } } }); } $( "#po14864" ).click(function() { var checked = $(this).is(':checked'); if(checked && !$('#po02210po00726').is(':checked')) { $.fancyConfirm({ title : "Pievienot preci", message : "

Rezerves ritenis ar stiprinājumu ārpusē aiz aizmugurējās ass starp rāmja sijām

", okButton : 'Jā', noButton : 'Nē', callback : function (value) { if (value) { $('#po02210po00726').attr("checked", "checked"); $('#po02210po00726').prop('checked', true); poarray('po02210po00726'); calculateaddon(); } else { //$("#test_confirm_rez").html("Maybe later."); $('#po14864').removeAttr('checked'); $('#po14864').prop('checked', false); poarray('po14864', true); calculateaddon(); } } }); // if(confirm('Pridėti prekę\n' + // '02210 ATSARGINIS RATAS (EUR 200.00)\n' + // '00726 16 MM MONTAVIMO PLOKŠTĖ (EUR 120.00)?')){ // $('#po02210po00726').attr("checked", "checked"); // poarray('po02210po00726'); // } } else if (checked) { if (kpdeliveryurban || kpdeliveryregional) { poarray('po14864+', true); } } else if (checked === false) { if (kpdeliveryurban || kpdeliveryregional) { poarray('po14864+'); } } }); $( "#po72813, #po72806, #po72805, #po02443, #po04383, #po14522, #po02443" ).click(function() { var checked = $(this).is(':checked'); if(checked) { if (!qdaily) { if (confirm('būtinas TFT (72623), kuris ateina su Q-Daily pack. Ar pridėti paketą?')) { //$(this).attr("checked", "checked"); if (!qdaily) { poarray('po79300'); poarray('po72619'); poarray('po72623'); qdaily = true; } } else { $(this).removeAttr('checked'); $(this).prop('checked', false); } } } }); $( "#po02210po00726" ).click(function() { var checked = $(this).is(':checked'); if(checked && !kpdeliveryregional && !kpdeliveryurban) { $.fancyConfirm({ title : "", message : "

Standartā ir instrumentu komplekts, vai vēlaties to atstāt?

", okButton : 'Jā', noButton : 'Nē', callback : function (value) { if (value) { if($('#po14864').is(':checked')) { $('#po14864').removeAttr('checked'); $('#po14864').prop('checked', false); if (kpdeliveryregional || kpdeliveryurban) { poarray('po14864+'); $('#po14864').prop('disabled', false); } else { poarray('po14864', true); } calculateaddon(); } } else { if(!$('#po14864').is(':checked')) { $('#po14864').attr("checked", "checked"); $('#po14864').prop('checked', true); poarray('po14864'); calculateaddon(); } //$("#test_confirm_rez").html("Maybe later."); } } }); // if(!confirm('Standarte yra Inflation kit ar norite pasilikti?')){ // $('#po14864').attr("checked", "checked"); // poarray('po14864'); // } } else if(checked && !kpdeliveryregional && !deliveryurban) { } else if (checked === false) { if (kpdeliveryregional || kpdeliveryurban) { $('#po14864').attr("checked", "checked"); $('#po14864').prop('checked', true); $('#po14864').attr("disabled", true); poarray('po14864+', true); } else { $('#po14864').prop('checked', false); $('#po14864').trigger('change'); $('#po14864').attr("disabled", false); } } }); $('#po77702').click(function(){ $('#po02308').prop("disabled", false); }); $('#po06628po08767po06644po00614').click(function(){ if($(this).is(':checked')) { $('#po00614').removeAttr('checked'); $('#po00614').prop('checked', false); $('#po00614').attr("disabled", true); poarray('#po00614', true); } else { $('#po00614').attr("disabled", false) } }); function twooptions(first, second){ var checked = $('#'+first).is(':checked'); if(checked) { if($('#'+second).is(':checked')){ $('#'+second).removeAttr('checked'); $('#'+second).prop('checked', false); $('#'+second).attr("disabled", false); $('#'+second).prop("disabled", false); poarray(second, true); } } } $('#po02308').click(function(){ twooptions('po02308', 'po77702'); }); $('#po77702').click(function(){ twooptions('po77702', 'po02308'); }); $('#po20737').click(function(){ twooptions('po20737', 'po20408'); }); $('#po20408').click(function(){ twooptions('po20408', 'po20737'); }); $('#po04383').click(function(){ twooptions('po04383', 'po01902'); }); $('#po01902').click(function(){ twooptions('po01902', 'po04383'); }); $('#po76104').click(function(){ if ($('#po06650').is(':checked') && (kpbussines)) { if(po[44][3] > 0){ if(jbassicdiscount2 > 0){ numberp = percentagedisc((Number(po[44][3]) + Number(jbassicdiscount2)), po[44][2]); //discountprice = Number(discountprice) + Number(percentage(Number(jbassicdiscount2), value[2])); } else { numberp = percentagedisc(po[44][3], po[44][2]); //discountprice = Number(discountprice) + Number(percentage(po[43][3], po[43][2])); } } else { numberp = Number(value[2]); } var d = numberp * 0.7; jminusprice = jminusprice + Number(d); } if ($('#po06650').is(':checked') && (kpconnectmanual || kpconnecthimatic || kpevolution)) { if(po[44][3] > 0){ if(jbassicdiscount2 > 0){ numberp = percentagedisc((Number(po[44][3]) + Number(jbassicdiscount2)), po[44][2]); } else { numberp = percentagedisc(po[44][3], po[44][2]); } } else { numberp = Number(value[2]); } var d = numberp * 0.7 * -1; jminusprice = jminusprice + Number(d); } else if ($('#po06650').prop('checked') === false && (kpconnectmanual || kpconnecthimatic || kpevolution)){ if (kpconnectmanual || kpconnecthimatic || kpevolution) { if(po[44][3] > 0){ if(jbassicdiscount2 > 0){ numberp = percentagedisc((Number(po[44][3]) + Number(jbassicdiscount2)), po[44][2]); } else { numberp = percentagedisc(po[44][3], po[44][2]); } } else { numberp = Number(value[2]); } var d = numberp * 0.7 * 1; po72801m = false; jminusprice = jminusprice + Number(d); $('#po06650').attr("disabled", true); $('#po06650').prop("checked", true); } } if(kpbussines){ $('#po76104').attr("disabled", true); } twooptions('po76104', 'po06650'); }); $('#po06650').click(function(){ if($(this).is(':checked')) { if ($('#po76104').is(':checked') && (kpbussines)) { if(po[44][3] > 0){ if(jbassicdiscount2 > 0){ numberp = percentagedisc((Number(po[44][3]) + Number(jbassicdiscount2)), po[44][2]); //discountprice = Number(discountprice) + Number(percentage(Number(jbassicdiscount2), value[2])); } else { numberp = percentagedisc(po[44][3], po[44][2]); //discountprice = Number(discountprice) + Number(percentage(po[43][3], po[43][2])); } } else { numberp = Number(value[2]); } var d = numberp * 0.7 * -1; po72801m = true; jminusprice = Number(jminusprice) + Number(d); } else if ($('#po76104').is(':checked') && (kpconnectmanual || kpconnecthimatic || kpevolution)) { if(po[44][3] > 0){ if(jbassicdiscount2 > 0){ numberp = percentagedisc((Number(po[44][3]) + Number(jbassicdiscount2)), po[44][2]); } else { numberp = percentagedisc(po[44][3], po[44][2]); } } else { numberp = Number(value[2]); } var d = numberp * 0.7; jminusprice = Number(jminusprice) + Number(d); $('#po76104').prop("checked", false); $('#po06650').attr("disabled", true); poarray("po76104", true); } } else if(kpbussines){ $('#po76104').prop("checked", true); $('#po76104').attr("disabled", true); if(po[44][3] > 0){ if(jbassicdiscount2 > 0){ numberp = percentagedisc((Number(po[44][3]) + Number(jbassicdiscount2)), po[44][2]); } else { numberp = percentagedisc(po[44][3], po[44][2]); } } else { numberp = Number(value[2]); } var d = numberp * 0.7; po72801m = false; jminusprice = jminusprice + Number(d); } twooptions('po06650', 'po76104'); }); $('#po79246').click(function(){ if ($('#po72801').is(':checked') && (kpbussines || kpevolution)) { if(po[21][3] > 0){ if(jbassicdiscount2 > 0){ numberp = percentagedisc((Number(po[21][3]) + Number(jbassicdiscount2)), po[21][2]); //discountprice = Number(discountprice) + Number(percentage(Number(jbassicdiscount2), value[2])); } else { numberp = percentagedisc(po[21][3], po[21][2]); //discountprice = Number(discountprice) + Number(percentage(po[43][3], po[43][2])); } } else { numberp = Number(value[2]); } var d = numberp * 0.7; po72801m = false; jminusprice = jminusprice + Number(d); } if ($('#po72801').is(':checked') && (kpconnectmanual || kpconnecthimatic)) { if(po[22][3] > 0){ if(jbassicdiscount2 > 0){ numberp = percentagedisc((Number(po[22][3]) + Number(jbassicdiscount2)), po[22][2]); } else { numberp = percentagedisc(po[22][3], po[22][2]); } } else { numberp = Number(value[2]); } var d = numberp * 0.7 * -1; po72801m = false; jminusprice = jminusprice + Number(d); } else if ($('#po72801').prop('checked') === false && (kpconnectmanual || kpconnecthimatic)){ if (kpconnectmanual || kpconnecthimatic) { if(po[22][3] > 0){ if(jbassicdiscount2 > 0){ numberp = percentagedisc((Number(po[22][3]) + Number(jbassicdiscount2)), po[22][2]); } else { numberp = percentagedisc(po[22][3], po[22][2]); } } else { numberp = Number(value[2]); } var d = numberp * 0.7 * 1; po72801m = false; jminusprice = jminusprice + Number(d); $('#po72801').attr("disabled", true); $('#po72801').prop("checked", true); } } if(kpbussines || kpevolution){ $('#po79246').attr("disabled", true); } twooptions('po79246', 'po72801'); }); $('#po72801').click(function(){ if($(this).is(':checked')) { if ($('#po79246').is(':checked') && (kpbussines || kpevolution)) { if(po[21][3] > 0){ if(jbassicdiscount2 > 0){ numberp = percentagedisc((Number(po[21][3]) + Number(jbassicdiscount2)), po[21][2]); //discountprice = Number(discountprice) + Number(percentage(Number(jbassicdiscount2), value[2])); } else { numberp = percentagedisc(po[21][3], po[21][2]); //discountprice = Number(discountprice) + Number(percentage(po[43][3], po[43][2])); } } else { numberp = Number(value[2]); } var d = numberp * 0.7 * -1; po72801m = true; jminusprice = Number(jminusprice) + Number(d); } else if ($('#po79246').is(':checked') && (kpconnectmanual || kpconnecthimatic)) { if(po[22][3] > 0){ if(jbassicdiscount2 > 0){ numberp = percentagedisc((Number(po[22][3]) + Number(jbassicdiscount2)), po[22][2]); } else { numberp = percentagedisc(po[22][3], po[22][2]); } } else { numberp = Number(value[2]); } var d = numberp * 0.7; po72801m = true; jminusprice = Number(jminusprice) + Number(d); $('#po79246').prop("checked", false); $('#po72801').attr("disabled", true); poarray("po79246", true); } } else if(kpbussines || kpevolution){ $('#po79246').prop("checked", true); $('#po79246').attr("disabled", true); if(po[21][3] > 0){ if(jbassicdiscount2 > 0){ numberp = percentagedisc((Number(po[21][3]) + Number(jbassicdiscount2)), po[21][2]); } else { numberp = percentagedisc(po[21][3], po[21][2]); } } else { numberp = Number(value[2]); } var d = numberp * 0.7; po72801m = false; jminusprice = jminusprice + Number(d); } twooptions('po72801', 'po79246'); }); $('#po00262').click(function(){ //if ($('#po00267').is(':checked') && (kpwinter)) { // if(po[47][3] > 0){ // if(jbassicdiscount2 > 0){ // numberp = percentagedisc((Number(po[47][3]) + Number(jbassicdiscount2)), po[47][2]); // //discountprice = Number(discountprice) + Number(percentage(Number(jbassicdiscount2), value[2])); // } else { // numberp = percentagedisc(po[47][3], po[47][2]); // //discountprice = Number(discountprice) + Number(percentage(po[43][3], po[43][2])); // } // } else { // numberp = Number(value[2]); // } // var d = numberp * 0.7; // po72801m = false; // jminusprice = jminusprice + Number(d); //} if(kpwinter){ $('#po00262').attr("disabled", true); } }) $('#po00267').click(function(){ //if($(this).is(':checked')) { // if ($('#po00262').is(':checked') && (kpwinter)) { // if(po[21][3] > 0){ // if(jbassicdiscount2 > 0){ // numberp = percentagedisc((Number(po[47][3]) + Number(jbassicdiscount2)), po[47][2]); // //discountprice = Number(discountprice) + Number(percentage(Number(jbassicdiscount2), value[2])); // } else { // numberp = percentagedisc(po[47][3], po[47][2]); // //discountprice = Number(discountprice) + Number(percentage(po[47][3], po[47][2])); // } // } else { // numberp = Number(value[2]); // } // // var d = numberp * 0.7 * -1; // po72801m = true; // jminusprice = Number(jminusprice) + Number(d); // } //} else if(kpwinter){ // $('#po00262').prop("checked", true); // $('#po00262').attr("disabled", true); // if(po[47][3] > 0){ // if(jbassicdiscount2 > 0){ // numberp = percentagedisc((Number(po[47][3]) + Number(jbassicdiscount2)), po[47][2]); // } else { // numberp = percentagedisc(po[47][3], po[47][2]); // } // } else { // numberp = Number(value[2]); // } // var d = numberp * 0.7; // po72801m = false; // jminusprice = jminusprice + Number(d); //} }); $('#po02463').click(function(){ if(po02463m && cbpg == 'mech'){ if(po[23][3] > 0){ if(jbassicdiscount2 > 0){ numberp = percentagedisc((Number(po[23][3]) + Number(jbassicdiscount2)), po[23][2]); //discountprice = Number(discountprice) + Number(percentage(Number(jbassicdiscount2), value[2])); } else { numberp = percentagedisc(po[23][3], po[23][2]); //discountprice = Number(discountprice) + Number(percentage(po[43][3], po[43][2])); } } else { numberp = Number(value[2]); } var d = numberp * 0.7; po02463m = false; jminusprice = jminusprice + Number(d); } else if(po02463m && cbpg == 'auto') { if(po[23][3] > 0){ if(jbassicdiscount2 > 0){ numberp = percentagedisc((Number(po[23][3]) + Number(jbassicdiscount2)), po[23][2]); //discountprice = Number(discountprice) + Number(percentage(Number(jbassicdiscount2), value[2])); } else { numberp = percentagedisc(po[23][3], po[23][2]); //discountprice = Number(discountprice) + Number(percentage(po[43][3], po[43][2])); } } else { numberp = Number(value[2]); } var d = numberp * 0.7; po02463m = false; jminusprice = jminusprice + Number(d); } if(kpbussines || kpbussinespremium){ $('#po02463').attr("disabled", true); } twooptions('po02463', 'po72803'); twooptions('po02463', 'po14522'); }); $('#po14522').click(function(){ if($(this).is(':checked')) { if ($('#po02463').is(':checked') && (kpbussines || kpbussinespremium)) { if(po[23][3] > 0){ if(jbassicdiscount2 > 0){ numberp = percentagedisc((Number(po[23][3]) + Number(jbassicdiscount2)), po[23][2]); //discountprice = Number(discountprice) + Number(percentage(Number(jbassicdiscount2), value[2])); } else { numberp = percentagedisc(po[23][3], po[23][2]); //discountprice = Number(discountprice) + Number(percentage(po[43][3], po[43][2])); } } else { numberp = Number(value[2]); } var d = numberp * 0.7 * -1; po02463m = true; jminusprice = Number(jminusprice) + Number(d); } } else if(kpbussines || kpbussinespremium){ $('#po02463').prop("checked", true); $('#po02463').attr("disabled", true); if(po[23][3] > 0){ if(jbassicdiscount2 > 0){ numberp = percentagedisc((Number(po[23][3]) + Number(jbassicdiscount2)), po[23][2]); //discountprice = Number(discountprice) + Number(percentage(Number(jbassicdiscount2), value[2])); } else { numberp = percentagedisc(po[23][3], po[23][2]); //discountprice = Number(discountprice) + Number(percentage(po[43][3], po[43][2])); } } else { numberp = Number(value[2]); } var d = numberp * 0.7; po02463m = false; jminusprice = jminusprice + Number(d); } twooptions('po14522', 'po02463'); }); $('#po72803').click(function(){ if($(this).is(':checked')) { if ($('#po02463').is(':checked') && (kpbussinesplus || kpbussinesexclusive)) { if(po[23][3] > 0){ if(jbassicdiscount2 > 0){ numberp = percentagedisc((Number(po[23][3]) + Number(jbassicdiscount2)), po[23][2]); //discountprice = Number(discountprice) + Number(percentage(Number(jbassicdiscount2), value[2])); } else { numberp = percentagedisc(po[23][3], po[23][2]); //discountprice = Number(discountprice) + Number(percentage(po[43][3], po[43][2])); } } else { numberp = Number(value[2]); } var d = numberp * 0.7 * -1; po02463m = true; jminusprice = Number(jminusprice) + Number(d); } } else if(kpbussinesplus || kpbussinesexclusive){ $('#po02463').prop("checked", true); $('#po02463').attr("disabled", true); if(po[42][3] > 0){ if(jbassicdiscount2 > 0){ numberp = percentagedisc((Number(po[23][3]) + Number(jbassicdiscount2)), po[23][2]); //discountprice = Number(discountprice) + Number(percentage(Number(jbassicdiscount2), value[2])); } else { numberp = percentagedisc(po[23][3], po[23][2]); //discountprice = Number(discountprice) + Number(percentage(po[43][3], po[43][2])); } } else { numberp = Number(value[2]); } var d = numberp * 0.7; po02463m = false; jminusprice = jminusprice + Number(d); } twooptions('po72803', 'po02463'); }); $('#po76104po07196').click(function(){ if($(this).is(':checked')) { if ($('#po06650po07196').is(':checked') && kpbussinespremium) { var p = 1600; var d = p * 0.7 * -1; po76104po07196m = true; jminusprice = Number(jminusprice) + Number(d); } } else if(kpbussinespremium){ $('#po06650po07196').prop("checked", true); $('#po06650po07196').attr("disabled", true); var p = 1600; var d = p * 0.7; po76104po07196m = false; jminusprice = jminusprice + Number(d); } if(po06650po07196m){ var p = 1300; var d = p * 0.7; po76104po07196m = false; jminusprice = jminusprice + Number(d); } if(kpbussines){ $('#po76104po07196').attr("disabled", true); } twooptions('po76104po07196', 'po06650po07196'); }); $('#po06650po07196').click(function(){ if($(this).is(':checked')) { if ($('#po76104po07196').is(':checked') && kpbussines) { var p = 1300; var d = p * 0.7 * -1; po06650po07196m = true; jminusprice = Number(jminusprice) + Number(d); } } else if(kpbussines){ $('#po76104po07196').prop("checked", true); $('#po76104po07196').attr("disabled", true); var p = 1300; var d = p * 0.7; po06650po07196m = false; jminusprice = jminusprice + Number(d); } if(po76104po07196m){ var p = 1600; var d = p * 0.7; po06650po07196m = false; jminusprice = jminusprice + Number(d); } if(kpbussinespremium){ $('#po06650po07196').attr("disabled", true); } twooptions('po06650po07196', 'po76104po07196'); }); $('#po08650').click(function(){ if(po08651m){ if(po[8][3] > 0){ if(jbassicdiscount2 > 0){ numberp = percentagedisc((Number(po[8][3]) + Number(jbassicdiscount2)), po[8][2]); //discountprice = Number(discountprice) + Number(percentage(Number(jbassicdiscount2), value[2])); } else { numberp = percentagedisc(po[8][3], po[8][2]); //discountprice = Number(discountprice) + Number(percentage(po[43][3], po[43][2])); } } else { numberp = Number(value[2]); } var d = numberp * 0.7; po08651m = false; jminusprice = jminusprice + Number(d); } if(kpdelivery || kpdeliveryplus){ $('#po08650').attr("disabled", true); } twooptions('po08650', 'po08651'); }); $('#po08651').click(function(){ if($(this).is(':checked') && !$('#po72801').is(':checked')) { $.fancyConfirm({ title: "Nepieciešamās papildiekārtas", message: "

"+po[22][1]+"

", okButton: 'Jā', noButton: 'Nē', callback: function (value) { if (value) { $('#po72801').attr("checked", "checked"); $('#po72801').prop("checked", true); $('#po72801').attr("disabled", true); $('#po79245').prop("checked", false); $('#po79245').attr("disabled", true); poarray('po72801'); $("#po72801").trigger("change"); calculateaddon(); } else { $('#po08651').removeAttr('checked'); $('#po08651').prop('checked', false); poarray('po08651', true); if(kpdelivery || kpdeliveryplus){ $('#po08650').prop("checked", true); $('#po08650').attr("disabled", true); } calculateaddon(); } } }); } else { if ($('#po72801').is(':checked') && !$(this).is(':checked')) { $.fancyConfirm({ title: "Papildiekārta", message: "

" + po[22][1] + "

Vai vēlaties no tās atteikties?

", okButton: 'Jā', noButton: 'Nē', callback: function (value) { if (value) { $('#po72801').prop("checked", false); $('#po72801').attr("disabled", false); $('#po08651').prop("checked", false); $('#po08651').attr("disabled", false); poarray('po72801', true); $("#po08651").trigger("change"); calculateaddon(); } else { } } }); } $('#po79245').attr("disabled", false); $('#po72801').attr("disabled", false); if ($('#po08650').is(':checked') && (kpdelivery || kpdeliveryplus)) { if(po[8][3] > 0){ if(jbassicdiscount2 > 0){ numberp = percentagedisc((Number(po[8][3]) + Number(jbassicdiscount2)), po[8][2]); //discountprice = Number(discountprice) + Number(percentage(Number(jbassicdiscount2), value[2])); } else { numberp = percentagedisc(po[8][3], po[8][2]); //discountprice = Number(discountprice) + Number(percentage(po[43][3], po[43][2])); } } else { numberp = Number(value[2]); } var d = numberp * 0.7 * -1; po08651m = true; jminusprice = Number(jminusprice) + Number(d); } else if(kpdelivery || kpdeliveryplus){ $('#po08650').prop("checked", true); if(po[8][3] > 0){ if(jbassicdiscount2 > 0){ numberp = percentagedisc((Number(po[8][3]) + Number(jbassicdiscount2)), po[8][2]); //discountprice = Number(discountprice) + Number(percentage(Number(jbassicdiscount2), value[2])); } else { numberp = percentagedisc(po[8][3], po[8][2]); //discountprice = Number(discountprice) + Number(percentage(po[43][3], po[43][2])); } } else { numberp = Number(value[2]); } var d = numberp * 0.7; po08651m = false; jminusprice = jminusprice + Number(d); } twooptions('po08651', 'po08650'); } twooptions('po08651', 'po08650'); }); $('#po06628').click(function(){ if(po06628m){ if(po[47][3] > 0){ if(jbassicdiscount2 > 0){ numberp = percentagedisc((Number(po[47][3]) + Number(jbassicdiscount2)), po[47][2]); //discountprice = Number(discountprice) + Number(percentage(Number(jbassicdiscount2), value[2])); } else { numberp = percentagedisc(po[47][3], po[47][2]); //discountprice = Number(discountprice) + Number(percentage(po[43][3], po[43][2])); } } else { numberp = Number(value[2]); } var d = numberp * 0.7; po06628m = false; jminusprice = jminusprice + Number(d); poarray('po06628', true); } if(kpwinter){ poarray('po06628', true); $('#po06628').attr("disabled", true); } //1sedyne twooptions('po06628', 'po08091'); twooptions('po06628', 'po06627'); }); $('#po06627').click(function(){ //2 sedyne if($(this).is(':checked')) { if ($('#po06628').is(':checked') && kpwinter) { var p = po[47][2] if(po[47][3] > 0){ if(jbassicdiscount2 > 0){ numberp = percentagedisc((Number(po[47][3]) + Number(jbassicdiscount2)), po[47][2]); //discountprice = Number(discountprice) + Number(percentage(Number(jbassicdiscount2), value[2])); } else { numberp = percentagedisc(po[47][3], po[47][2]); //discountprice = Number(discountprice) + Number(percentage(po[43][3], po[43][2])); } } else { numberp = Number(value[2]); } var d = numberp * 0.7 * -1; po06628m = true; jminusprice = Number(jminusprice) + Number(d); } } else if(kpwinter){ $('#po06628').prop("checked", true); $('#po06628').attr("disabled", true); } if(po06628m){ if(po[47][3] > 0){ if(jbassicdiscount2 > 0){ numberp = percentagedisc((Number(po[47][3]) + Number(jbassicdiscount2)), po[47][2]); //discountprice = Number(discountprice) + Number(percentage(Number(jbassicdiscount2), value[2])); } else { numberp = percentagedisc(po[47][3], po[47][2]); //discountprice = Number(discountprice) + Number(percentage(po[43][3], po[43][2])); } } else { numberp = Number(value[2]); } var d = numberp * 0.7; po06628m = false; jminusprice = jminusprice + Number(d); poarray('po06628', true); } if(kpwinter){ $('#po06628').attr("disabled", true); } twooptions('po06627', 'po06628'); }); $('#po08091').click(function(){ //2 sedyne if($(this).is(':checked')) { if ($('#po06628').is(':checked') && kpwinter) { var p = po[47][2] if(po[47][3] > 0){ if(jbassicdiscount2 > 0){ numberp = percentagedisc((Number(po[47][3]) + Number(jbassicdiscount2)), po[47][2]); //discountprice = Number(discountprice) + Number(percentage(Number(jbassicdiscount2), value[2])); } else { numberp = percentagedisc(po[47][3], po[47][2]); //discountprice = Number(discountprice) + Number(percentage(po[43][3], po[43][2])); } } else { numberp = Number(value[2]); } var d = numberp * 0.7 * -1; po06628m = true; jminusprice = Number(jminusprice) + Number(d); } } else if(kpwinter){ $('#po06628').prop("checked", true); $('#po06628').attr("disabled", true); } if(po06628m){ if(po[47][3] > 0){ if(jbassicdiscount2 > 0){ numberp = percentagedisc((Number(po[47][3]) + Number(jbassicdiscount2)), po[47][2]); //discountprice = Number(discountprice) + Number(percentage(Number(jbassicdiscount2), value[2])); } else { numberp = percentagedisc(po[47][3], po[47][2]); //discountprice = Number(discountprice) + Number(percentage(po[43][3], po[43][2])); } } else { numberp = Number(value[2]); } var d = numberp * 0.7; po06628m = false; jminusprice = jminusprice + Number(d); poarray('po06628', true); } if(kpwinter){ $('#po06628').attr("disabled", true); } twooptions('po08091', 'po06628'); }); $('#po00272').click(function(){ if($(this).is(':checked') && !$('#po00262').is(':checked')) { $.fancyConfirm({ title: "Nepieciešamās papildiekārtas", message: "Komfortabls apsildāms vadītāja sēdeklis ar poliuretāna putām, rokturi un pēc vadītāja svara regulējamu sēdekļa amortizāciju", okButton: 'Jā', noButton: 'Nē', callback: function (value) { if (value) { if (!$('#po00262').is(':checked')) { $('#po00262').attr("checked", "checked"); $('#po00262').prop('checked', true); $('#po00262').attr("disabled", true); $("#po00262").trigger("click") $("#po00262").trigger("change"); poarray('po00262'); //if(kpwinter){ // poarray('po00262', true); //} //poarray('po08091', true); //if($('#po00267').is(':checked')){ // $('#po00267').prop('checked', false); // poarray('po00267', true); //} //if(!kpwinter){ // $('#po00267').attr('disabled', true); // $('#po00262').attr('disabled', true); //} //calculateaddon(); } else if ($('#po00262').is(':checked')) { $('#po00262').attr("disabled", true); } } else { $('#po00272').removeAttr('checked'); $('#po00272').prop('checked', false); $('#po00267').attr("disabled", false); poarray('po00272', true); if ($('#po70582').is(':checked')) { } calculateaddon(); } } }); } else if (!$(this).is(':checked') && $('#po00262').is(':checked')) { $('#po00262').attr("disabled", false); $('#po00267').attr("disabled", false); } else if ($(this).is(':checked') && $('#po00262').is(':checked')) { $('#po00262').attr("disabled", true); } if(kpwinter){ $('#po00262').attr("disabled", true); } if($(this).is(':checked')) { } //twooptions('po06644', 'po72894'); //twooptions('po06644', 'po75082'); calculateaddon(); }); $('#po06644').click(function(){ if($(this).is(':checked') && !$('#po06628').is(':checked')) { $.fancyConfirm({ title: "Nepieciešamās papildiekārtas", message: "

"+po[47][1]+"

", okButton: 'Jā', noButton: 'Nē', callback: function (value) { if (value) { $('#po06628').attr("checked", "checked"); $('#po06628').prop('checked', true); $('#po06628').attr("disabled", true); $('#po06627').attr("disabled", true); $("#po06628").trigger("change"); $('#po08091').prop('checked', false); $("#po08091").trigger("change"); poarray('po06628'); if(kpwinter){ poarray('po06628', true); } poarray('po08091', true); if($('#po06627').is(':checked')){ $('#po06627').prop('checked', false); poarray('po06627', true); } calculateaddon(); } else { $('#po06644').removeAttr('checked'); $('#po06644').prop('checked', false); poarray('po06644', true); calculateaddon(); } } }); } else if(!$(this).is(':checked')){ $('#po06628').attr("disabled", false); $('#po06627').attr("disabled", false); } if(kpwinter){ $('#po06628').attr("disabled", true); } if($(this).is(':checked')) { $('#po06627').attr("disabled", true); } twooptions('po06644', 'po72894'); twooptions('po06644', 'po75082'); }); $('#po72894').click(function(){ twooptions('po72894', 'po06644'); twooptions('po72894', 'po75082'); }); $('#po75082').click(function(){ twooptions('po75082', 'po00272'); twooptions('po75082', 'po00267'); if (!kpwinter) { $('#po00262').attr('disabled', false); } }); $('#po00267').click(function(){ twooptions('po00267', 'po00272'); twooptions('po00267', 'po75082'); if (!kpwinter) { $('#po00262').attr('disabled', false); } }); $('#po00272').click(function(){ twooptions('po00272', 'po00267'); twooptions('po00272', 'po75082'); }); $('#po72839').click(function(){ if($(this).is(':checked') && !$('#po72806').is(':checked')) { $.fancyConfirm({ title: "Nepieciešamās papildiekārtas", message: "

"+po[19][1]+"

Vai vēlaties to pievienot?

", okButton: 'Jā', noButton: 'Nē', callback: function (value) { if (value) { $('#po72806').attr("checked", "checked"); $('#po72806').prop("checked", true); $('#po72806').attr("disabled", true); $("#po72806").trigger("change"); poarray('po72806'); calculateaddon(); } else { $('#po72839').removeAttr('checked'); $('#po72839').prop('checked', false); poarray('po72839', true); calculateaddon(); } } }); } else if(!kphidrive){ $('#po72806').prop("disabled", false); } }); $('input[type="checkbox"]').change(function(){ var itemID = $(this).attr('id'); if($(this).is(':checked')){ if(itemID == 'po08650' && (kpdelivery || kpdeliveryplus)){ } else if(itemID == 'po06650po07196' && kpbussinespremium) { } else if(itemID == 'po14864' && (kpdeliveryregional || kpdeliveryurban)) { } else if(itemID == 'po06650' && (kpconnecthimatic || kpconnectmanual || kpevolution)) { } else if(itemID == 'po76104po07196' && kpbussines){ } else if(itemID == 'po76104' && (kpbussines)){ } else if(itemID == 'po79246' && (kpbussines || kpevolution)) { } else if(itemID == 'po72801' && (kpconnectmanual || kpconnecthimatic)) { } else if(itemID == 'po06628' && kpwinter){ } else if(itemID == 'po00262' && kpwinter){ } else if(itemID == 'po02463' && (kpbussines || kpbussinespremium || kpbussinesplus || kpbussinesexclusive)){ } else { poarray(itemID); } } else { poarray(itemID, true); } //Do something. calculateaddon(); modaltablepo('vaziuoklebox', 'modalvaziuokle'); modaltablepo('sviesosbox', 'modalsviesos'); modaltablepo('kabinosisore', 'modalkabinosisore'); modaltablepo('kabinosvidus', 'modalkabinosvidus'); modaltablepo('sedynesbox', 'modalsedynes'); modaltablepo('krovinedalisbox', 'modalkrovininedalis'); modaltablepo('padangosbox', 'modalpadangos'); }); $( ".spalva" ).click(function() { var idel = $(this).attr('id'); if(idel == 'kita'){ $('#'+idel).addClass('active'); $( ".spalva-add" ).each(function() { $( this ).removeClass( "hidden" ); }); } if(idel == 'balta'){ $('#kita').removeClass('active'); $( ".spalva-add" ).each(function() { $( this ).addClass( "hidden" ); }); } $.each(color, function( index, value ) { $('#'+value).removeClass('active'); }); $('#'+idel).addClass('active'); ccolor = idel; modaltableprice(ccolor, color, 'spalva'); calculateaddon(); }); $( ".nav-item" ).click(function() { var idel = $(this).attr('id'); // $.each(navigantion, function( index, value ) { // $('.'+value).addClass('hidden'); // }); // $('.'+idel).removeClass('hidden'); $( ".nav-item" ).each(function() { $( this ).removeClass( "active" ); }); $(this).addClass('active'); $('html, body').animate({ scrollTop: $('.'+idel).offset().top }, 2000); }); $( "#modal-link-baz-par, #modal-link-baz-par2, #modal-link-baz-par3" ).click(function() { $('.modal').modal('hide') $('html, body').animate({ scrollTop: $('.link-baz-par').offset().top }, 2000); }); $( "#modal-link-kom-pak" ).click(function() { $('.modal').modal('hide') $('html, body').animate({ scrollTop: $('.link-kom-pak').offset().top }, 2000); }); $( "#modal-link-pap-ira" ).click(function() { $('.modal').modal('hide') $('html, body').animate({ scrollTop: $('.link-pap-ira').offset().top }, 2000); }); $( "#modal-link-spalva" ).click(function() { $('.modal').modal('hide') $('html, body').animate({ scrollTop: $('.link-spalva').offset().top }, 2000); }); $( "#modal-link-garan" ).click(function() { $('.modal').modal('hide') $('html, body').animate({ scrollTop: $('.link-garan').offset().top }, 2000); }); $( "#modal-link-finans" ).click(function() { $('.modal').modal('hide') $('html, body').animate({ scrollTop: $('.link-finans').offset().top }, 2000); }); $( "#l-link-patv, #l-link-patv2" ).click(function() { $('html, body').animate({ scrollTop: $('.link-uzk-pat').offset().top }, 2000); }); //var lastScrollTop = 0; //$(window).scroll(function(){ // var st = $(this).scrollTop(); // var popup = $('.popup-bottom'); // setTimeout(function(){ // if (st > lastScrollTop){ // if($(window).width() < 992) { // popup.slideUp(); // } // } else { // if($(window).width() < 992) { // popup.slideDown(); // } // } // lastScrollTop = st; // }, 100); //}); var popup = $('.popup-bottom'); $(document).inactivity( { // options here timeout: 3000 }); var timeoutID; $(document).on("inactivity", function(){ // do something when a user is idle if($(window).width() < 1681) { var height = $(window).scrollTop(); var topp = $('.link-kom-pak').offset(); var bot = $('.link-spalva').offset(); if(height > topp.top && height < bot.top && !fancyopen) { clearTimeout(timeoutID); popup.slideDown(); } } }); $(document).on("activity", function(){ // do something when a user is active if($(window).width() < 1681) { var height = $(window).scrollTop(); var topp = $('.link-kom-pak').offset(); var bot = $('.link-spalva').offset(); if(height > topp.top && height < bot.top && !fancyopen) { if ($(window).width() > 991) { timeoutID = setTimeout(function () { popup.slideUp(); }, 5000); } else { timeoutID = setTimeout(function () { popup.slideUp(); }, 500); } } } }); $("#patvirtinimas, #patvirtinimas2").click(function (){ $.fancybox.open('

' + 'Apsveicam, Jūs esat izveidojis savu Iveco Daily.' + '

' + 'Ievadiet, lūdzu, savu kontaktinformāciju, lai ar Jums varētu sazināties Iveco pārstāvis, ar kuru pārrunāsiet galīgo konfigurāciju un iegādes nosacījumus.' + '

' + '

' + 'Ievadīt kontaktinformāciju' + '

'); }); $( ".kdd" ).click(function() { var idel = $(this).attr('id'); $.each(kdd, function( index, value ) { $('#'+value).removeClass('active'); }); $('#'+idel).addClass('active'); ckdd = idel; //$('#jbasic-discount-last').html(calculateaddonsum(ckdd, akdd) +" EUR"); //$('#jbasic-discount-last2').html(calculateaddonsum(ckdd, akdd) +" EUR"); discountsum(); modaltableprice(ckdd, akdd, 'kdd'); calculateaddon(); }); $( ".kdd" ).click(function() { var idel = $(this).attr('id'); $.each(kdd, function( index, value ) { $('#'+value).removeClass('active'); }); $('#'+idel).addClass('active'); ckdd = idel; //$('#jbasic-discount-last').html(calculateaddonsum(ckdd, akdd) +" EUR"); //$('#jbasic-discount-last2').html(calculateaddonsum(ckdd, akdd) +" EUR"); discountsum(); modaltableprice(ckdd, akdd, 'kdd'); calculateaddon(); }); $( ".miestas" ).click(function() { var idel = $(this).attr('id'); $.each(miestas, function( index, value ) { $('#'+value).removeClass('active'); }); $('#'+idel).addClass('active'); cmiestas = idel; ltmiestasatiduoti = ltmiestas[jQuery.inArray(idel, miestas)]; $('#modalmiestasdesc').html(ltmiestasatiduoti); }); $( ".bpv" ).click(function() { var idel = $(this).attr('id'); if(cbpg == 'auto' && idel == 'hp120') { $.fancybox.open('

Automātiskā pārnesumkārba ir iespējama tikai ar 140 un 160 HP motoriem. Izvēlieties citu motoru.

'); } else { $.each(bpv, function (index, value) { $('#' + value).removeClass('active'); }); $('#' + idel).addClass('active'); cbpv = idel; //$('#jbasic-discount-last').html(calculateaddonsum(cbpv, abpv) +" EUR"); //$('#jbasic-discount-last2').html(calculateaddonsum(cbpv, abpv) +" EUR"); discountsum(); modaltableprice(cbpv, abpv, 'bpv'); removepackcheck(); calculateaddon(); } }); $( ".bpg" ).click(function() { var idel = $(this).attr('id'); if(idel == 'auto' && cbpv == 'hp120'){ $.fancybox.open('

Automātiskā pārnesumkārba ir iespējama tikai ar 140 un 160 HP motoriem. Izvēlieties citu motoru.

'); } else { cbpg = idel; if (cbpg == 'auto') { $('#BUSSINES').removeClass('d-none').addClass('d-block'); $('#EVOLUTION').removeClass('d-none').addClass('d-block'); $('#CONNECT-HI-MATIC').removeClass('d-none').addClass('d-block'); //$('#BUSSINES-EXCLUSIVE').removeClass('d-none').addClass('d-block'); //$('#BUSSINES-PLUS').removeClass('d-none').addClass('d-block'); //$('#HI-DRIVE-AUTO').removeClass('d-none').addClass('d-block'); $('#CONNECT-MANUAL').removeClass('d-block').addClass('d-none'); $('#CONNECT-MANUAL').removeClass('active'); $('#BUSSINES-PREMIUM').removeClass('d-block').addClass('d-none'); $('#BUSSINES-PREMIUM').removeClass('active'); $('#HI-DRIVE').removeClass('d-block').addClass('d-none'); $('#HI-DRIVE').removeClass('active'); $('#v2g').removeClass('d-block').addClass('d-none'); $('#v3g').removeClass('d-block').addClass('d-none'); $('#v4g').removeClass('d-none').addClass('d-block'); $('#v5g').removeClass('d-none').addClass('d-block'); kpbussinespremium = false; kpbussinesplus = false; kpbussinesexclusive = false; kphidrive = false; connectmanual = false; $('#po14522').attr("disabled", true); $('#po72803').attr("disabled", false); //$('#jbasic-discount-last').html(calculateaddonsum(cbpg, abpg) +" EUR"); //$('#jbasic-discount-last2').html(calculateaddonsum(cbpg, abpg) +" EUR"); $("#v1").click(); //removepackcheck(); } else { $('#BUSSINES').removeClass('d-none').addClass('d-block'); $('#EVOLUTION').removeClass('d-none').addClass('d-block'); $('#CONNECT-MANUAL').removeClass('d-none').addClass('d-block'); //$('#BUSSINES-PREMIUM').removeClass('d-none').addClass('d-block'); //$('#HI-DRIVE').removeClass('d-none').addClass('d-block'); $('#CONNECT-HI-MATIC').removeClass('d-block').addClass('d-none'); $('#CONNECT-HI-MATIC').removeClass('active'); $('#BUSSINES-PLUS').removeClass('d-block').addClass('d-none'); $('#BUSSINES-EXCLUSIVE').removeClass('d-block').addClass('d-none'); $('#BUSSINES-PLUS').removeClass('active'); $('#BUSSINES-EXCLUSIVE').removeClass('active'); $('#HI-DRIVE-AUTO').removeClass('d-block').addClass('d-none'); $('#HI-DRIVE-AUTO').removeClass('active'); $('#v2g').removeClass('d-none').addClass('d-block'); $('#v3g').removeClass('d-none').addClass('d-block'); $('#v4g').removeClass('d-block').addClass('d-none'); $('#v5g').removeClass('d-block').addClass('d-none'); kpbussinespremium = false; kpbussinesplus = false; kpbussinesexclusive = false; kphidriveauto = false; kpconnecthimatic = false; $('#po14522').attr("disabled", false); $('#po72803').attr("disabled", true); //removepackcheck(); //$('#jbasic-discount-last').html(calculateaddonsum(cbpg, abpg) +" EUR"); //$('#jbasic-discount-last2').html(calculateaddonsum(cbpg, abpg) +" EUR"); $("#v1").click(); } $.each(bpg, function (index, value) { $('#' + value).removeClass('active'); }); $('#' + idel).addClass('active'); discountsum(); modaltableprice(cbpg, abpg, 'bpg'); calculateaddon(); } }); $( ".finans" ).click(function() { var idel = $(this).attr('id'); $.each(finans, function( index, value ) { $('#'+value).removeClass('active'); }); $('#'+idel).addClass('active'); if (idel === 'taip' && (cfinans === 'ne' || !cfinans)) { $.fancyConfirm({ title : "Uzmanību!", message : "

Kad pabeigsiet konfigurāciju, saņemsiet automašīnas piedāvājumu, kurā būs norāde uz jūsu izveidotās automašīnas līzinga kalkulatoru

", okButton : 'Ok', removeNoButton: true, }); } cfinans = idel; $('#modalfinansprice').html(cfinans); }); $( ".gr" ).click(function() { var idel = $(this).attr('id'); $.each(gr, function( index, value ) { $('#'+value).removeClass('active'); }); $('#'+idel).addClass('active'); cgr = idel; calculateaddon(); modaltableprice(cgr, agr, 'garantija') }); $( ".spausdinti" ).click(function() { var data2 = $('#modalbody').html(); var pazinesparinktys = $('#modalkdddesc').html(); var pdfbpv = $('#modalbpvdesc').html(); var pdfbpg = $('#modalbpgdesc').html(); var paketas = $('#modalpaketas').html(); var spalva = $('#modalspalvadesc').html(); var garantija = $('#modalgarantijadesc').html(); var finansavimas = $('#modalfinansprice').html(); //var miestas = $('#modalmiestasdesc').html(); var papildoma = $('#pdfpap').html(); var vaziuokle = $('#modalvaziuokle').html(); var sviesos = $('#modalsviesos').html(); var kabinosisore = $('#modalkabinosisore').html(); var kabinosvidus = $('#modalkabinosvidus').html(); var sedynes = $('#modalsedynes').html(); var krovininedalis = $('#modalkrovininedalis').html(); var padangos = $('#modalpadangos').html(); var kaina = $('#jtotal-price2').html(); var pvm = $('#jtotal-price2-vat').html(); var kainasupvm = $('#jtotal-price2-with-vat').html(); var iframe = { datapost: data2, bazpar: pazinesparinktys, bpv: pdfbpv, bpg: pdfbpg, pack: paketas, pap: papildoma, vaz: vaziuokle, light: sviesos, kabinosisore: kabinosisore, kabinosvidus: kabinosvidus, sedynes: sedynes, krovininedalis: krovininedalis, padangos: padangos, color: spalva, insurance: garantija, finans: finansavimas, //town: miestas, price: kaina, vat: pvm, pricewithvat: kainasupvm, preview: true }; fetch('request.php', { method: 'POST', // or 'PUT' headers: { 'Content-Type': 'application/json', }, body: JSON.stringify(iframe), }) .then(response => response.blob()) .then(response => { const blob = new Blob([response], {type: 'application/pdf'}); const downloadUrl = URL.createObjectURL(blob); const a = document.createElement("a"); a.href = downloadUrl; a.download = "Mans_IvecoDailyPromotion.pdf"; document.body.appendChild(a); a.click(); }) }); $( "#submitForm" ).click(function() { var data2 = $('#modalbody').html(); var ivardas = $('#inputvardas').val(); var ipavarde = $('#inputpavarde').val(); var iemail = $('#inputemail').val(); var iimone = $('#inputimone').val(); var ipareigos = $('#inputpareigos').val(); var itelnr = $('#inputtelnr').val(); var ikomentarai = $('#komentarai').val(); var pazinesparinktys = $('#modalkdddesc').html(); var pdfbpv = $('#modalbpvdesc').html(); var pdfbpg = $('#modalbpgdesc').html(); var paketas = $('#modalpaketas').html(); var spalva = $('#modalspalvadesc').html(); var garantija = $('#modalgarantijadesc').html(); var finansavimas = $('#modalfinansprice').html(); //var miestas = $('#modalmiestasdesc').html(); var papildoma = $('#pdfpap').html(); var vaziuokle = $('#modalvaziuokle').html(); var sviesos = $('#modalsviesos').html(); var kabinosisore = $('#modalkabinosisore').html(); var kabinosvidus = $('#modalkabinosvidus').html(); var sedynes = $('#modalsedynes').html(); var krovininedalis = $('#modalkrovininedalis').html(); var padangos = $('#modalpadangos').html(); var kaina = $('#jtotal-price2').html(); var pvm = $('#jtotal-price2-vat').html(); var kainasupvm = $('#jtotal-price2-with-vat').html(); var iframe = { datapost: data2, vardas: ivardas, pavarde: ipavarde, email: iemail, imone: iimone, pareigos: ipareigos, telnr: itelnr, komentarai: ikomentarai, submit: true, bazpar: pazinesparinktys, bpv: pdfbpv, bpg: pdfbpg, pack: paketas, pap: papildoma, vaz: vaziuokle, light: sviesos, kabinosisore: kabinosisore, kabinosvidus: kabinosvidus, sedynes: sedynes, krovininedalis: krovininedalis, padangos: padangos, color: spalva, insurance: garantija, finans: finansavimas, //town: miestas, price: kaina, vat: pvm, pricewithvat: kainasupvm, preview: false }; if(!ivardas){ $('#inputvardas').addClass('is-invalid'); } if(!ipavarde){ $('#inputpavarde').addClass('is-invalid'); } if(!iemail){ $('#inputemail').addClass('is-invalid'); } if(!itelnr){ $('#inputtelnr').addClass('is-invalid'); } if(!$('#checkboxpolicy').is(':checked')){ $('#checkboxpolicy').addClass('is-invalid'); } if($('#checkboxpolicy').is(':checked') && ivardas && ipavarde && iemail && itelnr) { fetch('request.php', { method: 'POST', // or 'PUT' headers: { 'Content-Type': 'application/json', }, body: JSON.stringify(iframe), }) .then(response => response.statusText) .then(response => { $.fancybox.open('

Jūsu pieprasījums ir iesniegts.

'); }) } }); $( ".kp" ).click(function() { var idel = $(this).attr('id'); if($(this).hasClass( 'active' )){ $(this).removeClass('active'); if(idel == "BUSSINES"){ kpbussines = false; if(po72801m){ if(po[21][3] > 0){ if(jbassicdiscount2 > 0){ numberp = percentagedisc((Number(po[21][3]) + Number(jbassicdiscount2)), po[21][2]); //discountprice = Number(discountprice) + Number(percentage(Number(jbassicdiscount2), value[2])); } else { numberp = percentagedisc(po[21][3], po[21][2]); //discountprice = Number(discountprice) + Number(percentage(po[43][3], po[43][2])); } } else { numberp = Number(value[2]); } var d = numberp * 0.7; po72801m = false; jminusprice = jminusprice + Number(d); } if(po02463m){ if(po[23][3] > 0){ if(jbassicdiscount2 > 0){ numberp = percentagedisc((Number(po[23][3]) + Number(jbassicdiscount2)), po[23][2]); //discountprice = Number(discountprice) + Number(percentage(Number(jbassicdiscount2), value[2])); } else { numberp = percentagedisc(po[23][3], po[23][2]); //discountprice = Number(discountprice) + Number(percentage(po[43][3], po[43][2])); } } else { numberp = Number(value[2]); } var d = numberp * 0.7; po02463m = false; jminusprice = jminusprice + Number(d); } if(po06650po07196m){ var p = 1300; var d = p * 0.7; var d = p * 0.7; po76104po07196m = false; jminusprice = jminusprice + Number(d); } } if(idel == "EVOLUTION") { kpevolution = false; if(po72801m){ if(po[21][3] > 0){ if(jbassicdiscount2 > 0){ numberp = percentagedisc((Number(po[21][3]) + Number(jbassicdiscount2)), po[21][2]); //discountprice = Number(discountprice) + Number(percentage(Number(jbassicdiscount2), value[2])); } else { numberp = percentagedisc(po[21][3], po[21][2]); //discountprice = Number(discountprice) + Number(percentage(po[43][3], po[43][2])); } } else { numberp = Number(value[2]); } var d = numberp * 0.7; po72801m = false; jminusprice = jminusprice + Number(d); } } if(idel == "CONNECT-MANUAL"){ kpconnectmanual = false; } if(idel == "CONNECT-HI-MATIC"){ kpconnecthimatic = false; } if(idel == "BUSSINES-PREMIUM"){ kpbussinespremium = false; } if(idel == "DELIVERY"){ kpdelivery = false; } if(idel == "DELIVERY-URBAN"){ kpdeliveryurban = false; } if(idel == "DELIVERY-REGIONAL"){ kpdeliveryregional = false; } if(idel == "DELIVERY-PLUS"){ kpdeliveryplus = false; } if(idel == "WINTER"){ kpwinter = false; $('#po06644').prop('checked', false); poarray('po06644',1); } if(idel == "HI-DRIVE"){ kphidrive = false; } if(idel == "BUSSINES-PLUS"){ kpbussinesplus = false; if(po72801m){ if(po[21][3] > 0){ if(jbassicdiscount2 > 0){ numberp = percentagedisc((Number(po[21][3]) + Number(jbassicdiscount2)), po[21][2]); //discountprice = Number(discountprice) + Number(percentage(Number(jbassicdiscount2), value[2])); } else { numberp = percentagedisc(po[21][3], po[21][2]); //discountprice = Number(discountprice) + Number(percentage(po[43][3], po[43][2])); } } else { numberp = Number(value[2]); } var d = numberp * 0.7; po72801m = false; jminusprice = jminusprice + Number(d); } } if(idel == "BUSSINES-EXCLUSIVE"){ kpbussinesexclusive = false; } if(idel == "HI-DRIVE-AUTO"){ kphidriveauto = false; } if(idel == "EVOLUTION"){ kphevolution = false; } if(idel == "CONNECT-HI-MATIC"){ kphconnecthimatic = false; } if(idel == "CONNECT-MANUAL"){ kphconnectmanual = false; } $('#jbasic-discount-last').html("0 EUR"); $('#jbasic-discount-last2').html("0 EUR"); } else { removepackcheck(); $('#'+idel).addClass('active'); if(idel == "BUSSINES"){ kpbussines = true; kpbussinespremium = false; kpbussinesexclusive = false; kpbussinesplus = false; kpevolution = false; kpconnecthimatic = false; kpconnectmanual = false; $('#BUSSINES-PREMIUM').removeClass('active'); $('#BUSSINES-EXCLUSIVE').removeClass('active'); $('#BUSSINES-PLUS').removeClass('active'); $('#EVOLUTION').removeClass('active'); $('#CONNECT-HI-MATIC').removeClass('active'); $('#CONNECT-MANUAL').removeClass('active'); if($('#po72801').is(':checked')){ if(po[21][3] > 0){ if(jbassicdiscount2 > 0){ numberp = percentagedisc((Number(po[21][3]) + Number(jbassicdiscount2)), po[21][2]); //discountprice = Number(discountprice) + Number(percentage(Number(jbassicdiscount2), value[2])); } else { numberp = percentagedisc(po[21][3], po[21][2]); //discountprice = Number(discountprice) + Number(percentage(po[43][3], po[43][2])); } } else { numberp = Number(value[2]); } var d = numberp * 0.7 * -1; po72801m = true; jminusprice = Number(jminusprice) + Number(d); } if($('#po02463').is(':checked')){ if(po[23][3] > 0){ if(jbassicdiscount2 > 0){ numberp = percentagedisc((Number(po[23][3]) + Number(jbassicdiscount2)), po[23][2]); //discountprice = Number(discountprice) + Number(percentage(Number(jbassicdiscount2), value[2])); } else { numberp = percentagedisc(po[23][3], po[23][2]); //discountprice = Number(discountprice) + Number(percentage(po[43][3], po[43][2])); } } else { numberp = Number(value[2]); } var d = numberp * 0.7 * -1; po02463m = true; jminusprice = Number(jminusprice) + Number(d); } if($('po06650po07196').is(':checked')){ var p = 1300; var d = p * 0.7 * -1; po76104po07196m = true; jminusprice = Number(jminusprice) + Number(d); } } if(idel == "BUSSINES-PREMIUM"){ kpbussines = false; kpbussinespremium = true; kpbussinesexclusive = false; kpbussinesplus = false; kpevolution = false; kpconnecthimatic = false; kpconnectmanual = false; $('#BUSSINES').removeClass('active'); $('#BUSSINES-EXCLUSIVE').removeClass('active'); $('#BUSSINES-PLUS').removeClass('active'); $('#EVOLUTION').removeClass('active'); $('#CONNECT-HI-MATIC').removeClass('active'); $('#CONNECT-MANUAL').removeClass('active'); } if(idel == "BUSSINES-EXCLUSIVE"){ kpbussines = false; kpbussinespremium = false; kpbussinesexclusive = true; kpbussinesplus = false; kpevolution = false; kpconnecthimatic = false; kpconnectmanual = false; $('#BUSSINES').removeClass('active'); $('#BUSSINES-PREMIUM').removeClass('active'); $('#BUSSINES-PLUS').removeClass('active'); $('#EVOLUTION').removeClass('active'); $('#CONNECT-HI-MATIC').removeClass('active'); $('#CONNECT-MANUAL').removeClass('active'); } if(idel == "BUSSINES-PLUS"){ kpbussines = false; kpbussinespremium = false; kpbussinesexclusive = false; kpbussinesplus = true; kpevolution = false; kpconnecthimatic = false; kpconnectmanual = false; $('#BUSSINES').removeClass('active'); $('#BUSSINES-PREMIUM').removeClass('active'); $('#BUSSINES-EXCLUSIVE').removeClass('active'); $('#EVOLUTION').removeClass('active'); $('#CONNECT-HI-MATIC').removeClass('active'); $('#CONNECT-MANUAL').removeClass('active'); if($('#po72801').is(':checked')){ if(po[21][3] > 0){ if(jbassicdiscount2 > 0){ numberp = percentagedisc((Number(po[21][3]) + Number(jbassicdiscount2)), po[21][2]); //discountprice = Number(discountprice) + Number(percentage(Number(jbassicdiscount2), value[2])); } else { numberp = percentagedisc(po[21][3], po[21][2]); //discountprice = Number(discountprice) + Number(percentage(po[43][3], po[43][2])); } } else { numberp = Number(value[2]); } var d = numberp * 0.7 * -1; po72801m = true; jminusprice = Number(jminusprice) + Number(d); } } if(idel == "EVOLUTION"){ kpevolution = true; kpbussines = false; kpbussinespremium = false; kpbussinesexclusive = false; kpbussinesplus = false; kpconnecthimatic = false; kpconnectmanual = false; $('#BUSSINES').removeClass('active'); $('#BUSSINES-PREMIUM').removeClass('active'); $('#BUSSINES-EXCLUSIVE').removeClass('active'); $('#BUSSINES-PLUS').removeClass('active'); $('#CONNECT-HI-MATIC').removeClass('active'); $('#CONNECT-MANUAL').removeClass('active'); if($('#po72801').is(':checked')){ if(po[21][3] > 0){ if(jbassicdiscount2 > 0){ numberp = percentagedisc((Number(po[21][3]) + Number(jbassicdiscount2)), po[21][2]); //discountprice = Number(discountprice) + Number(percentage(Number(jbassicdiscount2), value[2])); } else { numberp = percentagedisc(po[21][3], po[21][2]); //discountprice = Number(discountprice) + Number(percentage(po[43][3], po[43][2])); } } else { numberp = Number(value[2]); } var d = numberp * 0.7 * -1; po72801m = true; jminusprice = Number(jminusprice) + Number(d); } } if(idel == "CONNECT-HI-MATIC"){ kpconnecthimatic = true; kpevolution = false; kpbussines = false; kpbussinespremium = false; kpbussinesexclusive = false; kpbussinesplus = false; kpconnectmanual = false; $('#BUSSINES').removeClass('active'); $('#BUSSINES-PREMIUM').removeClass('active'); $('#BUSSINES-EXCLUSIVE').removeClass('active'); $('#BUSSINES-PLUS').removeClass('active'); $('#EVOLUTION').removeClass('active'); $('#CONNECT-MANUAL').removeClass('active'); } if(idel == "CONNECT-MANUAL"){ kpconnectmanual = true; kpconnecthimatic = false; kpevolution = false; kpbussines = false; kpbussinespremium = false; kpbussinesexclusive = false; kpbussinesplus = false; $('#BUSSINES').removeClass('active'); $('#BUSSINES-PREMIUM').removeClass('active'); $('#BUSSINES-EXCLUSIVE').removeClass('active'); $('#BUSSINES-PLUS').removeClass('active'); $('#EVOLUTION').removeClass('active'); $('#CONNECT-HI-MATIC').removeClass('active'); } if(idel == "DELIVERY"){ kpdelivery = true; kpdeliveryplus = false; $('#DELIVERY-PLUS').removeClass('active'); } if(idel == "DELIVERY-PLUS"){ kpdelivery = false; kpdeliveryplus = true; $('#DELIVERY').removeClass('active'); } if(idel == "DELIVERY-URBAN"){ kpdeliveryurban = true; kpdeliveryregional = false; $('#DELIVERY-REGIONAL').removeClass('active'); } if(idel == "DELIVERY-REGIONAL"){ kpdeliveryregional = true; kpdeliveryurban = false; $('#DELIVERY-URBAN').removeClass('active'); } if(idel == "WINTER"){ kpwinter = true; } if(idel == "HI-DRIVE"){ kphidrive = true; kphidriveauto = false; } if(idel == "HI-DRIVE-AUTO"){ kphidriveauto = true; kphidrive = false; } $('#jbasic-discount-last').html(calculateaddonsum(idel, akp) +" EUR"); $('#jbasic-discount-last2').html(calculateaddonsum(idel, akp) +" EUR"); } removepackcheck(); ckp = idel; $('#modalpaketas').html(""); if(kpbussines) { packchose('BUSSINES', akp); $('#modalpaketas').append($('#BUSSINES').html());} if(kpevolution) { packchose('EVOLUTION', akp); $('#modalpaketas').append($('#EVOLUTION').html());} if(kpconnecthimatic) { packchose('CONNECT-HI-MATIC', akp); $('#modalpaketas').append($('#CONNECT-HI-MATIC').html());} if(kpconnectmanual) { packchose('CONNECT-MANUAL', akp); $('#modalpaketas').append($('#CONNECT-MANUAL').html());} if(kpdeliveryurban) { packchose('DELIVERY-URBAN', akp); $('#modalpaketas').append($('#DELIVERY-URBAN').html());} if(kpdeliveryregional) { packchose('DELIVERY-REGIONAL', akp); $('#modalpaketas').append($('#DELIVERY-REGIONAL').html());} if(kpwinter) { packchose('WINTER', akp); $('#modalpaketas').append($('#WINTER').html());} $('#modalpaketas .kp-pick-indentifier').remove(); //if(kpbussinespremium) { packchose('BUSSINES-PREMIUM', akp); $('#modalpaketas').append($('#BUSSINES-PREMIUM').html());} //if(kpdelivery) { packchose('DELIVERY', akp); $('#modalpaketas').append($('#DELIVERY').html());} //if(kpdeliveryplus) { packchose('DELIVERY-PLUS', akp); $('#modalpaketas').append($('#DELIVERY-PLUS').html());} //if(kphidrive) { packchose('HI-DRIVE', akp); $('#modalpaketas').append($('#HI-DRIVE').html());} //if(kpbussinesplus) { packchose('BUSSINES-PLUS', akp); $('#modalpaketas').append($('#BUSSINES-PLUS').html());} //if(kpbussinesexclusive) { packchose('BUSSINES-EXCLUSIVE', akp); $('#modalpaketas').append($('#BUSSINES-EXCLUSIVE').html());} //if(kphidriveauto) { packchose('HI-DRIVE-AUTO', akp); $('#modalpaketas').append($('#HI-DRIVE-AUTO').html());} calculateaddon(); $('div#modalpaketas p').removeClass('pl-3 pr-3'); }); function packchose(idel, mass){ $.each(mass, function ( index, value) { if(idel == value[0]) { $.each(value[4], function (index, item) { $('#' + item).prop("checked", true); $('#' + item).prop("disabled", true); poarray(item, 1); }); } }); } $(".collapse.show").each(function(){ $(this).prev(".card-header").find(".fa").addClass("fa-angle-down").removeClass("fa-angle-right"); }); // Toggle right and down arrow icon on show hide of collapse element $(".collapse").on('show.bs.collapse', function(){ $(this).prev(".card-header").find(".fa").removeClass("fa-angle-right").addClass("fa-angle-down"); }).on('hide.bs.collapse', function(){ $(this).prev(".card-header").find(".fa").removeClass("fa-angle-down").addClass("fa-angle-right"); }); function closeimg(item, click){ if($(window).width() < 990) $(click).trigger( "click" ); if($(window).width() < 990) { window.setTimeout(function(){ $(item).unbind('mouseenter'); $(item).css("display", "none"); }, 2000); } } function stopall() { $("#img9m3").stop(); $("#img12m3").stop(); $("#img16m3").stop(); $("#imghp120").stop(); $("#imghp140").stop(); $("#imghp160").stop(); $("#imgmechanine").stop(); $("#imgautomatine").stop(); } $("#m9").hover(function () { stopall(); //$("#img9m3").css("display", "inline-block"); // hide all product images $("#img9m3").fadeIn(); // hide all product images closeimg("#img9m3", "#m9"); }, function() { $("#img9m3").css("display", "none"); }); $("#m12").hover(function () { stopall(); $("#img12m3").fadeIn(); // hide all product images closeimg("#img12m3", "#m12"); }, function() { $("#img12m3").css("display", "none"); }); $("#m16").hover(function () { stopall(); $("#img16m3").fadeIn(); // hide all product images closeimg("#img16m3", "#m16"); }, function() { $("#img16m3").css("display", "none"); }); $("#hp120").hover(function () { stopall(); $("#imghp120").fadeIn(); // hide all product images closeimg("#imghp120", "#hp120"); }, function() { $("#imghp120").css("display", "none"); }); $("#hp140").hover(function () { stopall(); $("#imghp140").fadeIn(); // hide all product images closeimg("#imghp140", "#hp140"); }, function() { $("#imghp140").css("display", "none"); }); $("#hp160").hover(function () { stopall(); $("#imghp160").fadeIn(); // hide all product images closeimg("#imghp160", "#hp160"); }, function() { $("#imghp160").css("display", "none"); }); $("#mech").hover(function () { stopall(); $("#imgmechanine").fadeIn(); // hide all product images closeimg("#imgmechanine", "#mech"); }, function() { $("#imgmechanine").css("display", "none"); }); $("#auto").hover(function () { stopall(); $("#imgautomatine").fadeIn(); // hide all product images closeimg("#imgautomatine", "#auto"); }, function() { $("#imgautomatine").css("display", "none"); }); $(window).scroll(function() { // Says this function is preformed continuisly while scrolling. var Scroll = $(window).scrollTop() + 200, // This variable finds the distance you have scrolled from the top. SectionOneOffset = $('.link-baz-par').offset().top, // This variable finds the distance between #section-one and the top. Replace #section-one with the ID of your section. SectionTwoOffset = $('.link-kom-pak').offset().top, // This variable finds the distance between #section-two and the top. Replace #section-two with the ID of your section. You can duplicate this for as many sections as you want. Section3Offset = $('.link-pap-ira').offset().top, // This variable finds the distance between #section-two and the top. Replace #section-two with the ID of your section. You can duplicate this for as many sections as you want. Section4Offset = $('.link-spalva').offset().top, // This variable finds the distance between #section-two and the top. Replace #section-two with the ID of your section. You can duplicate this for as many sections as you want. Section5Offset = $('.link-garan').offset().top, // This variable finds the distance between #section-two and the top. Replace #section-two with the ID of your section. You can duplicate this for as many sections as you want. Section6Offset = $('.link-finans').offset().top, // This variable finds the distance between #section-two and the top. Replace #section-two with the ID of your section. You can duplicate this for as many sections as you want. Section7Offset = $('.link-patv').offset().top, // This variable finds the distance between #section-two and the top. Replace #section-two with the ID of your section. You can duplicate this for as many sections as you want. Section8Offset = $('.link-uzk-pat').offset().top- Number(200); // This variable finds the distance between #section-two and the top. Replace #section-two with the ID of your section. You can duplicate this for as many sections as you want. if (Scroll >= SectionOneOffset) { // If you have scrolled past section one do this. $("#link-baz-par").addClass("active"); // Adds class of current-menu-item to the menu item with a class of menu-item-1 if($(window).width() < 992) $('#mobsticky').fadeIn(); } else { // If you have not scrolled section one do this. //$("#link-baz-par").removeClass("active"); // Removes class of current-menu-item to the menu item with a class of menu-item-1 if($(window).width() < 992) $('#mobsticky').fadeOut(); } if (Scroll >= SectionTwoOffset) { // If you have scrolled past section two do this.You can duplicate this for as many sections as you want. $("#link-kom-pak").addClass("active"); // Adds class of current-menu-item to the menu item with a class of menu-item-2 $("#link-baz-par").removeClass("active"); // Removes class of current-menu-item to the menu item with a class of menu-item-1 $("#link-pap-ira").removeClass("active"); // Removes class of current-menu-item to the menu item with a class of menu-item-1 } else { // If you have not scrolled section two do this. $("#link-kom-pak").removeClass("active"); // Removes class of current-menu-item to the menu item with a class of menu-item-2 } if (Scroll >= Section3Offset) { // If you have scrolled past section two do this.You can duplicate this for as many sections as you want. $("#link-pap-ira").addClass("active"); // Adds class of current-menu-item to the menu item with a class of menu-item-2 $("#link-kom-pak").removeClass("active"); // Removes class of current-menu-item to the menu item with a class of menu-item-1 $("#link-spalva").removeClass("active"); // Removes class of current-menu-item to the menu item with a class of menu-item-1 } if (Scroll >= Section4Offset) { // If you have scrolled past section two do this.You can duplicate this for as many sections as you want. $("#link-spalva").addClass("active"); // Adds class of current-menu-item to the menu item with a class of menu-item-2 $("#link-pap-ira").removeClass("active"); // Removes class of current-menu-item to the menu item with a class of menu-item-1 $("#link-garan").removeClass("active"); // Removes class of current-menu-item to the menu item with a class of menu-item-1 } if (Scroll >= Section5Offset) { // If you have scrolled past section two do this.You can duplicate this for as many sections as you want. $("#link-garan").addClass("active"); // Adds class of current-menu-item to the menu item with a class of menu-item-2 $("#link-finans").removeClass("active"); // Removes class of current-menu-item to the menu item with a class of menu-item-1 $("#link-spalva").removeClass("active"); // Removes class of current-menu-item to the menu item with a class of menu-item-1 } if (Scroll >= Section6Offset) { // If you have scrolled past section two do this.You can duplicate this for as many sections as you want. $("#link-finans").addClass("active"); // Adds class of current-menu-item to the menu item with a class of menu-item-2 $("#link-garan").removeClass("active"); // Removes class of current-menu-item to the menu item with a class of menu-item-1 $("#link-patv").removeClass("active"); // Removes class of current-menu-item to the menu item with a class of menu-item-1 } if (Scroll >= Section7Offset) { // If you have scrolled past section two do this.You can duplicate this for as many sections as you want. $("#link-patv").addClass("active"); // Adds class of current-menu-item to the menu item with a class of menu-item-2 $("#link-finans").removeClass("active"); // Removes class of current-menu-item to the menu item with a class of menu-item-1 $("#link-uzk-pat").removeClass("active"); // Removes class of current-menu-item to the menu item with a class of menu-item-1 } if (Scroll >= Section8Offset) { // If you have scrolled past section two do this.You can duplicate this for as many sections as you want. $("#link-uzk-pat").addClass("active"); // Adds class of current-menu-item to the menu item with a class of menu-item-2 $("#link-patv").removeClass("active"); // Removes class of current-menu-item to the menu item with a class of menu-item-1 } else { $("#link-uzk-pat").removeClass("active"); } }); });