////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //NAME: js_changeImage //PURPOSE: change display image //ARG: image //RET: DOM HTML //NOTE: //DLM: 041207 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// function js_changeImage(image) { var main_image = document.getElementById('main_image'); var text = document.getElementById('image_text'); var slot_text = document.getElementById('text' + image); main_image.src = "images/" + image + ".jpg?" + (new Date()).getTime(); text.innerHTML = slot_text.innerHTML; } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //NAME: js_convertToMetric //PURPOSE: convest inches to mm //ARG: type //RET: DOM HTML //NOTE: //DLM: 041207 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// function js_convertToMetric(x) { if (x == 1) { var mm = document.getElementById("metric1"); var inches = document.getElementById("imperial1").value * 1; var converted = inches * 25.4; var converted_formatted = converted.toFixed(0); mm.value = converted_formatted; } if (x == 2) { var mm = document.getElementById("metric2"); var inches = document.getElementById("imperial2").value * 1; var converted = inches * 25.4; var converted_formatted = converted.toFixed(0); mm.value = converted_formatted; } } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //NAME: js_getQuote //PURPOSE: create quote //ARG: //RET: DOM HTML //NOTE: //DLM: 041207 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// function js_getQuote() { var results_div = document.getElementById("results_div"); var results_list_div = document.getElementById("results_list_div"); //DELETE EXISTING RESULTS results_div.removeChild(results_list_div); var new_results_list_div = document.createElement("DIV"); new_results_list_div.id = 'results_list_div'; results_div.appendChild(new_results_list_div); //CREATE ARRAYS var productNames = new Array(3); productNames[0] = document.getElementById("product_1_name").value; productNames[1] = document.getElementById("product_2_name").value; productNames[2] = document.getElementById("product_3_name").value; var prices = new Array(3); prices[0] = document.getElementById("product_1_price").value / 1000; prices[1] = document.getElementById("product_2_price").value / 1000; prices[2] = document.getElementById("product_3_price").value / 1000; prices[3] = document.getElementById("product_4_price").value; prices[4] = document.getElementById("product_5_price").value; prices[5] = document.getElementById("product_6_price").value; //CALCULATE COSTS var number_windows = document.getElementById("number_windows_hidden").value; var number = number_windows * 1; var tot = document.getElementById('tot'); var total_area = 0; var total_width = 0; for(i=1;i<=number;i++) { var window_width = document.getElementById("window_" + i + "_width").value * 1; var window_height = document.getElementById("window_" + i + "_height").value * 1; total_area = total_area + (window_width * window_height); total_width = total_width + window_width; } //EXTRAS var tot = document.getElementById('tot'); var tilt = document.getElementById('tilt'); var glide = document.getElementById('glide'); if (tot.checked == true) { var tot_on = prices[3]; var hidden_field = document.createElement("INPUT"); hidden_field.type = 'hidden'; hidden_field.name = 'tot' hidden_field.value = 'Tier on Tier'; new_results_list_div.appendChild(hidden_field); } else { var tot_on = 0; } if (tilt.checked == true) { var tilt_on = prices[4]; var hidden_field = document.createElement("INPUT"); hidden_field.type = 'hidden'; hidden_field.name = 'tilt' hidden_field.value = 'Clearview hidden tilt rod'; new_results_list_div.appendChild(hidden_field); } else { var tilt_on = 0; } if (glide.checked == true) { var glide_on = prices[5]; var hidden_field = document.createElement("INPUT"); hidden_field.type = 'hidden'; hidden_field.name = 'glide' hidden_field.value = 'Shutterglide Track System'; new_results_list_div.appendChild(hidden_field); } else { var glide_on = 0; } //BUILD RESULTS var quote_table = document.createElement("TABLE"); var quote_tbody = document.createElement("TBODY"); for (y=0;y<=2;y++) { var quote_table_row = document.createElement("TR"); for (q=0;q<=1;q++) { var base_price = total_area * prices[y]; var style_cost = (base_price + (base_price * tot_on) + (base_price * tilt_on) + (base_price * glide_on)); var style_cost_formatted = style_cost.toFixed(2); var quote_table_td = document.createElement("TD"); if (q == 0) { quote_table_td.innerHTML = productNames[y]; quote_table_td.setAttribute('class','quote_style_row_1'); quote_table_td.setAttribute('className','quote_style_row_1'); quote_table_row.appendChild(quote_table_td); } if (q == 1) { quote_table_td.innerHTML = '\u20AC' + style_cost_formatted; quote_table_td.setAttribute('class','quote_style_row_2'); quote_table_td.setAttribute('className','quote_style_row_2'); quote_table_row.appendChild(quote_table_td); var hidden_field = document.createElement("INPUT"); hidden_field.type = 'hidden'; hidden_field.name = "_" + y; hidden_field.value = style_cost_formatted; new_results_list_div.appendChild(hidden_field); } } quote_tbody.appendChild(quote_table_row); } quote_table.appendChild(quote_tbody); new_results_list_div.appendChild(quote_table); //DISPLAY EXTRAS var extras = document.getElementById('extras'); extras.style.display = 'block'; //DISPLAY EMAIL FORM ELEMENTS var name_input = document.getElementById("101"); name_input.style.display = 'block'; var address_input = document.getElementById("102"); address_input.style.display = 'block'; var telno_input = document.getElementById("103"); telno_input.style.display = 'block'; var send_email_input = document.getElementById("104"); send_email_input.style.display = 'block'; var send_email_button = document.getElementById("105"); send_email_button.style.display = 'block'; } ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// //NAME: js_createWindowInputs //PURPOSE:create table to allow input of window dimensions //ARG: //RET: DOM HTML //NOTE: //DLM: 041207 //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// function js_createWindowInputs() { var input_div = document.getElementById("input_div"); var input_div_table = document.getElementById("input_div_table"); var results_div = document.getElementById("results_div"); var results_list_div = document.getElementById("results_list_div"); var windows_select_id = document.getElementById("number_of_windows").selectedIndex; var number_windows = document.getElementById("number_of_windows").options[windows_select_id].value; //DELETE EXISTING TABLE SHELL input_div.removeChild(input_div_table); var new_input_div_table = document.createElement("DIV"); new_input_div_table.id = 'input_div_table'; input_div.appendChild(new_input_div_table); //DELETE EXISTING RESULTS results_div.removeChild(results_list_div); var new_results_list_div = document.createElement("DIV"); new_results_list_div.id = 'results_list_div'; results_div.appendChild(new_results_list_div); //HIDE EMAIL FORM ELEMENTS var name_input = document.getElementById("101"); name_input.style.display = 'none'; var telno_input = document.getElementById("102"); telno_input.style.display = 'none'; var send_email_input = document.getElementById("103"); send_email_input.style.display = 'none'; var send_email_button = document.getElementById("104"); send_email_button.style.display = 'none'; var confirm_message = document.getElementById("confirm_message"); if (confirm_message) confirm_message.style.display = 'none'; //RESET SELECT document.getElementById("number_of_windows").selectedIndex = 0; //CREATE TABLE SHELL var window_input_table = document.createElement("TABLE"); window_input_table.id = "window_input_table"; var window_input_tbody = document.createElement("TBODY"); window_input_tbody.id = "window_input_table"; window_input_table.setAttribute("class", "window_input_table"); window_input_table.setAttribute("className", "window_input_table"); window_input_tbody.setAttribute("class", "window_input_tbody"); window_input_tbody.setAttribute("className", "window_input_tbody"); //ADD ROWS AND COLUMNS for (x=1;x<=number_windows;x++) { var table_row = document.createElement("TR"); table_row.id = 'table_row_' + x; table_row.setAttribute("class", "window_input_table_tr"); table_row.setAttribute("className", "window_input_table_tr"); for (y=1;y<=4;y++) { var table_td = document.createElement("TD"); table_td.setAttribute("class", "window_input_table_td"); table_td.setAttribute("className", "window_input_table_td"); if (y == 1) { table_td.innerHTML = "Width (mm)"; table_td.setAttribute('class','quote_style'); table_td.setAttribute('className','quote_style'); } else if (y == 2) { table_td.innerHTML = ""; table_td.setAttribute('class','quote_style'); table_td.setAttribute('className','quote_style'); } else if (y == 3) { table_td.innerHTML = "Height (mm)"; table_td.setAttribute('class','quote_style'); table_td.setAttribute('className','quote_style'); } else if (y == 4) { table_td.innerHTML = ""; table_td.setAttribute('class','quote_style'); table_td.setAttribute('className','quote_style'); } table_row.appendChild(table_td); } window_input_tbody.appendChild(table_row); } window_input_table.appendChild(window_input_tbody); new_input_div_table.appendChild(window_input_table); //UPDATE HIDDEN NUMBER OF WINDOWS var number_windows_hidden = document.getElementById("number_windows_hidden"); number_windows_hidden.value = number_windows; //DISPLAY BUTTON var quote_button = document.getElementById("quote_button"); quote_button.style.display = 'block'; //FOCUS var first_input = document.getElementById('window_1_width'); first_input.focus(); }