//plywajacy popup - thm
var akt = false;
var displ = true;

function zamknij()
{
	obj = document.getElementById("banerek");
  obj.style.visibility = "hidden";
  document.cookie="alerted=yes";
  displ = false;
}

function wyswietl()
{
}

function popupchat()
{
	var width = 400;
	var height = 300;

	// the x,y position of the popup window
	// NOTE: this formula will auto-center the popup on the screen
	var y = (screen.height - height) / 2;
	var x = (screen.width - width) / 2;

	var url = '/chat/';
	var options = 'width=' + width + ',height=' + height + ',top=' + y + ',left=' + x + ',noresize';

	// open the info window as a popup, instead of embedded in webpage
	window.open( url,'Pomoc', options );
}

function popupPrzes()
{
	if (displ == false)
  {
  	clearInterval(intval);
  }
  else
  {
  	if (akt != true )
    {
    	akt = true;
      displ = true;
      intval = setInterval("popupPrzes()", 100);
    }
    else
  	{
    	obj = document.getElementById("banerek");
      obj.style.top = 100 + document.body.scrollTop;
    }
	}
}

// Obsługa cookie
// Alert message once script- By JavaScript Kit
// Credit notice must stay intact for use
// Visit http://javascriptkit.com for this script
function get_cookie(Name) 
{
	var search = Name + "="
	var returnvalue = "";
	if (document.cookie.length > 0) 
	{
  	offset = document.cookie.indexOf(search)
		if (offset != -1) { // if cookie exists
			offset += search.length;
			
			// set index of beginning of value
      end = document.cookie.indexOf(";", offset);
      
			// set index of end of cookie value
      if (end == -1)
         end = document.cookie.length;
      
			returnvalue = unescape(document.cookie.substring(offset, end))
    }
  }
  return returnvalue;
}

function alertornot()
{
  if (get_cookie('alerted')=='')
	{
    loadalert()
  }
}

function loadalert()
{
	obj = document.getElementById("banerek");
  obj.style.visibility ="visible";
  popupPrzes();
}

