<!--

var from = escape(document.referrer);
var query = location.search;
var colorDepth = window.screen.colorDepth;			
var res = window.screen.width + "," + window.screen.height;
document.write("<img src='statystyka/zlicz.php?referer=" + from + "&query=" + query + "&kolory=" + colorDepth + "&rozdzielczosc=" + res + "' align='middle' style='display:none'>");

function $(id){ return document.getElementById(id); };

function SendFormZND()
{
	if(jQuery("#znd_osoba").val() == "")
	{
		alert("Podaj imię i nazwisko.");
		jQuery("#znd_osoba").focus();
		return false;
	}
	if(jQuery("#znd_email").val() == "")
	{
		alert("Podaj adres e-mail.");
		jQuery("#znd_email").focus();
		return false;
	}
	if(jQuery("#znd_tel").val() == "")
	{
		alert("Podaj telefon.");
		jQuery("#znd_tel").focus();
		return false;
	}
	if(jQuery("#znd_tresc").val() == "")
	{
		alert("Wpisz treść wiadomości.");
		jQuery("#znd_tresc").focus();
		return false;
	}
	jQuery.get("ajax/znd_send_formular.php", { osoba: jQuery("#znd_osoba").val(), email: jQuery("#znd_email").val(), tel: jQuery("#znd_tel").val(), tresc: jQuery("#znd_tresc").val() },	
  	function(data){
		var tab = data.split(";");
		if(tab[0] != "1") alert("Błąd: " + tab[1]);
		else
		{
			alert("Formularz został wysłany. Dziękujemy.");
			jQuery("#znd_osoba").val("");
			jQuery("#znd_email").val("");
			jQuery("#znd_tel").val("");
			jQuery("#znd_tresc").val("");
		}
  	});
}

function ZamknijOkno()
{
	document.getElementById('popup').style.display = 'none';
}

function ConfirmAction(msg)
{
	var czy_potwierdzony = confirm(msg);
   if(czy_potwierdzony) return true;
	else return false;
}

function ZapiszOcene(oferta,klient,ocena)
{
	jQuery.get("ajax/klient_zapisz_ocene.php", { oferta: oferta, klient: klient, ocena: ocena },	
  	function(data){
		if(data != "OK") alert("Błąd: " + data);
  	});
}

function ZapiszUwagi(oferta,klient,uwagi)
{
	jQuery.get("ajax/klient_zapisz_uwagi.php", { oferta: oferta, klient: klient, uwagi: uwagi },	
  	function(data){
		if(data != "OK") alert("Błąd: " + data);
  	});
}

function sendFormLogin(formularz,user,pass)
{
	jQuery.get("/ajax/klient_loguj.php", { user: user, pass: pass },	
  	function(data){
		var tab = data.split("|");
		
		if(tab[0] == 'OK')
		{
			//$('user').value = '';
			//$('pass').value = '';
			$(formularz).submit();
			return true;
		}
		else
		{
			alert(tab[1]);
			return false;
		}
  	});
}

function WyslijEmail(uzytkownik, domena, temat)
{
	var OtworzProgramPocztowy = "mailto:" + uzytkownik + "@" + domena + "?Subject=" + temat;
	window.location = OtworzProgramPocztowy;
}

function PokazSchowaj(pole)
{
	var style = document.getElementById(pole).style;
	if(style.display == "none") style.display = "block";
	else style.display = "none";
}

function sprawdz_form_kontaktu(msg,msg2)
{
	var form = document.forms["kontakt"];
	if(form.elements["Komentarz"].value.length == 0) 
  	{
		alert(msg);
		form.elements["Komentarz"].focus();
		return false;
  	}
  	
  	if(form.elements["ImieNazwisko"].value.length == 0) 
  	{
		alert(msg);
		form.elements["ImieNazwisko"].focus();
		return false;
  	}
  	
  	if(form.elements["Telefon"].value.length == 0) 
  	{
		alert(msg);
		form.elements["Telefon"].focus();
		return false;
  	}
  	
  	if(form.elements["Email"].value.length != 0) 
  	{
  		if(!sprawdzemail(form.elements["Email"]))
  		{
  			alert(msg2);
	  		form.elements["Email"].focus();
			return false;
		}
  	}
  	return true;
}

function sprawdz_form_kontaktu_2(msg,msg2)
{
	var form = document.forms["kontakt"];
	if(form.elements["imie"].value.length == 0) 
  	{
		alert(msg);
		form.elements["imie"].focus();
		return false;
  	}
  	
  	if(form.elements["nazwisko"].value.length == 0) 
  	{
		alert(msg);
		form.elements["nazwisko"].focus();
		return false;
  	}
  	
  	if(form.elements["telefon"].value.length == 0) 
  	{
		alert(msg);
		form.elements["telefon"].focus();
		return false;
  	}
  	
  	if(form.elements["email"].value.length != 0) 
  	{
  		if(!sprawdzemail(form.elements["email"]))
  		{
  			alert(msg2);
	  		form.elements["email"].focus();
			return false;
		}
  	}
  	
  	if(form.elements["promocja"].value.length == 0) 
  	{
		alert(msg);
		form.elements["promocja"].focus();
		return false;
  	}
  	
  	if(form.elements["tresc"].value.length == 0) 
  	{
		alert(msg);
		form.elements["tresc"].focus();
		return false;
  	}
  	
  	return true;
}

