function PayPalCommercePlatform_Runtime_FindAndValidateProductAddForm(e){var t;for(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){var t,n,r,a,o,l;for(l=new Array,r=e.getElementsByTagName("input"),t=0;t<r.length;t++)"text"==(o=r[t].type.toLowerCase())||"number"==o||"tel"==o||"hidden"==o?((a=new Object).name=r[t].name,a.value=r[t].value,l.push(a)):"checkbox"!=o&&"radio"!=o||r[t].checked&&((a=new Object).name=r[t].name,a.value=r[t].value,l.push(a));for(r=e.getElementsByTagName("textarea"),t=0;t<r.length;t++)(a=new Object).name=r[t].name,a.value=r[t].value,l.push(a);for(r=e.getElementsByTagName("select"),t=0;t<r.length;t++)if(0<=r[t].selectedIndex&&r[t].options[r[t].selectedIndex])if(r[t].multiple)for(n=0;n<r[t].options.length;n++)r[t].options[n].selected&&((a=new Object).name=r[t].name,a.value=r[t].options[n].value,l.push(a));else(a=new Object).name=r[t].name,a.value=r[t].options[r[t].selectedIndex].value,l.push(a);return l=l.filter(function(e){var t=e.name.toLowerCase();return"quantity"==t||"product_code"==t||"product_subscription_term_id"==t||0==t.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)}