if (top != self) {
     top.location=self.location;
}

if (document.domain == "axa-equitable.com") {
   document.location.replace(document.location.href.replace(/axa-equitable\.com/,"www.axa-equitable.com"));
}

/* xgoto is a global var used to pass url to other fuctions */
var xgoto  //global var to pass url to other fuctions;

/* txt is the global disclaimer message.*/
var txt = '<strong>You are now leaving AXA Equitable</strong><br/><br/>Please note that by clicking on Agree, you will leave AXA Equitable and enter another website created, operated and maintained by a different company.';



/* Set Global Variables for window openers (variables not set in feature strings will set to off/no automatically) */
var NO_WINDOW_FEATURES = "menubar=no,location=no,toolbar=no,resizable=yes,scrollbars=no";
var windowfeatures = "menubar=yes,location=yes,toolbar=yes,resizable=yes,scrollbars=yes";

/* use the ExternalLinks object to customize  or omit the disclaimer for external links */
var ExternalLinks = new Object;
ExternalLinks["http://www.variableannuityfacts.org/"]  = {"disclaimer":"yes","newwindow": "yes"}
ExternalLinks["https://uls.axa-equitable.com/uls/jsp/forgot.jsp"]  = {"disclaimer":"no","newwindow": "no"}
ExternalLinks["https://uls.axa-equitable.com/uls/jsp/registration_terms.jsp"]  = {"disclaimer":"no","newwindow": "no"}
ExternalLinks["https://www3.financialtrans.com/tf/Trac?tx=SponsorDisclaim&cz=50023002715"]  = {"disclaimer":"no","newwindow": "no"}
ExternalLinks["https://eqonline.axa-equitable.com/eqsponsor/equivestloadlogin.do"]  = {"disclaimer":"no","newwindow": "no"}
ExternalLinks["https://www.planstat.com/axa/login.asp"]  = {"disclaimer":"no","newwindow": "no"}
ExternalLinks["https://www.planstat.com/axa/login.asp"]  = {"disclaimer":"no","newwindow": "no"}

/* use ExternalDomains to dynamically add to the ExternalLinks object */
var ctDomain = 0;
var ExternalDomains = new Array;
ExternalDomains[ctDomain++] = { "url":"forefield",properties: {"disclaimer":"no", "windowfeatures":"menubar=no,location=no,toolbar=no,resizable=yes,scrollbars=1","newwindow": "yes"}}
ExternalDomains[ctDomain++] = { "url":"axaonline.com",properties: {"disclaimer":"no", "windowfeatures":"menubar=no,location=no,toolbar=no,resizable=yes,scrollbars=1","newwindow": "yes"}}
ExternalDomains[ctDomain++] = { "url":"vdat.com",properties: {"disclaimer":"no", "windowfeatures":"menubar=no,location=no,toolbar=no,resizable=yes,scrollbars=1","newwindow": "yes"}}
ExternalDomains[ctDomain++] = { "url":"axa.com",properties: {"disclaimer":"no", "windowfeatures":"menubar=no,location=no,toolbar=no,resizable=yes,scrollbars=1","newwindow": "yes"}}
ExternalDomains[ctDomain++] = { "url":"axa-equitable.com",properties: {"disclaimer":"no", "windowfeatures":"menubar=no,location=no,toolbar=no,resizable=yes,scrollbars=1","newwindow": "no"}}
ExternalDomains[ctDomain++] = { "url":"axaequitable.com",properties: {"disclaimer":"no", "windowfeatures":"menubar=no,location=no,toolbar=no,resizable=yes,scrollbars=1","newwindow": "no"}}
ExternalDomains[ctDomain++] = { "url":"axaplandemo.com",properties: {"disclaimer":"no", "windowfeatures":"menubar=yes,location=yes,toolbar=yes,resizable=yes,scrollbars=1","newwindow": "yes"}}
ExternalDomains[ctDomain++] = { "url":"onlineaccess-int.axa-equitable.com",properties: {"disclaimer":"no", "windowfeatures":"menubar=no,location=no,toolbar=no,resizable=yes,scrollbars=1","newwindow": "no"}}
ExternalDomains[ctDomain++] = { "url":"onlineaccess-preprod.axa-equitable.com",properties: {"disclaimer":"no", "windowfeatures":"menubar=no,location=no,toolbar=no,resizable=yes,scrollbars=1","newwindow": "no"}}
ExternalDomains[ctDomain++] = { "url":"uls.axa-equitable.com",properties: {"disclaimer":"no", "windowfeatures":"menubar=no,location=no,toolbar=no,resizable=yes,scrollbars=1","newwindow": "no"}}
ExternalDomains[ctDomain++] = { "url":"testuls.axa-equitable.com",properties: {"disclaimer":"no", "windowfeatures":"menubar=no,location=no,toolbar=no,resizable=yes,scrollbars=1","newwindow": "no"}}
ExternalDomains[ctDomain++] = { "url":"eqonline.equitable.com",properties: {"disclaimer":"no", "windowfeatures":"menubar=no,location=no,toolbar=no,resizable=yes,scrollbars=1","newwindow": "no"}}
ExternalDomains[ctDomain++] = { "url":"www1.recruitingcenter.net",properties: {"disclaimer":"no", "windowfeatures":"menubar=no,location=no,toolbar=no,resizable=yes,scrollbars=1","newwindow": "yes"}}
ExternalDomains[ctDomain++] = { "url":"l51wlci3",properties: {"disclaimer":"no", "windowfeatures":"menubar=yes,location=yes,toolbar=yes,resizable=yes,scrollbars=1","newwindow": "no"}}