function PowiekszZdjecie(url, width, height)
{
	var okno = null;
	height = height + 4;
	ScrWidth = 640;
	ScrHeight = 480;
	if(window.screen)
  	{
   	ScrWidth = window.screen.width; 
		ScrHeight = window.screen.height;
  	}
  	PosX = Math.round((ScrWidth - width) / 2);
  	PosY = Math.round((ScrHeight - height) / 2);
  	okno = window.open("galeria.php?sciezka="+url, "zdjecie", "menubar=no,toolbar=no,location=no,directories=no,status=yes,scrollbars=no,resizable=no,copyhistory=no,width=" + width + ",height=" + height + ",left=" + PosX + ",top=" + PosY);
  	okno.focus();	
}

function sprawdzemail(adres) 
{	
   a = adres.value.search(/@/i);
   a1 = adres.value.substring(0,a);
   a2 = a1.length;
   a = a + 1;
   b = adres.value.indexOf(".");
   b1 = adres.value.substring(a,b);
   b2 = b1.length;
   b = b + 1;
   c = adres.value.length;
   c1 = adres.value.substring(b,c);
   c2 = c1.length;
   if(adres.value.indexOf("@") != "-1" && adres.value.indexOf(".") != "-1" && a2 >= 1 && b2 >= 1 && c2 >= 1)
   {
   	return true;
   }
   else
   {
   	return false;
   }		
}

function bookmark(){
  if (document.all) {
    window.external.AddFavorite(document.location.href,document.title)
  }
}

function makeHomePage() {
	if (document.all){
	  document.body.style.behavior='url(#default#homepage)';
      document.body.setHomePage(document.location);
	}
}

function PokazWidokOfertyDlaKlienta(id,lang)
{
	var OknoWidokDlaKlienta = null;
	width = 700;
   height = 640;
  	ScrWidth = 640;
  	ScrHeight = 640;
  	if(window.screen)
  	{
   	ScrWidth = window.screen.width; 
 		ScrHeight = window.screen.height;
  	}
 	PosX = Math.round((ScrWidth - width) / 2);
  	PosY = Math.round((ScrHeight - height) / 2);
  	OknoWidokDlaKlienta = window.open("/oferta_szczegolowa.php?id="+id+"&lang="+lang, "OknoWidokDlaKlienta", "menubar=yes,toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,resizable=no,copyhistory=no,width=" + width + ",height=" + height + ",left=" + PosX + ",top=" + PosY);
  	OknoWidokDlaKlienta.focus(); 
}

function PokazWidokOfertyPotDlaKlienta(id)
{
	var OknoWidokDlaKlienta = null;
	width = 700;
   height = 640;
  	ScrWidth = 640;
  	ScrHeight = 640;
  	if(window.screen)
  	{
   	ScrWidth = window.screen.width; 
 		ScrHeight = window.screen.height;
  	}
 	PosX = Math.round((ScrWidth - width) / 2);
  	PosY = Math.round((ScrHeight - height) / 2);
  	OknoWidokDlaKlienta = window.open("/oferta_pot.php?id="+id, "OknoWidokDlaKlienta", "menubar=yes,toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,resizable=no,copyhistory=no,width=" + width + ",height=" + height + ",left=" + PosX + ",top=" + PosY);
  	OknoWidokDlaKlienta.focus(); 
}

function PokazWidokOfertyDlaKlienta2(id)
{
	var OknoWidokDlaKlienta = null;
	width = 700;
   height = 640;
  	ScrWidth = 640;
  	ScrHeight = 640;
  	if(window.screen)
  	{
   	ScrWidth = window.screen.width; 
 		ScrHeight = window.screen.height;
  	}
 	PosX = Math.round((ScrWidth - width) / 2);
  	PosY = Math.round((ScrHeight - height) / 2);
  	OknoWidokDlaKlienta = window.open("/oferta_szczegolowa3.php?id="+id, "OknoWidokDlaKlienta", "menubar=yes,toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,resizable=no,copyhistory=no,width=" + width + ",height=" + height + ",left=" + PosX + ",top=" + PosY);
  	OknoWidokDlaKlienta.focus(); 
}

function PokazInformacje(url, width, height)
{
	var okno = null;
	var ScrWidth = 640;
	var ScrHeight = 480;
	if(window.screen)
	{
		ScrWidth = window.screen.width;
		ScrHeight = window.screen.height;
	}
	var PosX = Math.round((ScrWidth - width) / 2);
	var PosY = Math.round((ScrHeight - height) / 2);
	okno = window.open(url, "oknododatkowe", "menubar=no,toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,resizable=no,copyhistory=no,width=" + width + ",height=" + height + ",left=" + PosX + ",top=" + PosY);
	okno.focus();
}

-->