function areCookiesEnabled()
{
  var testCookie;
  fnMakeCookie("TestCookie", "test");
  testCookie = fnGetCookie("TestCookie");
  if( testCookie == null )
  {
    alert("Your browser is currently not accepting cookies.  You can't continue until it does.");
    return;
  }

  var search = document.location.search.substring(1);
  var code = search.split("=");
  if (code[0] == 'originCode') {
    fnMakeCookie("originCode",code[1]);
  }

  
  forward("nrl/useAgreement.do");

   //var ls = new String (document.location);

   //if ( ( ls.indexOf("2021") > -1 )  )
   //{
       //location = "https://nipr-qa.nipr.com:2020/nrl/useAgreement.do";
   //}
   //else
   //{

   // location="../nrl/useAgreement.do";
  // }
}




function forward(hyperlink)
{

   if ( ( hyperlink.indexOf("pacSignIn") > -1 ) )
   {
      today = new Date();
      if( today.getDay() == 0  && today.getDate() >= 15 && today.getDate() < 22 && today.getHours() >= 18 && today.getHours() <= 23 )
        hyperlink = "html/NRR_Announcement.html";
      else if( (today.getHours() == 21 && today.getMinutes() > 30) ||
    (today.getHours() == 22 && today.getMinutes() <= 30) )
    hyperlink = "html/NIPR_Maintenance_Window.html";
  }

   var ls = new String (document.location);
   var submitPage;

   if ( ( ls.indexOf("2021") > -1 )  )
   {
		submitPage = "https://pdb-qa.nipr.com:2020/" + hyperlink;
   }
   else if ( ( ls.indexOf("2020") > -1 )  )
   {
		submitPage = "https://pdb-qa.nipr.com:2020/" + hyperlink;
   }
   else if ( ( ls.indexOf("4040") > -1 )  )
   {
		submitPage = "http://pdb-int.nipr.com:4040/" + hyperlink;
   }
   else if ( ( ls.indexOf("8080") > -1 )  )
   {
		submitPage = "http://pdb-dvlp.nipr.com:8080/" + hyperlink;
   }
   else
   {
		submitPage = "https://pdb.nipr.com/" + hyperlink;
   }
window.location = submitPage;
}

function forwardLegacy(hyperlink)
{

   if ( ( hyperlink.indexOf("pacSignIn") > -1 ) )
   {
      today = new Date();
      if( today.getDay() == 0  && today.getDate() >= 15 && today.getDate() < 22 && today.getHours() >= 18 && today.getHours() <= 23 )
        hyperlink = "html/NRR_Announcement.html";
      else if( (today.getHours() == 21 && today.getMinutes() > 30) ||
    (today.getHours() == 22 && today.getMinutes() <= 30) )
    hyperlink = "html/NIPR_Maintenance_Window.html";
  }

   var ls = new String (document.location);
   var submitPage;

   if ( ( ls.indexOf("2020") > -1 )  )
   {
	if(hyperlink.indexOf("docMgmt") > -1 || hyperlink.indexOf("roa") > -1 || hyperlink.indexOf("Gateway") > -1 || hyperlink.indexOf("PacNpnSearch") > -1 || hyperlink.indexOf("ACR") > -1)
	{
		submitPage = "https://pdb-qa.nipr.com:2020/" + hyperlink;
	}
	else      
		submitPage = "https://nipr-qa.nipr.com:2020/" + hyperlink;
   }
   else if ( ( ls.indexOf("2021") > -1 )  )
   {
	if(hyperlink.indexOf("docMgmt") > -1 || hyperlink.indexOf("roa") > -1 || hyperlink.indexOf("Gateway") > -1 || hyperlink.indexOf("PacNpnSearch") > -1 || hyperlink.indexOf("ACR") > -1)
	{
		submitPage = "https://pdb-qa.nipr.com:2020/" + hyperlink;
	}
	else      
		submitPage = "https://nipr-qa.nipr.com:2020/" + hyperlink;
   }
   else if ( ( ls.indexOf("4040") > -1 )  )
   {
      	if(hyperlink.indexOf("docMgmt") > -1 || hyperlink.indexOf("roa") > -1 || hyperlink.indexOf("Gateway") > -1 || hyperlink.indexOf("PacNpnSearch") > -1 || hyperlink.indexOf("ACR") > -1)
	{
		submitPage = "http://pdb-int.nipr.com:4040/" + hyperlink;
	}
	else
		submitPage = "http://nipr-int.naic.org:4040/" + hyperlink;
   }
   else if ( ( ls.indexOf("8080") > -1 )  )
   {
      	if(hyperlink.indexOf("docMgmt") > -1 || hyperlink.indexOf("roa") > -1 || hyperlink.indexOf("Gateway") > -1 || hyperlink.indexOf("PacNpnSearch") > -1 || hyperlink.indexOf("ACR") > -1)
	{
		submitPage = "http://pdb-dvlp.nipr.com:8080/" + hyperlink;
	}
	else
		submitPage = "http://nipr-dvlp.naic.org:8080/" + hyperlink;
   }
   else
   {
      	if(hyperlink.indexOf("docMgmt") > -1 || hyperlink.indexOf("roa") > -1 || hyperlink.indexOf("Gateway") > -1 || hyperlink.indexOf("PacNpnSearch") > -1 || hyperlink.indexOf("ACR") > -1)
	{
		submitPage = "https://pdb.nipr.com/" + hyperlink;
	}
	else
		submitPage = "https://www.nipr.com/" + hyperlink;
   }
window.location = submitPage;
}
