1 function pkg_changed () {
2 var form = document.OrderPkgForm;
3 var discountnum = form.discountnum;
5 if ( form.pkgpart.selectedIndex > 0 ) {
7 var opt = form.pkgpart.options[form.pkgpart.selectedIndex];
8 var date_button = document.getElementById('start_date_button');
9 var date_button_disabled = document.getElementById('start_date_disabled');
10 var date_text = document.getElementById('start_date_text');
12 var radio_now = document.getElementById('start_now');
13 var radio_on_hold = document.getElementById('start_on_hold');
14 var radio_on_date = document.getElementById('start_on_date');
16 form.submitButton.disabled = false;
18 if ( opt.getAttribute('data-can_discount') == 1 ) {
19 form.discountnum.disabled = false;
20 discountnum_changed(form.discountnum);
22 form.discountnum.disabled = true;
23 discountnum_changed(form.discountnum);
27 // if this form element exists, then the start date is a future
28 // package change date; don't replace it
32 form.start_date_text.value = opt.getAttribute('data-start_date');
33 if ( opt.getAttribute('data-can_start_date') == 1 ) {
34 date_text.style.backgroundColor = '#ffffff';
35 date_text.disabled = false;
36 date_button.style.display = '';
37 date_button_disabled.style.display = 'none';
38 if ( radio_on_date ) {
39 // un-disable all the buttons that might get disabled
40 radio_on_date.disabled = false;
41 radio_now.disabled = false;
42 // if a start date has been entered, assume the user wants it
43 if ( form.start_date_text.value.length > 0 ) {
44 radio_now.checked = false;
45 radio_on_date.checked = true;
47 // if not, default to now
48 radio_now.checked = true;
51 } else { // the package is either fixed start date or start-on-hold
52 date_text.style.backgroundColor = '#dddddd';
53 date_text.disabled = true;
54 date_button.style.display = 'none';
55 date_button_disabled.style.display = '';
56 if ( radio_on_date ) {
57 if ( opt.getAttribute('data-start_on_hold') == 1 ) {
58 // disallow all options but "On hold"
59 radio_on_hold.checked = true;
60 radio_now.checked = false;
61 radio_now.disabled = true;
63 // disallow all options but "On date"
64 radio_on_hold.checked = false;
65 radio_now.checked = true;
66 radio_now.disabled = false;
72 form.submitButton.disabled = true;
73 if ( discountnum ) { form.discountnum.disabled = true; }
74 discountnum_changed(form.discountnum);
78 function standardize_new_location() {
79 var form = document.OrderPkgForm;
80 var loc = form.locationnum;
81 if (loc.type == 'select-one' && loc.options[loc.selectedIndex].value == -1){
82 standardize_locations();
88 function submit_abort() {
89 document.OrderPkgForm.submitButton.disabled = false;