//getsecureprotocol.js
function GetSecureProtocol(PassedWindow)
  {
  if (PassedWindow.location.hostname.toUpperCase()=='LOCALHOST')
    {return('http://')}
  else
    {return('https://')}
  }

function GetSecureUrl(PassedWindow,PassedURL)
  {
  var PathWithoutPage;
  if (PassedWindow.location.pathname.lastIndexOf('/')!=-1)
    {
    PathWithoutPage=PassedWindow.location.pathname.substr(0,PassedWindow.location.pathname.lastIndexOf('/')+1);
    }
  else
    {
    PathWithoutPage=PassedWindow.location.pathname;
    }

  if ((PassedURL.toUpperCase()=='APPFRAMES.HTM') ||
     (PassedURL.toUpperCase()=='EXIT.HTM') ||
     (PassedURL.toUpperCase()=='SUPPORT') ||
     (PassedURL.toUpperCase()=='RATE_TRACKER.HTM') ||
     (PassedURL.toUpperCase()=='OPT_OUT.HTM'))
    {
    return(GetSecureProtocol(PassedWindow)+PassedWindow.location.hostname+PathWithoutPage+PassedURL);
    }
  else
    {
    return('http://'+PassedWindow.location.hostname+PathWithoutPage+PassedURL);
    }
  }


//these variables need to be globals so they will stay in scope for setInterval
var RedirectWindow;
function GotoURL(PassedURL)
  {
  if ( (top.name!='ExitSurvey')  )
    {
    RedirectWindow=window.open(GetSecureUrl(window,'securetononsecureredirect.htm'),PassedURL);
    setInterval("if (RedirectWindow.closed) {parent.close();}", 100);
    }
  else
    {
    location.href=GetSecureUrl(window,PassedURL+'.htm');
    }
  }

