window.onload = () => { if(window.jQuery){ checkall(); } } function checkall(){ $('#checkall').change(function(){ var checkboxes = $(this).closest('form').find('.checkall'); if($(this).prop('checked')) { checkboxes.prop('checked', true); } else { checkboxes.prop('checked', false); } }); $('#checkall2').change(function(){ var checkboxes = $(this).closest('form').find('.checkall2'); if($(this).prop('checked')) { checkboxes.prop('checked', true); } else { checkboxes.prop('checked', false); } }); } function sowdeletionbar(){ var referrals=$("input:checked[name^='ref']"); var refslist=referrals.length; var raction = $("#descr").val(); $("#priceref").hide(); $("#priceref2").hide(); $("#paybutton").hide(); $("#addfunds").hide(); if(refslist>0){ $("#rentedbar").show(); if(raction == "delete"){ var price = deletion_price*refslist; price = price.toFixed(3); var step1 = 'done'; } if(step1 == 'done'){ if(rental_balance >= price){ $("#priceref").html(totaltopay+": $"+price); $("#priceref").show(); $("#paybutton").show(); }else{ $("#priceref2").html(noenoughfunds); $("#priceref2").show(); } } }else{ $("#rentedbar").hide(); } } /* Allocate */ function calculatecredits(value){ var newvalue = $("#allocate").val()*value; $("#creditcost").val(newvalue); } function recalculatecredits(value){ var newvalue = $("#creditcost").val()/value; $("#allocate").val(newvalue); } /* Advertise */ function updatepack(){ specialid = $("#spackformlist").val(); specialtext = $("#spackformlist option[value="+specialid+"]").text(); var packlist = ""+specialtext+""; packlist += '