window.onload=function(){var e=function(e,t){var l=document.createElement("input");return l.type="hidden",l.name=e,l.value=t,l},t=function(e){document.getElementById("ld_cw_paynow_div").style.display="none",document.getElementById("ld_cw_subscribe_div").style.display="none","paynow"===e?document.getElementById("ld_cw_paynow_div").style.display="block":"subscribe"===e&&(document.getElementById("ld_cw_subscribe_div").style.display="block")},l=document.querySelector('input[name="ld_cw_course_price_type"]:checked');l&&t(l.value);var n=document.getElementsByName("ld_cw_course_price_type");if(n.length>0)for(var r=0;r<n.length;r++)n[r].addEventListener("change",(function(e){t(e.target.value)}));var d=function(e){var t,l,n=ldCourseWizard.buttons.default.label,r=null,d=document.getElementById("ld_cw_load_data_button");if(function(e){for(;e.firstChild;)e.removeChild(e.firstChild)}(d),e.includes("youtube.com")?(n=ldCourseWizard.buttons.youtube.label,t=ldCourseWizard.buttons.youtube.img_src,l=ldCourseWizard.buttons.youtube.img_alt,r=ldCourseWizard.buttons.youtube.img_class):e.includes("vimeo.com")?(n=ldCourseWizard.buttons.vimeo.label,t=ldCourseWizard.buttons.vimeo.img_src,l=ldCourseWizard.buttons.vimeo.img_alt,r=ldCourseWizard.buttons.vimeo.img_class):e.includes("wistia.com")&&(n=ldCourseWizard.buttons.wistia.label,t=ldCourseWizard.buttons.wistia.img_src,l=ldCourseWizard.buttons.wistia.img_alt,r=ldCourseWizard.buttons.wistia.img_class),t){var i=document.createElement("img");i.src=t,i.alt=l,i.className=r,d.appendChild(i)}var a=document.createElement("span");a.textContent=n,d.appendChild(a)},i=document.getElementById("ld_cw_playlist_url");i&&(i.addEventListener("keyup",(function(e){d(e.target.value)})),i.addEventListener("change",(function(e){d(e.target.value)})),d(i.value));var a=document.getElementById("ld_cw_course_price_billing_interval"),u=document.getElementById("ld_cw_course_price_billing_number"),c=0;a&&u&&a.addEventListener("change",(function(e){switch(e.target.value){case"D":c=ldCourseWizard.valid_recurring_paypal_day_max;break;case"W":c=ldCourseWizard.valid_recurring_paypal_week_max;break;case"M":c=ldCourseWizard.valid_recurring_paypal_month_max;break;case"Y":c=ldCourseWizard.valid_recurring_paypal_year_max;break;default:c=0}u.value>c&&(u.value=c),u.setAttribute("max",c)}));var o=document.getElementById("ld_cw_create_course_btn");o&&o.addEventListener("click",(function(){var t=document.getElementById("ld_cw_create_course_form"),l=document.querySelector('input[name="ld_cw_course_price_type"]:checked').value;t&&(t.appendChild(e("course_price_type",l)),t.appendChild(e("course_disable_lesson_progression",document.querySelector('input[name="ld_cw_course_progression"]:checked').value)),"paynow"===l?t.appendChild(e("course_price",document.getElementById("ld_cw_course_price_type_paynow_price").value)):"subscribe"===l&&(t.appendChild(e("course_price",document.getElementById("ld_cw_course_price_type_subscribe_price").value)),t.appendChild(e("course_price_billing_number",document.getElementById("ld_cw_course_price_billing_number").value)),t.appendChild(e("course_price_billing_interval",document.getElementById("ld_cw_course_price_billing_interval").value))),t.submit())}))};