var d=!1;function debug(e){d&&console.log(e)}function urlFill(){var n,l={},o=document.getElementById("wsite-com-product-options");window.location.search.replace(/[?&]+([^=&]+)=([^&]*)/gi,function(e,t,a){switch(debug(e+": "+t+" = "+a),t){case"debug":1!=a&&"true"!=a||(d=!0);break;case"link":o&&((n=document.createElement("a")).id="make_link",n.type="button",n.innerHTML='Create URL with Parameters',n.className="wsite-button wsite-button-small wsite-button-highlight",n.onclick=makeLink,debug(n),o.parentNode.insertBefore(n,o.nextSibling));break;default:l[t.replace(/[^A-Za-z0-9\_\-]/g,"_")]=decodeURIComponent(a.replace(/\+/g," "))}});if(debug("url variables: "),debug(l),o.length&&Object.getOwnPropertyNames(l).length){for(debug("Product Options and URL Vars are both present"),i=0;i/gm,""));break;case"":debug("Radio Selector"),sel.checked&&(debug("name: "+sel.name),debug("value: "+sel.value),e[sel.name.replace(/[^A-Za-z0-9\_\-]/g,"_")]=sel.value)}debug(e);var a=window.location.href.split("?")[0],n="?";for(var l in e)a+=n+l.replace(" ","_")+"="+encodeURIComponent(e[l]),n="&";if(confirm("Created Link: \n"+a+"\n\nPress OK to copy to the clipboard")){if(window.clipboardData&&window.clipboardData.setData)return clipboardData.setData("Text",a);if(document.queryCommandSupported&&document.queryCommandSupported("copy")){var o=document.createElement("textarea");o.textContent=a,o.style.position="fixed",document.body.appendChild(o),o.select();try{return document.execCommand("copy")}catch(e){return console.warn("Copy to clipboard failed.",e),!1}finally{document.body.removeChild(o)}}}}"loading"===document.readyState?document.addEventListener("DOMContentLoaded",urlFill):urlFill();