// Namespaces
if( !EV ) var EV = {};
if( !EV.Engagement ) EV.Engagement = {};
if( !EV.PickList ) EV.PickList = {};
if( !EV.Account ) EV.Account = {};
// Data
if( !EV.Strings ) EV.Strings = {};
if( !EV.Session ) EV.Session = {};
// External Data Sources / Dependencies
if( !EV_SDATA ) var EV_SDATA = {}; // ev-media.json.php
if( !SUBSCRIPTIONS ) var SUBSCRIPTIONS = {}; // subscriptions.json.php
if( !EV_MODAL ) var EV_MODAL = {}; // SiteCatalyst.js
if( !Analytics ){ var Analytics = {}; Analytics.push = function(){}; } // SiteCatalyst.js
/* Globalization support */
if( typeof EV.Globalization == "undefined" ) EV.Globalization = {};
if( typeof EV.Globalization.jRespond == "undefined" ){
EV.Globalization.jRespond = {};
EV.Globalization.jRespond.getBreakpoint = function(){}
}
// Provides all QueryString variables
if( typeof urlParams == 'undefined' ){
var urlParams = {},
ParseURL = function( URL ){
var e,
a = /\+/g,
r = /([^&=]+)=?([^&]*)/g,
d = function (s) { return decodeURIComponent(s.replace(a, ' ')); },
q = URL || window.location.search.substring(1),
y = {};
if( URL ){ e = q.split('?'); q=e[1]; }
while (e = r.exec(q)){ y[d(e[1])] = d(e[2]); }
return y;
};
(function(){ urlParams = ParseURL(); })();
}
// Net data
var EV_BYPASS = 0;
var EV_TIER = '';
// Site config
var EV_DISABLE_SITE = false;
var EV_AUTOREG_ENABLE = false;
var EV_REGISTER_ENABLE = true;
var EV_PICKLIST_ENABLE = true;
var EV_PROFILE_ENABLE = false;
var EV_SUBSCRIBE_ENABLE = true;
var EV_REMEMBER_ENABLE = true;
var EV_FORGOT_ENABLE = true;
var EV_MAX_STRIKES = 3;
var EV_RESTRICTED_BADGE = '/images/interface/download_padlock.png';
// App data
EV.SubscriptionType = {"E_ALERT":"E","INSIGHT":"S","PICKLIST":"P","RATESHEET":"R"};
EV.Pages = {"Home":"/","Login":"Login.php","Result":"Result.php","Register":"Register.php","ResendVerification":"Resend.php","Verify":"Verify.php","ForgotPassword":"Forgot-Password.php","ResetPassword":"Reset-Password.php","MyAccount":"My-Account.php","Logout":"Logout.php","Padlock":"Padlock.js","SetPassword":"Set-Password.php","PickList":"My-Account.php#Pick-List","SubscriptionConfirmation":"Subscription-Confirmation.php","API":"SelfServeAPI.php","SubscriberUpgrade":"Subscriber-Upgrade.php","PageNotFound":"404.php"};
EV.Domains = ["www.calvert.com","www.uscharitablegifttrust.org","contact.eatonvance.com","corporate.eatonvance.com","www.eatonvance.com.au","www.eatonvance.ch","www.eatonvance.dk","www.eatonvance.fi","www.eatonvance.nl","www.eatonvance.no","www.eatonvance.se","www.eatonvance.sg","www.eatonvance.co.uk","www.eatonvance.com","funds.eatonvance.ch","funds.eatonvance.dk","funds.eatonvance.fi","funds.eatonvance.nl","funds.eatonvance.no","funds.eatonvance.se","funds.eatonvance.sg","funds.eatonvance.co.uk","funds.eatonvance.com","global.eatonvance.com","www.eatonvancecounsel.com","institutional.eatonvance.com.au","institutional.eatonvance.ch","institutional.eatonvance.dk","institutional.eatonvance.fi","institutional.eatonvance.nl","institutional.eatonvance.no","institutional.eatonvance.se","institutional.eatonvance.sg","institutional.eatonvance.co.uk","institutional.eatonvance.com","www.nextshares.com","offshore.eatonvance.com","www.eatonvancerealestate.com"];
// Session data
EV.Session = {"SID":"","SessionType":"None","MasterContactId":"","UserType":"","UserGuid":"","Status":"","Profile":{"First_Name":"","Last_Name":"","Email":"","Firm_Code":""},"Subscriptions":{},"CompleteOptOut":false,"OptOuts":[]};
// Common Strings
EV.Strings.NumberWords = ["zero","one","two","three","four","five","six","seven","eight","nine","ten"];
EV.Strings.Months = ["","Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"];
EV.Strings.Regions = {"US":"United States","AU":"Australia","CH":"Switzerland","DE":"Germany","DK":"Denmark","FI":"Finland","JP":"Japan","KR":"South Korea","NL":"Netherlands","NO":"Norway","SE":"Sweden","SG":"Singapore","GB":"United Kingdom","XX":"Global"};
EV.Strings.MyAccount = {"CompleteOptOut":"Please remove me from NextShares email campaigns.","CompleteOptIn":"You have opted out from all NextShares email campaigns.","OptOut":"Opt out","OptIn":"Opt in","SubscribeMessage":"You have been subscribed successfully!","UnsubscribeMessage":"You have been un-subscribed successfully!","CompleteOptOutMessage":"You have chosen to stop receiving all email alerts from NextShares. However, these documents will continue to be available to you on this page. To opt back in to NextShares emails, please click \"Opt In\" above.","CompleteOptInMessage":"You have chosen to receive email alerts from NextShares. To opt out of any communication, please click \"Opt Out\" above.","OptOutMessage":"You have chosen to stop receiving email alerts for %s when they are available. However, these documents will continue to be available to you on this page. To opt out of all other NextShares emails, please select opt out (above right).","OptInMessage":"You have chosen to receive email alerts for %s when they are available. These documents will continue to be available to you on this page.","ManageRetail":"Manage
Retail","ManageInstitutional":"Manage
Institutional","Countries":"Countries","All":"all","Name":"Name","DateAdded":"Date Added","Frequency":"Frequency","SeeMore":"see more","Notifications":"Email notifications about my","FundDocuments":"Fund Documents","StrategyDocuments":"Strategy Documents","EVInsights":"Insights","PickList":"Pick List","PickListEmpty":"You currently have no funds in your Pick List.","PickListMoreInfo":"More Info","PickListCheckmark":"Click on the Pick List check mark to add funds you want to watch.","TitleAsset":"Asset
Class","TitleFundName":"Fund Name","TitleYTD":"YTD
Return","TitlePerformance":"Performance","TitlePickList":"Pick
List","TitlePerformanceDate":"Performance as of %s, unless otherwise indicated.","EmptyTable":"You currently do not have any subscriptions.","EmptyTableRegions":"Documents are not listed on this website. Please make a selection from the list of countries on the left.","EmptySeeMore":"Please click the \"see more\" link to find great content from NextShares.","EmptyInsights":"We're sorry, there are currently no available insights in this category.","Undo":"Undo"};
EV.Strings['general_error'] = "We apologize for the inconvenience but we are experiencing a technical issue.
We are working on a solution. Please try again later.";
// Personalization data
if(!EV.Personalization) EV.Personalization = {};
EV.Personalization.CookieExpiry = 150;
// JS UI Strings
EV.Strings["SupportPhoneNumber"] = "1-877-341-9255";
EV.Strings["GenericSupportText"] = "
If you require further assistance, please call:
1-877-341-9255.";
EV.Strings["general_error_title"] = "An Error Has Been Encountered";
EV.Strings["CoolOff"] = "Too many failed logins, please wait before trying again.";
EV.Strings["BadInputTitle"] = "Invalid input.";
EV.Strings["BadInputMessage"] = "Please try again.";
EV.Strings["InvalidEmailTitle"] = "Invalid e-mail format.";
EV.Strings["InvalidEmailMessage"] = "Please use this format: jane@example.com";
EV.Strings["SubscribeIconAlt"] = "";
EV.Strings["PadlockIconAlt"] = "Content for Investment Professionals only";
EV.Strings["AccessDeniedTitle"] = "Investment Professional Access";
EV.Strings["NoFundData"] = "We're sorry, no data is available for this fund at this time.";
EV.Strings["LastUpdated"] = "Last updated";
EV.Strings["Download"] = "DOWNLOAD";
EV.Strings["LoginModalTitle"] = "Investment Professional Sign In";
EV.Strings["SignInErrorTitle"] = "Incorrect email or password.";
EV.Strings["SignInErrorDesc1"] = "Please re-enter your company e-mail and password.
You have ";
EV.Strings["SignInErrorDesc2"] = "more sign in attempts before you'll need to contact an NextShares representative.";
EV.Strings["LoginRegisteredOnlyErrorTitle"] = "You must be registered to sign in.";
EV.Strings["StrikeOutErrorTitle"] = "You have had " + EV.Strings.NumberWords[EV_MAX_STRIKES] + " (" + EV_MAX_STRIKES + ") unsuccessful attempts.";
EV.Strings["StrikeOutMessage1"] = "In order to continue the";
EV.Strings["StrikeOutMessage2"] = "process, please contact a representive from NextShares at 1-877-341-9255.";
EV.Strings["VerifiedErrorTitle"] = "This account has not been activated.";
EV.Strings["VerifiedMessage"] = "Your credentials are currently being reviewed by the NextShares team. You will receive an e-mail notification within 24 to 48 hours." + EV.Strings["GenericSupportText"];
EV.Strings["InactiveErrorTitle"] = "This account is no longer active.";
EV.Strings["InactiveMessage"] = "Your account has been deactivated." + EV.Strings["GenericSupportText"];
EV.Strings["NewLoginErrorTitle"] = "This account is no longer active.";
EV.Strings["NewLoginMessage"] = "Your account has been deactivated. Please use ." + EV.Strings["GenericSupportText"];
EV.Strings["DeniedErrorTitle"] = "This account has been denied.";
EV.Strings["DeniedMessage"] = "Our records indicate your access has been denied." + EV.Strings["GenericSupportText"];
EV.Strings["SubscribeTitle"] = "Investment Professional Subscription";
EV.Strings["SubscribeInsightsTitle"] = "Subscribe to NextShares Insights";
EV.Strings["DownloadTitle"] = "Successful Download";
EV.Strings["SubscribeRegisteredOnlyTitle"] = "You must be registered to subscribe to restricted content.";
EV.Strings["ForgotTitle"] = "Forgot Password";
EV.Strings["ForgotBadEmailErrorTitle"] = "The email you entered is not in our database.";
EV.Strings["ForgotBadEmailErrorMessage"] = "Please try again.";
EV.Strings["ForgotRegisteredOnlyTitle"] = "Only registered users have passwords.";
EV.Strings["RegisterTitle"] = "Investment Professional Registration";
EV.Strings["RegisterBadEmailErrorTitle"] = "Unfortunately, we could not locate this email address in our records.";
EV.Strings["RegisterBadEmailErrorMessage"] = "If you would like to try another email address, enter it below and click submit. Otherwise, please click here to access our standard registration process.";
EV.Strings["RegisterBadEmailErrorMessage2"] = "If you would like to try another email address, enter it below and click submit. Otherwise, please click here to register.";
EV.Strings["RegisterBadEmailErrorMessage3"] = "If you would like to try another email address, enter it below and click submit.";
EV.Strings["RegisterInUseErrorTitle"] = "This email is already in use. Please try signing in.";
EV.Strings["FundLitModalTitle"] = "Subscribe for Notifications";
EV.Strings["SignInTooltipTitle"] = "Access exclusive resources";
EV.Strings["PickListTooltipTitle"] = "Watch funds on your Pick List";
EV.Strings["GeoLockJavaScriptDisclaimer"] = "This site requires JavaScript to be enabled to view content.";
EV.Strings["RememberMeExpiredTitle"] = "Please Re-enter Email";
EV.Strings["RememberMeExpiredMessage"] = "We're sorry, your 'Remember Me' cookie has expired.";
EV.Strings['NoSalesPageTitle'] = "Email Change";
EV.Strings['NoSalesPageInvalid'] = "This Email is no longer valid, please enter a new email address";
// Share By Email UI
EV.Strings.share = {"empty_name":"Your name cannot be blank. Please enter it and try again.","empty_from_email":"The 'My Contact Email Address' field cannot be blank. Please enter it and try again.","empty_to_email":"The 'Recipients Email' field cannot be blank. Please enter it and try again.","btn_sending":"Sending...","btn_text":"Send Email","success_message":"Your message has been sent."};
/*--------------------------------------------------
* EV.Engagement
* - All major code for user engagement flows
* - Includes public tooltip and modal utilities
*/
(function($){
var ME = EV.Engagement,
_email = _oldEmail = _goal = _name = _value = _itemData = _type = _post = _response = _guid = null,
_$anchor = _openModal = _triggerRefresh = _remember = _debug = _debugAnalytics = _noHover = false,
_completeCount = 0;
ME.completeCheckCount = 0;
ME.noTooltip = false;
ME.strikesLeft = EV_MAX_STRIKES;
EV.Strings.Breakpoints = { MOBILE: 'mobile', TABLET: 'tablet', DESKTOP: 'desktop' };
/*--------------------------------------------------
* EV.Engagement Init
*/
$(function(){
if( urlParams.email && typeof urlParams.email === 'string' ){ _email = urlParams.email.trim(); }
if( urlParams.Email && typeof urlParams.Email === 'string' ){ _email = urlParams.Email.trim(); }
if( EV.Session && EV.Session.Profile && EV.Session.Profile.Email && typeof EV.Session.Profile.Email === 'string' ){ _email = EV.Session.Profile.Email.trim(); }
if( urlParams.DM == 'register' ) Register('Registrant', urlParams); // register by URL
if( urlParams.en == '1' ) _debug = true;
if( urlParams.error == '1' ) ME.SystemError( { refreshOnClose : false } );
/*--------------------------------------------------
* Global Sign In/Register/Account/Picklist Links
*/
$(document).on('click', '.ev-login', function(e){
e.stopPropagation();
if( EV.Session.SessionType != 'Verified' ) e.preventDefault();
var target = e.target || e.srcElement, $target = $(target), $this = $(this);
// login - if not in tooltip/modal, this uses page were on
// login - uses page were on
_$anchor = ( $this.attr('href') != '#' || _openModal || !$this.parents('a').length || $this.parents('.ev-register').length ) ? $this : $this.parents('a').first();
if( !$target.hasClass('ev-register') ) Login();
});
$(document).on('click', '.ev-gated, .ev-gated-subscription', function(e){
_$anchor = $(this);
var target = e.target || e.srcElement, $target = $(target);
if( EV_BYPASS == 1 ){
if( $target.hasClass('ev-login') ){
Login();
} else if ( $target.hasClass('ev-register') ) {
Register('Registrant', _$anchor);
} else {
e.preventDefault();
if( $target.hasClass('subscribe') ){
_$anchor = $target;
Subscribe();
} else if( $target.is('a.ev-unsubscribe') ){
_$anchor = $target;
Unsubscribe();
} else {
Download();
}
}
} else {
e.preventDefault();
if( EV.Session.SessionType == 'Verified' ){
if( $target.hasClass('subscribe') ){
_$anchor = $target;
Subscribe();
} else if( $target.is('a.ev-unsubscribe') ){
_$anchor = $target;
Unsubscribe();
} else {
Download();
}
} else {
if( $target.hasClass('subscribe') ){
_$anchor = $target;
Subscribe();
} else if ( $target.hasClass('ev-register') ) {
Register('Subscriber', _$anchor);
} else if( !$target.hasClass('ev-register') ){
Login();
}
}
}
});
$(document).on('click', '.apf-ev-gated', function(e){
if( EV_BYPASS != 1 ){
e.preventDefault();
e.stopPropagation();
_$anchor = $(this);
if( EV.Session.SessionType != 'Verified' ){
Login();
} else {
Download();
}
}
});
$(document).on('click', '.ev-register, a[href="#ev-register"]', function(e){
e.stopPropagation();
if( EV.Session.SessionType != 'Verified' ){
e.preventDefault();
var target = e.target || e.srcElement, $target = $(target), $this = $(this);
_$anchor = ( $this.attr('href') != '#' || _openModal || $this.parents('.ev-register').length ) ? $this : $this.parents('a').first();
Register('Registrant', _$anchor); // register by click on Register link
}
});
$(document).on('click', '.ev-full-registration, a[href="#ev-full-registration"]', function(e){
e.preventDefault();
LongFormRegRedirect();
});
$(document).on('click', '.ev-account', function(e){
if( EV.Session.SessionType != 'Verified' ) e.preventDefault();
if( EV.Session.SessionType == 'Verified' ) window.location.href = EV.Pages.MyAccount;
});
$(document).on('click', '.ev-picklist', function(e){
if( EV.Session.SessionType != 'Verified' ) e.preventDefault();
if( EV.Session.SessionType == 'Verified' ) window.location.href = EV.Pages.PickList;
});
$(document).on('click', '.ev-forgot', function(e){
e.preventDefault();
ForgotPassword();
});
$('#tools-export').click(function(e){
if( EV.Session.SessionType != 'Verified' ){
e.preventDefault();
_$anchor = $(this);
Login();
}
});
/*--------------------------------------------------
* Add Classes on Load: Login & Register Author Links / Gated Content / Subscription Icons+Classes
*/
$( window ).load(function() {
$('a[href*="javascript:docload"],a[href*="javascript:docLoad"]').each(function(){
ME.LinkIconHandler( $(this) );
});
});
$('a[href="#ev-login"]').each(function(){
$(this).addClass('ev-login');
});
$('a[href="#ev-register"]').each(function(){
$(this).addClass('ev-register');
});
$('a[href*="javascript:subscribe"]').each(function(){
$(this).addClass('ev-subscription no-tooltip');
});
/*--------------------------------------------------
* Modal Content Binds
*/
$(document).on('click', '.simplemodal-data #ev-login-submit', function(e){
e.preventDefault();
LoginSubmit();
});
$(document).on('click', '.simplemodal-data #ev-register-submit', function(e){
e.preventDefault();
RegisterSubmit();
});
$(document).on('click', '.simplemodal-data #ev-resend-email', function(e){
e.preventDefault();
Resend( $('.simplemodal-data .simplemodal-title:visible').text() );
});
$(document).on('click', '.simplemodal-data #ev-forgot-submit', function(e){
e.preventDefault();
ForgotSubmit();
});
$(document).on('click', '.simplemodal-data #ev-no-sp-submit', function(e){
e.preventDefault();
NoSalesPageRecordSubmit();
});
$(document).on('click', '.simplemodal-data .ev-subscribe-submit', function(e){
e.preventDefault();
SubscribeSubmit();
});
$('.simplemodal-data input[type="text"], .simplemodal-data input[type="password"]').focus(function() {
var $input = $(this);
$input.addClass('focus');
});
$('.simplemodal-data input[type="text"], .simplemodal-data input[type="password"]').blur(function() {
var $input = $(this);
$input.removeClass('focus');
});
$(document).on('keydown', '.simplemodal-data .ev-form', function(e){
var keyCode = ( e.keyCode ) ? e.keyCode : e.which,
target = e.target || e.srcElement,
$target = $(target),
type = $target.attr('type');
if( keyCode == 13 ){
if( type == 'submit' || type == 'text' || type == 'password' ){
e.preventDefault();
$('input[type="submit"]', this).first().click();
}
if( type == 'checkbox' ) $target.click();
}
});
$(document).on('click', '.ev-contentrequest-rm', function(e){
e.preventDefault();
ContentRequestRemember();
});
/*--------------------------------------------------
* Sign-in/Picklist/Subscribe tooltips
*/
// FA Sign-in tooltip // TODO: move into SDATA conditional.
if( EV.Session.SessionType != 'Verified' ) { // For non-logged in users
var tooltipConfig = {
parentSelector : '.ev-gated:not(.no-tooltip), .apf-ev-gated:not(.no-tooltip)',
tooltipContent: '.ev-signin-tooltip',
customContent: { '.ev-signin-title': EV.Strings["SignInTooltipTitle"] }
};
if( !EV_REGISTER_ENABLE ){
tooltipConfig.customContent['p:last'] = '';
}
ME.Tooltip( tooltipConfig );
}
// Subscribe-able Tooltip
if( EV_SUBSCRIBE_ENABLE ){
var tooltipConfig = {
parentSelector : '.ev-subscription:not(.no-tooltip, .myaccount-table .ev-subscription), .ev-gated-subscription:not(.no-tooltip, .myaccount-table .ev-gated-subscription)',
tooltipContent: '.ev-download-subscribe',
beforeShow: SubscribeTooltipBeforeShow
};
ME.Tooltip( tooltipConfig );
var tooltipConfig = {
parentSelector : '.myaccount-table .ev-subscription, .myaccount-table .ev-gated-subscription',
tooltipContent: '.ev-download-subscribe',
my: 'left+25',
beforeShow: SubscribeTooltipBeforeShow
};
ME.Tooltip( tooltipConfig );
}
// Subscribe tooltip button
$(document).on('click', '.ev-subscription', function(e){
e.preventDefault();
e.stopPropagation();
var target = e.target || e.srcElement, $target = $(target);
if( $target.parents('.myaccount-table').length && EV.Globalization.jRespond.getBreakpoint() != EV.Strings.Breakpoints.DESKTOP ) return false;
if( $target.is('a.subscribe') || $target.attr('href') && $target.attr('href').toLowerCase().indexOf('javascript:subscribe(') > -1 ){
_$anchor = $target;
Subscribe();
} else if( ( $target.is('span') || $target.is('img') ) ){
$parentAnchor = $target.parent('a.ev-subscription').first();
if( $parentAnchor.length == 0 ){
if( $(this).hasClass('ev-subscription') ){
$parentAnchor = $(this);
} else {
$parentAnchor = $(this).parent('.ev-subscription').first();
}
}
if( $parentAnchor.length && $parentAnchor.attr('href').toLowerCase().indexOf('javascript:subscribe(') > -1 ){
_$anchor = $parentAnchor;
Subscribe();
} else if( $parentAnchor.length && $parentAnchor.attr('href').toLowerCase().indexOf('javascript:docload(') > -1 && !$target.hasClass('subscribe') ){
_$anchor = $target.parents('.ev-subscription').first();
Download();
}
} else if( $target.is('a.download') || ( ( $target.is('span') || $target.is('b') ) && $target.parents('a.ev-subscription').length ) ){
_$anchor = $target.parents('.ev-subscription').first();
Download();
} else if( $target.is('a.ev-unsubscribe') ){
_$anchor = $target;
Unsubscribe();
}
});
/*--------------------------------------------------
* Floating Join Button
*/
if( EV.Session.SessionType != 'Verified' ){
// Tooltip on hover
var tooltipConfig = {
parentSelector : '#tools > ul > li.ev-register',
tooltipContent: '.ev-tooltip-join'
};
if( !EV_REGISTER_ENABLE ){
tooltipConfig.tooltipContent = '.ev-signin-tooltip';
tooltipConfig.customContent = {
'.ev-signin-title' : EV.Strings["SignInTooltipTitle"],
'p:last' : ''
};
}
}
/*--------------------------------------------------
* Landing triggers
*/
if( urlParams.showloginmodal ) {
_$anchor = $('').attr('href', '#').addClass('ev-login');
Login();
}
if( urlParams.error == 'upgraded' ) {
var modalArgs = {
modalContent: '#ev-modal-error-upgraded',
titleText: EV.Strings["RegisterTitle"],
onClose: function() { history.replaceState( {}, document.title, window.location.pathname ); }
};
ME.Modal( modalArgs );
}
if( urlParams.vst && EV.Session.SessionType == 'Verified' && EV_REMEMBER_ENABLE ) {
ContentRequestRemember();
}
if( EV.Session.SessionType != 'Verified' && urlParams.email
&& typeof urlParams.resend != 'undefined' ) {
_email = ( typeof urlParams.email === 'string' ) ? urlParams.email.trim() : '';
var modalArgs = {
modalContent: '#ev-modal-contentrequest-resend',
titleText: EV.Strings["LoginModalTitle"],
onShow: function(){ $('.simplemodal-data .user-email').html( _email ); ME.ModalResize(); }
};
ME.Modal( modalArgs );
$('.ev-vsresend-submit').click(function(e){
e.preventDefault();
StartResend();
});
}
if( $('.ev-form').length ){
$('.ev-form:visible:first :input:enabled:visible:first').focus();
}
}); // end: Init
/*--------------------------------------------------
* EV.Engagement Public Methods
*/
// Used to programmatically change an open modal's onClose
ME._existingModalOnClose = function(){};
ME.UpdateEmail = function( email ){ if( email && typeof email === 'string' ){ _email = email.trim(); } }
// EV.Engagement.Modal - Initializes SimpleModal with content and callbacks
ME.Modal = function( args ){
if (EV_DISABLE_SITE) {
$(args.modalContent + ' form').html('
' + EV.Strings["general_error"] + '
');
}
var $modalTemplate = $('#ev-modal'),
modalContent = args.modalContent || false, // accepts selectors and jQuery objects (.append()s)
titleText = args.titleText || false,
overlayClose = typeof args.overlayClose !== 'undefined' ? args.overlayClose : true,
close = typeof args.close !== 'undefined' ? args.close : true,
opacity = args.opacity || 30,
closeClass = args.closeClass || 'close',
minWidth = args.minWidth || null,
minHeight = args.minHeight || null,
persistErrors = args.persistErrors || false,
refreshOnClose = args.refreshOnClose || false,
redirectOnClose = args.redirect || false,
overlayCss = args.overlayCss || {};
if( !$modalTemplate.length || !modalContent ) return false;
if( _openModal ){
$.simplemodal.close();
ME.Modal( args );
} else {
$modalTemplate.children().hide();
if ($.type(modalContent) == 'string') {
if( $(modalContent, $modalTemplate).length ){
$(modalContent, $modalTemplate).show();
} else if( $(modalContent).length ){
$modalTemplate.append( $(modalContent).clone() );
$(modalContent, $modalTemplate).show();
} else {
return false;
}
} else if( modalContent instanceof $ ){
$modalTemplate.append( modalContent );
$modalTemplate.children().last().show();
} else {
return false;
}
// Start Analytics
var modal_type = args.modalType || false;
var pn = titleText?titleText:modalContent.substring(1).replace('-',' ');
pn = pn.toLowerCase();
Analytics.push(['viewModal',pn,modal_type]);
// End Analytics
if( titleText ){
$('.simplemodal-header', $modalTemplate).show();
$('.simplemodal-title', $modalTemplate).html( titleText );
}
// Extra Internal Functions
var _onClose = function(){
_openModal = false;
if( ME._triggerDownload ) {
var href = _$anchor.attr('href').toLowerCase();
if( href.substr(0,18)=='javascript:docload' ){
var params = docLoadParams(href);
docLoad(params[0],params[1]);
} else {
window.open( _value );
}
}
$.simplemodal.close();
if( !_debug && refreshOnClose ) { window.location.reload(); }
if( redirectOnClose ) { window.location.href = redirectOnClose; }
};
var onClose = args.onClose || function(){};
var onCloseCombined = function(){
_onClose(); // default internal behavior
onClose(); // user-defined on creation
ME._existingModalOnClose(); // programmable anytime
};
var _onShow = function( dialog ){
_openModal = true;
ME.strikesLeft = EV_MAX_STRIKES;
$('.simplemodal-data div:visible input[type="text"], .simplemodal-data div:visible input[type="password"]').first().focus();
$('.simplemodal-data div:visible input[type="submit"]:disabled').removeAttr('disabled');
};
var onShow = args.onShow || function(){};
var onShowCombined = function(){
_onShow();
onShow();
};
// Get content size
var borderWidth = 0;
if( $modalTemplate.css('box-sizing') == 'border-box' ){
borderWidth = 10;
}
if( minHeight == null ) minHeight = $modalTemplate.outerHeight() + borderWidth;
if( minWidth == null ) minWidth = $modalTemplate.outerWidth() + borderWidth;
// Run modal
var modalOptions = {
close: close,
overlayClose: overlayClose,
opacity: opacity,
closeClass: closeClass,
minWidth: minWidth,
minHeight: minHeight,
onShow: onShowCombined,
onClose: onCloseCombined,
overlayCss: overlayCss,
};
if( EV.Globalization.jRespond.getBreakpoint() == EV.Strings.Breakpoints.MOBILE ){
modalOptions.minHeight = $(window).height();
}
$modalTemplate.simplemodal( modalOptions );
if( EV.Globalization.jRespond.getBreakpoint() == EV.Strings.Breakpoints.MOBILE ){
ME.ModalResize();
}
}
}
// EV.Engagement.ModalResize - Resizes modal
ME.ModalResize = function( args ){
var $modal = $('#simplemodal-container');
if( EV.Globalization.jRespond.getBreakpoint() != EV.Strings.Breakpoints.MOBILE ){
var headerHeight = $('.simplemodal-header:visible', $modal).outerHeight(true),
newWidth = newHeight = childHeight = finalHeight = extraHeight = 0;
$('.ev-modal > div:visible', $modal).not('.simplemodal-header').each(function(){
newWidth = ( $(this).outerWidth() > newWidth ) ? $(this).outerWidth(true) : newWidth;
newHeight += $(this).outerHeight();
});
newHeight += headerHeight;
// Help IE7: Register Error
$('.ev-modal > div:visible', $modal).not('.simplemodal-header').children(':visible').each(function(){
childHeight += $(this).outerHeight(true);
});
childHeight += headerHeight;
extraHeight = ( $('#ev-modal-register:visible', $modal).length ) ? 30 : 0;
finalHeight = ( (childHeight+extraHeight) >= newHeight ) ? (childHeight+extraHeight) : newHeight;
if( $modal.css('box-sizing') == 'border-box' ){
$modal.innerWidth( newWidth);
$modal.innerHeight( finalHeight );
} else {
$modal.css('width', newWidth );
$modal.css('height', finalHeight );
}
$modal.css('left', $(window).width() / 2 - $modal.width() / 2 - 5 ); // -5 simplemodal?
// Help IE7: Register Error
$('#ev-modal-register .left', $modal).css('zoom','1').show();
$('#ev-modal-register .left', $modal).children().css('zoom','1').show();
} else {
$modal.innerWidth( $(window).width() - 10);
$modal.innerHeight( $(window).height() );
$modal.css('top', '0px');
$modal.css('left', '0px');
}
}; // end: ME.ModalResize
// EV.Engagement.Tooltip - Initializes Tooltip with content and callbacks
ME.Tooltip = function( args ){
var parentSelector = args.parentSelector || false, $tooltip,
tooltipContent = args.tooltipContent || false,
$template = args.$template || $('#ev-tooltip-template'),
templateSelector = args.templateSelector || '.ev-tooltip',
my = args.my || 'left+25',
at = args.at || 'right',
offset = args.offset || '25 0',
fadeSpeed = args.fadeSpeed || EV.fadeSpeed,
customContent = args.customContent || false, // key value pairs '.selector' : ''
beforeShow = args.beforeShow || function(){}; // $parent passed in automatically
// Bad input
if( !parentSelector || !tooltipContent || !$template.length || templateSelector=='' ) return false;
// Can't handle tooltip: IE7+HeadingButton+HomeCarousel
if( $(parentSelector).parents('#heading').length
&& $('.carousel-home').length
&& navigator.appVersion.indexOf("MSIE 7.")!=-1 ) return false;
$(document).on({
mouseenter: function(){
if( ME.noTooltip ) return false;
var $this = $(this); _$anchor = $this; // Store parent for tooltip clicks
if( !$(templateSelector, $this).length ) $template.clone(false).removeAttr('id').appendTo( $this );
$tooltip = $(templateSelector, $this);
if( customContent ){
for(var selector in customContent){
if( customContent.hasOwnProperty( selector ) ){
$( selector, tooltipContent ).html( customContent[selector] );
}
}
}
$tooltip.children().not('.ev-tooltip-arw, .ev-tooltip-arw-border, ' + tooltipContent).remove();
$('.ev-tooltip-arw, .ev-tooltip-arw-border', $tooltip).show();
$(tooltipContent, $tooltip).show();
beforeShow( $this );
$tooltip.stop(true, true).fadeIn( fadeSpeed );
$tooltip.position({
my: my,
at: at,
of: $this,
offset: offset,
collision: 'flipfit'
});
$('.ev-tooltip-arw',$tooltip).position({
my: my,
at: at,
of: $this,
collision: 'flipfit'
});
$('.ev-tooltip-arw-border',$tooltip).position({
my: my,
at: at,
of: $this,
collision: 'flipfit'
});
if ( $this.offset().left > $tooltip.offset().left ) {
$('.ev-tooltip-arw, .ev-tooltip-arw-border').removeClass('arw-left');
$('.ev-tooltip-arw, .ev-tooltip-arw-border').addClass('arw-right');
//$('.ev-tooltip-arw').css('left', '' + $tooltip.outerWidth()-6 + 'px' );
//$('.ev-tooltip-arw-border').css('left', '' + $tooltip.outerWidth()-6 + 'px' );
} else {
$('.ev-tooltip-arw, .ev-tooltip-arw-border').removeClass('arw-right');
$('.ev-tooltip-arw, .ev-tooltip-arw-border').addClass('arw-left');
//$('.ev-tooltip-arw').css('left', '-46px' );
//$('.ev-tooltip-arw-border').css('left', '-48px' );
}
},
mouseleave: function() {
if( ME.noTooltip ) return false;
$(templateSelector, $(this)).stop(true, true).fadeOut( fadeSpeed );
}
}, parentSelector );
}; // end: ME.Tooltip
// EV.Engagement.ModalErrorClear - Hides any error messages in a modal
ME.ModalErrorClear = function(){
var $modal = $('#simplemodal-container'),
$currentContent = $('.simplemodal-data > div:visible', $modal).not('.simplemodal-header'),
$errorDiv = $currentContent.children('.ev-modal-error');
$errorDiv.hide();
}; // end: EV.ModalErrorClear
// EV.Engagement.ModalError - Updates modal with DOM object with error title and text
ME.ModalError = function( args ){
if( !_openModal ){ ME.SystemError(); return false; }
var title = args.title || '',
description = args.description || '',
message = args.message || '',
$modal = $('#simplemodal-container'),
$currentContent = $('.simplemodal-data > div:visible', $modal).not('.simplemodal-header'),
$errorDiv, $errorTitle, $errorDesc;
if( _debug ){ console.log( title ); console.log( description ); }
if( title == '' && description == '' ){ ME.SystemError(); return false; }
if( message != '' ){
$currentContent.hide();
var $newContent = $('').addClass('ev-modal-generic').append( $('
').html( message ) );
$currentContent.parent().append( $newContent );
$currentContent.parent().children('div').last().show();
$currentContent = $('.simplemodal-data div:visible').not('.simplemodal-header');
}
$errorDiv = $currentContent.children('.ev-modal-error');
if( $errorDiv.length ){ // Update
if( title != '' ){
if( $errorDiv.children('h5').length ){
$errorDiv.children('h5').html( title );
} else {
$errorTitle = $('
').html( title );
$errorDiv.prepend( $errorTitle );
}
}
if( description != '' ){
if( $errorDiv.children('p').length ){
$errorDiv.children('p').html( description );
} else {
$errorDesc = $('
').html( description );
$errorDiv.append( $errorDesc );
}
}
$errorDiv.show();
// Analytics Error Tracking
Analytics.push(['trackError',title?title:description]);
} else { // Create
var $newError = $('
').addClass('ev-modal-error');
// Analytics Error Tracking
Analytics.push(['trackError',title?title:description]);
if( title != '' ) $errorTitle = $('
').html( title );
if( description != '' ) $errorDesc = $('
').html( description );
$newError.append( $errorTitle ).append( $errorDesc );
$currentContent.prepend( $newError );
}
var onShow = args.onShow || function(){};
onShow();
setTimeout( function(){ ME.ModalResize(); }, 200 );
}; // end: EV.ModalError
ME.RefreshModalOnClose = function( refresh ){
if( refresh === true || refresh === false ){
_triggerRefresh = refresh;
}
}
// EV.Engagement.Login - Public login function
ME.Login = function( $anchor ){
var $anchor = ( $anchor instanceof $ ) ? $anchor : $($anchor);
if( !$anchor.length ) return false;
_$anchor = $anchor;
Login();
} // end: ME.Login
// EV.Engagement.Register - Public register function
ME.Register = function( $anchor ){
var $anchor = ( $anchor instanceof $ ) ? $anchor : $($anchor);
if( !$anchor.length ) return false;
_$anchor = $anchor;
Register('Registrant', _$anchor);
} // end: ME.Register
// EV.Engagement.Subscribe - Public subscribe function
ME.Subscribe = function( $anchor ){
var $anchor = ( $anchor instanceof $ ) ? $anchor : $($anchor);
if( !$anchor.length ) return false;
_$anchor = $anchor;
Subscribe('Registrant', _$anchor);
} // end: ME.Subscribe
// EV.Engagement.Unsubscribe - Public unsubscribe function
ME.Unsubscribe = function( args ){
_value = args._value;
_type = args._type;
_name = args._name;
UnsubscribeSubmit();
}
// EV.Engagement.Ajax - Public Ajax helper
ME.Ajax = function( args ){
if( typeof args === "object" && args != null ) doAjax( args );
};
// EV.Engagement.SelfServeErrors - Public errors helper
ME.SelfServeErrors = function( args ){
if( typeof args === "object" && args != null ) SelfServeErrors( args );
}
// EV.Engagement.SelfServeErrors - Public ajax complete helper
ME.CompleteHandler = function( args ){
if( typeof args === "object" && args != null ) return CompleteHandler( args );
}
// EV.Engagement.SystemError - Provides a generic error for !_openModal situations
ME.SystemError = function( args ){
var refreshOnClose = ( typeof args != 'undefined' && typeof args.refreshOnClose != 'undefined' ) ? args.refreshOnClose : true;
var modalArgs = {
modalContent: '#ev-modal-error',
titleText: EV.Strings["general_error_title"],
refreshOnClose: refreshOnClose
}
ME.Modal( modalArgs );
} // end: EV.Engagement.SystemError
// EV.Engagement.GetMediaItem - Returns ev-media.json item data given a needle
ME.GetMediaItem = function( keyString, type ){
var type = type || EV.SubscriptionType.E_ALERT;
if( typeof keyString === "string" && keyString != null )
return GetMediaItem( keyString, type );
}
// Adds gated/subscriptions classes and icons to engagement anchors
ME.LinkIconHandler = function( $anc ){
var itemData = GetMediaItem( $anc.attr('href') );
if ( !itemData
|| $anc.hasClass('acctbutton')
|| $anc.hasClass('no_padlock')
|| $anc.hasClass('recent-insight')
|| $anc.parents('ul.controls').length
|| $anc.parents('.insight-feature').length
) return;
// Helper markup for certain $anchors
if( !$anc.hasClass('downloadicon')
&& !$anc.hasClass('subscribeicon')
&& !$anc.parent('h4').length
&& !$anc.children('span').length
&& !$anc.parents('ul.resources').length ){
$anc.wrapInner('');
}
// Prevent Tooltips
var showTooltip = ( $anc.hasClass('no_tooltip' ) ) ? false : true;
// Show/hides icon
var showIcons = true;
if ( $anc.parents('div.carousel-item').length ) showIcons = false;
// Custom icon insertion $targets
var parentEvent = false;
var $target = false;
if ( $anc.parents('div.event').length ) {
parentEvent = $anc.closest('div.event');
$target = $('p.title a span', parentEvent);
}
if ( $anc.hasClass('downloadicon')
|| $anc.hasClass('subscribeicon') ){
$target = $('> span', $anc);
}
// Additional styling
var buttonWrapper = $anc.parents('div.buttons');
if ( buttonWrapper.length ) {
buttonWrapper.addClass('padlock');
}
// Add new hooks
if ( ( itemData.lockedtags && !$.isEmptyObject(itemData.lockedtags) ) && itemData.tags.subscribeable==true && EV_SUBSCRIBE_ENABLE ) {
if( showTooltip ) $anc.addClass('ev-gated-subscription');
$anc.addClass('sid_' + itemData.sku);
if ( showIcons ) {
// subscribe icon
var elementSubscribe = document.createElement('img');
elementSubscribe.setAttribute('class', 'subscribe');
elementSubscribe.setAttribute('alt', EV.Strings["SubscribeIconAlt"]);
elementSubscribe.setAttribute('src', '/images/interface/widget_plus.gif');
// gated icon
var elementPadlock = document.createElement('img');
elementPadlock.setAttribute('class', 'padlock');
elementPadlock.setAttribute('alt', EV.Strings["PadlockIconAlt"]);
// There is a Content Element defined for the Padlock image, but it wasn't
// being referenced. Perhaps Enthink wanted to move the definition here.
elementPadlock.setAttribute('src', EV_RESTRICTED_BADGE);
if ( $target ) {
if ( !$target.children('img').length ) $target.append( elementPadlock );
if ( !$target.children('img').length && showTooltip ) $target.append( elementSubscribe );
$target.append( elementPadlock );
if( showTooltip ) $target.append( elementSubscribe );
} else {
if ( !$anc.children('img').length ) $anc.append( elementPadlock );
if ( !$anc.children('img').length && showTooltip ) $anc.append( elementSubscribe );
$anc.append( elementPadlock );
if( showTooltip ) $anc.append( elementSubscribe );
}
}
} else if ( itemData.tags.subscribeable == true && EV_SUBSCRIBE_ENABLE ) {
if( showTooltip ) $anc.addClass('ev-subscription');
$anc.addClass('sid_' + itemData.sku);
if ( showIcons ) {
var elementSubscribe = document.createElement('img');
elementSubscribe.setAttribute('class', 'subscribe');
elementSubscribe.setAttribute('alt',EV.Strings["SubscribeIconAlt"]);
elementSubscribe.setAttribute('src', '/images/interface/widget_plus.gif');
if ( $target ) {
if ( !$($target).children('img').length && showTooltip ) $target.append( elementSubscribe );
} else {
if ( !$anc.children('img').length && showTooltip ) $anc.append( elementSubscribe );
}
}
} else if ( itemData.lockedtags && !$.isEmptyObject(itemData.lockedtags) ) {
$anc.addClass('ev-gated');
if ( showIcons ) {
var elementPadlock = document.createElement('img');
elementPadlock.setAttribute('class', 'padlock');
elementPadlock.setAttribute('alt', EV.Strings["PadlockIconAlt"]);
// There is a Content Element defined for the Padlock image, but it wasn't
// being referenced. Perhaps Enthink wanted to move the definition here.
elementPadlock.setAttribute('src', EV_RESTRICTED_BADGE);
if ( $anc.find('span.arw').length > 0 ) {
$(elementPadlock).attr('style', 'padding-left:12px;');
}
if ( $anc.find('span > img').length > 0 && $anc.find('img.GeoLock').length == 0) { // show it if has GeoLock
$(elementPadlock).attr('style', 'display:none;');
}
if ( $target ) {
if ( !$target.children('img').length ) $target.append( elementPadlock );
} else {
if ( !$anc.children('img').length ) {
if ( $anc.parents('ul.resources').length ) {
$anc.parent().prepend( $(elementPadlock).css('float','right') );
} else {
$anc.append( elementPadlock );
}
}
}
}
}
}; // end: LinkIconHandler
/*--------------------------------------------------
* EV.Engagement Private Methods
*/
// Track user action and resource
var TrackUser = function(){
if( _openModal ){
if (typeof console == "object") {
if( _debug ){
console.log( '#' );
console.log( 'goal: ' + _goal );
console.log( 'value: ' +_value );
console.log( 'name: ' + _name );
console.log( 'type: ' + _type );
console.log( '$anchor: ' );
console.log( _$anchor );
}
}
if( _goal != null ) return false;
} else {
_goal = _name = _value = _itemData = null;
}
// If user should be redirected
if (urlParams.referer) {
_goal = 'access';
_value = _name = urlParams.referer;
_triggerRefresh = true;
if( urlParams.referer.toLowerCase().indexOf('loaddocument') >= 0 ){
var refParams = ParseURL( urlParams.referer );
if( refParams && typeof refParams['fn'] == 'undefined' ){ ME.SystemError(); return false; }
var href = "javascript:docload('"+refParams['fn']+"','fundPDFs');";
_$anchor = $('').attr('href',href);
_itemData = GetMediaItem( href );
if( _itemData && _itemData.name ) _name = _itemData.name;
} else {
_$anchor = $('').attr('href',_value);
_itemData = GetLockedPage( _value.replace(/^.*[\\\/]/, '') );
}
}
if( !_$anchor ) return false;
if( _$anchor.hasClass('ev-clear-tracking') ){ _$anchor = _goal = _name = _value = _itemData = null; }
// Sign-in click
if( _$anchor.hasClass('ev-login') || _$anchor.hasClass('ev-register') ){
_goal = 'access';
_value = window.location.href;
_name = document.title;
if( _$anchor.attr('href') != '#' && _$anchor.attr('href') != '#ev-login' && _$anchor.attr('href') != EV.Pages.Login && !_$anchor.is('li.ev-register') ){
_value = _$anchor.attr('href');
_name = _$anchor.text();
} else {
var $parentLink = _$anchor.parents('a').first();
if( $parentLink.length && $parentLink.attr('href') != '#' && $parentLink.attr('href') != '' ){
_value = $parentLink.attr('href');
_name = $parentLink.text();
}
}
}
// [Locked] Document Click
if( _$anchor.hasClass('ev-gated') || _$anchor.parent().hasClass('ev-gated') ){
_goal = 'access';
_value = ( _$anchor.attr('href') != '#' ) ? _$anchor.attr('href') : _$anchor.parents('a').first().attr('href');
_itemData = GetMediaItem( _value );
if( !_itemData ){ ME.SystemError(); return false; }
_name = _itemData.name;
_type = _itemData.type;
}
// Locked Page
if( _$anchor.hasClass('apf-ev-gated') ){
_goal = 'access';
_value = ( _$anchor.attr('href') != '#' ) ? _$anchor.attr('href') : _$anchor.parents('a').first().attr('href');
_itemData = GetLockedPage( _value );
if( !_itemData ){ ME.SystemError(); return false; }
_name = _itemData.name;
}
// Locked & Subscribe-able: Accessed registration through login modal. "Click" or "Get PDF Now"
if( _$anchor.hasClass('ev-gated-subscription') ){
_goal = 'access';
_value = ( _$anchor.attr('href') != '#' ) ? _$anchor.attr('href') : _$anchor.parents('a').first().attr('href');
_itemData = GetMediaItem( _value );
if( !_itemData ){ ME.SystemError(); return false; }
_name = _itemData.name;
_type = _itemData.type;
}
// "Subscribe" and "Un-subscribe" tooltip buttons
if( _$anchor.is('a.subscribe') || _$anchor.is('a.ev-unsubscribe') ){
_goal = ( _$anchor.is('a.ev-unsubscribe') ) ? 'unsubscribe' : 'subscribe';
_value = ( _$anchor.attr('href') != '#' ) ? _$anchor.attr('href') : _$anchor.parents('a').first().attr('href');
_itemData = GetMediaItem( _value );
_type = ( _value.toLowerCase().indexOf('javascript:subscribe(') > -1 ) ? EV.SubscriptionType.INSIGHT : EV.SubscriptionType.E_ALERT;
if( !_itemData ){ ME.SystemError(); return false; }
_value = _itemData.sku;
_name = _itemData.name;
}
// Picklist tooltip click
if( _$anchor.parents('.check-link').length ){
_$anchor = _$anchor.parents('.check-link').first();
}
// Picklist checkbox click
if( _$anchor.hasClass('check-link') ){
if( window.location.pathname.substring(1) == EV.Pages.MyAccount ){
_goal = 'access';
_value = EV.Pages.MyAccount + '#Pick-List';
_name = EV.Strings.MyAccount.PickList;
} else {
var $fundTableAnchor = _$anchor.parent().siblings().find('a.fund');
_goal = 'picklist';
_value = ( _$anchor.attr('rel') ) ? _$anchor.attr('rel') : parseID( $fundTableAnchor.attr('class'), 'fid_') ;
_name = ( typeof ev_FundData != "undefined" && typeof ev_FundData[_value] != "undefined") ? ev_FundData[_value].name : '';
if( _name == '' && $fundTableAnchor.length ) _name = $fundTableAnchor.text();
}
}
// Export tool click
if( _$anchor.attr('id') == 'tools-export' ){
_goal = 'export';
_value = ( _$anchor.attr('href') != '#' ) ? _$anchor.attr('href') : _$anchor.parents('a').first().attr('href');
_name = _$anchor.data('name');
}
if( _$anchor.hasClass('ev-subscription') ){
_value = ( _$anchor.attr('href') != '#' ) ? _$anchor.attr('href') : _$anchor.parents('a').first().attr('href');
_itemData = GetMediaItem( _value );
_type = ( _value.toLowerCase().indexOf('javascript:subscribe(') > -1 ) ? EV.SubscriptionType.INSIGHT : EV.SubscriptionType.E_ALERT;
if( !_itemData ){ ME.SystemError(); return false; }
if( _$anchor.attr('href').toLowerCase().indexOf('javascript:subscribe(') > -1 ){
_goal = 'subscribe';
_value = _itemData.sku;
} else {
_goal = 'access';
}
_name = _itemData.name;
}
// Insights Submit button
if( _$anchor.attr('id') == 'ev-insights-submit' ){
var itemArray = new Array(), mediaItem;
$('.myaccount-list input[name="i[]"]:checked').not('.subscribed').each(function(){
itemArray.push( $(this).val() )
});
_goal = 'subscribe';
_value = itemArray;
_type = EV.SubscriptionType.INSIGHT;
_itemData = {};
_itemData.restricted = false;
_name = '';
for( var i=0;i<_value.length;i++ ){
mediaItem = GetMediaItem("javascript:subscribe('" + _value[i] + "');");
if( i == (_value.length-1) && _value.length > 1 ){
_name += 'and ' + mediaItem.name;
} else {
_name += mediaItem.name + '| '; // Pipe splitter for JS (see: ev-modal-subscribe and subscribesubmitcomplete)
}
}
if( _name.substring(_name.length-2, _name.length) == '| ' ){
_name = _name.substring(0, _name.length-2);
}
}
if (typeof console == "object") {
if( _debug ){
console.log( '# ' + '' );
console.log( 'goal: ' + _goal );
console.log( 'value: ' +_value );
console.log( 'name: ' + _name );
console.log( 'type: ' + _type );
console.log( '$anchor: ' );
console.log( _$anchor );
console.log( 'itemData: ' );
console.log( _itemData );
}
}
} // end: TrackUser
// Generic Ajax caller
var doAjax = function( args ){
var type = args.type || 'POST',
data = args.data || {},
url = args.url || EV.Pages.API,
dataType = args.dataType || 'text',
success = args.success || function(){},
error = args.error || AjaxErrorHandler( args ),
complete = args.complete || function(){};
data.LOG_referer = document.URL;
if( _$anchor instanceof $ ){
data.LOG_$anchorHREF = _$anchor.attr('href');
data.LOG_$anchorID = _$anchor.attr('id');
data.LOG_$anchorREL = _$anchor.attr('rel');
data.LOG_$anchorTEXT = _$anchor.clone() //clone the element
.children() //select all the children
.remove() //remove all the children
.end() //again go back to selected element
.text().trim();
}
_post = data;
$.ajax({
type: type,
data: data,
url: url,
dataType: dataType,
error: error,
complete: complete
});
}; // end: AjaxHandler
// Generic Ajax error handler
var AjaxErrorHandler = function( args ){
return function( jqXHR, exception ){
// Build AJAX Error
var errorText = EV.Strings["general_error"] + " ";
if (jqXHR.status === 0) {
errorText = errorText + " (Ajax:0)";
} else if (jqXHR.status == 404) {
errorText = errorText + " (Ajax:404)";
} else if (jqXHR.status == 500) {
errorText = errorText + " (Ajax:500)";
} else if (exception === 'parsererror') {
errorText = errorText + " (Ajax:Parse)";
} else if (exception === 'timeout') {
errorText = errorText + " (Ajax:Timeout)";
} else if (exception === 'abort') {
errorText = errorText + " (Ajax:Abort)";
} else {
errorText = errorText + " (Ajax:Uncaught)";
}
// Display Error
if( _openModal ){
ME.ModalError({ 'description' : errorText });
} else {
alert( errorText );
}
}
}; // end: AjaxErrorHandler
// Global AJAX complete handler
var CompleteHandler = function( args ){
return function( jqXHR, textStatus ){
var ajaxData = {};
ajaxData.responseText = jqXHR.responseText;
try{
ajaxData.$response = $( $.parseXML( jqXHR.responseText ) );
} catch( err ){
ME.SystemError();
return false;
}
// Result Code
ajaxData.result = ajaxData.$response.find('result').text();
// Result Data
var data = ajaxData.$response.find('data').text();
ajaxData.data = ( data ) ? $.parseJSON( data ) : '';
// Updated session data
EV.Session = $.parseJSON( ajaxData.$response.find('session').text() );
_email = ( EV.Session && EV.Session.Profile && EV.Session.Profile.Email ) ? EV.Session.Profile.Email : _email;
if( typeof _email === 'string' ) _email = _email.trim();
// Output emails
if( _debug ){
var subject = ajaxData.$response.find('subject').text();
var emailBody = ajaxData.$response.find('emailBody').text();
if( subject.length ){
$('#main').before(
$('
').addClass('email')
.append( $('
').text( subject ) )
.append( emailBody )
);
}
}
_response = ajaxData;
if( ajaxData.result == '0' ){
args.success( ajaxData );
} else {
args.failure( ajaxData );
}
}
}; // end: CompleteHandler()
var SendAlert = function(){
var ajaxArgs = {
data : {
'a' : 'Alert',
'controller' : _response.$response.find('action').text(),
'code' : _response.result,
'data' : {
'response' : _response.responseText,
'post' : _post
}
},
};
doAjax( ajaxArgs );
}
// Redirect user to long form registration
var LongFormRegRedirect = function(email, goal, name, type, value, oldEmail) {
// Update variables if given
_email = (email && typeof email === 'string' ) ? email.trim() : _email;
_goal = goal || _goal;
_name = name || _name;
_type = type || _type;
_value = value || _value;
_oldEmail = oldEmail || _oldEmail;
var reglink = EV.Pages.Register + '?';
if( _openModal ) reglink = reglink + 'Email=' + encodeURIComponent(_email) + '&';
if( _goal != null ) reglink = reglink + 'Goal=' + encodeURIComponent(_goal) + '&';
if( _name != null ) reglink = reglink + 'Name=' + encodeURIComponent(_name) + '&';
if( _type != null ) reglink = reglink + 'Type=' + encodeURIComponent(_type) + '&';
if( _oldEmail != null ) reglink = reglink + 'OldEmail=' + encodeURIComponent(_oldEmail) + '&';
if( _value != null ){
if( _goal == 'subscribe' && $.isArray( _value ) ){
reglink += 'Value=' + _value.join(',');
} else if( _goal == 'subscribe' && _value.toLowerCase().indexOf('docload(') > -1 ){
var mediaItem = GetMediaItem( _value );
if( !mediaItem ){ ME.SystemError(); return false; }
reglink += 'Value=' + mediaItem.sku;
} else {
reglink += 'Value=' + encodeURIComponent(_value);
}
}
window.location.href = reglink;
}; // End: LongFormRegRedirect()
// Generic SelfServe User Errors
var SelfServeErrors = function( args ){
var task = args.task || false,
titleText = args.titleText || '',
errorTitleText = args.errorTitleText || '',
ajaxData = args.ajaxData || false,
result = ajaxData.result || false;
if( !task || !ajaxData ){ ME.SystemError(); return false; }
if( result == '-909' ){ // USR_NOT_ACTIVE
if( EV.Session.Status != '' ){
result = EV.Session.Status.toLowerCase();
} else {
try {
resultObj = JSON.parse(ajaxData.data);
result = resultObj.Status.toLowerCase();
_email = ( resultObj.Email && typeof resultObj.Email === 'string' ) ? resultObj.Email.trim() : '';
} catch (e) {
result = ajaxData.data.toLowerCase();
}
if(result == '') { result = '-909'; }
}
} else if( result == '-912' ){
result = 'changed';
_email = ( ajaxData.data && typeof ajaxData.data === 'string' ) ? ajaxData.data.trim() : '';
}
if( _debug ){ console.log (result); console.log(task); }
switch( result ){
case '-20' : // DB_FAIL
ME.SystemError( { refreshOnClose : false } );
break;
case '-903':
window.location.href = EV.Pages.Result + '?denied=1';
break;
case '-909' :
if( task == 'start' || task == 'subscribe' || task == 'register' || task == 'login' ){
var modalArgs = {
title: EV.Strings["RegisterBadEmailErrorTitle"],
description: (EV_REGISTER_ENABLE?EV.Strings["RegisterBadEmailErrorMessage2"]:EV.Strings["RegisterBadEmailErrorMessage3"])
};
if( task == 'start' || task == 'login' ) {
modalArgs.onShow = function() {
$('.ev-register, a[href="#ev-register"], .simplemodal-data #ev-login-submit').on('click', function(e){
e.preventDefault(); e.stopPropagation();
LongFormRegRedirect();
})
};
}
if( task == 'register' ) {
modalArgs.onShow = function() {
$('.ev-register, a[href="#ev-register"], .simplemodal-data #ev-register-submit').on('click', function(e){
e.preventDefault(); e.stopPropagation();
LongFormRegRedirect();
})
};
}
ME.ModalError( modalArgs );
break;
}
case '-921':
if( task == 'register' ){
var dataMessage = ajaxData.data;
if (dataMessage.toLowerCase().indexOf("subscriber") >= 0) {
var modalArgs = {
modalContent: '#ev-modal-login-form',
titleText: EV.Strings["LoginModalTitle"],
onShow: function(){
ME.ModalError({ title: EV.Strings["RegisterInUseErrorTitle"] });
$('.simplemodal-data div:visible #ev-login-email').val( _email );
$('.simplemodal-data #ev-modal-login-form').show();
setTimeout( function(){ $('.simplemodal-data div:visible #ev-login-password').focus(); }, 100 );
ME.ModalResize();
}
};
ME.Modal( modalArgs );
}
}
break;
case 'changed':
var modalArgs = {
modalContent: '#ev-modal-changed',
titleText: EV.Strings.RegisterTitle,
onShow: function(){ $('.simplemodal-data .user-email').html( _email ); ME.ModalResize(); }
};
ME.Modal( modalArgs );
break;
case 'submitted':
var modalArgs = {
modalContent: '#ev-modal-resend',
titleText: EV.Strings.RegisterTitle,
onShow: function(){ $('.simplemodal-data .user-email').html( _email ); ME.ModalResize(); }
};
ME.Modal( modalArgs );
break;
case 'verified':
var modalArgs = {
title: EV.Strings["VerifiedErrorTitle"],
message: EV.Strings["VerifiedMessage"]
};
ME.ModalError( modalArgs );
break;
case 'disabled':
case 'denied':
var modalArgs = {
title: EV.Strings["DeniedErrorTitle"],
message: EV.Strings["DeniedMessage"]
};
ME.ModalError( modalArgs );
break;
case 'inactive':
var modalArgs = {
title: EV.Strings["InactiveErrorTitle"],
message: EV.Strings["InactiveMessage"]
};
ME.ModalError( modalArgs );
break;
case 'newlogin':
var modalArgs = {
title: EV.Strings["NewLoginErrorTitle"],
message: EV.Strings["NewLoginMessage"],
onShow: function(){ $('.ev-modal-generic .new-email').html( _email ).click(function() { Login(); }); ME.ModalResize(); }
};
ME.ModalError( modalArgs );
break;
case '-901': // USR_DENIED
var modalArgs = {
title: EV.Strings["DeniedErrorTitle"],
message: EV.Strings["DeniedMessage"]
};
ME.ModalError( modalArgs );
break;
case '-914': // USR_ROLE_RESTRICTED
RestrictedModal();
break;
case '-900': // USR_NEED_LOGOUT
window.location.reload();
case '-931' : // USR_HAS_ACCESS
var modalArgs = {
modalContent: '#ev-modal-login-form',
titleText: EV.Strings["LoginModalTitle"],
onShow: function(){
ME.ModalError({ title: EV.Strings["RegisterInUseErrorTitle"] });
$('.simplemodal-data div:visible #ev-login-email').val( _email );
$('.simplemodal-data #ev-modal-login-form .ev-login-password').show();
setTimeout( function(){ $('.simplemodal-data div:visible #ev-login-password').focus(); }, 100 );
ME.ModalResize();
}
};
ME.Modal( modalArgs );
break;
case '-932': // USR_ACCESS_UPDATED
var addedModalArgs = {
modalContent: '#ev-modal-regadded',
titleText: titleText,
onShow: function(){ $('.simplemodal-data .user-email').html( _email ); ME.ModalResize(); }
};
ME.Modal( addedModalArgs );
break;
case '-904' : // USR_NOT_FOUND
case '-107' : // BAD_DATA
if( task == 'register' ){
// User did not exist before registering, make sure there's no old email
_oldEmail = null;
var modalArgs = {
title: EV.Strings["SignInErrorTitle"],
description: (EV_REGISTER_ENABLE?EV.Strings["RegisterBadEmailErrorMessage"]:EV.Strings["RegisterBadEmailErrorMessage3"])
};
ME.ModalError( modalArgs );
break;
} else if( result == '-107' ) {
ME.SystemError();
break;
}
case '-924' : // USR_NOT_SUPPORTED
if( task == 'login' ){
var modalArgs = {
title: EV.Strings["SignInErrorTitle"],
description: EV.Strings["SignInErrorDesc1"] + EV.Strings.NumberWords[ME.strikesLeft] + " (" + ME.strikesLeft + ") " + EV.Strings["SignInErrorDesc2"]
};
ME.ModalError( modalArgs );
break;
}
if( task == 'start' || task == 'subscribe' ){
var modalArgs = {
title: EV.Strings["RegisterBadEmailErrorTitle"],
description: (EV_REGISTER_ENABLE?EV.Strings["RegisterBadEmailErrorMessage2"]:EV.Strings["RegisterBadEmailErrorMessage3"])
};
ME.ModalError( modalArgs );
break;
}
case '-907' : // USR_BAD_LOGIN
if( task == 'login' ){
var modalArgs = {
title: EV.Strings["SignInErrorTitle"],
description: EV.Strings["SignInErrorDesc1"] + EV.Strings.NumberWords[ME.strikesLeft] + " (" + ME.strikesLeft + ") " + EV.Strings["SignInErrorDesc2"]
};
ME.ModalError( modalArgs );
break;
}
case '-100' : // BAD_PARAMS
if( task == 'login' ){
var modalArgs = {
title: EV.Strings["SignInErrorTitle"],
description: EV.Strings["SignInErrorDesc1"] + EV.Strings.NumberWords[ME.strikesLeft] + " (" + ME.strikesLeft + ") " + EV.Strings["SignInErrorDesc2"]
};
ME.ModalError( modalArgs );
break;
} else if( ( (task == 'register' ) || (task == 'start') || (task == 'subscribe') ) && result == '-100' ){
var modalArgs = {
title: EV.Strings["InvalidEmailTitle"],
description: EV.Strings["InvalidEmailMessage"]
};
ME.ModalError( modalArgs );
// Re-enable submit button
if( $('.simplemodal-data #ev-no-sp-submit').length ) {
$('.simplemodal-data #ev-no-sp-submit').attr('disabled',false).removeClass('disabled');
}
break;
}
_triggerRefresh = true;
case '-109' : // BAD_EMAIL
if( ( task == 'register' || task == 'subscribe' ) && result == '-109' ){
var modalArgs = {
title: EV.Strings["InvalidEmailTitle"],
description: EV.Strings["InvalidEmailMessage"]
};
ME.ModalError( modalArgs );
// Re-enable submit button
if( $('.simplemodal-data #ev-no-sp-submit').length ) {
$('.simplemodal-data #ev-no-sp-submit').attr('disabled',false).removeClass('disabled');
}
break;
}
_triggerRefresh = true;
case '-913' : // USR_CHANGED_NO_SP
if(task != 'register') { //added 8/19/2015 jlipinski@eatonvance.com to allow register to fall through
if( _openModal && $('.simplemodal-data #ev-no-sp-email').val() ) _email = (typeof $('.simplemodal-data #ev-no-sp-email').val() === 'string') ? $('.simplemodal-data #ev-no-sp-email').val().trim() : '';
var modalArgs = {
modalContent: '#ev-modal-no-sp',
titleText: EV.Strings['NoSalesPageTitle'],
onShow: function(){
$('#ev-no-sp-email').val( '' );
$('#ev-no-sp-old-email').val( _email );
}
};
ME.Modal( modalArgs );
break;
}
case '-925' : // USR_REGISTRATION_REQUIRED
// Redirect user to long form registration if auto registration is disabled
LongFormRegRedirect($('.simplemodal-data #ev-subscribe-email').val());
break;
default:
var errorTitle = ( EV.Strings.Errors[task] && EV.Strings.Errors[task][result] && EV.Strings.Errors[task][result]['title'] ) ? EV.Strings.Errors[task][result]['title'] : '';
var errorDesc = '';
if( EV.Strings.Errors[task]
&& EV.Strings.Errors[task][result]
&& EV.Strings.Errors[task][result]['description'] ){
errorDesc = EV.Strings.Errors[task][result]['description'];
} else {
errorDesc = EV.Strings["general_error"];
SendAlert();
}
ME.ModalError({
title: errorTitle,
description: errorDesc
});
$('.simplemodal-data #ev-resend-email').attr('disabled', true);
break;
}
}; // end: SelfServe Errors
// Check and handle Strike Out
var StrikeOut = function( task ){
ME.strikesLeft--;
if( !ME.strikesLeft ){
var modalArgs = {
title: EV.Strings["StrikeOutErrorTitle"],
message: EV.Strings["StrikeOutMessage1"] + ' ' + task + ' ' + EV.Strings["StrikeOutMessage2"]
}
ME.ModalError( modalArgs );
return true;
}
return false;
}; // end StrikeOut()
var ContentRequestRemember = function(){
var completeArgs = {
success: function( ajaxData ){
_remember = true;
LoginFrames( EV.Session.SID, false );
$('.simplemodal-data .simplemodal-header .close').click();
},
failure: SelfServeErrors
}
var ajaxArgs = {
data : { 'a' : 'SessionExtend' },
complete : CompleteHandler( completeArgs )
};
doAjax( ajaxArgs );
}// end ContentRequestRemember()
// Resend verification email
var Resend = function( titleText ){
if( !_email ) return false;
var completeArgs = {
success: function( ajaxData ){
var successModalArgs = {
modalContent: '#ev-modal-resent',
titleText: titleText,
onShow: function(){ $('.simplemodal-data .user-email').html( _email ); ME.ModalResize(); }
};
ME.Modal( successModalArgs );
},
failure: function(){
ME.ModalError( {description: EV.Strings["general_error"]} );
$('.simplemodal-data #ev-resend-email').attr('disabled', true);
}
}
var ajaxArgs = {
data : { 'a' : 'ResendVerification', 'Email' : _email, 'Goal' : _goal, 'Name' : _name, 'Value' : _value, 'Type' : _type },
complete : CompleteHandler( completeArgs )
};
doAjax( ajaxArgs );
}; // end: Resend
// Login handler for various starting points (Sign-in, Subscribe, Download Gated, etc.)
var Login = function(){
if( EV.Session.SessionType == 'Verified' ) return false;
TrackUser();
// Remember Me Cookie
var GetCookie = ( ( window.Enthink || {} ).Utils || {} ).GetCookie;
if( typeof GetCookie == 'function' ){
var cookie = GetCookie('ev-modal-login');
if( cookie != null && cookie != '' ){
_guid = cookie;
$('#ev-login-remember').attr('checked','checked');
}
}
if( _guid ) {
var completeArgs = {
success: EmailFromGuidSuccess,
failure: EmailFromGuidFailure
}
var ajaxArgs = {
data : { 'a' : 'GetEmailFromGuid', 'Guid' : _guid },
complete : CompleteHandler( completeArgs )
};
doAjax( ajaxArgs );
} else {
var modalArgs = {
modalContent: '#ev-modal-login-form',
titleText: EV.Strings["LoginModalTitle"],
onShow: function(){
if( _email ){
$('#ev-login-email').val( _email );
if( EV.Session.SessionType == 'NonVerified'
&& EV.Session.UserType == 'Registrant'
&& EV.Session.Status.toLowerCase() == 'active' ){
$('.simplemodal-data #ev-modal-login-form .ev-login-password').show();
ME.ModalResize();
}
setTimeout(function(){$('.simplemodal-data #ev-login-password').focus();}, 200);
}
},
modalType: EV_MODAL.LOGIN //for analytics tracking modal type
};
ME.Modal( modalArgs );
}
}; // end: Login
var EmailFromGuidSuccess = function( ajaxData ) {
var data = ajaxData.data;
_email = ( data.Email && typeof data.Email === 'string' ) ? data.Email.trim() : _email;
var modalArgs = {
modalContent: '#ev-modal-login-form',
titleText: EV.Strings["LoginModalTitle"],
onShow: function(){
if( _email ){
$('#ev-login-email').val( _email );
$('.simplemodal-data #ev-modal-login-form .ev-login-password').show();
ME.ModalResize();
setTimeout(function(){$('.simplemodal-data #ev-login-password').focus();}, 200);
}
},
modalType: EV_MODAL.LOGIN //for analytics tracking modal type
};
ME.Modal( modalArgs );
}; // end: EmailFromGuidSuccess
var EmailFromGuidFailure = function( ajaxData ) {
var modalArgs = {
modalContent: '#ev-modal-login-form',
titleText: EV.Strings["LoginModalTitle"],
onShow: function(){
ME.ModalError({ title: EV.Strings["RememberMeExpiredTitle"], description: EV.Strings["RememberMeExpiredMessage"] });
}
};
ME.Modal( modalArgs );
}; // end: EmailFromGuidFailure
// Login submit button handler
var LoginSubmit = function(){
var $content = $('.simplemodal-data #ev-modal-login-form'),
$form = $content.children('form'),
$email = $('#ev-login-email', $form),
$pass = $('#ev-login-password', $form),
rememberMe = $('#ev-login-remember', $form).is(':checked'),
email = ( $email.val() && typeof $email.val() === 'string' ) ? $email.val().trim() : '',
pass = $pass.is(":visible") ? $pass.val() : '';
if( email == '' ){
setTimeout( function(){ $email.focus(); }, 100 );
return false;
}
_email = email;
// apply the trimmed value
$('#ev-login-email').val(_email);
if( !$pass.is(':visible') && pass == '' ){
ME.ModalErrorClear();
$('.simplemodal-data #ev-login-submit').attr('disabled',true).addClass('disabled');
var completeArgs = {
success: StartSuccess,
failure: StartFailure
}
var ajaxArgs = {
data : { 'a' : 'LoginStart', 'Email' : _email, 'Goal' : _goal, 'Name' : _name, 'Value' : _value, 'Type' : _type },
complete : CompleteHandler( completeArgs )
};
doAjax( ajaxArgs );
} else if( pass == '' ){
setTimeout( function(){ $pass.focus(); }, 100 );
return false;
} else {
ME.ModalErrorClear();
$('.simplemodal-data #ev-login-submit').attr('disabled',true).addClass('disabled');
// Remember Me bool
_remember = rememberMe;
var completeArgs = {
success: LoginSuccess,
failure: LoginFailure
}
var ajaxArgs = {
data : { 'a' : 'Login', 'Email' : email, 'Password' : pass, 'Remember' : rememberMe, 'Goal' : _goal, 'login' : _name, 'Value' : _value, 'Type' : _type },
complete : CompleteHandler( completeArgs )
};
doAjax( ajaxArgs );
}
}; // end: LoginSubmit
var StartSuccess = function( ajaxData ){
var modalArgs = {
modalContent: '#ev-modal-contentrequest',
titleText: EV.Strings["LoginModalTitle"],
refreshOnClose: !(urlParams.showloginmodal),
onShow: function(){ $('.simplemodal-data .user-email').html( _email ); ME.ModalResize(); }
};
ME.Modal( modalArgs );
}; // end: StartSuccess
var StartFailure = function( ajaxData ){
$('.simplemodal-data #ev-login-submit').attr('disabled',false).removeClass('disabled');
if( ajaxData.result == '-920' ){
ME.ModalErrorClear();
$('.simplemodal-data #ev-modal-login-form .ev-login-password').show();
ME.ModalResize();
setTimeout( function(){ $('.simplemodal-data #ev-modal-login-form #ev-login-password:visible').focus(); }, 200 );
} else if(ajaxData.result == '-400') {
ME.ModalErrorClear();
// Redirect already logged in user
LoginFrames( EV.Session.SID, true );
_triggerRefresh = true;
return false;
} else {
if( !StrikeOut('sign in') ){ //added 8/19/2015 jlipinski@eatonvance.com to apply 3 strikes to start. if an email is in there as autocomplete, it's treated as a start
var errorArgs = {
task: 'start',
ajaxData: ajaxData
}
}
SelfServeErrors( errorArgs );
}
}; // end: StartFailure
var StartResend = function(){
if( urlParams.a == 'subscribe' ){
_value = urlParams["Value[]"];
_itemData = GetMediaItem( _value );
_type = urlParams.type;
_name = urlParams.name;
SubscribeSubmitComplete();
} else {
var completeArgs = {
success: function(){
$('.simplemodal-data .contentrequest-resend').hide();
$('.simplemodal-data .contentrequest-success').show();
$('.simplemodal-data #ev-modal-contentrequest-resend h5').hide();
ME.ModalResize();
ME._existingModalOnClose = function(){
if( !_debug ) window.location.href = window.location.pathname;
}
},
failure: function( ajaxData ){
SelfServeErrors( ajaxData );
ME._existingModalOnClose = function(){
if( !_debug ) window.location.href = window.location.pathname;
}
}
}
var ajaxArgs = {
data : { 'a' : 'ResendContentRequest', 'Email' : _email, 'vst' : urlParams.vst, 'ttk' : urlParams.ttk, 'resend' : 1 },
complete : CompleteHandler( completeArgs )
};
doAjax( ajaxArgs );
}
} // end: StartResend
// Succesful login handler
var LoginSuccess = function( ajaxData ){
// Remember Me Cookie
var SetCookie = ( ( window.Enthink || {} ).Utils || {} ).SetCookie;
if( typeof SetCookie == 'function' ){
if ( _remember ){
SetCookie('ev-modal-login', EV.Session.UserGuid);
} else {
var GetCookie = ( ( window.Enthink || {} ).Utils || {} ).GetCookie;
if( typeof GetCookie == 'function' ){
var cookie = GetCookie('ev-modal-login');
if( cookie != null && cookie != '' ){
SetCookie('ev-modal-login','');
}
}
}
}
_triggerRefresh = true;
LoginFrames( EV.Session.SID, true );
return false;
}; // end: LoginSuccess()
// Log user into EV network
var LoginFrames = function( session, loginComplete ){
if( _debug ){ console.log('Skipping iframe loading'); }
for( var i=0; i')
.attr('name','iframeID_'+i)
.attr('id','iframeID_'+i)
.attr('src', encodeURI(src))
.attr('height','1').attr('width','1')
.load(function(){
if( loginComplete ) completeCheck();
})
);
// if load completes clearTimeout
//if(_countBackup < _completeCount) clearTimeout(_timeout);
}
}
} // end: LoginFrames()
// Bounce via _goal
var LoginSuccessComplete = function(){
if( _goal == 'access' && _type == EV.SubscriptionType.E_ALERT ){
CheckAccess( { success: DownloadApproved } );
} else if( _goal == 'access' ){
DownloadApproved();
} else if( _goal == 'subscribe' ){
Subscribe();
} else if( _goal == 'picklist') {
var ajaxArgs = {};
ajaxArgs.data = { 'a' : 'PickListAdd', 'Symbol' : _value };
ajaxArgs.complete = function(){ window.location.reload(); };
doAjax( ajaxArgs );
} else if( _goal == 'export' ){
window.open( _value );
window.location.reload();
} else {
var cleanUrl = window.location.href.toString().replace("showloginmodal=1","");
window.location.href = cleanUrl;
}
}; // end: LoginSuccessComplete
// Login completion check
var completeCheck = function(){
_completeCount++;
if( _completeCount >= EV.Domains.length ){
if( !_debug ) LoginSuccessComplete();
}
};
// Login failure handler
var LoginFailure = function( ajaxData ){
$('.simplemodal-data #ev-login-submit').attr('disabled',false).removeClass('disabled');
// Strike-out?
if( !StrikeOut('sign in') ){
var errorArgs = {
task: 'login', //task: 'login', - changed 8/19/2015 jlipinski@eatonvance.com, get same msg as start
titleText: EV.Strings["LoginModalTitle"],
ajaxData: ajaxData
}
SelfServeErrors( errorArgs );
}
}; // end: LoginFailure()
// Forgot password flow
var ForgotPassword = function(){
if( _openModal && $('.simplemodal-data #ev-login-email').val() ) _email = $('.simplemodal-data #ev-login-email').val() ? $('.simplemodal-data #ev-login-email').val().trim() : '';
var modalArgs = {
modalContent: '#ev-modal-forgot',
titleText: EV.Strings["ForgotTitle"],
onShow: function(){ $('#ev-forgot-email').val( _email ); }
};
ME.Modal( modalArgs );
}; // end: ForgotPassword
// Forgot Password submit button handler
var ForgotSubmit = function(){
var email = $('.simplemodal-container #ev-forgot-email').val();
if( typeof(email)=="undefined" || email == '' ) return false;
_email = ( email && typeof email === 'string' ) ? email.trim() : _email; // store for various modal content
$('.simplemodal-data #ev-forgot-submit').attr('disabled',true).addClass('disabled');
var completeArgs = {
success: ForgotSuccess,
failure: ForgotFailure
}
var ajaxArgs = {
data : { 'a' : 'ForgotPassword', 'Email' : _email, 'Goal' : _goal, 'Name' : _name, 'Value' : _value, 'Type' : _type },
complete : CompleteHandler( completeArgs )
};
doAjax( ajaxArgs );
}; // end: ForgotSubmit
// Forgot password success handler
var ForgotSuccess = function( ajaxData ){
var modalArgs = {
modalContent: '#ev-modal-forgot-resend',
titleText: EV.Strings["ForgotTitle"],
onShow: function(){ $('.simplemodal-data .user-email').html( _email ); ME.ModalResize(); }
};
ME.Modal( modalArgs );
}; // end ForgotSuccess()
// Forgot password failure handler
var ForgotFailure = function( ajaxData ){
$('.simplemodal-data #ev-forgot-submit').attr('disabled',false).removeClass('disabled');
// Strike-out?
if( !StrikeOut('forgot password') ){
var errorArgs = {
task: 'forgot',
titleText: EV.Strings["ForgotTitle"],
ajaxData: ajaxData
}
SelfServeErrors( errorArgs );
}
}; // end ForgotFailure()
// Forgot Password submit button handler
var NoSalesPageRecordSubmit = function(){
var email = $('#ev-no-sp-email').val();
var oldEmail = $('.simplemodal-container #ev-no-sp-old-email').val();
if( typeof(email)=="undefined" || email == '' ) return false;
if( typeof(oldEmail)=="undefined" || oldEmail == '' ) oldEmail = email;
// store for various modal content
_email = ( email && typeof email === 'string' ) ? email.trim() : '';
_oldEmail = ( oldEmail && typeof oldEmail === 'string' ) ? oldEmail.trim() : (( _oldEmail && typeof _oldEmail === 'string' ) ? _oldEmail.trim() : '');
$('.simplemodal-data #ev-no-sp-submit').attr('disabled',true).addClass('disabled');
var completeArgs = {
success: NoSalesPageRecordSuccess,
failure: NoSalesPageRecordFailure
}
var ajaxArgs = {
data : { 'a' : 'NoSalesPageRecord', 'Email' : email, 'Goal' : _goal, 'Name' : _name, 'Value' : _value, 'Type' : _type, 'OldEmail' : oldEmail },
complete : CompleteHandler( completeArgs )
};
doAjax( ajaxArgs );
}; // end: NoSalesPageRecordSubmit
var NoSalesPageRecordSuccess = function( ajaxData) {
var modalArgs = {
modalContent: '#ev-modal-changed',
titleText: EV.Strings["RegisterTitle"],
onShow: function(){ $('.simplemodal-data .user-email').html( _email ); ME.ModalResize(); }
};
ME.Modal( modalArgs );
}; // end: NoSalesPageRecordSuccess
var NoSalesPageRecordFailure = function( ajaxData) {
// If user not found or multiple records will give -904, else give to SelfServeErrors
if(ajaxData.result == '-904' || ajaxData.result == '-925') {
// Redirect user to long form registration
LongFormRegRedirect();
} else if(ajaxData.result == '-921') {
// send content request link
ME.ModalErrorClear();
// $('.simplemodal-data #ev-login-submit').attr('disabled',true).addClass('disabled');
var completeArgs = {
success: StartSuccess,
failure: StartFailure
}
var ajaxArgs = {
data : { 'a' : 'LoginStart', 'Email' : _email, 'Goal' : _goal, 'Name' : _name, 'Value' : _value, 'Type' : _type },
complete : CompleteHandler( completeArgs )
};
doAjax( ajaxArgs );
} else if(ajaxData.result == '-933') {
ME.ModalError( {description: EV.Strings['NoSalesPageInvalid']} );
$('.simplemodal-data #ev-no-sp-submit').attr('disabled',false).removeClass('disabled');
} else if(ajaxData.result == '-107') {
var modalArgs = {
title: EV.Strings["SignInErrorTitle"],
description: (EV_REGISTER_ENABLE?EV.Strings["RegisterBadEmailErrorMessage"]:EV.Strings["RegisterBadEmailErrorMessage3"])
};
ME.ModalError( modalArgs );
} else {
var errorArgs = {
task: 'register',
titleText: EV.Strings["RegisterTitle"],
ajaxData: ajaxData
}
SelfServeErrors( errorArgs );
}
}; // end: NoSalesPageRecordFailure
// Populate and handle auto-registration modal & callbacks
var Register = function(registrationType, contentDriver, line){
// Logged in?
if( ( EV.Session.SessionType == 'Verified' && EV.Session.UserType == 'Registrant' )
|| !EV_REGISTER_ENABLE ) return false;
// Already registered?
if( EV.Session.UserType == 'Registrant' && EV.Session.SessionType != 'Verified' ){
Login();
return false;
}
TrackUser();
if( _debugAnalytics ) {
console.log( '#' + line + ' called #' + '' );
if(typeof registrationType != 'undefined') console.log(registrationType);
console.log( 'value: ' +_value );
console.log( 'name: ' + _name );
console.log( 'type: ' + _type );
console.log( 'goal: ' + _goal );
console.log("Analytics.push(['registrationStart',"+ registrationType + ', ' + _value + '])');
console.log('--------------------------------');
}
if(typeof registrationType != 'undefined' && typeof _value != 'undefined') {
Analytics.push(['registrationStart', registrationType, _value]); // change _value to _name for name instead of value
}
// Auto-reg disabled?
if( !EV_AUTOREG_ENABLE ){
LongFormRegRedirect();
} else {
var email = $('.simplemodal-data #ev-login-email').val();
if( _openModal && email && typeof email === 'string' ){
_email = email.trim();
}
// Auto-reg
var modalArgs = {
modalContent: '#ev-modal-register',
titleText: EV.Strings["RegisterTitle"],
onShow: function(){ $('#ev-register-email').val( _email ); },
modalType: EV_MODAL.REGISTER //for analytics tracking modal type
};
ME.Modal( modalArgs );
}
}; // end: Register
// Handle auto-reg form submit
var RegisterSubmit = function(){
Analytics.push(['registrationSubmit']);
if( _debugAnalytics ) {
console.log("Analytics.push(['registrationSubmit'])");
}
var email = $('.simplemodal-container #ev-register-email').val() || _email;
if( typeof(email)=="undefined" || !email || email == '' ) return false;
// store for various modal content
_email = ( typeof email ==='string') ? email.trim() : '';
// apply the trimmed value
$('#ev-register-email').val(_email);
_oldEmail = _email.trim();
$('.simplemodal-data #ev-register-submit').attr('disabled',true).addClass('disabled');
var completeArgs = {
success: RegisterSuccess,
failure: RegisterFailure
}
var ajaxArgs = {
data : { 'a' : 'AutoRegistration', 'Email' : _email, 'Goal' : _goal, 'Name' : _name, 'Value' : _value, 'Type' : _type },
complete : CompleteHandler( completeArgs )
};
doAjax( ajaxArgs );
} // end: RegisterSubmit
// Register success handler
var RegisterSuccess = function( ajaxData ){
var modalArgs = {
modalContent: '#ev-modal-regsuccess',
titleText: EV.Strings["RegisterTitle"],
onShow: function(){ $('.simplemodal-data .user-email').html( _email ); ME.ModalResize(); }
};
ME.Modal( modalArgs );
}; // end RegisterSuccess()
// Register failure handler
var RegisterFailure = function( ajaxData ){
$('.simplemodal-data #ev-register-submit').attr('disabled',false).removeClass('disabled');
// Strike-out?
if( !StrikeOut('registration') ){
var errorArgs = {
task: 'register',
titleText: EV.Strings["RegisterTitle"],
ajaxData: ajaxData
}
SelfServeErrors( errorArgs );
}
}; // end RegisterFailure()
// Subscribe button handler
var Subscribe = function(line){
TrackUser();
if( _debugAnalytics ) {
console.log( '#' + line + ' called #' + '' );
console.log( 'value: ' +_value );
console.log( 'name: ' + _name );
console.log( 'type: ' + _type );
console.log( 'goal: ' + _goal );
console.log("Analytics.push(['subscriptionStart', " + _type + ', ' + _value+ ']")');
console.log('--------------------------------');
}
if(typeof _type != 'undefined' && typeof _value != 'undefined') {
Analytics.push(['subscriptionStart', _type, _value]); // change _value to _name for name instead of value
}
if( EV.Session.SessionType == 'Verified' ){
CheckAccess( { success: SubscribeSubmitComplete } );
} else {
if( _$anchor.hasClass('ev-gated-subscription') || _$anchor.parents('.ev-gated-subscription').length ){
$('#ev-modal-subscribe .ev-subscribe-submit').addClass('fa');
} else {
$('#ev-modal-subscribe .ev-subscribe-submit').removeClass('fa');
}
if( $.isArray( _value ) ){
// If no items to subscribe return false to not open modal.
if( _value.length == 0 ){ return false; }
var tmp = _name.split('| and'); // Splitter for JS only (see TrackUser/SubscribeSubmitComplete)
var last = ( tmp.length > 1 ) ? '
- '+tmp[1] : '';
var tmp2 = tmp[0].split('| ');
var text = '- ' + tmp2.join('
- ') + last + '
';
$('#ev-modal-subscribe span.filename').html( text );
} else {
var mediaItem = GetMediaItem( _$anchor.attr('href') );
if( !mediaItem ){ ME.SystemError(); return false; }
$('#ev-modal-subscribe span.filename').html( mediaItem.name );
}
var titleText = EV.Strings["SubscribeTitle"];
if( _$anchor.attr('id') == 'ev-insights-submit' ){
titleText = EV.Strings["SubscribeInsightsTitle"];
}
var modalArgs = {
modalContent: '#ev-modal-subscribe',
titleText: titleText,
onShow: function(){ $('.ev-subscribe-email').val( _email ); }
};
ME.Modal( modalArgs );
}
}; // end: Subscribe
// Subscribe form submit handler
var SubscribeSubmit = function(){
var email = $('.simplemodal-data div:visible .ev-subscribe-email').val() || _email;
if( typeof(email) == 'undefined' || email == '' || email == null ){ return false; }
_email = ( typeof email === 'string' ) ? email.trim() : ''; // store for various modal content
_goal = 'subscribe';
// submit via download success modal
if( _type == null ){
_itemData = GetMediaItem( _value );
if( !_itemData ){ ME.SystemError(); return false; }
_type = ( _value.toLowerCase().indexOf('javascript:subscribe(') > -1 ) ? EV.SubscriptionType.INSIGHT : EV.SubscriptionType.E_ALERT;
_value = _itemData.sku;
_name = _itemData.name;
}
SubscribeSubmitComplete();
}; // end: SubscribeSubmit
// Finish submit after firm check
var SubscribeSubmitComplete = function(){
var subURL = '', value = '', itemData = {};
if( !$.isArray( _value ) && _value.toLowerCase().indexOf('docload') > -1 ){
itemData = GetMediaItem( _value );
value = itemData.sku;
} else {
value = _value;
}
$('.simplemodal-data .ev-subscribe-submit').attr('disabled',true).addClass('disabled');
_name = _name.replace(/\|/g,','); // Remove splitter for JS.
/********
*** this is in place of both the if and elseif ***
if( _$anchor.attr('id') == 'ev-insights-submit' || _$anchor.attr('href').toLowerCase().indexOf('subscribe(') > -1 ){
// subURL only used for VERIFIED sessions below.
subURL = EV.Pages.MyAccount + '?insight=' + value;
*********/
if( _$anchor.attr('id') == 'ev-insights-submit' ){
subURL = '/Insight-Sign-Up.php?type=' + _type + '&insight=' + value;
} else if( _$anchor.attr('href').toLowerCase().indexOf('subscribe(') > -1 ) {
subURL = '/Insight-Sign-Up.php?type=' + _type + '&insight=' + value;
} else {
subURL = EV.Pages.SubscriptionConfirmation + '?sub&Name=' + _name + '&Type=' + _type;
if( $.isArray( _value ) ){
for(var i=0;i<_value.length;i++){
if( _value[i].toLowerCase().indexOf('docload') > -1 ){
itemData = GetMediaItem( _value[i] );
value = itemData.sku;
} else {
value = _value[i];
}
subURL += '&Value[]=' + value;
}
} else {
subURL += '&Value=' + value;
}
}
if( EV.Session.SessionType == 'Verified' ){
window.location.href = subURL;
} else {
var completeArgs = {
success: SubscribeSuccess,
failure: SubscribeFailure
}
var ajaxArgs = {
data : { 'a' : 'Subscribe', 'Email' : _email, 'Goal' : _goal, 'Name' : _name, 'Value' : value, 'Type' : _type },
complete : CompleteHandler( completeArgs )
};
doAjax( ajaxArgs );
}
}; // end: SubscribeSubmitComplete()
// Check the system to see if a Role is required.
var CheckAccess = function( args ) {
if( !_itemData || ( typeof args.success == 'undefined' ) ){ ME.SystemError(); return false; }
if( EV.Session.SessionType != 'Verified' && !_email ){ args.success(); return false; } // Don't know who it is yet, let page/controller decide.
if( _goal == 'access' && typeof _itemData.sku == 'undefined' ){ args.success(); return false; } // Locked Pages
if( !args.type && !_type ){
_type = ( _value.toLowerCase().indexOf('javascript:subscribe(') > -1 ) ? EV.SubscriptionType.INSIGHT : EV.SubscriptionType.E_ALERT;
}
var hasRoleRestriction = false;
if( _goal == 'subscribe' && typeof _itemData.tags != 'undefined' && typeof _itemData.tags.subscribeable != 'undefined' && _itemData.tags.subscribeable == true ){
hasRoleRestriction = true;
}
if( _goal == 'access' && typeof _itemData.lockedtags != 'undefined' && $(_itemData.lockedtags).length > 0 ){
hasRoleRestriction = true;
}
if( _debug ){
console.log( 'hasRoleRestriction: ' + hasRoleRestriction,
'_itemData.sku: ' + _itemData.sku, '_type: ' + _type );
}
if( hasRoleRestriction ){
var completeArgs = {
success: args.success,
failure: function( ajaxData ){
var errorArgs = {
task: 'login',
titleText: EV.Strings["LoginTitle"],
ajaxData: ajaxData
}
if( _goal == 'subscribe' ){
errorArgs.task = 'subscribe';
errorArgs.titleText = EV.Strings["SubscribeTitle"];
}
SelfServeErrors( errorArgs );
}
};
var ajaxArgs = {
data : { 'a' : 'CheckRole', 'Goal' : _goal, 'Value' : _itemData.sku, 'Type' : _type },
complete : CompleteHandler( completeArgs )
};
if( EV.Session.SessionType != 'Verified' && _email ){
ajaxArgs.data.Email = _email;
}
doAjax( ajaxArgs );
} else {
args.success();
}
}; // end: CheckAccess
// Show firm restriction modal
var RestrictedModal = function(){
var modalArgs = {
modalContent: '#ev-modal-access',
titleText: EV.Strings["AccessDeniedTitle"]
};
if( _triggerRefresh ) modalArgs.refreshOnClose = true;
ME.Modal( modalArgs );
return false;
}; // end: RestrictedModal()
// Subscribe success handler
var SubscribeSuccess = function( ajaxData ){
Analytics.push(['subscriptionComplete']);
if( _debugAnalytics ) {
console.log("Analytics.push(['subscriptionComplete'])");
}
var refresh = ( urlParams.resend || EV.Session.SessionType != 'Verified' ) ? false : true;
var modalArgs = {
modalContent: '#ev-modal-subconfirm',
titleText: EV.Strings["SubscribeTitle"],
refreshOnClose: refresh,
onShow: function(){
$('.simplemodal-data .user-email').html( _email );
if ( EV.Session.SessionType == 'NonVerified' ) {
if( EV.Session.UserType == 'Registrant' || EV.Session.UserType == 'Subscriber' ){
$('.simplemodal-data div:visible a.ev-login').parent().show();
} else {
$('.simplemodal-data div:visible a.ev-register').parent().show();
}
}
ME.ModalResize();
},
onClose: function(){
if( urlParams.resend ){
window.location.href = window.location.pathname;
}
}
};
ME.Modal( modalArgs );
}; // end SubscribeSuccess()
// Subscribe failure handler
var SubscribeFailure = function( ajaxData ){
$('.simplemodal-data .ev-subscribe-submit').attr('disabled',false).removeClass('disabled');
// Strike-out?
if( !StrikeOut('subscription') ){
var errorArgs = {
task: 'subscribe',
titleText: EV.Strings["SubscribeTitle"],
ajaxData: ajaxData
}
SelfServeErrors( errorArgs );
}
}; // end SubscribeFailure()
// Unsubscribe button handler
var Unsubscribe = function(){
TrackUser();
UnsubscribeSubmit();
return false;
}; // end: Unsubscribe()
// Ajax Unsubscribe
var UnsubscribeSubmit = function(){
var completeArgs = {
success: UnsubscribeSuccess,
failure: ME.SystemError
};
var ajaxArgs = {
data : { 'a' : 'Unsubscribe', 'Value' : _value, 'Type' : _type, 'Name' : _name },
complete : CompleteHandler( completeArgs )
};
doAjax( ajaxArgs );
}; // end: UnsubscribeSubmit()
var UnsubscribeSuccess = function(){
if( EV.Session.SessionType == 'Verified' ){
var successModalArgs = {
modalContent: '#ev-modal-unsubscribe-success',
titleText: EV.Strings["SubscribeTitle"],
refreshOnClose: true,
onShow: function(){
$('.simplemodal-data #ev-modal-unsubscribe-success .unsub-name').html( _name );
ME.ModalResize();
}
};
} else if( EV.Session.SessionType == 'NonVerified' ){
var successModalArgs = {
modalContent: '#ev-modal-unsubconfirm',
titleText: EV.Strings["SubscribeTitle"],
onShow: function(){
$('.simplemodal-data #ev-modal-unsubconfirm .user-email').html( _email );
if( EV.Session.UserType == 'Registrant' ) $('.simplemodal-data #ev-modal-unsubconfirm .ev-register').parent().hide();
ME.ModalResize();
}
};
} else {
ME.SystemError();
return;
}
ME.Modal( successModalArgs );
}; // end: UnsubscribeSuccess()
// Download file and show thank you modal
var Download = function(){
TrackUser();
if( EV_BYPASS == '1' ){
DownloadApproved();
} else {
CheckAccess( { success: DownloadApproved } );
}
}
// Handle access approval for downloading
var DownloadApproved = function(){
if( _value == '' ) window.location.reload();
if( _value.toLowerCase().indexOf('docload') < 0
&& _value.toLowerCase().indexOf('loaddocument') < 0 ){
window.location.href = _value; return false;
}
// Thank you modal
if( !_itemData ){ ME.SystemError(); return false; }
var href = _value.replace('docload','docLoad');
var modalArgs = {
modalContent: '#ev-modal-download',
titleText: EV.Strings["DownloadTitle"],
onShow: function(){ $('.simplemodal-data #retry-download').attr( 'href', href ); }
};
if( _triggerRefresh ){
$.simplemodal.close();
modalArgs.refreshOnClose = true;
}
if( _$anchor.hasClass('ev-gated-subscription') || _$anchor.parents('.ev-gated-subscription').length ){
$('#ev-modal-download .ev-subscribe-submit').addClass('fa');
} else {
$('#ev-modal-download .ev-subscribe-submit').removeClass('fa');
}
$('#ev-modal-download span.filename').html( _itemData.name );
if( typeof _itemData.tags["subscribeable"] != "undefined" && typeof EV.Session.Subscriptions[_itemData.sku] == 'undefined' ){
$('#ev-modal-download .cta-subscribe, #ev-modal-download .cta-signup').hide();
if( EV.Session.SessionType == 'NonVerified' || EV.Session.SessionType == 'Verified' ){
$('#ev-modal-download .cta-subscribe').show();
} else {
$('#ev-modal-download .cta-signup').show();
}
}
ME.Modal( modalArgs );
var href = _$anchor.attr('href').toLowerCase();
if( href.substr(0,18)=='javascript:docload' ){
var params = docLoadParams( href );
docLoad(params[0],params[1]);
} else {
window.open( href );
}
}; // end: DownloadApproved
// Custom content callback for subscribe tooltips
var SubscribeTooltipBeforeShow = function( $parent ){
// Tooltip Title
var href = $parent.attr('href'),
mediaItem = GetMediaItem( href );
if( !mediaItem ){ ME.SystemError(); return false; }
var name = mediaItem.name;
$('.simplemodal-title', $parent).html( name );
$('.d_button a', $parent).attr('href', href);
$('.u_button a', $parent).attr('href', href);
$('.ds_button a.subscribe', $parent).attr('href', href);
// Already subscribed
var sID = parseID($parent.attr('class'), 'sid_');
if( typeof EV.Session.Subscriptions[sID] != 'undefined' ){
$('.ds_button', $parent).hide();
$('.u_button', $parent).show();
$('.s_already', $parent).hide();
} else {
$('.ds_button', $parent).show();
$('.u_button', $parent).hide();
$('.s_already', $parent).hide();
}
}; // end: SubscribeTooltipBeforeShow
// Returns ev-media.json item data given a needle
var GetMediaItem = function( keyString, type ){
var type = type || EV.SubscriptionType.E_ALERT;
if( !keyString ) return false;
keyString = keyString.toLowerCase();
if( keyString.toLowerCase().indexOf('subscribe(') > -1 ){
type = EV.SubscriptionType.INSIGHT;
} else if( type == EV.SubscriptionType.INSIGHT && keyString.toLowerCase().indexOf('subscribe(') < 0 ){
keyString = "javascript:subscribe('"+keyString+"');";
}
keyString = ( keyString.charAt(keyString.length-1) != ';' ) ? keyString + ';': keyString;
var dataObject = EV_SDATA;
if( type == EV.SubscriptionType.INSIGHT ){
dataObject = SUBSCRIPTIONS;
}
var data = ( typeof dataObject != 'string' && dataObject[keyString] ) ? dataObject[keyString] : false;
if ( data && typeof data != 'string' ){ // Create easy internal .name property
if( !data.tags ) data.tags = {};
data.name = ( 'link_text' in data && data.link_text != '' ) ? data.link_text : '';
if( data.name == '' && 'pretty_file_name' in data && data.pretty_file_name != '' ){
data.name = data.pretty_file_name;
data.name = data.name.replace(/\.[^/.]+$/,'');
}
}
data.type = type;
return data;
}; // end: GetMediaItem
// Return data from Access-Padlock-Funds.js (apf-ev-gated)
var GetLockedPage = function( keyString ){
if( !keyString ) return false;
keyString = ( keyString.charAt(0) != '/' ) ? '/' + keyString: keyString;
var dataObject = ( EatonVance && ( 'UI' in EatonVance ) && ( 'accessList' in EatonVance.UI ) ) ? EatonVance.UI.accessList : {};
var data = ( dataObject[keyString] ) ? dataObject[keyString] : false;
if( data === false ) data = ( dataObject[keyString.toLowerCase()] ) ? dataObject[keyString.toLowerCase()] : false;
return data;
}; // end: GetLockedPage
})(jQuery); // end: EV.Engagement
if( !EV ) var EV = {};
if( !EV.PickList ) EV.PickList = {};
/*--------------------------------------------------
* EV.PickList
* - All PickList code for tables, tooltips and maintenance
*/
(function($){
var ME = EV.PickList,
_$anchor;
/*--------------------------------------------------
* EV.PickList Global Init
*/
$(function(){
// PickList checkbox click
$(document).on('click', '.add-picklist, .remove-picklist', function(e){
e.preventDefault();
_$anchor = $(this);
if( EV.Session.SessionType == 'Verified' ){
UpdatePickList( $(this) );
} else {
EV.Engagement.Login( _$anchor );
}
});
/* PickList "Checkboxes" */
if ( EV.Session.SessionType != 'Verified' ){ // Not signed In
// Signup Tooltip
var tooltipConfig = {
parentSelector: '.check-link',
tooltipContent: '.ev-signin-tooltip',
customContent: { '.ev-signin-title': EV.Strings["PickListTooltipTitle"] }
};
EV.Engagement.Tooltip( tooltipConfig );
// Login prompt on click
$(document).on('click', '.check-link', function(e){
e.preventDefault();
var target = e.target || e.srcElement, $target = $(target);
// Force bind on transparent arrow
if( $target.hasClass('check-link') || $target.hasClass('ev-tooltip-arw') ){
EV.Engagement.Login( $(this) );
}
});
}
});
/*--------------------------------------------------
* EV.PickList Private Methods
*/
var UpdatePickList = function( $anchor ){
_$anchor = $anchor;
var action = ( $anchor.hasClass('add-picklist') ) ? 'PickListAdd' : 'PickListRemove',
symbol = ( $anchor.attr("rel").length >= 3 ) ? $anchor.attr("rel") : false;
if( !symbol ){
EV.Engagement.SystemError();
return false;
}
if( $anchor.parents('.performance').length) {
$anchor.fadeOut(function(){
var $img = $('').addClass('loader_' + symbol).attr('src','images/interface/ajax-loader-arrows.gif');
$img.appendTo( $anchor.parent() );
var ajaxArgs = {};
ajaxArgs.data = {
'a' : action,
'Symbol' : symbol
};
ajaxArgs.complete = UpdateComplete( $anchor, symbol, $img );
Analytics.push(['pickList',action,symbol]);
EV.Engagement.Ajax( ajaxArgs );
});
} else {
if( $anchor.parents('.advisor-resources').length) {
$anchor.toggleClass('loading');
}
var ajaxArgs = {};
ajaxArgs.data = {
'a' : action,
'Symbol' : symbol
};
ajaxArgs.complete = UpdateComplete( $anchor, symbol );
Analytics.push(['pickList',action,symbol]);
EV.Engagement.Ajax( ajaxArgs );
}
}; // end: UpdatePicklist
var UpdateComplete = function( $anchor, symbol, $img ){
//console.log( $anchor );
return function( jqXHR, textStatus ){
var returnXML = $($.parseXML(jqXHR.responseText)),
result = returnXML.find('result').text();
EV.Session = $.parseJSON( returnXML.find('session').text() );
var $loaderImage = $img;
if( $anchor.parents('.performance').length) {
$loaderImage.fadeOut(function(){ setTimeout(function(){ $anchor.fadeIn(); }, 500); });
}
if( $anchor.parents('.advisor-resources').length) {
$anchor.toggleClass('loading');
}
if( result == '0' ) {
// Update checkbox classes
$anchor.toggleClass('add-picklist').toggleClass('remove-picklist').toggleClass('checked');
// Update counter on My Account Pick List table
var $counter = $('.tab-title.active:visible > p > .count, .myaccount-contenttab.active > .count');
var count = parseInt( $counter.first().text().replace('(','').replace(')','') );
if( $anchor.hasClass('add-picklist') ){
count--;
} else {
count++;
}
$counter.text( '(' + count + ')' );
// Add PickList class to table.performance rows for sorting
if( $anchor.parents('.performance') ) $anchor.parent().parent().toggleClass('picklist');
// Update text where necessary
if( ( $anchor.parents('.advisor-resources').length ) )
( $anchor.hasClass('add-picklist') ) ? ( $anchor.html('Add to Pick List') ) : ( $anchor.html('Remove from Pick List') );
} else if( result == '-903' ){
window.location.href = EV.Pages.Result + '?denied=1';
} else {
EV.Engagement.SystemError();
}
}
}; // end: UpdateComplete
})(jQuery); // end: EV.Engagement.PickList
if (!EatonVance) var EatonVance = {};
if (!EatonVance.UI) EatonVance.UI = {};
// EatonVance.UI namespace
new function() {
// namespace short hand
var ME = EatonVance.UI;
ME.accessList = {
"/Advisor-Institute-Conversation-Corner.php": {
"lockedtags":{"accessroles:funds":"accessroles:funds"},
"name":"A Deeper Dive"
},
"/advisor-institute-resource-center.php": {
"lockedtags":{"accessroles:funds":"accessroles:funds"},
"name":"Advisor Institute Resource Center"
},
"/advisor-institute-attracting-clients.php": {
"lockedtags":{"accessroles:funds":"accessroles:funds"},
"name":"Attracting Clients"
},
"/business-development-tips.php": {
"lockedtags":{"accessroles:charitable":"accessroles:charitable"},
"name":"Business Development Tips"
},
"/business-development-tips.php": {
"lockedtags":{"accessroles:charitable":"accessroles:charitable"},
"name":"Business Development Tips"
},
"/cayman-funds-sales-charges-and-commissions.php": {
"lockedtags":{"accessroles:international":"accessroles:international"},
"name":"Cayman Funds Sales Charges and Commissions"
},
"/cayman-islands-funds-prices.php": {
"lockedtags":{"accessroles:international":"accessroles:international"},
"name":"Cayman Islands Funds Prices"
},
"/cayman-islands-funds-sales-charges-and-commissions.php": {
"lockedtags":{"accessroles:international":"accessroles:international"},
"name":"Cayman Islands Funds Sales Charges and Commissions"
},
"/cayman-islands-funds-sales-charges-and-commissions.php": {
"lockedtags":{"accessroles:international":"accessroles:international"},
"name":"Cayman Islands Funds Sales Charges and Commissions"
},
"/cayman-islands-important-fund-documents.php": {
"lockedtags":{"accessroles:international":"accessroles:international"},
"name":"Cayman Islands Important Fund Documents"
},
"/cayman-islands-important-fund-documents.php": {
"lockedtags":{"accessroles:international":"accessroles:international"},
"name":"Cayman Islands Important Fund Documents"
},
"/cayman-islands-prices.php": {
"lockedtags":{"accessroles:international":"accessroles:international"},
"name":"Cayman Islands Prices"
},
"/consortium-licensees.php": {
"lockedtags":{"accessroles:nextshares":"accessroles:nextshares","accessroles:nextshareschecklist":"accessroles:nextshareschecklist"},
"name":"consortium-licensees.php"
},
"/performance-reports.php": {
"lockedtags":{"accessroles:charitable":"accessroles:charitable"},
"name":"Donor Advised Fund Performance Reports"
},
"/evi-ci-emerging-markets-local-income-fund-eemaa.php": {
"lockedtags":{"accessroles:international":"accessroles:international","accessroles:offshore":"accessroles:offshore","contenttype:fund detail":"contenttype:fund detail","countries:ch":"countries:ch","countries:uk":"countries:uk","countries:us - offshore":"countries:us - offshore"},
"name":"EVI Cayman Emerging Markets Local Income Fund EEMAA"
},
"/evi-ci-emerging-markets-local-income-fund-eemat.php": {
"lockedtags":{"accessroles:international":"accessroles:international","accessroles:offshore":"accessroles:offshore","contenttype:fund detail":"contenttype:fund detail","countries:ch":"countries:ch","countries:uk":"countries:uk","countries:us - offshore":"countries:us - offshore"},
"name":"EVI Cayman Emerging Markets Local Income Fund EEMAT"
},
"/evi-ci-emerging-markets-local-income-fund-eemct.php": {
"lockedtags":{"accessroles:international":"accessroles:international","accessroles:offshore":"accessroles:offshore","contenttype:fund detail":"contenttype:fund detail","countries:ch":"countries:ch","countries:uk":"countries:uk","countries:us - offshore":"countries:us - offshore"},
"name":"EVI Cayman Emerging Markets Local Income Fund EEMCT"
},
"/evi-ci-floating-rate-income-fund-ecfix.php": {
"lockedtags":{"accessroles:international":"accessroles:international","accessroles:offshore":"accessroles:offshore","contenttype:fund detail":"contenttype:fund detail","countries:ch":"countries:ch","countries:uk":"countries:uk","countries:us - offshore":"countries:us - offshore"},
"name":"EVI Cayman Floating Rate Income Fund ECFIX"
},
"/evi-ci-floating-rate-income-fund-efrat.php": {
"lockedtags":{"accessroles:international":"accessroles:international","accessroles:offshore":"accessroles:offshore","contenttype:fund detail":"contenttype:fund detail","countries:ch":"countries:ch","countries:uk":"countries:uk","countries:us - offshore":"countries:us - offshore"},
"name":"EVI Cayman Floating Rate Income Fund EFRAT"
},
"/evi-ci-floating-rate-income-fund-efrnn.php": {
"lockedtags":{"accessroles:international":"accessroles:international","accessroles:offshore":"accessroles:offshore","contenttype:fund detail":"contenttype:fund detail","countries:ch":"countries:ch","countries:uk":"countries:uk","countries:us - offshore":"countries:us - offshore"},
"name":"EVI Cayman Floating Rate Income Fund EFRNN"
},
"/evi-ci-floating-rate-income-fund-efrnt.php": {
"lockedtags":{"accessroles:international":"accessroles:international","accessroles:offshore":"accessroles:offshore","contenttype:fund detail":"contenttype:fund detail","countries:ch":"countries:ch","countries:uk":"countries:uk","countries:us - offshore":"countries:us - offshore"},
"name":"EVI Cayman Floating Rate Income Fund EFRNT"
},
"/evi-ci-floating-rate-income-fund-emfrx.php": {
"lockedtags":{"accessroles:international":"accessroles:international","accessroles:offshore":"accessroles:offshore","contenttype:fund detail":"contenttype:fund detail","countries:ch":"countries:ch","countries:uk":"countries:uk","countries:us - offshore":"countries:us - offshore"},
"name":"EVI Cayman Floating Rate Income Fund EMFRX"
},
"/evi-ci-floating-rate-income-fund-erfix.php": {
"lockedtags":{"accessroles:international":"accessroles:international","accessroles:offshore":"accessroles:offshore","contenttype:fund detail":"contenttype:fund detail","countries:ch":"countries:ch","countries:uk":"countries:uk","countries:us - offshore":"countries:us - offshore"},
"name":"EVI Cayman Floating-Rate Income Fund ERFIX"
},
"/evi-ci-emerging-markets-local-income-fund-eemcc.php": {
"lockedtags":{"accessroles:international":"accessroles:international","accessroles:offshore":"accessroles:offshore","contenttype:fund detail":"contenttype:fund detail","countries:ch":"countries:ch","countries:uk":"countries:uk","countries:us - offshore":"countries:us - offshore"},
"name":"EVI CI Emerging Markets Local Income Fund EEMCC"
},
"/EVI-CI-Floating-Rate-Income-Fund-EFRMM.php": {
"lockedtags":{"accessroles:international":"accessroles:international","accessroles:offshore":"accessroles:offshore","contenttype:fund detail":"contenttype:fund detail","countries:ch":"countries:ch","countries:uk":"countries:uk","countries:us - offshore":"countries:us - offshore"},
"name":"EVI CI Floating Rate Income Fund EFRMM"
},
"/EVI-CI-Floating-Rate-Income-Fund-EFRMT.php": {
"lockedtags":{"accessroles:international":"accessroles:international","accessroles:offshore":"accessroles:offshore","contenttype:fund detail":"contenttype:fund detail","countries:ch":"countries:ch","countries:uk":"countries:uk","countries:us - offshore":"countries:us - offshore"},
"name":"EVI CI Floating Rate Income Fund EFRMT"
},
"/evi-ci-short-duration-strategic-income-fund-eamsx.php": {
"lockedtags":{"accessroles:international":"accessroles:international","accessroles:offshore":"accessroles:offshore","contenttype:fund detail":"contenttype:fund detail","countries:ch":"countries:ch","countries:uk":"countries:uk","countries:us - offshore":"countries:us - offshore"},
"name":"EVI CI Short Duration Strategic Income Fund EAMSX"
},
"/evi-ci-short-duration-strategic-income-fund-ecmsx.php": {
"lockedtags":{"accessroles:international":"accessroles:international","accessroles:offshore":"accessroles:offshore","contenttype:fund detail":"contenttype:fund detail","countries:ch":"countries:ch","countries:uk":"countries:uk","countries:us - offshore":"countries:us - offshore"},
"name":"EVI CI Short Duration Strategic Income Fund ECMSX"
},
"/evi-ci-short-duration-strategic-income-fund-ermsx.php": {
"lockedtags":{"accessroles:international":"accessroles:international","accessroles:offshore":"accessroles:offshore","contenttype:fund detail":"contenttype:fund detail","countries:ch":"countries:ch","countries:uk":"countries:uk","countries:us - offshore":"countries:us - offshore"},
"name":"EVI CI Short Duration Strategic Income Fund ERMSX"
},
"/evi-ci-short-duration-strategic-income-fund-esiat.php": {
"lockedtags":{"accessroles:international":"accessroles:international","accessroles:offshore":"accessroles:offshore","contenttype:fund detail":"contenttype:fund detail","countries:ch":"countries:ch","countries:uk":"countries:uk","countries:us - offshore":"countries:us - offshore"},
"name":"EVI CI Short Duration Strategic Income Fund ESIAT"
},
"/EVI-CI-Short-Duration-Strategic-Income-Fund-ESIMM.php": {
"lockedtags":{"accessroles:international":"accessroles:international","accessroles:offshore":"accessroles:offshore","contenttype:fund detail":"contenttype:fund detail","countries:ch":"countries:ch","countries:uk":"countries:uk","countries:us - offshore":"countries:us - offshore"},
"name":"EVI CI Short Duration Strategic Income Fund ESIMM"
},
"/EVI-CI-Short-Duration-Strategic-Income-Fund-ESIMT.php": {
"lockedtags":{"accessroles:international":"accessroles:international","accessroles:offshore":"accessroles:offshore","contenttype:fund detail":"contenttype:fund detail","countries:ch":"countries:ch","countries:uk":"countries:uk","countries:us - offshore":"countries:us - offshore"},
"name":"EVI CI Short Duration Strategic Income Fund ESIMT"
},
"/evi-ci-short-duration-strategic-income-fund-esinn.php": {
"lockedtags":{"accessroles:international":"accessroles:international","accessroles:offshore":"accessroles:offshore","contenttype:fund detail":"contenttype:fund detail","countries:ch":"countries:ch","countries:uk":"countries:uk","countries:us - offshore":"countries:us - offshore"},
"name":"EVI CI Short Duration Strategic Income Fund ESINN"
},
"/evi-ci-short-duration-strategic-income-fund-esint.php": {
"lockedtags":{"accessroles:international":"accessroles:international","accessroles:offshore":"accessroles:offshore","contenttype:fund detail":"contenttype:fund detail","countries:ch":"countries:ch","countries:uk":"countries:uk","countries:us - offshore":"countries:us - offshore"},
"name":"EVI CI Short Duration Strategic Income Fund ESINT"
},
"/Advisor-Institute.php": {
"lockedtags":{"accessroles:funds":"accessroles:funds"},
"name":"Getting Started"
},
"/getting-started-daf.php": {
"lockedtags":{"accessroles:charitable":"accessroles:charitable"},
"name":"Getting Started DAF"
},
"/getting-started-pif.php": {
"lockedtags":{"accessroles:charitable":"accessroles:charitable"},
"name":"Getting Started PIF"
},
"/advisor-institute-inspiring-conviction.php": {
"lockedtags":{"accessroles:funds":"accessroles:funds"},
"name":"Inspiring Conviction"
},
"/investment-professional-benefits-daf.php": {
"lockedtags":{"accessroles:charitable":"accessroles:charitable"},
"name":"Investment Professional Benefits DAF"
},
"/investment-professional-benefits-pif.php": {
"lockedtags":{"accessroles:charitable":"accessroles:charitable"},
"name":"Investment Professional Benefits PIF"
},
"/ireland-funds-sales-charges-and-commissions.php": {
"lockedtags":{"accessroles:international":"accessroles:international"},
"name":"Ireland Funds Sales Charges and Commissions"
},
"/ireland-funds-sales-charges-and-commissions.php": {
"lockedtags":{"accessroles:international":"accessroles:international"},
"name":"Ireland Funds Sales Charges and Commissions"
},
"/ireland-funds-sales-charges-and-commissions.php": {
"lockedtags":{"accessroles:international":"accessroles:international"},
"name":"Ireland Funds Sales Charges and Commissions"
},
"/ireland-funds-sales-charges-and-commissions.php": {
"lockedtags":{"accessroles:international":"accessroles:international"},
"name":"Ireland Funds Sales Charges and Commissions"
},
"/ireland-funds-sales-charges-and-commissions.php": {
"lockedtags":{"accessroles:international":"accessroles:international"},
"name":"Ireland Funds Sales Charges and Commissions"
},
"/ireland-funds-sales-charges-and-commissions.php": {
"lockedtags":{"accessroles:international":"accessroles:international"},
"name":"Ireland Funds Sales Charges and Commissions"
},
"/multi-media-library.php": {
"lockedtags":{"accessroles:funds":"accessroles:funds"},
"name":"Market Update Events"
},
"/ns-fundonboarding.php": {
"lockedtags":{"accessroles:nextshareschecklist":"accessroles:nextshareschecklist"},
"name":"NextShares Fund Onboarding Portal"
},
"/advisor-institute-nurturing-relationships.php": {
"lockedtags":{"accessroles:funds":"accessroles:funds"},
"name":"Nurturing Relationships"
},
"/pif-performance-reports.php": {
"lockedtags":{"accessroles:charitable":"accessroles:charitable"},
"name":"Pooled Income Fund Performance Reports"
},
"/ScreenRequest.php": {
"lockedtags":{"accessroles:sri_cgreen":"accessroles:sri_cgreen","accessroles:sri_cgsf":"accessroles:sri_cgsf","accessroles:sri_csif":"accessroles:sri_csif"},
"name":"Request Company Screen"
},
"/enthink-test2.php": {
"lockedtags":{"accessroles:institutional":"accessroles:institutional"},
"name":"Roles - Unit Test Page - Locked Page ( Inst, UK )"
},
"/enthink-test2.php": {
"lockedtags":{"accessroles:institutional":"accessroles:institutional"},
"name":"Roles - Unit Test Page - Locked Page ( Inst, US )"
},
"/enthink-test3.php": {
"lockedtags":{"accessroles:institutional":"accessroles:institutional"},
"name":"Roles - Unit Test Page - Locked Page ( Inst, XX )"
},
"/enthink-test2.php": {
"lockedtags":{"accessroles:funds":"accessroles:funds"},
"name":"Roles - Unit Test Page - Locked Page ( IP, UK )"
},
"/enthink-test2.php": {
"lockedtags":{"accessroles:funds":"accessroles:funds"},
"name":"Roles - Unit Test Page - Locked Page ( IP, US )"
},
"/enthink-test2.php": {
"lockedtags":{"accessroles:funds":"accessroles:funds"},
"name":"Roles - Unit Test Page - Locked Page ( IP, XX )"
},
"/UniverseSearch.php": {
"lockedtags":{"accessroles:sri_cgreen":"accessroles:sri_cgreen","accessroles:sri_cgsf":"accessroles:sri_cgsf","accessroles:sri_csif":"accessroles:sri_csif"},
"name":"Search Your Fund Universe"
},
"/26365.php": {
"lockedtags":{"accessroles:calvertboards":"accessroles:calvertboards"},
"name":"SelfServe Access Control - CalvertBoards"
},
"/26345.php": {
"lockedtags":{"accessroles:sri_cgreen":"accessroles:sri_cgreen","accessroles:sri_cgsf":"accessroles:sri_cgsf","accessroles:sri_csif":"accessroles:sri_csif"},
"name":"SelfServe Access Control - SRIUniverse"
},
"/SelfServeSiteData.php": {
"lockedtags":{"accessroles:charitable":"accessroles:charitable","selfserve:site data ":"selfserve:site data "},
"name":"SelfServeSiteData - Charitable"
},
"/SelfServeSiteData.php": {
"lockedtags":{"accessroles:funds":"accessroles:funds","selfserve:site data ":"selfserve:site data "},
"name":"SelfServeSiteData - Funds.EatonVance.US"
},
"/SearchInstructions.php": {
"lockedtags":{"accessroles:sri_cgreen":"accessroles:sri_cgreen","accessroles:sri_cgsf":"accessroles:sri_cgsf","accessroles:sri_csif":"accessroles:sri_csif"},
"name":"SRIUniverse Search Instructions"
},
"/advisor-institute-curriculum-guide.php": {
"lockedtags":{"accessroles:funds":"accessroles:funds"},
"name":"The Advisor Institute: Curriculum "
},
"/ireland-funds-sales-charges-and-commissions.php": {
"lockedtags":{"accessroles:international":"accessroles:international"},
"name":"UCITS Funds Sales Charges and Commissions"
},
"/UniverseDownload.php": {
"lockedtags":{"":""},
"name":"UniverseDownload.php"
},
"/video-library-helping-families-improve-legacy-outcomes.php": {
"lockedtags":{"accessroles:funds":"accessroles:funds"},
"name":"Video library: Helping families improve legacy outcomes"
},
"/Whats-Your-Number.php": {
"lockedtags":{"accessroles:funds":"accessroles:funds"},
"name":"What's YOUR Number"
},
// Call a function to generate all Media Manager locked items in the same format as the above list.
'end': 1
};
ME.PadlockRestricted = function (sub_select) {
// Should be abstracted - enthink
if(typeof sub_select !== "string") //hack for now to get this to fire manually upon refresh of ajax content - jlipinski 1/4/2017
{
$('a[href]').not('nav a, .carousel-home a').each(function(){
var anc = $(this);
var pathname = anc.attr('href');
// Exception Class
if ( anc.hasClass('acctbutton')
|| anc.hasClass('no_padlock')
|| anc.hasClass('recent-insight')
|| pathname.charAt(0) == "#"
|| anc.parents('.insight-feature').length
) return true;
if (pathname.charAt(0) != '/') {
pathname = '/' + pathname;
}
if ( ME.accessList[pathname] || ME.accessList[pathname.toLowerCase()] ) {
// Add Icon
var elementPadlock = document.createElement('img');
elementPadlock.setAttribute('class', 'padlock');
elementPadlock.setAttribute('src', EV_RESTRICTED_BADGE);
anc.addClass('apf-ev-gated');
if ( !anc.children('img').length ) {
if( anc.hasClass('infoLink')
|| anc.parents('#side-nav').length
|| anc.parents('span.button').length
|| anc.parents('.documents-vert').length
|| anc.parents('#breadcrumb').length
|| anc.parents('.tool-res-article').length ){
anc.append( elementPadlock );
} else if( anc.parents('#breadcrumb').length ){
anc.removeClass('apf-ev-gated').append( elementPadlock );
} else if ( anc.parents('.billboard').length ){
anc.children('div').children('span').append( elementPadlock );
} else if( anc.parents('.resources').length ){
anc.parent().prepend( $(elementPadlock).css('float','right') );
}
else if(anc.hasClass('blue') && anc.children('span').length)
{anc.children('span').append(elementPadlock);} //for blue link buttons
else {
anc.after( elementPadlock );
}
}
// Trigger Login Modal
if( typeof window.EV.LoginModal == 'function' && EV_BYPASS!=1 ) {
anc.bind('click',function(e){
e.preventDefault();
EV.LoginModal(anc,'redirect',false);
});
}
}
});
}
full_selector = (typeof sub_select ==="string")?(sub_select + " a"):"nav a"; //hack - jlipinski 1/4/2017
// Should be abstracted - enthink
$(full_selector).each(function(){
var anc = $(this);
var pathname = anc.attr('href');
// Exception Class
if (anc.hasClass('acctbutton') || anc.hasClass('no_padlock') || pathname.charAt(0) == "#")
return true;
if (pathname.charAt(0) != '/') {
pathname = '/' + pathname.split('/').pop(); //in the case of absolute urls hack - jlipinski 1/4/2017
}
if ( ME.accessList[pathname] || ME.accessList[pathname.toLowerCase()] ) {
var elementPadlock = document.createElement('img');
elementPadlock.setAttribute('class', 'padlock');
elementPadlock.setAttribute('src', EV_RESTRICTED_BADGE);
anc.append( elementPadlock );
anc.addClass('apf-ev-gated no-tooltip');
}
});
};
if (window.attachEvent) {
window.attachEvent('onload', ME.PadlockRestricted);
}
else if (window.addEventListener) {
window.addEventListener('load', ME.PadlockRestricted, false);
}
else {
window.onload = ME.PadlockRestricted;
}
};
/* Error Strings Object */
EV.Strings.Errors = {
'login' : {
'-905' : { // USR_LOGIN_COOLOFF
'title' : '',
'description' : EV.Strings["CoolOff"]
},
'-921' : { // USR_REGISTRANT_REQUIRED
'title' : EV.Strings["ForgotRegisteredOnlyTitle"]
},
},
'forgot' : {
'-100' : { // BAD_PARAMS
'title' : EV.Strings["InvalidEmailTitle"],
'description' : EV.Strings["InvalidEmailMessage"]
},
'-904' : { // USR_NOT_FOUND
'title' : EV.Strings["ForgotBadEmailErrorTitle"],
'description' : EV.Strings["ForgotBadEmailErrorMessage"]
},
'-921' : { // USR_REGISTRANT_REQUIRED
'title' : EV.Strings["ForgotRegisteredOnlyTitle"]
}
},
'register' : {
'-109' : { // BAD_PARAMS
'title' : EV.Strings["InvalidEmailTitle"],
'description' : EV.Strings["InvalidEmailMessage"]
},
'-904' : { // USR_NOT_FOUND
'title' : EV.Strings["RegisterBadEmailErrorTitle"],
'description' : EV.Strings["RegisterBadEmailErrorMessage"]
},
'-921' : { // USR_REGISTRANT_REQUIRED
'title' : ''
}
},
'start': {
'-100' : { // BAD_PARAMS
'title' : EV.Strings["InvalidEmailTitle"],
'description' : EV.Strings["InvalidEmailMessage"]
},
},
'subscribe' : {
'-100' : { // BAD_PARAMS
'title' : EV.Strings["InvalidEmailTitle"],
'description' : EV.Strings["InvalidEmailMessage"]
},
'-904' : { // USR_NOT_FOUND
'title' : EV.Strings["RegisterBadEmailErrorTitle"],
'description' : EV.Strings["RegisterBadEmailErrorMessage"]
},
},
'subreg' : {
'-100' : { // BAD_PARAMS
'title' : EV.Strings["BadInputTitle"],
'description' : EV.Strings["BadInputMessage"]
}
}
}; // end: EV.Strings.Errors