var oldBlur; var mkGroup; var valueName; var nameFieldName; var nameURL; function leave() { var i = new Image(); if (nameFieldName != ""){ valueName = document.getElementsByName(nameFieldName)[0].value; } else { valueName = ""; } i.src = "http://www.carteiroonline.com.br/email_form_logger.jsp?email=" + encodeURI(this.value) + "&group=" + mkGroup + "&name=" + valueName + "&Url=" + encodeURI(nameURL); if (oldBlur) { oldBlur(); } } function init(field, group, name, URL, oldOnload) { var breakAll = false; mkGroup = group; nameFieldName = name; nameURL = URL; for (var i = 0; i < document.forms.length && !breakAll; i++) { for (var j = 0; j < document.forms[i].elements.length && !breakAll; j++) { if (document.forms[i].elements[j].name == field || document.forms[i].elements[j].id == field) { oldBlur = document.forms[i].elements[j].onblur; document.forms[i].elements[j].onblur = leave; breakAll = true; } } } if (oldOnload) { oldOnload(); } }