function getr(g) {
  g.style.position = 'absolute';
  g.style.top = '0';
  g.style.left = '0';
  g.style.width = '100%';
  g.style.height = '100%';
  g.style.display = 'block';
  g.innerHTML = '&nbsp;';
  g.className = 'jibber';
  return g;
}
function pop_invite2() {
  var h = getr(document.createElement('div'));
  var g = getr(document.createElement('div'));
  g.style.backgroundColor = '#cccccc';
  h.style.color='#666666';
  jQuery(h).fadeOut('fast',function() {
    jQuery(g).fadeTo('fast',0.1,function() {
      g.style.display = 'block';
      g.style.zIndex = '3002';
      h.style.zIndex = '3003';
      document.body.appendChild(g);
      document.body.appendChild(h);

//-----------------------------------------------
      if (window.XMLHttpRequest)  {
        xhttp=new XMLHttpRequest();
      } else {
        xhttp=new ActiveXObject("Microsoft.XMLHTTP");
      }
			xhttp.open("GET","/invite.shtml",false);
			xhttp.send("");
			var rhtml=xhttp.responseText; 
			h.innerHTML = rhtml;
			jQuery(g).fadeTo('fast', 0.5);
			jQuery(h).fadeIn('fast');
//-----------------------------------------------


/*      jQuery(h).load('/invite.shtml',null,function() {
	jQuery(g).fadeTo('fast', 0.5);
	jQuery(h).fadeIn('fast');
      });

  doesn't work in IE8 :(
*/
    });
  });
}
function del_invite2() {
  jQuery('.jibber').remove();
}

function pop_invite() {
  window.setTimeout(pop_invite2,10);
  return false;
}
function del_invite() {
  window.setTimeout(del_invite2,10);
  return false;
}
function give_cookie() {
  document.cookie = "emergency=" + escape(flastmod() );
}
function get_cookie(c_name) {
  if (document.cookie.length>0)
    {
    c_start=document.cookie.indexOf(c_name + "=");
    if (c_start!=-1)
      {
      c_start=c_start + c_name.length+1;
      c_end=document.cookie.indexOf(";",c_start);
      if (c_end==-1) c_end=document.cookie.length;
      return unescape(document.cookie.substring(c_start,c_end));
      }
    }
  return "";
}
function valid_cookie() {
  if(get_cookie('emergency') == flastmod() ) {
    return 1;
  } else {
    give_cookie();
    return 0;
  }
}
function flastmod() {
	return 'Wednesday, 04-Nov-2009 15:22:29 EST';
}
jQuery().ready(function() { if(!valid_cookie() ) pop_invite(); });
