var verticalpos="fromtop";
var startY;
function daj_zapytanie()
{
if (!document.layers)
document.write('<div id="divStayTopLeft" style="position:absolute">')
document.write('<layer id="divStayTopLeft">'+
'<table border="0" width="200" cellspacing="0" cellpadding="0">'+
  '<tr>'+
    '<td colspan="2" width="100%" >'+
      '<p align="right"><img src=ikony/plus4.gif width="30" height="50" onclick="JSFX_FloatTopDiv(-1000);" ALT="Zamknij zapytanie" style="cursor:hand"></td>'+
  '</tr>'+
  '<tr>'+
    '<td colspan="2" width="100%" >'+
      '<p align="center"><b><font size="4" color="#B8C7DB">Zapytaj teraz</font></b></td>'+
  '</tr>'+
  '<tr>'+
    '<td width="50%" >'+
    '<p align="center"><input type="button" value="Dodaj" name="B1" onclick="javascript:dodaj();" style="font-family: Tahoma; border: 1px solid #9ECCFE; background-color: #B8C7DB; height:28px; width:78px; cursor:hand"></p>'+
    '</td>'+
    '<td width="50%" >'+
    '<p align="center"><input type="button" value="Pokaż" name="B1" onclick="javascript:lokalizacja();" style="font-family: Tahoma; border: 1px solid #9ECCFE; background-color: #B8C7DB; height:28px; width:78px; cursor:hand"></p>'+
   '<INPUT TYPE="hidden" NAME="plik" VALUE="!!plik!!!">'+
    '</td>'+
  '</tr>'+
'</table>'+
'</layer>');
 if (!document.layers)
 document.write('</div>')
 JSFX_FloatTopDiv(-1000);
}

function setCookie(NameOfCookie, value, expiredays)
{

var ExpireDate = new Date ();
ExpireDate.setTime(ExpireDate.getTime()+ (expiredays * 1000));//
document.cookie = NameOfCookie + "=" + escape(value) + //"; expires=1"
((expiredays == null) ? "" : "; expires=" + ExpireDate.toGMTString());

//jezeli usune expie to nie dopisuje
/*
 var waznosc=new Date();
 waznosc.setTime(waznosc.getTime());
 document.cookie=NameOfCookie+"=" + escape(value) + "; expires=" + waznosc.toGMTString;
*/
}


function dodaj()
{
 poz=window.strona.location.href.indexOf("strony/");
 lok=window.strona.location.href;
 lok=lok.substring(poz,lok.length);
 lok=lok.replace('.','!');
 setCookie(lok,1,60*60);
}
function test_cook(nazwa)
{
//  nazwa=window.strona.location.href+"=";
  startCookie=document.cookie.indexOf(nazwa);
  if (startCookie==-1) {return "Brak cookies: "}
  startCookie+=nazwa.length;
  if (document.cookie.indexOf(";",startCookie)==-1)
    koniecCookie=document.cookie.length;
  else
    koniecCookie=document.cookie.indexOf(";",startCookie);
  textCookie=document.cookie.substring(startCookie,koniecCookie);
  textCookie=unescape(textCookie);
  return "Cookies: "+nazwa+textCookie;

}

function lokalizacja()
{
  window.strona.location='strony/zapytanie.php#gora';
}
function JSFX_FloatTopDiv(Y)
{
	if (startY!= Y)
	startY = Y; else return
    startX = window.screen.width-250;
	var ns = (navigator.appName.indexOf("Netscape") != -1);
	var d = document;
	function ml(id)
	{
		var el=d.getElementById?d.getElementById(id):d.all?d.all[id]:d.layers[id];
		if(d.layers)el.style=el;
		el.sP=function(x,y){this.style.left=x;this.style.top=y;};
		el.x = startX;
		if (verticalpos=="fromtop")
		el.y = startY;
		else{
		el.y = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
		el.y -= startY;
		}
		return el;
	}
	window.stayTopLeft=function()
	{
		if (verticalpos=="fromtop"){
		var pY = ns ? pageYOffset : document.body.scrollTop;
		ftlObj.y += (pY + startY - ftlObj.y)/8;
		}
		else{
		var pY = ns ? pageYOffset + innerHeight : document.body.scrollTop + document.body.clientHeight;
		ftlObj.y += (pY - startY - ftlObj.y)/8;
		}
		ftlObj.sP(ftlObj.x, ftlObj.y);
		setTimeout("stayTopLeft()", 10);
	}
	ftlObj = ml("divStayTopLeft");
	stayTopLeft();
}

function dodaj_sesja()
{
 poz=window.strona.location.href.indexOf("strony/");
 lok=window.strona.location.href;
 lok=lok.substring(poz,lok.length);
 document.forma.plik.value=lok;
 return true;
}
function czytaj()
 {
  nazwa=cook.value+"=";
  startCookie=document.cookie.indexOf(nazwa);
  if (startCookie==-1) {return ""}
  startCookie+=nazwa.length;
  if (document.cookie.indexOf(";",startCookie)==-1)
    koniecCookie=document.cookie.length;
  else
    koniecCookie=document.cookie.indexOf(";",startCookie);
  textCookie=document.cookie.substring(startCookie,koniecCookie);
  textCookie=unescape(textCookie); //rozkodowuje treść
  return textCookie; //zwraca wartość
}