/* function use to to the opening if Agree is clicked */
function mycallbackform(v,m){
  try {
     if (v == "Agree") {
      window.open(xgoto,"_new",xfeatures).focus();
     }
  } catch(e){
    window.status="error mcb";
    return true;
  }   
return false;
}

function xsitewindow(goto,features) {
    try {
      xgoto=goto;
      xfeatures=features;
        $.prompt(txt,{callback: mycallbackform, buttons: { Agree: 'Agree', Disagree: 'Disagree' } });
      } catch (e) {
        window.status="error 003";
        return true;
      }
return false;    
}

/* Start of custom openers */
$(document).ready(function(){
   $('a[@href^="/axa/financial-professional/fp-disclaimer.html"]').each(function() { 
                     $(this).attr("target","_new");
                      $(this).attr("href","var fp = window.open(\""+"/axa/financial-professional/fp-disclaimer.html"+"\",\"disclaimer\", \"width=500, height=350,\"+NO_WINDOW_FEATURES); return false;");  
     });

   $('a[@id$="email"]').each(function() { 
                     
                     TITLE=$("title").html();
                     URL=
                      $(this).attr("href","mailto:?subject=AXA Equitable - "+ TITLE + "&body=" +document.location);  
     });

/* new window functions added 3-25-2008 Troy Peterson */
   $('a[@href^="http"]').each(function() { 
       url = this.href;

       for (var i=0; i<ExternalDomains.length; i++) {
             if (url.indexOf(ExternalDomains[i].url) > -1) {
                 ExternalLinks[url]  = ExternalDomains[i].properties;
             }
       }

       if (ExternalLinks[url] && ExternalLinks[url]["windowfeatures"]) {
            windowfeatures = ExternalLinks[url]["windowfeatures"];
         } else {
            windowfeatures = "menubar=yes,location=yes,toolbar=yes,resizable=yes,scrollbars=yes";
         }

      if (ExternalLinks[url] && ExternalLinks[url]["disclaimer"] && ExternalLinks[url]["disclaimer"] == "no") {

          if (ExternalLinks[url]["newwindow"] && ExternalLinks[url]["newwindow"] == "yes") {
                               $(this).click( function(){
                                   window.open(this.href,"_blank",windowfeatures).focus();
                                   return false;
                               }) 
          }      
      
      } else {        
                   $(this).click( function(){
                            windowfeatures = "menubar=yes,location=yes,toolbar=yes,resizable=yes,scrollbars=yes"; 
                       xsitewindow(this.href,windowfeatures);
                       return false;
                   }); // end click
       } 

     }); // end each external link

  $('a[@href$=".pdf"]').unbind('click').click(function() { try{nwin=window.open("","pdfwin"); nwin.close(); nwin = window.open($(this).attr("href"),"pdfwin")} catch(e){};   return false; });
  $('a[@href$="demo-eqaccess.html"]').unbind('click').click(function() { try{nwin=window.open("","demowin"); nwin.close(); nwin = window.open($(this).attr("href"),"demowin","height=600,width=800")} catch(e){};   return false; });
  $('a[@href*="fic.wharton.upenn.edu"]').unbind('click').click( function(){  xsitewindow(this.href,"");return false; });
  $('a[@href*="www.wiserwomen.org"]').unbind('click').click( function(){  xsitewindow(this.href,"");return false; });
  $('a[@href*="www.ncpssm.org"]').unbind('click').click( function(){  xsitewindow(this.href,"");return false; });
  $('a[@href*="www.ssa.gov"]').unbind('click').click( function(){  xsitewindow(this.href,"");return false; });
});
