/* Setup variables for Google Ads */



function google_ad_request_done2(google_ads) {
/*
* This function is required and is used to display
* the ads that are returned from the JavaScript
* request. You should modify the document.write
* commands so that the HTML they write out fits
* with your desired ad layout.
*/

var s = '';
var i;

/*
* Verify that there are actually ads to display.
*/
if (google_ads.length == 0) {
return;
}


if (google_ads.length == 1) {
/*
* Partners should adjust text sizes
* so ads occupy the majority of ad space.
*/
s += '<div class="adBlock"><a class="title" href="' + 
google_ads[0].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'http://' +
google_ads[0].visible_url + '\';return true">' + 
google_ads[0].line1 + '</a><br><span class="text">' +
google_ads[0].line2 + ' ' +
google_ads[0].line3 + '<br></span> <a class="url" href="' + 
google_ads[0].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'http://' +
google_ads[0].visible_url + '\';return true">' + 
google_ads[0].visible_url + '</a></div>';



} else if (google_ads.length > 1) {

   s += '<a href=\"' + google_info.feedback_url + '\" class="adsBy">Ads by Google</a><br>' 

  /*
  * For text ads, append each ad to the string.
  */

for(i = 0; i < google_ads.length; ++i) {


s += '<div class="adBlock"><a class="adTitle" href="' + 
google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'http://' +
google_ads[i].visible_url + '\';return true">' + 
google_ads[i].line1 + '</a><span class="adText">' +
google_ads[i].line2 + ' ' +
google_ads[i].line3 + '<br></span> <a class="adUrl" href="' + 
google_ads[i].url + '" onmouseout="window.status=\'\'" onmouseover="window.status=\'http://' +
google_ads[i].visible_url + '\';return true">' + 
google_ads[i].visible_url + '</a></div>';
}
    }

    document.write(s);
    return;
  }

function displayOverlay() 
{
  var tbody = document.getElementsByTagName("body")[0];
  var overlay = document.createElement('div');          
  overlay.onClick='hideOverlay();';
  overlay.id='signupOverlay'; 
  tbody.appendChild(overlay);
  overlayDiv=document.getElementById('signupOverlay');
  overlayDiv.innerHTML = '<div class="close" onclick="Set_Cookie(\'disableSignupOverlay\', \'true\', 7, \'/\')">X</div><h2>Don\'t miss out on our weekly email!</h2><img src="/images/overlay-baby.gif" style="float:right; margin-right:10px; margin-top:5px; margin-left:10px;"><h3>Are You Trying to Conceive?</h3><p>Receive advice on how you can enhance your chances of conceiving.</p><h3>Are You Pregnant?</h3><p>Follow your baby\'s  weekly development and receive practical advice to help you through your pregnancy.</p><h3>Do You Have a New Baby?</h3><p>Receive practical advice to help you adjust to parenthood and learn about your baby\'s development.</p>';
  overlayDiv.onclick = hideOverlay;
}

function hideOverlay() {
  document.getElementById('signupOverlay').style.display='none';
}

function checkLaunchOverlay() 
{
  if(Get_Cookie('disableSignupOverlay') != 'true')
  {
    if(Get_Cookie('signupOverlayPageCount') == 1 || Get_Cookie('signupOverlayPageCount') == 4 || Get_Cookie('signupOverlayPageCount') == 9)
    {
      displayOverlay();
      setTimeout('hideOverlay();', 20000);
    }
    if(Get_Cookie('signupOverlayPageCount') == null)
    {
      // Set cookie to 1
      Set_Cookie('signupOverlayPageCount', 1, null, '/');
    }
    else
    {
      // Add 1 to cookie
      var newCount = parseInt(Get_Cookie('signupOverlayPageCount')) + 1;
      Set_Cookie('signupOverlayPageCount', newCount, null, '/');
    }
  }
}

/*function Set_Cookie( name, value, expires, path, domain, secure )
{
  var today = new Date();
  today.setTime( today.getTime() );
  if ( expires )
  {
    expires = expires * 1000 * 60 * 60 * 24;
  }
  var expires_date = new Date( today.getTime() + (expires) );

  document.cookie = name + "=" +escape( value ) +
  ( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
  ( ( path ) ? ";path=" + path : "" ) +
  ( ( domain ) ? ";domain=" + domain : "" ) +
  ( ( secure ) ? ";secure" : "" );
}

function Get_Cookie( name )
{
  var start = document.cookie.indexOf( name + "=" );
  var len = start + name.length + 1;
  if ( ( !start ) &&
  ( name != document.cookie.substring( 0, name.length ) ) )
  {
    return null;
  }
  if ( start == -1 ) return null;
  var end = document.cookie.indexOf( ";", len );
  if ( end == -1 ) end = document.cookie.length;
  return unescape( document.cookie.substring( len, end ) );
}
*/