function PayPalCommercePlatform_Runtime_FindAndValidateProductAddForm(e){for(var t=e.parentNode;t&&"FORM"!=t.nodeName;t=t.parentNode);if(t&&PayPalCommercePlatform_Runtime_FormIsProductAdd(t))return t}function PayPalCommercePlatform_Runtime_FormIsProductAdd(e){return e.elements.Quantity&&e.elements.Product_Code&&e.elements.Action&&"ADPR"===e.elements.Action.value}function PayPalCommercePlatfrom_Runtime_FormGatherInputElements(e){for(var t,n,r,a=new Array,o=e.getElementsByTagName("input"),l=0;l<o.length;l++)"text"==(r=o[l].type.toLowerCase())||"number"==r||"tel"==r||"hidden"==r?((n=new Object).name=o[l].name,n.value=o[l].value,a.push(n)):"checkbox"!=r&&"radio"!=r||o[l].checked&&((n=new Object).name=o[l].name,n.value=o[l].value,a.push(n));for(o=e.getElementsByTagName("textarea"),l=0;l<o.length;l++)(n=new Object).name=o[l].name,n.value=o[l].value,a.push(n);for(o=e.getElementsByTagName("select"),l=0;l<o.length;l++)if(0<=o[l].selectedIndex&&o[l].options[o[l].selectedIndex])if(o[l].multiple)for(t=0;t<o[l].options.length;t++)o[l].options[t].selected&&((n=new Object).name=o[l].name,n.value=o[l].options[t].value,a.push(n));else(n=new Object).name=o[l].name,n.value=o[l].options[o[l].selectedIndex].value,a.push(n);return a=a.filter(function(e){e=e.name.toLowerCase();return"quantity"==e||"product_code"==e||"product_subscription_term_id"==e||0==e.indexOf("product_attributes[")})}function PayPalCommercePlatform_Runtime_CreateProductOrder(e,t){var n;return null==(n=PayPalCommercePlatform_Runtime_FindAndValidateProductAddForm(document.getElementById("paypalcp-button-container")))?e({success:0,error_code:"MER-PAY-PCP-RUN-00001",error_message:"Unable to locate product form"}):AJAX_Call_Module_JSON_FieldList(e,"runtime","paypalcp","Runtime_CreateProductOrder",null,PayPalCommercePlatfrom_Runtime_FormGatherInputElements(n),t)}function PayPalCommercePlatform_Runtime_CreateOrder(e,t){return AJAX_Call_Module_JSON(e,"runtime","paypalcp","Runtime_CreateOrder",null,t)}function PayPalCommercePlatform_Runtime_CancelProductOrder(e,t){return AJAX_Call_Module_JSON(e,"runtime","paypalcp","Runtime_CancelProductOrder",null,t)}function PayPalCommercePlatform_Runtime_PaymentApproved(e,t,n){return AJAX_Call_Module_JSON(t,"runtime","paypalcp","Runtime_PaymentApproved",{PayPalOrderID:e},n)}function PayPalCommercePlatform_Runtime_UpdateOrderShipping(e,t,n){return AJAX_Call_Module_JSON(t,"runtime","paypalcp","Runtime_UpdateOrderShipping",e,n)}