function cf_parse_options () { var cf_parsed_data = ''; if (document.getElementById('orderForm')) { var select_tags = document.getElementById('orderForm').getElementsByTagName('select'); for (i = 0; i < select_tags.length; i++) { var tmp_select_value = select_tags[i].value; if ((select_tags[i].name.toUpperCase().indexOf ('VWATTR') != -1) && (select_tags[i].name.toUpperCase().indexOf ('VWATTR0') == -1) && (tmp_select_value.toUpperCase().indexOf ('SELECT') != -1)) tmp_select_value = 'DUMMY'; if ((select_tags[i].className.toUpperCase().indexOf ('CF-IGNORE') == -1) && (select_tags[i].name.toUpperCase() != 'ID')) { if ((tmp_select_value.toUpperCase().indexOf ('SELECT') == -1) && (tmp_select_value.toUpperCase().indexOf ('CHOOSE') == -1) && (select_tags[i].name.toUpperCase().indexOf ('VWQUANTITY') == -1) && (tmp_select_value != '')) { if (!cf_parsed_data) cf_parsed_data = select_tags[i].name + '~~~' + tmp_select_value; else cf_parsed_data = cf_parsed_data + '%%%' + select_tags[i].name + '~~~' + tmp_select_value; } else if (select_tags[i].name.toUpperCase().indexOf ('VWQUANTITY') != -1) { cf_parsed_data = cf_parsed_data + ''; } else { cf_parsed_data = 'SELECT'; break; } } } } cf_parsed_data = cf_parsed_data.replace (/&/g, '!!!'); cf_parsed_data = cf_parsed_data.replace (/#/g, '***'); cf_parsed_data = cf_parsed_data.replace (/ /g, ' '); return cf_parsed_data; } function cf_check_inv () { if (document.getElementById('inv-email-address')) document.getElementById('inv-email-address').value = document.getElementById('inv-email-address').defaultValue; if (document.getElementById('inv-msg')) document.getElementById('inv-msg').innerHTML = ''; var collected_data = cf_parse_options(); if (collected_data != 'SELECT') { collected_data = encodeURIComponent (collected_data); var jsel = document.createElement('script'); jsel.type = 'text/javascript'; jsel.src = 'https://www.centrifugeconnect.com/clients/check_inventory.php?si=yhst-11683221621812&ids=1' + '&opt=' + collected_data + '&multi='; jsel.src = jsel.src + '&id0=' + item_id0 + '&code0=' + item_code0; if (document.getElementById('cf-avail')) document.getElementById('cf-avail').innerHTML = ''; document.getElementById('cf-ajax-load').appendChild (jsel); } } function cf_bis_notification () { if (document.getElementById('inv-email-address').value == '') { alert ('Please enter your email address'); } else if ((document.getElementById('inv-email-address').value.indexOf('@') == -1) || (document.getElementById('inv-email-address').value.indexOf('.') == -1)) { alert ('Please enter a valid email address'); } else { var collected_data = cf_parse_options(); collected_data = encodeURIComponent (collected_data); var jsel = document.createElement('script'); jsel.type = 'text/javascript'; jsel.src = 'https://www.centrifugeconnect.com/clients/check_inventory.php?si=yhst-11683221621812&id=' + item_id0 + '&code=' + item_code0 + '&opt=' + collected_data + '&email=' + document.getElementById('inv-email-address').value; document.getElementById('cf-ajax-load').appendChild (jsel); } } function cf_insert_after (referenceNode, newNode) { referenceNode.parentNode.insertBefore(newNode, referenceNode.nextSibling); } function cf_disable_enter_key (e) { var key; if (window.event) { key = window.event.keyCode; } else { key = e.which; } if (key == 13) { return false; } else { return true; } } function cf_add_event (obj, evType, fn) { if (obj.addEventListener) { obj.addEventListener(evType, fn, false); return true; } else if (obj.attachEvent) { var r = obj.attachEvent('on'+evType, fn); return r; } else { return false; } } function cf_onfocus (obj_to_handle) { if (obj_to_handle.value == obj_to_handle.defaultValue) obj_to_handle.value = ''; } function cf_onblur (obj_to_handle) { if (obj_to_handle.value == '') obj_to_handle.value = obj_to_handle.defaultValue; } function cf_oos () { if (!document.getElementById('inv-oos')) {; var cf_inv_oos = document.createElement('div'); cf_inv_oos.setAttribute('id', 'inv-oos'); var cf_inv_text = document.createElement('div'); cf_inv_text.setAttribute('id', 'inv-text'); var cf_inv_text_value = document.createTextNode('Please call 888-335-5077 for availability or enter your email address to be notified when the item is back in-stock:'); cf_inv_text.appendChild(cf_inv_text_value); var cf_inv_oos_input_submit_holder = document.createElement('div'); cf_inv_oos_input_submit_holder.setAttribute('id', 'inv-oos-input-submit'); var cf_inv_oos_input_holder = document.createElement('div'); cf_inv_oos_input_holder.setAttribute('id', 'inv-oos-input'); var cf_inv_oos_input = document.createElement('input'); cf_inv_oos_input.setAttribute('id', 'inv-email-address'); cf_inv_oos_input.setAttribute('type', 'text'); cf_inv_oos_input.setAttribute('value', 'Enter email address'); cf_inv_oos_input.setAttribute('onfocus', 'cf_onfocus(this);'); cf_inv_oos_input.setAttribute('onblur', 'cf_onblur(this);'); cf_inv_oos_input.onkeypress = cf_disable_enter_key; cf_inv_oos_input_holder.appendChild(cf_inv_oos_input); var cf_inv_oos_submit_holder = document.createElement('div'); cf_inv_oos_submit_holder.setAttribute('id', 'inv-oos-submit'); var cf_inv_oos_submit = document.createElement('input'); cf_inv_oos_submit.setAttribute('id', 'inv-submit'); cf_inv_oos_submit.setAttribute('type', 'button'); cf_inv_oos_submit.setAttribute('value', 'Submit'); cf_inv_oos_submit.onclick = cf_bis_notification; cf_inv_oos_submit_holder.appendChild(cf_inv_oos_submit); var cf_inv_oos_clear_both = document.createElement('div'); cf_inv_oos_clear_both.setAttribute('class', 'clear-both'); cf_inv_oos_clear_both.setAttribute('className', 'clear-both'); cf_inv_oos_input_submit_holder.appendChild(cf_inv_oos_input_holder); cf_inv_oos_input_submit_holder.appendChild(cf_inv_oos_submit_holder); cf_inv_oos_input_submit_holder.appendChild(cf_inv_oos_clear_both); var cf_inv_msg = document.createElement('div'); cf_inv_msg.setAttribute('id', 'inv-msg'); cf_inv_oos.appendChild(cf_inv_text); cf_inv_oos.appendChild(cf_inv_oos_input_submit_holder); cf_inv_oos.appendChild(cf_inv_msg); cf_insert_after (document.getElementById('cf-atc'), cf_inv_oos); document.getElementById('inv-oos').style.display = 'none'; } } function cf_init () { if (!document.getElementById('cf-ajax-load')) { var cf_ajax_load_div = document.createElement('div'); cf_ajax_load_div.setAttribute('id', 'cf-ajax-load'); document.getElementById('orderForm').parentNode.insertBefore (cf_ajax_load_div, document.getElementById('orderForm')); document.getElementById('cf-ajax-load').style.display = 'none'; } if (document.getElementById('orderForm')) { var select_tags = document.getElementById('orderForm').getElementsByTagName('select'); for (i = 0; i < select_tags.length; i++) { cf_add_event (select_tags[i], 'change', cf_check_inv); } } cf_check_inv (); cf_oos (); } var total_ids = '1'; var item_id0 = 'cs-610624'; var item_code0 = 'CS-610624';