
var AX=AX||{};AX.session_timer=null;$.fn.debug_links=function(){return this.each(function(){$(this).click(function(){alert("Sorry, this link is not implemented yet.");return false;});});};AX.onload=function(scope){scope=scope||$(document);};AX.timeout_warning=function(){if($('body').hasClass('AuthLoggedIn')&&!$.cookie('SupressReminder')){var default_warning_interval=510000;var time_check_interval=300000;var timestamp=new Date();var current_time=timestamp.getTime();var cookie=$.cookie('AXTimeoutWarning');var cookie_timestamp;if(cookie===null||current_time-cookie>time_check_interval){$.cookie('AXTimeoutWarning',current_time);cookie_timestamp=current_time;}else{cookie_timestamp=cookie;}
time_to_warning=default_warning_interval-(current_time-cookie_timestamp);return setTimeout(function(){$('body').sysmessage('<p id="warning">Due to inactivity, you will be logged out in: <em id="timer">60</em> seconds.</p><p id="call_to_action"><a id="cancel_timeout" href="#">remain logged in</a> <a id="logout" \ href="https://sso.americanexpress.com/SSO/request?request_type=un_logoff&amp;SSOURL=http://www.openforum.com">log out now</a></p><p id="legal">At American Express we take your account security seriously. That\'s why we automatically log you out of our system if you\'ve been inactive for an extended period of time.</p>',{type:'error timeout_warning',autoDismiss:false});var count=parseInt(document.getElementById('timer').innerHTML,10);var timer;timer=setInterval(function(){if(count>0){count--;$('#warning #timer').html(count);}else{clearInterval(timer);$('#warning').html('Due to a period of inactivity, you have been logged out');$.cookie('NucleusAuth','',{path:'/'});$.cookie('AXTimeoutWarning','',{path:'/'});var $login=$("<a id=\"log_back_in\"  href=\""+AX.login_link+"\">Log Back In</a>").click(function(){window.location.href=$(this).attr('href');return false;});$('#call_to_action').html($login);}},1000);$('#cancel_timeout').click(function(e){e.preventDefault();var $obj=$(this);AX.reset_warning();clearInterval(timer);var sessionFrame=$('<iframe src="/home/profile/youprovideseek"></iframe>');sessionFrame.css('display','none');$('body').append(sessionFrame);$obj.parent().parent().parent().find('.sysmessage-close').trigger('click');return false;});$('#dismiss_reminder').click(function(e){e.preventDefault();$.cookie('SupressReminder',true);$('#cancel_timeout').trigger('click');return false;});$('.timeout_warning #logout').click(function(e){e.preventDefault();var redirectURL=$(this).attr('href');$.cookie('NucleusAuth','',{path:'/'});$.cookie('AXTimeoutWarning','',{path:'/'});window.location.href=redirectURL;});},time_to_warning);}};AX.reset_warning=function(){clearTimeout(AX.session_timer);AX.session_timer=AX.timeout_warning();};AX.load_once=function(){AX.onload();$('#PageWrapper').ax();$('#ContentWell input:text, #ContentWell textarea').not('#questions_popup input[type=text], #questions_popup textarea').not('#ask_the_show_form input[type=text], #ask_the_show_form textarea').formKit();$('input:text, textarea').defaultText();$.ax.sysmessageListner();$.ax.NavColumn();$.fn.helpLinks();acceptpayInterstitial();AX.session_timer=AX.timeout_warning();$('.ContactIcon').personaCard();$.ajaxSetup({global:true,timeout:15000,type:'GET',contentType:'application/x-www-form-urlencoded',processData:true,error:function(){$('body').sysmessage('Your request could not be processed',{type:'error'});}});$(window).ajaxComplete(function(e,request,settings){try{if(request.status==302){window.location.reload(true);}}catch(caughtEvent){}});var loaderTimeout;$(window).ajaxStart(function(){AX.reset_warning();loaderTimeout=setTimeout(function(){$('<div id="AjaxLoader">Loading...</div>').appendTo('#PageWrapper');},100);});$(window).ajaxStop(function(){clearTimeout(loaderTimeout);$('#AjaxLoader').remove();});$.ax.sysmessageInline('.sysmessageInline');$('#SectionNav li, #UtilityControl #Login').hover(function(){$(this).addClass('hover');},function(){$(this).removeClass('hover');});$('#iNavLnkLog').click(function(e){e.preventDefault();if($(this).html().toLowerCase()=='log out'){e.preventDefault();AX.logout($("#Global_Auth li.log_out a").attr("href"));}else{destinationUrl=$("#Login").attr('href');window.location.href=destinationUrl;}});$('#Global_Auth').delegate('a','click',function(e){if($(this).parent().hasClass('log_out')){e.preventDefault();if($(this).html().toLowerCase()=='log out'){e.preventDefault();AX.logout($("#Global_Auth li.log_out a").attr("href"));}}});$('#footer_logout').click(function(e){e.preventDefault();AX.logout($("#Global_Auth li.log_out a").attr("href"));});(function($){if($.browser.msie&&$.browser.version<7){$('#UtilityControl #Login').append('<iframe>');}})(jQuery);};$(function(){AX.load_once();});AX.preloadImage=new Image();AX.preloadImage.src='/images/nav/bkg.left-nav-sprite.gif';AX.stringSanitize=function(inputString){return inputString.toString().replace(/\<|\>/g,"");};AX.logout=function(destinationURL){$.post('/Authentication/OpenForumLogOut',function(data){window.location.href=destinationURL;});};
