1 function pkg_changed () {
2 var form = document.OrderPkgForm;
3 var discountnum = form.discountnum;
4 var opt = form.pkgpart.options[form.pkgpart.selectedIndex];
6 usageprice_pkg_changed( opt.value );
8 if ( form.pkgpart.selectedIndex > 0 ) {
10 var date_button = document.getElementById('start_date_button');
11 var date_button_disabled = document.getElementById('start_date_disabled');
12 var date_text = document.getElementById('start_date_text');
14 var radio_now = document.getElementById('start_now');
15 var radio_on_hold = document.getElementById('start_on_hold');
16 var radio_on_date = document.getElementById('start_on_date');
18 form.submitButton.disabled = false;
20 if ( opt.getAttribute('data-can_discount') == 1 ) {
21 form.discountnum.disabled = false;
22 discountnum_changed(form.discountnum);
24 form.discountnum.disabled = true;
25 discountnum_changed(form.discountnum);
29 // if this form element exists, then the start date is a future
30 // package change date; don't replace it
34 form.start_date_text.value = opt.getAttribute('data-start_date');
35 if ( opt.getAttribute('data-can_start_date') == 1 ) {
36 date_text.style.backgroundColor = '#ffffff';
37 date_text.disabled = false;
38 date_button.style.display = '';
39 date_button_disabled.style.display = 'none';
40 if ( radio_on_date ) {
41 // un-disable all the buttons that might get disabled
42 radio_on_date.disabled = false;
43 radio_now.disabled = false;
44 // if a start date has been entered, assume the user wants it
45 if ( form.start_date_text.value.length > 0 ) {
46 radio_now.checked = false;
47 radio_on_date.checked = true;
49 // if not, default to now
50 radio_now.checked = true;
53 } else { // the package is either fixed start date or start-on-hold
54 date_text.style.backgroundColor = '#dddddd';
55 date_text.disabled = true;
56 date_button.style.display = 'none';
57 date_button_disabled.style.display = '';
58 if ( radio_on_date ) {
59 if ( opt.getAttribute('data-start_on_hold') == 1 ) {
60 // disallow all options but "On hold"
61 radio_on_hold.checked = true;
62 radio_now.checked = false;
63 radio_now.disabled = true;
65 // disallow all options but "On date"
66 radio_on_hold.checked = false;
67 radio_now.checked = true;
68 radio_now.disabled = false;
74 form.submitButton.disabled = true;
75 if ( discountnum ) { form.discountnum.disabled = true; }
76 discountnum_changed(form.discountnum);
81 function standardize_new_location() {
82 var form = document.OrderPkgForm;
83 var loc = form.locationnum;
84 if (loc.type == 'select-one' && loc.options[loc.selectedIndex].value == -1){
85 standardize_locations();
91 function submit_abort() {
92 document.OrderPkgForm.submitButton.disabled = false;