function at_schedule_image_refresh(e)
{
	schedule_image_refresh(e);
    build_barcode_preview();
    build_note();
}

// This will rebuild the note on under the image, if required.
function build_note()
{
    var note_el = document.getElementById("note");
    if (note_el && note_el.innerHTML === undefined) {
    return;
    }

    var material_el = document.getElementById("25[]");
    var design_val = getFormValue('48[]');

    if (!material_el.value || !design_val) {
    note_el.innerHTML = "";
    return;
    }

    if (material_el.value == "354" && design_val != "AT011NO") {
    note_el.innerHTML = "<br><br>NOTE:  With Security Silver \"VOID\" Polyester, white will be printed behind barcode to ensure accurate scans.";
    return;
    }
    if (material_el.value == "339" && design_val != "AT011NO") {
    note_el.innerHTML = "<br><br>NOTE:  With Destructible Reflective White Vinyl, white will be printed behind barcode to ensure accurate scans.";
    return;
    }

    note_el.innerHTML = "";
}

// This will rebuild the barcode preview, if required.
function build_barcode_preview()
{
    var bar_el = document.getElementById("barcode_summary");
    if (bar_el && bar_el.innerHTML === undefined) {
    return;
    }

    var start_el = document.getElementById("29[]");
    var prefix_el = document.getElementById("30[]");
    var suffix_el = document.getElementById("31[]");
    var num_el = document.getElementById("qty[]");

    var start = parseInt(start_el.value);
    var end = parseInt(num_el.value) + start;

    // If either the starting number or the quantity are not set,
    // delete the preview.
    if (!start_el.value || !num_el.value || !start || !end) {
    bar_el.innerHTML = "";
    return;
    }

    // We have to reflect these back into strings so we can make sure
    // that any leading zeros are filled in.
    var start_string = new String();
    var end_string = new String();

    start_string += start;
    end_string += end - 1;

    // backfill with leading zeros
    while (start_string.length < start_el.value.length) {
    start_string = "0" + start_string;
    }

    while (end_string.length < start_el.value.length) {
    end_string = "0" + end_string;
    }

    var final_string = "Start: ";
    final_string += prefix_el.value + start_string + suffix_el.value;

    final_string += " End: ";
    final_string += prefix_el.value + end_string + suffix_el.value;

    bar_el.innerHTML = final_string;
}

