function get_checkbox(check_name, input_array) { var amount = 0; obj = document.forms['quote'].elements[check_name]; if (obj.length > 0){ for (i = 0; i < obj.length; i++) { if (obj[i].checked) {amount += input_array[obj[i].value];} } } else {if (obj.checked) {amount += input_array[obj.value];}} return amount; } function get_select(input_name, input_value) { var amount = 0; amount = input_name.value * input_value; return amount; } function re_calc(v){ /***************************** Set up the cost array *****************************/ costs = new Array(); costs['identity'] = new Array(); costs['identity']['create_identity'] = 400; costs['identity']['evolve_identity'] = 240; costs['identity']['existing_identity'] = 0; costs['design_options'] = new Array(); costs['design_options']['none'] = 0; costs['design_options']['one_design'] = 480; costs['design_options']['two_design'] = 640; costs['design_options']['three_design'] = 760; costs['design_elements'] = new Array(); costs['design_elements']['image_search'] = 240; costs['design_elements']['illustrations'] = 320; costs['design_elements']['diagrams'] = 320; costs['design_elements']['flash'] = 400; costs['development'] = new Array(); costs['development']['create_html'] = 1350; costs['unique_pages'] = 425; costs['database_sections'] = 285; costs['extranet'] = new Array(); costs['extranet']['extranet'] = 515; costs['content_pages'] = 20; costs['content_management'] = new Array(); costs['content_management']['cms'] = 330; costs['blog'] = new Array(); costs['blog']['blog'] = 375; costs['deploy'] = new Array(); costs['deploy']['evokedset'] = 0; costs['deploy']['own_server'] = 150; costs['publish'] = new Array(); costs['publish']['publish'] = 150; costs['support'] = new Array(); /***************************** Support is a special case.... *****************************/ costs['support']['none'] = 0; costs['support']['bronze'] = 100; costs['support']['silver'] = 350; costs['support']['gold'] = 950; /***************************** Now step through each element of the array *****************************/ current_cost = 0; current_cost += get_checkbox('identity', costs['identity']); current_cost += get_checkbox('design_options', costs['design_options']); current_cost += get_checkbox('design_elements[]', costs['design_elements']); current_cost += get_checkbox('development', costs['development']); current_cost += get_select(v.unique_pages, costs['unique_pages']); current_cost += get_select(v.database_sections, costs['database_sections']); current_cost += get_checkbox('extranet', costs['extranet']); current_cost += get_select(v.content_pages, costs['content_pages']); current_cost += get_checkbox('content_management', costs['content_management']); current_cost += get_checkbox('blog', costs['blog']); current_cost += get_checkbox('deploy', costs['deploy']); current_cost += get_checkbox('publish', costs['publish']); /***************************** Support is a special case.... *****************************/ current_cost_s = 0; current_cost_s += get_checkbox('support', costs['support']); /***************************** Identify the cost box and update it *****************************/ cost_box = document.getElementById('cost'); cost_box.innerHTML = current_cost + ".00"; cost_box_s = document.getElementById('monthly'); cost_box_s.innerHTML = current_cost_s + ".00"; }