var SocialShare = function () { $.ajaxSetup({ cache: false }); var socialShare = this; var emailSubject; var urlReferrer; socialShare.bindControl = function (id, whatToDo, returnFalse, passControl) { $(id).keypress(function () { $(this).click(); }); $(id).click(function () { if (passControl) { whatToDo(this); } else { whatToDo(); } if (returnFalse) { return false; } }); }; socialShare.setup = function (emailSubjectText, urlReferrerUrl) { emailSubject = emailSubjectText; urlReferrer = urlReferrerUrl; socialShare.bindControl('#shareViaEmailButton', socialShare.sendEmail, true, false); }; socialShare.sendEmail = function () { $(window).scrollTop(0); openShareEmailPageModalWithReferrel(emailSubject, urlReferrer, true); }; }