function cf_parse_options () { var cf_parsed_data = ''; if (document.getElementById('orderForm')) { var radio_inputs_array = new Array(); var input_tags = document.getElementById('orderForm').getElementsByTagName('input'); for (i = 0; i < input_tags.length; i++) { if (input_tags[i].type == 'radio') { if (input_tags[i].className.toUpperCase().indexOf ('CF-IGNORE') == -1) { if (!radio_inputs_array[input_tags[i].name]) radio_inputs_array[input_tags[i].name] = 'false'; if (input_tags[i].checked == true) { radio_inputs_array[input_tags[i].name] = 'true'; if (!cf_parsed_data) cf_parsed_data = input_tags[i].name + '~~~' + input_tags[i].value; else cf_parsed_data = cf_parsed_data + '%%%' + input_tags[i].name + '~~~' + input_tags[i].value; } } } } for (var i in radio_inputs_array) { if (radio_inputs_array[i] == 'false') cf_parsed_data = 'SELECT'; } } 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 = 'http://www.centrifugeconnect.com/clients/check_inventory.php?si=hq4sports&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 = 'http://www.centrifugeconnect.com/clients/check_inventory.php?si=hq4sports&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('Place order above and we will ship when available. Or enter your email address below and we will notify you when it 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-space-holder'), 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 input_tags = document.getElementById('orderForm').getElementsByTagName('input'); for (i = 0; i < input_tags.length; i++) { if (input_tags[i].type == 'radio') { cf_add_event (input_tags[i], 'click', cf_check_inv); } } } cf_check_inv (); cf_oos (); } var total_ids = '1'; var item_id0 = 'easton-training-a162686pk-5-inch-plastic-training-balls'; var item_code0 = 'A162686PK';