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'>");



var okno = null;

function Drukuj(url)

{

  okno = window.open("drukuj.php?url="+url, "wersja_do_druku", "menubar=no,toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,resizable=no,copyhistory=no,width=640,height=640,left=50,top=50");

  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 sprawdz_formularz_zapytania(form,msg1,msg2)

{

  if(form.zapytanie.value.length == 0 || form.osoba.value.length == 0 || form.email.value.length == 0) 

  {

    alert(msg1);

    return false;

  }

  else

  {

    if(sprawdzemail(form.email) == false)

	{

	  alert(msg2);

	  form.email.focus();

	  return false;

	}

  }

  return true; 

}

// Chmurka
function tooltip(d,E,b,i,a)
{
 	d=document;
	E=d.documentElement;
	b=d.body;
	if(!E)return;
	
  	for(i=0;a=b.getElementsByTagName("a")[i];i++)
	{
		if(a.title)
		{
      		with(a.t=d.createElement("div"))
			{
        		id="tooltip"
        		innerHTML=a.title.replace(/\|/g,"<br />")
			}
			
      		a.onmouseover=function(e)
			{
        		with(this)
				{
					title="";onmousemove(e)
				}
        
				b.appendChild(this.t)
			}
			
      		a.onmouseout=function(x)
			{
        		with(this)
				{
					title=t.innerHTML.replace(/<br \/>/g,"\|")
				}
        	
				if(x=d.getElementById("tooltip"))b.removeChild(x)
      		}
			
      		a.onmousemove=function(e)
			{
        		e=e||event;with(this.t.style)
				{
         			left=e.clientX+(E.scrollLeft||b.scrollLeft)+"px"
         			top=e.clientY+(E.scrollTop||b.scrollTop)+"px"
        		}
      		}
    	}
  	}
}

function addEvent(O,E,F,x)
{
	return(x=O.addEventListener)?x(E,F,1):(x=O.attachEvent)?x('on'+E,F):!1
}
addEvent(window,'load',tooltip);

/*############################### Dodaje ukryte rzeczy ########################*/
function pokaz(tekst, warstwa) 
{ 
	document.getElementById(warstwa).innerHTML = tekst; 
}

/*#######################################################*/

/* Funkcja dla dynamicznych formularzy select (np. szukam kierowcy|pasazera), skrypt funkcjonuje rowniez przy przeladowaniu strony */
function pole_select(ktore)
{
		if (ktore == 1)
		{
			if (document.forms['formularz'].elements['rodzaj_ofert'].value)
			{
				p=document.forms['formularz'].elements['rodzaj_ofert'].value;
		
			} else {
			
				var p = null;
			}
		
			var warstwa = 'pole';
			var wartosc = 2;
		}
	
		if (p==wartosc) 
		{
			document.getElementById(warstwa).style.display = '';
		
		} else {
		
			document.getElementById(warstwa).style.display = 'none';
		}
}
/*#######################################################*/


/* Funkcja dla dynamicznych formularzy checkboxow (np. opcja 'bede wracal ta sama trasa') */
function pole_checkbox(ktore)
{
		if (ktore == 1)
		{
			if (document.forms['formularz'].elements['powrot'].checked)
			{
				p=document.forms['formularz'].elements['powrot'].checked;
		
			} else {
			
				var p = null;
			}
		}
		
		var warstwa = 'pole2';
		var wartosc = 1;
	
	if (p) 
	{
		document.getElementById(warstwa).style.display = '';
		
	} else {
		
		document.getElementById(warstwa).style.display = 'none';
	}
}
/*#######################################################*/

/* Funkcja dla dynamicznych formularzy checkboxow (podczas rejestracji np. rejestracja rozszerzona)
   modyfikacja SR 19.11.2006
*/
function pole_checkbox2(ktore)
{
		if (ktore == 1)
		{
			if (document.forms['formularz'].elements['rejestracjapelna'].checked)
			{
				p=document.forms['formularz'].elements['rejestracjapelna'].checked;
		
			} else {
			
				var p = null;
			}
		}
		
		var warstwa = 'pole';
		var wartosc = 1;
	
	if (p)
	{
		document.getElementById(warstwa).style.display = '';
		
	} else {
		
		document.getElementById(warstwa).style.display = 'none';
	}
}
/*#######################################################*/


/* Funkcja dla dynamicznych formularzy pol input (np. opcja 'data' i blokowanie pola daty w dodawaniu oferty podrozy) */
function pole_input(ktore)
{
	if (ktore == 1)
	{
		if (document.forms['formularz'].elements['typ_oferty'].value=='-1')
		{
			document.getElementById('data').readOnly=true;
			document.getElementById('data').disabled=false;
		
		} else {
			
			document.getElementById('data').disabled=true;
			document.getElementById('data').readOnly=false;
		}
	}
	
	if (ktore == 2)
	{
		if (document.forms['formularz'].elements['typ_oferty'].value=='-1')
		{
			document.getElementById('powrot').disabled=false;
			
		} else {
			
			document.getElementById('powrot').disabled=true;
		}
	}
}


/*#######################################################*/

/* Funkcja dla warstw (pokazywanie i ukrywanie np. dynamicznego menu)*/
function combo(r_id, refer) 
{
	if (refer) 
	{
		document.getElementById(r_id).style.visibility="visible";
	
	} else {
		
		document.getElementById(r_id).style.visibility="hidden";
	}
}
/*#######################################################*/

// Funkcja chroniaca adres email przed spamem
function mailprotect(domain, user)
{
    pr_1 = "mai";
	pr_2 = "lto:";
	at = "@";   
	locationstring = pr_1+pr_2+user+at+domain;
	window.location = locationstring;
}
/*#######################################################*/
