

function checkRefresh()
{
alert('Check Refresh');
  // Get the time now and convert to UTC seconds
  var today = new Date();
  var now = today.getUTCSeconds();

  // Get the cookie
  var cookie = top.document.cookie;
   
  var cookieArray = cookie.split('; ');
  
  var backlinkt = 0;
  var backlink1 = '';
  var backlink2 = '';
  var backurl	= '';

  for (i = 0; i < cookieArray.length; i++)
  {
    var nameValue = cookieArray[i].split('=');

    if (nameValue[0] == 'BLTIME')
      backlinkt = parseInt(nameValue[1]);
    else if (nameValue[0] == 'BLONE')
      backlink1 = nameValue[1];
    else if (nameValue[0] == 'BLTWO')
      backlink2 = nameValue[1];
    else if (nameValue[0] == 'BLURL')
      backurl = nameValue[1];
  }

  if (Math.abs(now - backlinkt) < 300)
  {
    if (backurl != undefined && backurl != '')
      top.onRefresh(backurl);
    else if (backlink2 != undefined && backlink2 != '')
      top.onBackLink(backlink2);
    else if (backlink1 != undefined && backlink1 != '')
      top.onBackLink(backlink1);
    else
      top.goHome();
  }
  else
  {
    top.document.cookie = 'DISCLAIMER=false;';
    top.goHome();
  }
}

function registerRefreshURL(url)
{
  var today = new Date();
  var now = today.getUTCSeconds();
  // top.document.cookie  = '';
  // top.document.cookie  = 'BLTIME=' + now + ';';
  // top.document.cookie  = 'BLURL=' + encodeURI(url) + ';';
  /*
  if (top.disclaimerAggrement)
    top.document.cookie  = "DISCLAIMER=true;";
  else
    top.document.cookie  = "DISCLAIMER=false;";
  */
}

function prepareForRefreshOLD(bl1, bl2)
{
  var today = new Date();
  var now = today.getUTCSeconds();
  top.document.cookie  = '';
  top.document.cookie  = 'BLTIME=' + now + ';';
  top.document.cookie  += 'BLONE=' + escape(bl1) + ';';
  top.document.cookie  += 'BLTWO=' + escape(bl2) + ';';
}

function registerDisclaimerAccepted()
{
/*
  var today = new Date();
  var now = today.getUTCSeconds();
  top.document.cookie  = '';
  top.document.cookie  = 'BLTIME=' + now + ';';
  top.document.cookie  = 'DISCLAIMER=true;';

var expirationDate = new Date;
expirationDate.setMonth(expirationDate.getMonth()-1);

document.cookie = "yourName=expired; expires=" + expirationDate.toGMTString();
*/  
  var today = new Date();
  var now = today.getUTCSeconds();
  today.setMinutes(today.getMinutes() + 5);

/*  
  top.document.cookie = 'BLTIME=' + now + '; DISCLAIMER=true; expires=' + today.toGMTString();
 */

  top.document.cookie = '';
  top.document.cookie = 'BLTIME=' + now + ';';
  top.document.cookie = 'DISCLAIMER=true;';
  top.document.cookie = 'expires=' + today.toGMTString() + ';';
}


function hasAcceptedDisclaimer()
{
  res = false;
  
  var today = new Date();
  var now = today.getUTCSeconds();

  var cookie = top.document.cookie;
  if (cookie != null)
  {
    var cookieArray = cookie.split('; ');
  
    var tim = 0;
    var dis = '';
 
    for (i = 0; i < cookieArray.length; i++)
    {
      var nameValue = cookieArray[i].split('=');
  
      if (nameValue[0] == 'BLTIME')
        tim = parseInt(nameValue[1]);
      else if (nameValue[0] == 'DISCLAIMER')
        dis = nameValue[1];
    }
  
    if (Math.abs(now - tim) < 300)
    {
      if (dis == 'true')
        res = true;
    }
  }
  
  return res;
}




