function postwith (to,p) { var myForm = document.createElement("form"); myForm.method="post" ; myForm.action = to ; myForm.target = "webinar"; for (var k in p) { var myInput = document.createElement("input") ; myInput.setAttribute("name", k) ; myInput.setAttribute("value", p[k]); myForm.appendChild(myInput) ; } document.body.appendChild(myForm) ; myForm.submit() ; document.body.removeChild(myForm) ; } function checkCookie(url,assetURL,prerecordedurl) { // if the cookie is set, do not prompt the user to complete the download form. TODO: email about the download. form = getCookie('downloadForm'); if (form!=null && form!="") { var contentForm = "From page:" + assetURL; contentForm += "PDF:
"+ url; var Nurl = "/downloadbrochure/sendEmail?content=" + contentForm; $.get(Nurl , { misc: contentForm }, function(data){ }); if(prerecordedurl) { window.open(prerecordedurl,'webinar'); } else if(url){ window.open(url,'webinar'); } return false; } else { // have the user fill out the download form. if(prerecordedurl) { //var redirect = "/downloadbrochure?pdf="+prerecordedurl+";returnURL="+assetURL; postwith("/downloadbrochure",{pdf: prerecordedurl}); } else { // have the user fill out the download form. var redirect = "/downloadbrochure?pdf="+url+";returnURL="+assetURL; } if (redirect) { window.open(redirect,'webinar'); } } return false; } // Sets a cookie indicating the form has been filled out previously function getCookie(c_name) { if (document.cookie.length>0) { c_start=document.cookie.indexOf(c_name + "="); if (c_start!=-1) { c_start=c_start + c_name.length+1; c_end=document.cookie.indexOf(";",c_start); if (c_end==-1) c_end=document.cookie.length; return unescape(document.cookie.substring(c_start,c_end)); } } return; }