var MultiOptin; if (MultiOptin == undefined || MultiOptin.version < 1.07) { MultiOptin = { version : 1.07, cookies : true, confirmPrompt : "", enable : true, // connect a function to this for conditional submissions formsSubmitted : 0, mainForm : null, box : null, formList : [ ], emailSource : null, firstnameSource : null, ready : false, layered : false, fill : function(tag, value) { if (tag == "firstname") { if (MultiOptin.firstnameSource != null) { document.getElementById(MultiOptin.firstnameSource).value = value; } } else if (tag == "lastname") { if (MultiOptin.lastnameSource != null) { document.getElementById(MultiOptin.lastnameSource).value = value; } } else if (tag == "email") { if (MultiOptin.emailSource != null) { document.getElementById(MultiOptin.emailSource).value = value; } } }, send : function() { MultiOptin.debug("Submission process started: " + MultiOptin.formList.length); if (MultiOptin.formList.length == 0) { return true; } // First, find out if we should be doing this. MultiOptin.ready = true; if (typeof MultiOptin.enable == "function" && !MultiOptin.enable()) { return true; } else if (!MultiOptin.enable) { return true; } // Disable if we've already subscribed //else if (MultiOptin.cookies && MultiOptinCookie.get("firstname") != undefined) { return true; } MultiOptin.formsSubmitted = 0; // Tell all catcher iframes to hit formDone when finished loading for (i=0;i'; } } MultiOptin.debug(MultiOptin.formList[i].action + " ... " + MultiOptin.formList[i].innerHTML); // Add a frame to the document to "catch" the form submission var catcherName = "catcher[" + i + "]"; if (MultiOptin.debug()) { var newIframe = document.createElement('span'); newIframe.innerHTML = ''; MultiOptin.insertAfter(MultiOptin.formList[i], newIframe); } else { var newIframe = document.createElement('span'); newIframe.innerHTML = ''; MultiOptin.insertAfter(MultiOptin.formList[i], newIframe); //MultiOptin.formList[i].innerHTML += (''); } // Submit normally if this form's target is blank or top if (MultiOptin.formList[i].target != "_blank" && MultiOptin.formList[i].target != "_top") { MultiOptin.formList[i].target = catcherName; } } // old spot for mainForm selection... seems to work better when we move it MultiOptin.debug("main form = " + MultiOptin.mainForm.innerHTML); if (typeof jQuery == "function") { jQuery(MultiOptin.mainForm).submit(MultiOptin.send); } else { MultiOptin.mainForm.onsubmit = MultiOptin.send; } }, submitForm : function(theForm) { if (theForm.submit && typeof theForm.submit == "function") { theForm.submit(); return true; } if (jQuery && typeof jQuery == "function") { jQuery(theForm).submit(); return true; } if (theForm.onsubmit && typeof theForm.onsubmit == "function") { theForm.onsubmit(); return true; } if (theForm.submit.click && typeof theForm.submit.click == "function") { theForm.submit.click(); return true; } }, insertAfter : function( referenceNode, newNode ) { referenceNode.parentNode.insertBefore( newNode, referenceNode.nextSibling ); }, formDone : function() { if (!MultiOptin.ready) { return false; } MultiOptin.formsSubmitted++; MultiOptin.debug("forms submitted = " + MultiOptin.formsSubmitted + " out of " + MultiOptin.formList.length); if (MultiOptin.formsSubmitted >= MultiOptin.formList.length) { if (MultiOptin.debug() && !confirm("All forms submitted... continue or cancel?")) { return false; } // formerly else if if (MultiOptin.mainForm.redirect != undefined && MultiOptin.mainForm.redirect.value != undefined && MultiOptin.mainForm.redirect.value != null && MultiOptin.mainForm.redirect.value != "http://") { MultiOptin.debug("redirecting"); document.location = MultiOptin.mainForm.redirect.value; } else if (MultiOptin.mainForm.className == "background" || MultiOptin.mainForm.className == "autosubmit") { MultiOptin.mainForm.onsubmit = function() { return false; }; MultiOptin.debug("hide the main form at this point"); MultiOptin.mainForm.style.display = "none"; } else if (MultiOptin.formList[0] != MultiOptin.mainForm) { // Don't get us caught in a loop MultiOptin.debug("submitting the main form"); MultiOptin.mainForm.onsubmit = function() { return true; }; MultiOptin.submitForm(MultiOptin.mainForm); } for (i=0; i -1) { MultiOptin.formList[i].style.display = "none"; } } } }, // Try to figure out which "firstname" "lastname" and "email" fields to use detect : function() { //if (MultiOptin.layered) { return; } if (document.getElementById("firstname")) { MultiOptin.debug("firstname already exists"); } else { // Tag each input element inside a "multioptin-firstname" under the firstname class blocks = MultiOptin.getClass("multioptin-firstname"); if (blocks && blocks.length > 0) { for (i=0; i 0) { for (i=0; i 0) { for (i=0; i -1) { MultiOptin.debug("first name = " + blocks[i].name); blocks[i].id = "firstname"; break; } } //} //if (!document.getElementById("lastname")) { blocks = document.getElementsByTagName("INPUT"); var nameGuess = '|lname|lastname|Contact0LastName|Name_Last|'; for (i=0;i -1) { blocks[i].id = "lastname"; break; } } //} //if (!document.getElementById("email")) { blocks = document.getElementsByTagName("INPUT"); var emailGuess = '|email|Email1|MailFromAddress|category3|SendEmail|Contact0Email|Email|'; var nonEmailGuess = '|password|'; for (i=0;i -1) { if (nonEmailGuess.indexOf('|' + blocks[i].name + '|') > -1) { continue; // skip over this one } MultiOptin.debug("email = " + blocks[i].name); blocks[i].id = "email"; break; } } //} MultiOptin.layered = true; }, getClass : function(clsName, source) { if (source == undefined) { source = document; } var retVal = new Array(); var elements = source.getElementsByTagName("*"); for (var i=0;i < elements.length;i++) { if (elements[i].className.indexOf(" ") >= 0) { var classes = elements[i].className.split(" "); for (var j = 0;j < classes.length;j++) { if (classes[j] == clsName) { retVal.push(elements[i]); } } } else if(elements[i].className == clsName) { retVal.push(elements[i]); } } return retVal; }, getTag : function(tagName, source) { if (source == undefined) { source = document; } var retVal = new Array(); var elements = source.getElementsByTagName(tagName); for (var i=0;i < elements.length;i++) { retVal.push(elements[i]); } return retVal; }, getParameter : function(parameter, url) { if (url == undefined) { url = window.location.search.substring(0); } else { url = url.substring(0); } if (url == "") { return undefined; } var results = url.match( new RegExp("(?:&|\\?)" + parameter + "=(.*?)(?:&|$)", "") ); if (results && results != null && results.length >= 1) { return unescape(results[1]); } return undefined; } }; } // End MultiOptin framework function WebinarOptin(url) { this.print = function(url) { // GoToWebinar if (url.match(/[0-9]{9,}/) || url.indexOf("gotomeeting.com") > -1) { var webinarID = url.match(/[0-9]{9,}/); // Find a 9-plus digit number in the URL... if (webinarID) { var html = document.getElementById("webinaroptin").innerHTML; var formCode = '
'; var timezone = MultiOptin.timezone(); if (timezone > 0) { formCode += ''; } formCode += '' + '' + 'Firstname: ' + 'Lastname: ' + 'Email: ' + '' + '
'; html = html + formCode; document.getElementById("webinaroptin").innerHTML = html; } } }; // end this.print if (url != undefined) { if (!document.getElementById("webinaroptin")) { document.write(''); } this.print(url); } MultiOptin.cookies = false; MultiOptin.detect(); MultiOptin.init("webinaroptin", "email", "firstname", "lastname"); MultiOptin.enable = true; // Next, try to fill in query string variables var firstname = undefined; var lastname = undefined; var email = undefined; // Look for squeeze.html?firstname=Robert&lastname=Plank notation firstname = MultiOptin.getParameter("firstname"); lastname = MultiOptin.getParameter("lastname"); email = MultiOptin.getParameter("email"); // Also accept f, l, and e if (!firstname) { firstname = MultiOptin.getParameter("f"); } if (!lastname) { lastname = MultiOptin.getParameter("l"); } if (!email) { email = MultiOptin.getParameter("e"); } if (firstname != undefined) { firstname = firstname.replace(/.html?$/, ''); } if (email != undefined) { email = email.replace(/.html?$/, ''); } if (email == "[[email]]" || email == "[email]" || email == "!email" || email == '{email}' || email == 'email') { email = undefined; } if (firstname == '{firstname}') { firstname = undefined; } if (firstname != undefined && lastname == undefined) { lastname = "-"; } MultiOptin.debug("query string firstname = " + firstname); // Fill in form fields if applicable if (firstname != undefined) { MultiOptin.fill("firstname", firstname); } if (lastname != undefined) { lastname = lastname.replace(/.html?$/, ''); MultiOptin.fill("lastname", lastname); } if (email != undefined) { MultiOptin.fill("email", email); } if (firstname != undefined && lastname != undefined && email != undefined) { if (MultiOptin.debug()) { alert("Submitting the form..."); } if (MultiOptin.debug()) { } else { MultiOptin.submitForm(); // auto submit the form } } // Submit all forms with class "autosubmit" for (i=0;i