//------------------------------------------------------------ // src_product_javascript.asp // // Javascript functions to support product specific Javascript functions. function cart_update_notice(the_window) { document.thisForm.submit(); } function clear_sample() { // if (document.images['sample_image']) // { // document.images['sample_image'].src = default_rollover_image; // } } function show_sample(colour_number) { if (document.images['sample_image']) { document.images['sample_image'].src = colour_images[colour_number]; if (document.all) { if (document.all['the_description']) { document.all['the_description'].innerHTML = colour_selections[colour_number]; } if (document.all['the_model']) { document.all['the_model'].innerHTML = colour_models[colour_number]; } } } } function show_colour_name(colour_id) { var colour_num = get_colour_index(colour_id); if (colour_num == 0) { document.write("< unknown >"); } else { document.write(colour_selections[colour_num]); } } function show_sample_ex(colour_id) { var colour_number = get_colour_index(colour_id); if (document.images['sample_image']) { document.images['sample_image'].src = colour_images[colour_number]; if (document.all) { if (document.all['the_description']) { document.all['the_description'].innerHTML = colour_selections[colour_number]; } if (document.all['the_model']) { document.all['the_model'].innerHTML = colour_models[colour_number]; } } } } function get_colour_index(colour_id) { var the_colour_index = 0; for (i = 1; i <= colour_id_list.length; ++i) { if (colour_id == colour_id_list[i]) { the_colour_index = i; break; } } return the_colour_index; } function get_model_index(model_id) { var the_model_index = 0; for (i = 1; i <= model_id_list.length; ++i) { if (model_id == model_id_list[i]) { the_model_index = i; break; } } return the_model_index; } function select_colour_ex(model_id) { var theObject; var colour_id; theObject = document.thisForm['lstColour'+model_id.toString()]; if (theObject) { colour_id = theObject.options[theObject.selectedIndex].value; model_colour_picks[get_model_index(model_id)] = colour_id; show_colour_price(model_id, colour_id); } else { window.alert('Unrecognized colour selection'); } } function show_colour_price(model_id, colour_id) { var thePriceObj; var thePriceArray; var colour_id; theObject = document.thisForm['lstColour'+model_id.toString()]; if (document.all) { thePriceObj = document.all['the_price'+model_id.toString()]; thePriceArray = eval('colour_price_' + model_id.toString()); if (!thePriceObj) { return; } if (colour_id == 0) { thePriceObj.innerHTML = model_prices[get_model_index(model_id)]; } else { if ('' == thePriceArray[get_colour_index(colour_id)]) { thePriceObj.innerHTML = model_prices[get_model_index(model_id)]; } else { thePriceObj.innerHTML = thePriceArray[get_colour_index(colour_id)]; } } } } function select_colour(model) { var theObject; theObject = document.thisForm['lstColour'+model.toString()]; if (theObject) { if (theObject.options[theObject.selectedIndex].value == 0) { model_colour_picks[model] = 0; // window.alert('picked no colour'); } else { model_colour_picks[model] = theObject.selectedIndex; // window.alert('picked colour number ' + (model_colour_picks[model]).toString()); } } else { window.alert('Unrecognized colour selection'); } } function product_add_to_cart(product_id, model_id) { if (model_colour_picks[get_model_index(model_id)] == 0) { window.alert('You must select a color before you can add this item to your shopping cart.'); } else { open_window('product_add_to_cart.asp?p=' + product_id.toString() + '&m=' + model_id.toString() + '&l=' + model_colour_picks[get_model_index(model_id)], 750, 440); } }