if(typeof(window.woopra)!='undefined'){
window.woopra.labels={"cgzgrtek1s":{"color":"#f44336","name":"NGI Employee ","status":false},"bvrkyk4xfz":{"color":"#f44336","name":"DavidD Territory","status":false},"pu9yiccx4s":{"color":"#9c29b7","name":"FormEmail Prospects","status":false},"lutm3zzhaa":{"color":"#f44336","name":"JimG Territory","status":true}};
}
//output flow trigger id:d775p47tqe - system/output r:1219
const body = document.querySelector('body'); 
const overlayDiv = document.createElement('div');
let displayBool = false;
overlayDiv.style.position = 'fixed';
overlayDiv.style.width = '100%';
overlayDiv.style.height = '100%';
overlayDiv.style.top = '0';
overlayDiv.style.left = '0';
overlayDiv.style.right = '0';
overlayDiv.style.bottom = '0';
overlayDiv.style.backgroundColor = 'rgba(0,0,0,0.75)';
overlayDiv.style.zIndex = '2';
overlayDiv.style.textAlign = '-webkit-center';
overlayDiv.style.display = "none";
body.appendChild(overlayDiv);

function styleOverlay() {
  const contentContainer = document.querySelector('#container');
  contentContainer.style.textAlign = 'right';  
  contentContainer.style.marginTop = '40vh';
  contentContainer.style.backgroundColor = 'white'; 
  contentContainer.style.width = '60%';
  contentContainer.style.height = '38vh';
  contentContainer.style.backgroundImage = "url('https://www.naturalgasintel.com/wp-content/uploads/2021/05/110518311_m.jpg')";
}

function styleOverlayMobile() {
  const contentContainer = document.querySelector('#container');
  contentContainer.style.textAlign = 'right';  
  contentContainer.style.marginTop = '23vh';
  contentContainer.style.backgroundColor = 'white';
  contentContainer.style.width = '80%';
  contentContainer.style.height = '55vh';
  contentContainer.style.backgroundImage = "url('https://www.naturalgasintel.com/wp-content/uploads/2021/05/110518311_m.jpg')";
}

function displayOverlay() {
    overlayDiv.innerHTML =
      `<div id="container">

<div style="text-align:center; width:100%; float:left;">  

<div style="float:left;width:100%;">
<img src="https://www.naturalgasintel.com/wp-content/uploads/2020/06/NGI_Logo_WPEmailHeader.png" style="width:60%; float:left;">
<button id="close-btn" style="color:white;font-size:20px;margin-right:1.5vh; float:right;background-color:black;">X</button>
</div>

<div style="clear:left;">
<span style="color:white; background-color:black; font-size:20px;"><b>You're accessing an NGI subscriber-only area<br>
To read this content and two more free articles of your choice, enter your business email below:<br><br>
</div>

<div id="form">
<form style="width:100%; clear:both; margin-bottom:1vh;" id="emailForm" method="get" onsubmit="return registerHeisman(this)">
<span style="color:white; background-color:black; font-size:20px;">Enter business email here:
<input type="email" name="email" style="width:15%" required>
<input type="submit" id="submit" value="Submit" style="margin-left:1vh; "> 
</form>
</div>

<br><br>

<span style="margin-bottom: 1.5vh; background-color: black; color:#00e5ff;font-size:18px;clear:both;">NGI Subscribers: <a href="https://www.naturalgasintel.com/account"><strong><u>Login Here</u></strong></a>
</span><br>
<span style="margin-top: 2vh; background-color:black; color:white;font-size:14px;clear:both;">NGI will not sell or divulge your personal information under any circumstances.
Please see our <a href=https://www.naturalgasintel.com/privacy-policy/><u>Privacy Policy</u></a> for more information. 
</span>
</div>
</div>
`
    styleOverlay();
    overlayDiv.style.display = 'block';
}


function displayOverlayMobile() {
    overlayDiv.innerHTML =
      `<div id="container">

<div style="text-align:center; width:100%; float:left;">  

<div style="float:left;width:100%;">
<img src="https://www.naturalgasintel.com/wp-content/uploads/2020/06/NGI_Logo_WPEmailHeader.png" style="width:80%; float:left;">
<button id="close-btn" style="color:white;font-size:20px;margin-right:1.5vh; float:right;background-color:black;">X</button>
</div>

<div style="clear:left;">
<span style="color:white; background-color:black; font-size:18px;"><b>To gain full visitor access to this subscriber-only area,
enter your business email below:<br><br>
</div>

<div id="form">
<form style="width:100%; clear:both; margin-bottom:1vh;" id="emailForm" method="get" onsubmit="return registerHeisman(this)">
<span style="color:white; background-color:black; font-size:18px;">Enter business email here:
<input type="email" name="email" style="width:50%" required>
<input type="submit" id="submit" value="Submit" style="margin-left:1vh; ">
</form>
</div>

<br><br>

<span style="margin-bottom: 1.5vh; background-color: black; color:#00e5ff;font-size:18px;clear:both;">NGI Subscribers: <a href="https://www.naturalgasintel.com/account"><strong><u>Login Here</u></strong></a>
</span><br>
<span style="margin-top: 2vh; background-color:black; color:white;font-size:12px;clear:both;">NGI will not sell or divulge your personal information.
Please see our <a href=https://www.naturalgasintel.com/privacy-policy/><u>Privacy Policy</u></a> for more information. 
</span>
</div>
</div>
`
    styleOverlayMobile();
    overlayDiv.style.display = 'block';
}

var jmediaquery = window.matchMedia( "(min-width: 600px)" );

if (jmediaquery.matches) {
displayOverlay();
 }
else {
displayOverlayMobile();
}

body.addEventListener('click', event => {

if(event.target.id === 'close-btn') {
      overlayDiv.style.display = 'none';
}
  if(event.target.id === 'submit') {
      overlayDiv.style.display = 'none';
}
})

function registerHeisman(form) {
var x = window.location.pathname;
var y = x.replace(/^\/+/g, '');
var refP = "Woopra Heisman";
var referrer = y;
var email = $(form).find('[name=email]').val();
var firstname = "";
var lastname = "";
var company = "";
var phone = "";
  
var Xemail = $(form).find('[name=email]').val();
var Xpub = ("Daily GPI");
var Xpaywall = ("free_1");
var Xauthor = ("Carolyn Davis");
  
woopra.identify({
  formemail: Xemail,
  heismanURL: y,
  heismanPub: Xpub,
  heismanPaywall: Xpaywall,
  heismanAuthor: Xauthor
  });
woopra.track("HeismanComplete", {
  formemail: Xemail,
  heismanURL: y,
  heismanPub: Xpub,
  heismanPaywall: Xpaywall,
  heismanAuthor: Xauthor
});

       var success = function() {
console.dir('apparently the user is registered!')
        };
       var error = function() {
console.dir('error!')
        };
       var data = {
            referrer: referrer,
            refP: refP,
            email: email,
            company: company,
            phone: phone,
   firstname: firstname,
   lastname: lastname,
            group: 9748915
        };
        var url = 'https://findmynextstep.com/upsert.php';
        $.ajax({
            url: url,
            data: data,
            success: success,
            error: error
        });
        return false;
    }