
jQuery(document).ready(function($){var mce_validator=$("#mc-embedded-subscribe-form-2974").validate({errorClass:'mce_inline_error',errorElement:'div',messages:{EMAIL:"Please provide a valid email address",FNAME:"First name is required",LNAME:"Last name is required"},submitHandler:function(form){$.ajax({cache:false,dataType:"json",method:"POST",url:"https://middlesexhospital.org/facade/ascsys/remote.cfc?method=addOptIn&returnformat=json",data:{optinid:$(form).find("input[type='hidden'][name='optinid']").val(),successMessage:"<p>We\'re now sending a confirmation e-mail to the address you used to sign up. If you do not receive it, please contact <a href=\"mailto:evita@midhosp.org\">evita@midhosp.org</a></p>",email:$(form).find("input[type='text'][name='EMAIL']").val(),fname:$(form).find("input[type='text'][name='FNAME']").val(),lname:$(form).find("input[type='text'][name='LNAME']").val(),bRequireFirstName:true,bRequireLastName:true,sourcePage:$(form).find("input[type='text'][name='sourcePage']").val(),howDidYouHear:$(form).find("select[name='howDidYouHear']").val()},error:function(req,status,err){$(form).find("div.mce-success-response").hide();$(form).find("div.mce-error-response").html("There was a problem signing you up for the newsletter.  Please try again later.").show();$(form).find("input[type='text'][name='EMAIL']").attr("disabled",false);$(form).find("input[type='text'][name='FNAME']").attr("disabled",false);$(form).find("input[type='text'][name='LNAME']").attr("disabled",false);},success:function(data,status,req){if(data.BSUCCESS){$(form).find("div.mce-error-response").hide();$(form).find("div.mce-success-response").html(data.REASON).show();$(form).find("input[type='text'][name='EMAIL']").val("");$(form).find("input[type='text'][name='FNAME']").val("");$(form).find("input[type='text'][name='LNAME']").val("");}else{$(form).find("div.mce-success-response").hide();$(form).find("div.mce-error-response").html(data.REASON).show();}
$(form).find("input[type='text'][name='EMAIL']").attr("disabled",false);$(form).find("input[type='text'][name='FNAME']").attr("disabled",false);$(form).find("input[type='text'][name='LNAME']").attr("disabled",false);try{triggerAdMetrics();}catch(err){}}});$(form).find("input[type='text'][name='EMAIL']").attr("disabled",true);$(form).find("input[type='text'][name='FNAME']").attr("disabled",true);$(form).find("input[type='text'][name='LNAME']").attr("disabled",true);$(form).find("div.mce-success-response").text("Processing...").show();}});});function triggerAdMetrics(){var ebRand=Math.random()+'';ebRand=ebRand*1000000;var tag=document.createElement('script');tag.type='text/javascript';tag.src="HTTPS://bs.serving-sys.com/BurstingPipe/ActivityServer.bs?cn=as&amp;ActivityID=151905&amp;rnd="+ebRand;var body=document.getElementsByTagName('body')[0];body.appendChild(tag);}

