<!-- //
function showStar() {
	var o = document.getElementById('rating');
	if(o && o.style) {
		o.style.display = '';
	}
}

function goTo (l) {
	location.href=l;
}

function hideElement(id) {
	var o = document.getElementById(id);
	if(o.style) {
		o.style.display = 'none';
	}
}
function showElement(id) {
	var o = document.getElementById(id);
	if(o.style) {
		o.style.display = '';
	}
}

function sprawdz_czy_w_aktowce(id) {
    $.get("ajax_sprawdz_czy_w_aktowce.php",{id: id}, function(ret) {  
        if(parseInt(ret)==1){
            $('#obserwuj_'+id).attr('innerHTML',dodano_do_a);
        }else{
            $('#obserwuj_'+id).attr('innerHTML',dodaj_do_a);
        }
    });
    return '';
}



function dodaj_do_aktowki(id) {
$.get("ajax_dodaj_do_aktowki.php",{id: id}, function(ret) {  

if(parseInt(ret)==1){

var thebutton = $('#obserwuj_'+id);
var thebutton_offset = thebutton.offset();
var thebutton_left = thebutton_offset.left;
var thebutton_top = thebutton_offset.top;
//dwie zmienne zawierajace odleglosc
//buttona od gory i od lewej krawedzi ekranu
//pozycje ikony identyczna z tymi
//wartosciami z buttona
var theaktowka = $('#aktowkapozycja');
var theaktowka_offset = theaktowka.offset();
var theaktowka_left = theaktowka_offset.left;
var theaktowka_top = theaktowka_offset.top;
//i zmienne dla aktowki

$("#popup").offset({top: thebutton_top, left: thebutton_left});
//i animujemy
$("#popup").css("position","absolute");
$("#popup").css({top: thebutton_top - 10});
$("#popup").css({left: thebutton_left + 30});
$("#popup").show("slow");
 $("#popup").animate({top:theaktowka_top - 10,left:theaktowka_left + 30},1400);
 $("#popup").fadeOut();


$.post("ajax_podaj_ilosc_ofert_w_aktowce.php", function(obecna_ilosc) {  
aktualna_ilosc=parseInt(obecna_ilosc);  
$('#ilosc_aktowka').attr('innerHTML','('+aktualna_ilosc+')');
if($('#obserwuj_'+id)){
$('#obserwuj_'+id).attr('href','javascript:dodaj_do_aktowki('+id+')');
$('#obserwuj_'+id).attr('title',dodano_do_a_label);
$('#obserwuj_'+id).attr('innerHTML',dodano_do_a);
}
}); 

} else if(parseInt(ret)==2) {
$.post("ajax_podaj_ilosc_ofert_w_aktowce.php", function(obecna_ilosc) {  
aktualna_ilosc=parseInt(obecna_ilosc);  
if(aktualna_ilosc==0) $('#ilosc_aktowka').attr('innerHTML','');
else $('#ilosc_aktowka').attr('innerHTML','('+aktualna_ilosc+')');

if($('#obserwuj_'+id)) {
$('#obserwuj_'+id).attr('href','javascript:dodaj_do_aktowki('+id+')');
$('#obserwuj_'+id).attr('title',dodaj_do_a_label);
$('#obserwuj_'+id).attr('innerHTML',dodaj_do_a);
}
}); 
} else if(parseInt(ret)==3) {
alert('Wystąpił błąd podczas dodawania nieruchomości do aktówki.');
}

}); 

} 

function dodaj_do_porownywarki(id) {
$.get("ajax_dodaj_do_porownywarki.php",{id: id}, function(ret) {

if(parseInt(ret)==1){

var thebutton = $('#porownaj_'+id);
var thebutton_offset = thebutton.offset();
var thebutton_left = thebutton_offset.left;
var thebutton_top = thebutton_offset.top;
//dwie zmienne zawierajace odleglosc
//buttona od gory i od lewej krawedzi ekranu
//pozycje ikony identyczna z tymi
//wartosciami z buttona
var theporownywarka = $('#porownywarkapozycja');
var theporownywarka_offset = theporownywarka.offset();
var theporownywarka_left = theporownywarka_offset.left;
var theporownywarka_top = theporownywarka_offset.top;
//i zmienne dla aktowki

$("#popup").offset({top: thebutton_top, left: thebutton_left});
//i animujemy
$("#popup").css("position","absolute");
$("#popup").css({top: thebutton_top - 10});
$("#popup").css({left: thebutton_left + 30});
$("#popup").show("slow");
 $("#popup").animate({top:theporownywarka_top - 10,left:theporownywarka_left + 30},1400);
 $("#popup").fadeOut();


$.post("ajax_podaj_ilosc_ofert_w_porownywarce.php", function(obecna_ilosc) {
aktualna_ilosc=parseInt(obecna_ilosc);
$('#ilosc_porownywarka').attr('innerHTML','('+aktualna_ilosc+')');
$('#checkbox_'+id).attr('disabled','disabled');
if($('#porownaj_'+id)){
}
$('#porownaj_'+id).attr('href','javascript:dodaj_do_porownywarki('+id+')');
$('#porownaj_'+id).attr('title',dodano_do_p_label);
$('#porownaj_'+id).attr('innerHTML',dodano_do_p);
  $('#'+id+'_TipDiv span').attr('innerHTML','Odznacz aby usunąć z porównywarki');
            $('#checkbox_'+id).attr('checked','checked');
            $('#checkbox_'+id).attr('disabled','');



});

} else if(parseInt(ret)==2) {
$.post("ajax_podaj_ilosc_ofert_w_porownywarce.php", function(obecna_ilosc) {
aktualna_ilosc=parseInt(obecna_ilosc);
if(aktualna_ilosc==0) $('#ilosc_porownywarka').attr('innerHTML','');
else $('#ilosc_porownywarka').attr('innerHTML','('+aktualna_ilosc+')');

if($('#porownaj_'+id)) {
$('#porownaj_'+id).attr('href','javascript:dodaj_do_porownywarki('+id+')');
$('#porownaj_'+id).attr('title',dodaj_do_p_label);
$('#porownaj_'+id).attr('innerHTML',dodaj_do_p);
}
});
} else if(parseInt(ret)==3) {
alert('Wystąpił błąd podczas dodawania nieruchomości do porównywarki.');
}

});

}


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 SetCookie(cookieName,cookieValue,nDays) {
 			var today = new Date();
			var expire = new Date();
			if (nDays==null || nDays==0) nDays=1;
				expire.setTime(today.getTime() + 3600000*24*nDays);
			 document.cookie = cookieName+"="+escape(cookieValue)
                 + ";expires="+expire.toGMTString();
}
function SetCookieHour(cookieName,cookieValue,nHour) {
 			var today = new Date();
			var expire = new Date();
			if (nHour==null || nHour==0) nHour=1;
				expire.setTime(today.getTime() + 3600000*nHour);
			 document.cookie = cookieName+"="+escape(cookieValue)
                 + ";expires="+expire.toGMTString();
}
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 sprawdzemail2(adres)
{
	a = adres.search(/@/i);
	a1 = adres.substring(0,a);
	a2 = a1.length;
	a = a + 1;
	b = adres.indexOf(".");
	b1 = adres.substring(a,b);
	b2 = b1.length;
	b = b + 1;
	c = adres.length;
	c1 = adres.substring(b,c);
	c2 = c1.length;
	if(adres.indexOf("@") != "-1" && adres.indexOf(".") != "-1" && a2 >= 1 && b2 >= 1 && c2 >= 1)
	{
		return true;
	}
	else
	{
		return false;
	}
}
function popup(typ,jezyk,waluta,skad,rent)
{
	width = 355;
	height = 480;
	ScrWidth = 800;
	ScrHeight = 600;
	if(window.screen)
	{
		ScrWidth = window.screen.width;
		ScrHeight = window.screen.height;
	}
	PosX = Math.round((ScrWidth - width) / 2);
	PosY = Math.round((ScrHeight - height) / 2);
	switch(typ){
		case 'logowanie':
		okno = window.open("logowanie.php?jezykID="+jezyk+"&waluta="+waluta+"&skad="+skad, "logowanie", "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();
		break;
		case 'e_haslo':
		okno = window.open("edycja_hasla.php?jezykID="+jezyk+"&waluta="+waluta+"&skad="+skad, "edycja_hasla", "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();
		break;
		case 'e_dane':
		okno = window.open("edycja_danych.php?jezykID="+jezyk+"&waluta="+waluta+"&skad="+skad, "edycja_hasla", "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();
		break;
		case 'e_waluta':
		okno = window.open("edycja_waluty.php?jezykID="+jezyk+"&waluta="+waluta+"&skad="+skad, "edycja_hasla", "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();
		break;
		case 'e_kredyt':
		okno = window.open("edycja_kredyt.php?jezykID="+jezyk+"&waluta="+waluta+"&skad="+skad, "edycja_hasla", "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();
		break;
		case 'dojazd_komunikacja':
		okno = window.open("dojazd_komunikacja.php?id="+skad+"&jezykID="+jezyk, "edycja_hasla", "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();
		break;
		case 'dojazd_autem':
		okno = window.open("dojazd_autem.php?id="+skad+"&jezykID="+jezyk, "edycja_hasla", "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();
		break;
		case 'wyslij_znajomemu':
		okno = window.open("wyslij_znajomemu.php?id="+skad+"&jezykID="+jezyk, "wyslij_znajomemu", "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();
		break;
		case 'wyslij_zapytanie':
		okno = window.open("wyslij_zapytanie.php?id="+skad+"&jezykID="+jezyk, "wyslij_znajomemu", "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();
		break;
		case 'wyslij_zapytanie2':
		okno = window.open("wyslij_zapytanie.php?id="+skad+"&akcja=wyslij&telefon="+waluta+"&jezykID="+jezyk, "wyslij_znajomemu", "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();
		break;
		case 'drzwi_otwarte':
		okno = window.open("drzwi_otwarte.php?id="+skad+"&jezykID="+jezyk, "drzwi_otwarte", "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();
		break;
		case 'dodaj_do_aktowki':
		okno = window.open("dodaj_do_aktowki.php?akcja=dodaj&id="+skad+"&jezykID="+jezyk, "dodaj_do_aktowki", "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();
		break;
		case 'nieruchomosci_w_okolicy':
		okno = window.open("okoliczne_nieruchomosci.php?id="+skad+"&jezykID="+jezyk+"&rent="+rent, "nieruchomosci_w_okolicy", "menubar=no,toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,resizable=no,copyhistory=no,width=400,height=550,left=" + PosX + ",top=" + PosY);
		okno.focus();
		break;
		case 'nieruchomosci_w_okolicy2':
		nieruchomosci_w_okolicy2 = window.open("okoliczne_nieruchomosci2.php?id="+skad+"&jezykID="+jezyk, "nieruchomosci_w_okolicy2", "menubar=no,toolbar=no,location=no,directories=no,status=yes,scrollbars=yes,resizable=no,copyhistory=no,width=400,height=550,left=" + PosX + ",top=" + PosY);
		nieruchomosci_w_okolicy2.focus();
		break;
		case 'developer_formularz':
		okno = window.open("developer_formularz.php?&jezykID="+jezyk, "developer_formularz", "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();
		break;
	}

}


function PowiekszZdjecie(url, width, height)
{
	var okno = null;
	if(okno) okno.close();
	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=yes,resizable=no,copyhistory=no,width=" + (width+19) + ",height=" + height + ",left=" + PosX + ",top=" + PosY);
	okno.focus();
}

function MM_findObj(n, d) { //v4.0
	var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
		d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
		if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
		for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
		if(!x && document.getElementById) x=document.getElementById(n); return x;
}
function MM_showHideLayers() { //v3.0
	var i,p,v,obj,args=MM_showHideLayers.arguments;
	for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
	if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
	obj.visibility=v; }
}

function flash(id, kolor, czas, kolor2, czas2)
{
	if (document.getElementById)
	{
		document.getElementById(id).style.color = kolor;
		setTimeout('flash("' +  id + '","' + kolor2 + '",' + czas2 + ',"' + kolor + '",' + czas + ')', czas);
	}
	else if (document.all)
	{
		document.all[id].style.color = kolor;
		setTimeout('flash("' +  id + '","' + kolor2 + '",' + czas2 + ',"' + kolor + '",' + czas + ')', czas);
	}
}
var preload = new Array
preload[0] = new Image()
preload[1] = new Image()
preload[0].src = "l/i/lista/pomoc.gif";
preload[1].src = "l/i/lista/pomoc_r.gif";
function flashimg(id, kolor, czas, kolor2, czas2,id_obrazu, plik1, plik2)
{
	if (document.getElementById)
	{


		preload.src=plik1;
		document.getElementById(id).style.color = kolor;
		document.getElementById(id_obrazu).src=plik1;
		setTimeout('flashimg("' +  id + '","' + kolor2 + '",' + czas2 + ',"' + kolor + '",' + czas + ',"'+id_obrazu+'","'+plik2+'","'+plik1+'")', czas);
	}
	else if (document.all)
	{
		document.all[id].style.color = kolor;
		document.all[id_obrazu].src=plik1;
		setTimeout('flashimg("' +  id + '","' + kolor2 + '",' + czas2 + ',"' + kolor + '",' + czas + ',"'+id_obrazu+'","'+plik2+'","'+plik1+'")', czas);
	}
}

function formatNumber(number)
{
	var num = new NumberFormat();
	num.setInputDecimal('.');
	num.setNumber(number); // obj.value is '-1000.247'
	num.setPlaces('0', false);
	num.setCurrencyValue('$');
	num.setCurrency(false);
	num.setCurrencyPosition(num.LEFT_OUTSIDE);
	num.setNegativeFormat(num.LEFT_DASH);
	num.setNegativeRed(false);
	num.setSeparators(true, ' ', ',');
	return num.toFormatted();

}
function maxlength(el, maxSize)
{
	if (!el.onblur) el.onblur = el.onclick = el.onmousedown = el.onmouseup = el.keypress = el.onkeydown = el.onkeyup = el.onmouseover = el.onmouseout = el.onfocus;
	if (el.value.length < maxSize) el.maxlengthvalue = null;
	else if (el.value.length == maxSize) el.maxlengthvalue = el.value;
	else el.maxlengthvalue = el.value = (el.maxlengthvalue ? el.maxlengthvalue : el.value.substring(0, maxSize));
}
function Trim(STRING){
	STRING = LTrim(STRING);
	return RTrim(STRING);
}

function RTrim(STRING){
	while(STRING.charAt((STRING.length -1))==" "){
		STRING = STRING.substring(0,STRING.length-1);
	}
	return STRING;
}


function LTrim(STRING){
	while(STRING.charAt(0)==" "){
		STRING = STRING.replace(STRING.charAt(0),"");
	}
	return STRING;
}

function $(id) {

	return document.getElementById(id);
}

function pokaz_chmurke(e,i,off,rep){
	if (typeof(i) == 'string') {
		i = document.getElementById(i);
		i.style.position = 'absolute';
	}
	else {
		i=i.getElementsByTagName('div');
		i=i[0];
	}
	if (!i.innerHTML) return;
	if (off) {
		i.style.display="none";
	//	document.body.style.cursor="";
	} else {
		if (rep) {
		i.style.top=e.clientY-document.getElementById('page').offsetTop+document.documentElement.scrollTop+3+"px";
		i.style.left=e.clientX-document.getElementById('page').offsetLeft+document.documentElement.scrollLeft+3+"px";
		//i.style.top=e.clientY-document.getElementById('page').offsetTop+"px";
		} else {
		//i.style.top=e.clientY+document.documentElement.scrollTop+3+"px";
		i.style.left=e.clientX+document.documentElement.scrollLeft+3+"px";
		}
		i.style.display="block";
	}
}

function pokaz_chmurke_porownaj(e,i,off,rep){
	if (typeof(i) == 'string') {
		i = document.getElementById(i);
		i.style.position = 'absolute';
	}
	else {
		i=i.getElementsByTagName('div');
		i=i[0];
	}
	if (!i.innerHTML) return;
	if (off) {
		i.style.display="none";
	//	document.body.style.cursor="";
	} else {
		if (rep) {
		i.style.top=e.clientY-document.getElementById('page').offsetTop+document.documentElement.scrollTop+3+"px";
		i.style.left=e.clientX-document.getElementById('page').offsetLeft+document.documentElement.scrollLeft+3+"px";
		i.style.top=e.clientY-document.getElementById('page').offsetTop+"px";
		} else {
		i.style.top=e.clientY+document.documentElement.scrollTop+3+"px";
		i.style.left=e.clientX+document.documentElement.scrollLeft+3+"px";
		}
		i.style.display="block";
	}
}


function 	ConvertDistrict(t)
{

	switch(t){
		case"Bialoleka":{return "Białołęka"};
		case"Targowek":{return "Targówek"};
		case"Rembertow":{return "Rembertów"};
		case"Wesola":{return "Wesoła"};
		case"Praga Polnoc":{return "Praga Północ"};
		case"Praga Poludnie":{return "Praga Południe"};
		case"Zoliborz":{return "Żoliborz"};
		case"Srodmiescie":{return "Śródmieście"};
		case"Mokotow":{return "Mokotów"};
		case"Wlochy":{return "Włochy"};
		case"Ursynow":{return "Ursynów"};
		case"Wilanow":{return "Wilanów"};
		case"Poludniowy Wschod":{return "Południowy Wschód"};
		case"Polnocny Wschod":{return "Północny Wschód"};
		case"Polnocny Zachod":{return "Północny Zachód"};
		case"Poludniowy Zachod":{return "Południowy Zachód "};
		default: return t;
	};
}
function showOtherCities(direction, label){
	var t='';
	switch(direction){
		case'N-E':{
			t+= '<br/>'+label+'<br/><input type="checkbox" name="OtherCities" id="Marki"  value="Marki" checked  /><label for="Marki">Marki</label> <br/>';
			t+= '<input type="checkbox" name="OtherCities" id="Radzymin" value="Radzymin" checked  /><label for="Radzymin">Radzymin</label> <br/>';
			t+= '<input type="checkbox" name="OtherCities" id="Zabki" value="Ząbki" checked  /><label for="Zabki">Ząbki</label> <br/>';
			t+= '<input type="checkbox" name="OtherCities" id="Zielonka" value="Zielonka" checked  /><label for="Zielonka">Zielonka</label> <br/>';
		}break;
		case'S-E':{
			t+= '<br/>'+label+'<br/><input type="checkbox" name="OtherCities" id="Jozefow" value="Józefów" checked  /><label for="Jozefow">Józefów</label> <br/>';
			t+= '<input type="checkbox" name="OtherCities" id="Konstancin" value="Konstancin-Jeziorna" checked  /><label for="Konstancin">Konstancin - Jeziorna</label> <br/>';
			t+= '<input type="checkbox" name="OtherCities" id="Otwock" value="Otwock" checked  /><label for="Otwock">Otwock</label> <br/>';
		}break;
		case'S-W':{
			t+= '<br/>'+label+'<br/><input type="checkbox" name="OtherCities" id="Piaseczno" value="Piaseczno" checked /><label for="Piaseczno">Piaseczno</label> <br/>';
			t+= '<input type="checkbox" name="OtherCities" id="test" value="Testowy" checked  /><label for="test">testowy</label> <br/>';
			t+= '<input type="checkbox" name="OtherCities" id="Pruszkow" value="Pruszków" checked  /><label for="Pruszkow">Pruszków</label> <br/>';
			t+= '<input type="checkbox" name="OtherCities" id="Raszyn" value="Raszyn" checked  /><label for="Raszyn">Raszyn</label> <br/>';
		}break;
		case'N-W':{
			t+= '<br/>'+label+'<br/><input type="checkbox" name="OtherCities" id="Legionowo" value="Legionowo" checked /><label for="Legionowo">Legionowo</label><br/>';
			t+= '<input type="checkbox" name="OtherCities" id="Lomianki" value="Lomianki" checked  /><label for="Lomianki">Łomianki</label> <br/>';
			t+= '<input type="checkbox" name="OtherCities" id="Zielonka" value="Ożarów Mazowiecki" checked  /><label for="Zielonka">Ożarów Mazowiecki</label> <br/>';
		}break;
		default:'';break;
	}
	return t;
}
// -->




// mredkj.com
function NumberFormat(num, inputDecimal)
{
this.VERSION = 'Number Format v1.5.4';
this.COMMA = ',';
this.PERIOD = '.';
this.DASH = '-'; 
this.LEFT_PAREN = '('; 
this.RIGHT_PAREN = ')'; 
this.LEFT_OUTSIDE = 0; 
this.LEFT_INSIDE = 1;  
this.RIGHT_INSIDE = 2;  
this.RIGHT_OUTSIDE = 3;  
this.LEFT_DASH = 0; 
this.RIGHT_DASH = 1; 
this.PARENTHESIS = 2; 
this.NO_ROUNDING = -1 
this.num;
this.numOriginal;
this.hasSeparators = false;  
this.separatorValue;  
this.inputDecimalValue; 
this.decimalValue;  
this.negativeFormat; 
this.negativeRed; 
this.hasCurrency;  
this.currencyPosition;  
this.currencyValue;  
this.places;
this.roundToPlaces; 
this.truncate; 
this.setNumber = setNumberNF;
this.toUnformatted = toUnformattedNF;
this.setInputDecimal = setInputDecimalNF; 
this.setSeparators = setSeparatorsNF; 
this.setCommas = setCommasNF;
this.setNegativeFormat = setNegativeFormatNF; 
this.setNegativeRed = setNegativeRedNF; 
this.setCurrency = setCurrencyNF;
this.setCurrencyPrefix = setCurrencyPrefixNF;
this.setCurrencyValue = setCurrencyValueNF; 
this.setCurrencyPosition = setCurrencyPositionNF; 
this.setPlaces = setPlacesNF;
this.toFormatted = toFormattedNF;
this.toPercentage = toPercentageNF;
this.getOriginal = getOriginalNF;
this.moveDecimalRight = moveDecimalRightNF;
this.moveDecimalLeft = moveDecimalLeftNF;
this.getRounded = getRoundedNF;
this.preserveZeros = preserveZerosNF;
this.justNumber = justNumberNF;
this.expandExponential = expandExponentialNF;
this.getZeros = getZerosNF;
this.moveDecimalAsString = moveDecimalAsStringNF;
this.moveDecimal = moveDecimalNF;
this.addSeparators = addSeparatorsNF;
if (inputDecimal == null) {
this.setNumber(num, this.PERIOD);
} else {
this.setNumber(num, inputDecimal); 
}
this.setCommas(true);
this.setNegativeFormat(this.LEFT_DASH); 
this.setNegativeRed(false); 
this.setCurrency(false); 
this.setCurrencyPrefix('$');
this.setPlaces(2);
}
function setInputDecimalNF(val)
{
this.inputDecimalValue = val;
}
function setNumberNF(num, inputDecimal)
{
if (inputDecimal != null) {
this.setInputDecimal(inputDecimal); 
}
this.numOriginal = num;
this.num = this.justNumber(num);
}
function toUnformattedNF()
{
return (this.num);
}
function getOriginalNF()
{
return (this.numOriginal);
}
function setNegativeFormatNF(format)
{
this.negativeFormat = format;
}
function setNegativeRedNF(isRed)
{
this.negativeRed = isRed;
}
function setSeparatorsNF(isC, separator, decimal)
{
this.hasSeparators = isC;
if (separator == null) separator = this.COMMA;
if (decimal == null) decimal = this.PERIOD;
if (separator == decimal) {
this.decimalValue = (decimal == this.PERIOD) ? this.COMMA : this.PERIOD;
} else {
this.decimalValue = decimal;
}
this.separatorValue = separator;
}
function setCommasNF(isC)
{
this.setSeparators(isC, this.COMMA, this.PERIOD);
}
function setCurrencyNF(isC)
{
this.hasCurrency = isC;
}
function setCurrencyValueNF(val)
{
this.currencyValue = val;
}
function setCurrencyPrefixNF(cp)
{
this.setCurrencyValue(cp);
this.setCurrencyPosition(this.LEFT_OUTSIDE);
}
function setCurrencyPositionNF(cp)
{
this.currencyPosition = cp
}
function setPlacesNF(p, tr)
{
this.roundToPlaces = !(p == this.NO_ROUNDING); 
this.truncate = (tr != null && tr); 
this.places = (p < 0) ? 0 : p; 
}
function addSeparatorsNF(nStr, inD, outD, sep)
{
nStr += '';
var dpos = nStr.indexOf(inD);
var nStrEnd = '';
if (dpos != -1) {
nStrEnd = outD + nStr.substring(dpos + 1, nStr.length);
nStr = nStr.substring(0, dpos);
}
var rgx = /(\d+)(\d{3})/;
while (rgx.test(nStr)) {
nStr = nStr.replace(rgx, '$1' + sep + '$2');
}
return nStr + nStrEnd;
}
function toFormattedNF()
{	
var pos;
var nNum = this.num; 
var nStr;            
var splitString = new Array(2);   
if (this.roundToPlaces) {
nNum = this.getRounded(nNum);
nStr = this.preserveZeros(Math.abs(nNum)); 
} else {
nStr = this.expandExponential(Math.abs(nNum)); 
}
if (this.hasSeparators) {
nStr = this.addSeparators(nStr, this.PERIOD, this.decimalValue, this.separatorValue);
} else {
nStr = nStr.replace(new RegExp('\\' + this.PERIOD), this.decimalValue); 
}
var c0 = '';
var n0 = '';
var c1 = '';
var n1 = '';
var n2 = '';
var c2 = '';
var n3 = '';
var c3 = '';
var negSignL = (this.negativeFormat == this.PARENTHESIS) ? this.LEFT_PAREN : this.DASH;
var negSignR = (this.negativeFormat == this.PARENTHESIS) ? this.RIGHT_PAREN : this.DASH;
if (this.currencyPosition == this.LEFT_OUTSIDE) {
if (nNum < 0) {
if (this.negativeFormat == this.LEFT_DASH || this.negativeFormat == this.PARENTHESIS) n1 = negSignL;
if (this.negativeFormat == this.RIGHT_DASH || this.negativeFormat == this.PARENTHESIS) n2 = negSignR;
}
if (this.hasCurrency) c0 = this.currencyValue;
} else if (this.currencyPosition == this.LEFT_INSIDE) {
if (nNum < 0) {
if (this.negativeFormat == this.LEFT_DASH || this.negativeFormat == this.PARENTHESIS) n0 = negSignL;
if (this.negativeFormat == this.RIGHT_DASH || this.negativeFormat == this.PARENTHESIS) n3 = negSignR;
}
if (this.hasCurrency) c1 = this.currencyValue;
}
else if (this.currencyPosition == this.RIGHT_INSIDE) {
if (nNum < 0) {
if (this.negativeFormat == this.LEFT_DASH || this.negativeFormat == this.PARENTHESIS) n0 = negSignL;
if (this.negativeFormat == this.RIGHT_DASH || this.negativeFormat == this.PARENTHESIS) n3 = negSignR;
}
if (this.hasCurrency) c2 = this.currencyValue;
}
else if (this.currencyPosition == this.RIGHT_OUTSIDE) {
if (nNum < 0) {
if (this.negativeFormat == this.LEFT_DASH || this.negativeFormat == this.PARENTHESIS) n1 = negSignL;
if (this.negativeFormat == this.RIGHT_DASH || this.negativeFormat == this.PARENTHESIS) n2 = negSignR;
}
if (this.hasCurrency) c3 = this.currencyValue;
}
nStr = c0 + n0 + c1 + n1 + nStr + n2 + c2 + n3 + c3;
if (this.negativeRed && nNum < 0) {
nStr = '<font color="red">' + nStr + '</font>';
}
return (nStr);
}
function toPercentageNF()
{
nNum = this.num * 100;
nNum = this.getRounded(nNum);
return nNum + '%';
}
function getZerosNF(places)
{
var extraZ = '';
var i;
for (i=0; i<places; i++) {
extraZ += '0';
}
return extraZ;
}
function expandExponentialNF(origVal)
{
if (isNaN(origVal)) return origVal;
var newVal = parseFloat(origVal) + ''; 
var eLoc = newVal.toLowerCase().indexOf('e');
if (eLoc != -1) {
var plusLoc = newVal.toLowerCase().indexOf('+');
var negLoc = newVal.toLowerCase().indexOf('-', eLoc); 
var justNumber = newVal.substring(0, eLoc);
if (negLoc != -1) {
var places = newVal.substring(negLoc + 1, newVal.length);
justNumber = this.moveDecimalAsString(justNumber, true, parseInt(places));
} else {
if (plusLoc == -1) plusLoc = eLoc;
var places = newVal.substring(plusLoc + 1, newVal.length);
justNumber = this.moveDecimalAsString(justNumber, false, parseInt(places));
}
newVal = justNumber;
}
return newVal;
} 
function moveDecimalRightNF(val, places)
{
var newVal = '';
if (places == null) {
newVal = this.moveDecimal(val, false);
} else {
newVal = this.moveDecimal(val, false, places);
}
return newVal;
}
function moveDecimalLeftNF(val, places)
{
var newVal = '';
if (places == null) {
newVal = this.moveDecimal(val, true);
} else {
newVal = this.moveDecimal(val, true, places);
}
return newVal;
}
function moveDecimalAsStringNF(val, left, places)
{
var spaces = (arguments.length < 3) ? this.places : places;
if (spaces <= 0) return val; 
var newVal = val + '';
var extraZ = this.getZeros(spaces);
var re1 = new RegExp('([0-9.]+)');
if (left) {
newVal = newVal.replace(re1, extraZ + '$1');
var re2 = new RegExp('(-?)([0-9]*)([0-9]{' + spaces + '})(\\.?)');		
newVal = newVal.replace(re2, '$1$2.$3');
} else {
var reArray = re1.exec(newVal); 
if (reArray != null) {
newVal = newVal.substring(0,reArray.index) + reArray[1] + extraZ + newVal.substring(reArray.index + reArray[0].length); 
}
var re2 = new RegExp('(-?)([0-9]*)(\\.?)([0-9]{' + spaces + '})');
newVal = newVal.replace(re2, '$1$2$4.');
}
newVal = newVal.replace(/\.$/, ''); 
return newVal;
}
function moveDecimalNF(val, left, places)
{
var newVal = '';
if (places == null) {
newVal = this.moveDecimalAsString(val, left);
} else {
newVal = this.moveDecimalAsString(val, left, places);
}
return parseFloat(newVal);
}
function getRoundedNF(val)
{
val = this.moveDecimalRight(val);
if (this.truncate) {
val = val >= 0 ? Math.floor(val) : Math.ceil(val); 
} else {
val = Math.round(val);
}
val = this.moveDecimalLeft(val);
return val;
}
function preserveZerosNF(val)
{
var i;
val = this.expandExponential(val);
if (this.places <= 0) return val; 
var decimalPos = val.indexOf('.');
if (decimalPos == -1) {
val += '.';
for (i=0; i<this.places; i++) {
val += '0';
}
} else {
var actualDecimals = (val.length - 1) - decimalPos;
var difference = this.places - actualDecimals;
for (i=0; i<difference; i++) {
val += '0';
}
}
return val;
}
function justNumberNF(val)
{
newVal = val + '';
var isPercentage = false;
if (newVal.indexOf('%') != -1) {
newVal = newVal.replace(/\%/g, '');
isPercentage = true; 
}
var re = new RegExp('[^\\' + this.inputDecimalValue + '\\d\\-\\+\\(\\)eE]', 'g');	
newVal = newVal.replace(re, '');
var tempRe = new RegExp('[' + this.inputDecimalValue + ']', 'g');
var treArray = tempRe.exec(newVal); 
if (treArray != null) {
var tempRight = newVal.substring(treArray.index + treArray[0].length); 
newVal = newVal.substring(0,treArray.index) + this.PERIOD + tempRight.replace(tempRe, ''); 
}
if (newVal.charAt(newVal.length - 1) == this.DASH ) {
newVal = newVal.substring(0, newVal.length - 1);
newVal = '-' + newVal;
}
else if (newVal.charAt(0) == this.LEFT_PAREN
&& newVal.charAt(newVal.length - 1) == this.RIGHT_PAREN) {
newVal = newVal.substring(1, newVal.length - 1);
newVal = '-' + newVal;
}
newVal = parseFloat(newVal);
if (!isFinite(newVal)) {
newVal = 0;
}
if (isPercentage) {
newVal = this.moveDecimalLeft(newVal, 2);
}
return newVal;
}





function startCircleMap(miasto,dzielnica,mode,block) {
	
	var block = (block == null) ? false : block;
	
	//alert(miasto+'-'+dzielnica+'-'+mode+'-'+block);
	
	if(miasto=='Warszawa'&& dzielnica){
		// włączenie i wyłączenie mapy
		if(!block)
			if(document.getElementById("circle").style.visibility == 'hidden') mode=1; else mode=0;
		
		if(mode==1 && (dzielnica=="Poludniowy Wschod" || dzielnica=="Polnocny Wschod" || dzielnica=="Polnocny Zachod" || dzielnica=="Poludniowy Zachod" || dzielnica=="center" || dzielnica=="warminsko-mazurskie" || dzielnica=="pomorskie" || dzielnica=="dolnoslaskie" || dzielnica=="zachodniopomorskie" ) )  {
			document.getElementById("circle").style.visibility='visible';
			document.getElementById("circle").style.height='400px';
			if (navigator.appName.indexOf ("Microsoft") !=-1)
				document.getElementById("circle").style.position='relative';
			
			//document.getElementById("circle").style.display='';
			document.getElementById("label_typ_mapy_0").style.fontWeight='normal';
			document.getElementById("label_typ_mapy_1").style.fontWeight='bold';
			document.getElementById('typ_mapy_1').checked = true;

			if(dzielnica=="warminsko-mazurskie") {
				advAJAX.get({
					url: "include/ustaw_wojewodztwo.php?wojewodztwo=olsztyn",
					onSuccess : function(obj) {return 1;}
				});
				document.getElementById("woj1").style.background = 'white';
				document.getElementById("woj2").style.background = '#fbc748';
				document.getElementById("woj3").style.background = 'white';
				document.getElementById("woj4").style.background = 'white';
				document.getElementById("woj5").style.background = 'white';
				document.getElementById("mapka_metrohouse").style.display = 'none';
				document.getElementById("typy_mapy").style.display = 'none';
				if(document.getElementById("rID"))
					ustaw_mini_wyszukiwarke('load');
			
			
			}else if(dzielnica=="pomorskie") {
				advAJAX.get({
					url: "include/ustaw_wojewodztwo.php?wojewodztwo=gdansk",
					onSuccess : function(obj) {return 1;}
				});
				document.getElementById("woj1").style.background = 'white';
				document.getElementById("woj2").style.background = 'white';
				document.getElementById("woj3").style.background = '#fbc748';
				document.getElementById("woj4").style.background = 'white';
				document.getElementById("woj5").style.background = 'white';
				document.getElementById("mapka_metrohouse").style.display = 'none';
				document.getElementById("typy_mapy").style.display = 'none';
				if(document.getElementById("rID"))
					ustaw_mini_wyszukiwarke('load');
			
			
			}else if(dzielnica=="dolnoslaskie") {
				advAJAX.get({
					url: "include/ustaw_wojewodztwo.php?wojewodztwo=wroclaw",
					onSuccess : function(obj) {return 1;}
				});
				document.getElementById("woj1").style.background = 'white';
				document.getElementById("woj2").style.background = 'white';
				document.getElementById("woj3").style.background = 'white';
				document.getElementById("woj4").style.background = '#fbc748';
				document.getElementById("woj5").style.background = 'white';
				document.getElementById("mapka_metrohouse").style.display = 'none';
				document.getElementById("typy_mapy").style.display = 'none';
				if(document.getElementById("rID"))
					ustaw_mini_wyszukiwarke('load');	
			
			
			}else if(dzielnica=="zachodniopomorskie") {
				advAJAX.get({
					url: "include/ustaw_wojewodztwo.php?wojewodztwo=szczecin",
					onSuccess : function(obj) {return 1;}
				});
				document.getElementById("woj1").style.background = 'white';
				document.getElementById("woj2").style.background = 'white';
				document.getElementById("woj3").style.background = 'white';
				document.getElementById("woj4").style.background = 'white';
				document.getElementById("woj5").style.background = '#fbc748';
				document.getElementById("mapka_metrohouse").style.display = 'none';
				document.getElementById("typy_mapy").style.display = 'none';
				if(document.getElementById("rID"))
					ustaw_mini_wyszukiwarke('load');		
					
				
					
			
			
			}else{
				advAJAX.get({
					url: "include/ustaw_wojewodztwo.php?wojewodztwo=warszawa",
					onSuccess : function(obj) {return 1;}
				});
				document.getElementById("woj1").style.background = '#fbc748';
				document.getElementById("woj2").style.background = 'white';
				document.getElementById("woj3").style.background = 'white';
				document.getElementById("woj4").style.background = 'white';
				document.getElementById("woj5").style.background = 'white';
				document.getElementById("mapka_metrohouse").style.display = '';
				document.getElementById("typy_mapy").style.display = '';
				if(document.getElementById("rID"))
					ustaw_mini_wyszukiwarke('load');
			}
			document['mapsflex'].resetMap(dzielnica);
			//setTimeout(function(){document['mapsflex'].resetMap(dzielnica);},10);

		} else {
			document.getElementById("circle").style.height='1px';
			document.getElementById("circle").style.visibility='hidden';
			if (navigator.appName.indexOf ("Microsoft") !=-1)
				document.getElementById("circle").style.position='absolute';
			
			//document.getElementById("circle").style.display='none';
			
			
			document.getElementById("label_typ_mapy_0").style.fontWeight='bold';
			document.getElementById("label_typ_mapy_1").style.fontWeight='normal';
			document.getElementById('typ_mapy_0').checked = true;
		}
	}
}

function getFlexApp_old(appName) {
	if (navigator.appName.indexOf ("Microsoft") !=-1) {
		return window[appName];
	} else {
		return document[appName];
	}
}





/*
 * AdvancedAJAX 1.1.2
 * (c) 2005-2006 Lukasz Lach
 *  mail: anakin@php5.pl
 *  www:  http://advajax.anakin.us/
 *        http://anakin.us/
 * http://creativecommons.org/licenses/LGPL/2.1/
 *
 */

function advAJAX() {

    var obj = new Object();

    obj.url = window.location.href;
    obj.method = "GET";
    obj.parameters = new Object();
    obj.jsonParameters = new Object();
    obj.headers = new Object();
    obj.async = true;
    obj.mimeType = "text/xml";
    obj.username = null;
    obj.password = null;
    obj.form = null;
    obj.disableForm = true;

    obj.unique = true;
    obj.uniqueParameter = "_uniqid";

    obj.requestDone = false;
    obj.queryString = "";
    obj.responseText = null;
    obj.responseXML = null;
    obj.status = null;
    obj.statusText = null;
    obj.aborted = false;
    obj.timeout = 0;
    obj.retryCount = 0;
    obj.retryDelay = 1000;
    obj.tag = null;
    obj.group = null;
    obj.progressTimerInterval = 50;

    obj.xmlHttpRequest = null;

    obj.onInitialization = null;
    obj.onFinalization = null;
    obj.onReadyStateChange = null;
    obj.onLoading = null;
    obj.onLoaded = null;
    obj.onInteractive = null;
    obj.onComplete = null;
    obj.onProgress = null;
    obj.onSuccess = null;
    obj.onFatalError = null;
    obj.onError = null;
    obj.onTimeout = null;
    obj.onRetryDelay = null;
    obj.onRetry = null;
    obj.onGroupEnter = null;
    obj.onGroupLeave = null;

    obj.createXmlHttpRequest = function() {

        if (typeof XMLHttpRequest != "undefined")
            return new XMLHttpRequest();
        var xhrVersion = [ "MSXML2.XMLHttp.5.0", "MSXML2.XMLHttp.4.0","MSXML2.XMLHttp.3.0",
                "MSXML2.XMLHttp","Microsoft.XMLHttp" ];
        for (var i = 0; i < xhrVersion.length; i++) {
            try {
                var xhrObj = new ActiveXObject(xhrVersion[i]);
                return xhrObj;
            } catch (e) { }
        }
        obj.raiseEvent("FatalError");
        return null;
    };

    obj._oldResponseLength = null;
    obj._progressTimer = null;
    obj._progressStarted = navigator.userAgent.indexOf('Opera') == -1;
    obj._onProgress = function() {

        if (typeof obj.onProgress == "function" &&
            typeof obj.xmlHttpRequest.getResponseHeader == "function") {
            var contentLength = obj.xmlHttpRequest.getResponseHeader("Content-length");
            if (contentLength != null && contentLength != '') {
                var responseLength = obj.xmlHttpRequest.responseText.length;
                if (responseLength != obj._oldResponseLength) {
                    obj.raiseEvent("Progress", obj, responseLength, contentLength);
                    obj._oldResponseLength = obj.xmlHttpRequest.responseText.length;
                }
            }
        }
        if (obj._progressStarted) return;
        obj._progressStarted = true;
        var _obj = this;
        this.__onProgress = function() {
            obj._onProgress();
            obj._progressTimer = window.setTimeout(_obj.__onProgress, obj.progressTimerInterval);
        }
        _obj.__onProgress();
    }

    obj._onInitializationHandled = false;
    obj._initObject = function() {

        if (obj.xmlHttpRequest != null) {
            delete obj.xmlHttpRequest["onreadystatechange"];
            obj.xmlHttpRequest = null;
        }
        if ((obj.xmlHttpRequest = obj.createXmlHttpRequest()) == null)
            return null;
        if (typeof obj.xmlHttpRequest.overrideMimeType != "undefined")
            obj.xmlHttpRequest.overrideMimeType(obj.mimeType);
        obj.xmlHttpRequest.onreadystatechange = function() {

            if (obj == null || obj.xmlHttpRequest == null)
                return;
            obj.raiseEvent("ReadyStateChange", obj, obj.xmlHttpRequest.readyState);
            obj._onProgress();
            switch (obj.xmlHttpRequest.readyState) {
                case 1: obj._onLoading(); break;
                case 2: obj._onLoaded(); break;
                case 3: obj._onInteractive(); break;
                case 4: obj._onComplete(); break;
            }
        };
        obj._onLoadingHandled =
            obj._onLoadedHandled =
            obj._onInteractiveHandled =
            obj._onCompleteHandled = false;
    };

    obj._onLoading = function() {

        if (obj._onLoadingHandled)
            return;
        if (!obj._retry && obj.group != null) {
            if (typeof advAJAX._groupData[obj.group] == "undefined")
                advAJAX._groupData[obj.group] = 0;
            advAJAX._groupData[obj.group]++;
            if (typeof obj.onGroupEnter == "function" && advAJAX._groupData[obj.group] == 1)
                obj.onGroupEnter(obj);
        }
        obj.raiseEvent("Loading", obj);
        obj._onLoadingHandled = true;
    };
    obj._onLoaded = function() {

        if (obj._onLoadedHandled)
            return;
        obj.raiseEvent("Loaded", obj);
        obj._onLoadedHandled = true;
    };
    obj._onInteractive = function() {

        if (obj._onInteractiveHandled)
            return;
        obj.raiseEvent("Interactive", obj);
        obj._onInteractiveHandled = true;
        if (!obj._progressStarted)
            obj._onProgress();
    };
    obj._onComplete = function() {

        if (obj._onCompleteHandled || obj.aborted)
            return;
        if (obj._progressStarted) {
            window.clearInterval(obj._progressTimer);
            obj._progressStarted = false;
        }
        obj.requestDone = true;
        with (obj.xmlHttpRequest) {
            obj.responseText = responseText;
            obj.responseXML = responseXML;
            if (typeof status != "undefined")
                obj.status = status;
            if (typeof statusText != "undefined")
                obj.statusText = statusText;
        }
        obj.raiseEvent("Complete", obj);
        obj._onCompleteHandled = true;
        if (obj.status == 200)
            obj.raiseEvent("Success", obj); else
            obj.raiseEvent("Error", obj);
        delete obj.xmlHttpRequest['onreadystatechange'];
        obj.xmlHttpRequest = null;
        if (obj.disableForm)
            obj.switchForm(true);
        obj._groupLeave();
        obj.raiseEvent("Finalization", obj);
    };

    obj._groupLeave = function() {

        if (obj.group != null) {
            advAJAX._groupData[obj.group]--;
            if (advAJAX._groupData[obj.group] == 0)
                obj.raiseEvent("GroupLeave", obj);
        }
    };

    obj._retry = false;
    obj._retryNo = 0;
    obj._onTimeout = function() {

        if (obj == null || obj.xmlHttpRequest == null || obj._onCompleteHandled)
            return;
        obj.aborted = true;
        obj.xmlHttpRequest.abort();
        obj.raiseEvent("Timeout", obj);
        obj._retry = true;
        if (obj._retryNo != obj.retryCount) {
            obj._initObject();
            if (obj.retryDelay > 0) {
                obj.raiseEvent("RetryDelay", obj);
                startTime = new Date().getTime();
                while (new Date().getTime() - startTime < obj.retryDelay);
            }
            obj._retryNo++;
            obj.raiseEvent("Retry", obj, obj._retryNo);
            obj.run();
        } else {
            delete obj.xmlHttpRequest["onreadystatechange"];
            obj.xmlHttpRequest = null;
            if (obj.disableForm)
                obj.switchForm(true);
            obj._groupLeave();
            obj.raiseEvent("Finalization", obj);
        }
    };

    obj.run = function() {

        obj._initObject();
        if (obj.xmlHttpRequest == null)
            return false;
        obj.aborted = false;
        if (!obj._onInitializationHandled) {
            obj.raiseEvent("Initialization", obj);
            obj._onInitializationHandled = true;
        }
        if (obj.method == "GET" && obj.unique)
            obj.parameters[encodeURIComponent(obj.uniqueParameter)] =
            new Date().getTime().toString().substr(5) + Math.floor(Math.random() * 100).toString();
        if (!obj._retry) {
            for (var a in obj.parameters) {
                if (obj.queryString.length > 0)
                    obj.queryString += "&";
                if (typeof obj.parameters[a] != "object")
                    obj.queryString += encodeURIComponent(a) + "=" + encodeURIComponent(obj.parameters[a]); else {
                    for (var i = 0; i < obj.parameters[a].length; i++)
                        obj.queryString += encodeURIComponent(a) + "=" + encodeURIComponent(obj.parameters[a][i]) + "&";
                    obj.queryString = obj.queryString.slice(0, -1);
                }
            }
            for (var a in obj.jsonParameters) {
                var useJson = typeof [].toJSONString == 'function';
                if (obj.queryString.length > 0)
                    obj.queryString += "&";
                obj.queryString += encodeURIComponent(a) + "=";
                if (useJson)
                    obj.queryString += encodeURIComponent(obj.jsonParameters[a].toJSONString()); else
                    obj.queryString += encodeURIComponent(obj.jsonParameters[a]);
            }
            if (obj.method == "GET" && obj.queryString.length > 0)
                obj.url += (obj.url.indexOf("?") != -1 ? "&" : "?") + obj.queryString;
        }
        if (obj.disableForm)
            obj.switchForm(false);
        try {
            obj.xmlHttpRequest.open(obj.method, obj.url, obj.async, obj.username || '', obj.password || '');
        } catch (e) {
            obj.raiseEvent("FatalError", obj, e);
            return;
        }
        if (obj.timeout > 0)
            setTimeout(obj._onTimeout, obj.timeout);
        if (typeof obj.xmlHttpRequest.setRequestHeader != "undefined")
            for (var a in obj.headers)
                obj.xmlHttpRequest.setRequestHeader(encodeURIComponent(a), encodeURIComponent(obj.headers[a]));
        if (obj.method == "POST" && typeof obj.xmlHttpRequest.setRequestHeader != "undefined") {
            obj.xmlHttpRequest.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
            obj.xmlHttpRequest.send(obj.queryString);
        } else if (obj.method == "GET")
            obj.xmlHttpRequest.send('');
    };

    obj.handleArguments = function(args) {

        if (typeof args.form == "object" && args.form != null) {
            obj.form = args.form;
            obj.appendForm();
        }
        for (a in args) {
            if (typeof obj[a] == "undefined")
                obj.parameters[a] = args[a]; else {
                if (a != "parameters" && a != "headers")
                    obj[a] = args[a]; else
                    for (b in args[a])
                        obj[a][b] = args[a][b];
            }
        }
        obj.method = obj.method.toUpperCase();
    };

    obj.switchForm = function(enable) {

        if (typeof obj.form != "object" || obj.form == null)
            return;
        with (obj.form)
            for (var nr = 0; nr < elements.length; nr++)
                if (!enable) {
                    if (elements[nr]["disabled"])
                        elements[nr]["_disabled"] = true; else
                        elements[nr]["disabled"] = "disabled";
                } else
                    if (typeof elements[nr]["_disabled"] == "undefined")
                        elements[nr].removeAttribute("disabled");
    };

    obj.appendForm = function() {

        with (obj.form) {
            obj.method = getAttribute("method").toUpperCase();
            obj.url = getAttribute("action");
            for (var nr = 0; nr < elements.length; nr++) {
                var e = elements[nr];
                if (e.disabled)
                    continue;
                switch (e.type) {
                    case "text":
                    case "password":
                    case "hidden":
                    case "textarea":
                        obj.addParameter(e.name, e.value);
                        break;
                    case "select-one":
                        if (e.selectedIndex >= 0)
                            obj.addParameter(e.name, e.options[e.selectedIndex].value);
                        break;
                    case "select-multiple":
                        for (var nr2 = 0; nr2 < e.options.length; nr2++)
                            if (e.options[nr2].selected)
                                obj.addParameter(e.name, e.options[nr2].value);
                        break;
                    case "checkbox":
                    case "radio":
                        if (e.checked)
                            obj.addParameter(e.name, e.value);
                        break;
                }
            }
        }
    };

    obj.addParameter = function(name, value) {
        if (typeof obj.parameters[name] == "undefined")
            obj.parameters[name] = value; else
        if (typeof obj.parameters[name] != "object")
            obj.parameters[name] = [ obj.parameters[name], value ]; else
        obj.parameters[name][obj.parameters[name].length] = value;
    };
    obj.delParameter = function(name) {

        delete obj.parameters[name];
    };
    obj.raiseEvent = function(name) {
        var args = [];
        for (var i = 1; i < arguments.length; i++)
            args.push(arguments[i]);
        if (typeof obj["on" + name] == "function")
            obj["on" + name].apply(null, args);
        if (name == "FatalError")
            obj.raiseEvent("Finalization", obj);
    }

    if (typeof advAJAX._defaultParameters != "undefined")
        obj.handleArguments(advAJAX._defaultParameters);
    return obj;
}

advAJAX.get = function(args) {

    return advAJAX.handleRequest("GET", args);
};

advAJAX.post = function(args) {

    return advAJAX.handleRequest("POST", args);
};

advAJAX.head = function(args) {

    return advAJAX.handleRequest("HEAD", args);
};

advAJAX.submit = function(form, args) {

    if (typeof args == "undefined" || args == null)
        return -1;
    if (typeof form != "object" || form == null)
        return -2;
    var request = new advAJAX();
    args["form"] = form;
    request.handleArguments(args);
    return request.run();
};

advAJAX.assign = function(form, args) {

    if (typeof args == "undefined" || args == null)
        return -1;
    if (typeof form != "object" || form == null)
        return -2;
    if (typeof form["onsubmit"] == "function")
        form["_onsubmit"] = form["onsubmit"];
    form["advajax_args"] = args;
    form["onsubmit"] = function() {
        if (typeof this["_onsubmit"] != "undefined" && this["_onsubmit"]() === false)
            return false;
        if (advAJAX.submit(this, this["advajax_args"]) == false)
            return true;
        return false;
    }
    return true;
};

advAJAX.download = function(targetObj, url) {

    if (typeof targetObj == "string")
        targetObj = document.getElementById(targetObj);
    if (!targetObj)
        return -1;
    advAJAX.get({
        url: url,
        onSuccess : function(obj) {
            targetObj.innerHTML = obj.responseText;
        }
    });
};

advAJAX.scan = function() {

    var obj = document.getElementsByTagName("a");
    for (var i = 0; i < obj.length;) {
        if (obj[i].getAttribute("rel") == "advancedajax" && obj[i].getAttribute("href") !== null) {
            var url = obj[i].getAttribute("href");
            var div = document.createElement("div");
            div.innerHTML = obj[i].innerHTML;
            div.className = obj[i].className;
            var parent = obj[i].parentNode;
            parent.insertBefore(div, obj[i]);
            parent.removeChild(obj[i]);
            advAJAX.download(div, url);
        } else i++;
    }
};

advAJAX.handleRequest = function(requestType, args) {

    if (typeof args == "undefined" || args == null)
        return -1;
    var request = new advAJAX();
    window.advajax_obj = request;
    request.method = requestType;
    request.handleArguments(args);
    return request.run();
};

advAJAX._defaultParameters = new Object();
advAJAX.setDefaultParameters = function(args) {

    advAJAX._defaultParameters = new Object();
    for (a in args)
        advAJAX._defaultParameters[a] = args[a];
};

advAJAX._groupData = new Object();






/**
 * SWFObject v1.5.1: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof deconcept=="undefined"){var deconcept={};}if(typeof deconcept.util=="undefined"){deconcept.util={};}if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil={};}deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a){if(!document.getElementById){return;}this.DETECT_KEY=_a?_a:"detectflash";this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);this.params={};this.variables={};this.attributes=[];if(_1){this.setAttribute("swf",_1);}if(id){this.setAttribute("id",id);}if(w){this.setAttribute("width",w);}if(h){this.setAttribute("height",h);}if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();if(!window.opera&&document.all&&this.installedVer.major>7){if(!deconcept.unloadSet){deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};__flash_savedUnloadHandler=function(){};window.attachEvent("onunload",deconcept.SWFObjectUtil.cleanupSWFs);};window.attachEvent("onbeforeunload",deconcept.SWFObjectUtil.prepUnload);deconcept.unloadSet=true;}}if(c){this.addParam("bgcolor",c);}var q=_7?_7:"high";this.addParam("quality",q);this.setAttribute("useExpressInstall",false);this.setAttribute("doExpressInstall",false);var _c=(_8)?_8:window.location;this.setAttribute("xiRedirectUrl",_c);this.setAttribute("redirectUrl","");if(_9){this.setAttribute("redirectUrl",_9);}};deconcept.SWFObject.prototype={useExpressInstall:function(_d){this.xiSWFPath=!_d?"expressinstall.swf":_d;this.setAttribute("useExpressInstall",true);},setAttribute:function(_e,_f){this.attributes[_e]=_f;},getAttribute:function(_10){return this.attributes[_10]||"";},addParam:function(_11,_12){this.params[_11]=_12;},getParams:function(){return this.params;},addVariable:function(_13,_14){this.variables[_13]=_14;},getVariable:function(_15){return this.variables[_15]||"";},getVariables:function(){return this.variables;},getVariablePairs:function(){var _16=[];var key;var _18=this.getVariables();for(key in _18){_16[_16.length]=key+"="+_18[key];}return _16;},getSWFHTML:function(){var _19="";if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","PlugIn");this.setAttribute("swf",this.xiSWFPath);}_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+(this.getAttribute("style")||"")+"\"";_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";var _1a=this.getParams();for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}var _1c=this.getVariablePairs().join("&");if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");this.setAttribute("swf",this.xiSWFPath);}_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\" style=\""+(this.getAttribute("style")||"")+"\">";_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";var _1d=this.getParams();for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}var _1f=this.getVariablePairs().join("&");if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}return _19;},write:function(_20){if(this.getAttribute("useExpressInstall")){var _21=new deconcept.PlayerVersion([6,0,65]);if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){this.setAttribute("doExpressInstall",true);this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));document.title=document.title.slice(0,47)+" - Flash Player Installation";this.addVariable("MMdoctitle",document.title);}}if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){var n=(typeof _20=="string")?document.getElementById(_20):_20;n.innerHTML=this.getSWFHTML();return true;}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}return false;}};deconcept.SWFObjectUtil.getPlayerVersion=function(){var _23=new deconcept.PlayerVersion([0,0,0]);if(navigator.plugins&&navigator.mimeTypes.length){var x=navigator.plugins["Shockwave Flash"];if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}}else{if(navigator.userAgent&&navigator.userAgent.indexOf("Windows CE")>=0){var axo=1;var _26=3;while(axo){try{_26++;axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+_26);_23=new deconcept.PlayerVersion([_26,0,0]);}catch(e){axo=null;}}}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}}return _23;};deconcept.PlayerVersion=function(_29){this.major=_29[0]!=null?parseInt(_29[0]):0;this.minor=_29[1]!=null?parseInt(_29[1]):0;this.rev=_29[2]!=null?parseInt(_29[2]):0;};deconcept.PlayerVersion.prototype.versionIsValid=function(fv){if(this.major<fv.major){return false;}if(this.major>fv.major){return true;}if(this.minor<fv.minor){return false;}if(this.minor>fv.minor){return true;}if(this.rev<fv.rev){return false;}return true;};deconcept.util={getRequestParameter:function(_2b){var q=document.location.search||document.location.hash;if(_2b==null){return q;}if(q){var _2d=q.substring(1).split("&");for(var i=0;i<_2d.length;i++){if(_2d[i].substring(0,_2d[i].indexOf("="))==_2b){return _2d[i].substring((_2d[i].indexOf("=")+1));}}}return "";}};deconcept.SWFObjectUtil.cleanupSWFs=function(){var _2f=document.getElementsByTagName("OBJECT");for(var i=_2f.length-1;i>=0;i--){_2f[i].style.display="none";for(var x in _2f[i]){if(typeof _2f[i][x]=="function"){_2f[i][x]=function(){};}}}};if(!document.getElementById&&document.all){document.getElementById=function(id){return document.all[id];};}var getQueryParamValue=deconcept.util.getRequestParameter;var FlashObject=deconcept.SWFObject;var SWFObject=deconcept.SWFObject;






req2 = [];
function DoCallback(data, s)
{
	goUrl = (s)? url3 : url;
    if (window.XMLHttpRequest) {
        req = new XMLHttpRequest();
        req.onreadystatechange = (s)? processReqChange3 : processReqChange;
		req.open('POST', goUrl, true);
        req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
        req.send(data);
    } else if (window.ActiveXObject) {
        req = new ActiveXObject('Microsoft.XMLHTTP')
        if (req) {
        	
            //req.onreadystatechange = processReqChange;
        	req.onreadystatechange = (s)? processReqChange3 : processReqChange;
            
			req.open('POST', goUrl, true);
            req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
            req.send(data);
        }
    }
}

function processReqChange() {
    if (req.readyState == 4) {
        // only if 'OK'
        if (req.status == 200) {
            eval(what);
        } else {
           alert('There was a problem retrieving the XML data: ' +
                req.responseText);
        }
    }
}

function processReqChange2() {
    if (req.readyState == 4) {
        // only if 'OK'
        if (req.status == 200) {
            eval(what2);
        } else {
           //alert('There was a problem retrieving the XML data: ' + req.responseText);
        }
    }
}
function processReqChange3() {
    if (req.readyState == 4) {
        // only if 'OK'
        if (req.status == 200) {
            eval(what3);
        } else {
           alert('There was a problem retrieving the XML data: ' +
                req.responseText);
        }
    }
}
function DoCallback2(data)
{
    // branch for native XMLHttpRequest object
    if (window.XMLHttpRequest) {
        req = new XMLHttpRequest();
        req.onreadystatechange = processReqChange2;
        req.open('POST', url2, true);
        req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
        req.send(data);

    } else if (window.ActiveXObject) {
        req = new ActiveXObject('Microsoft.XMLHTTP')
        if (req) {
            req.onreadystatechange = processReqChange2;
            req.open('POST', url2, true);
            req.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
            req.send(data);
        }
    }
}
function DoCallback_Regions(data,cnt)
{
	url_regions ="include/ajax_ustaw_regiony.php";
	//req = [];
    // branch for native XMLHttpRequest object
    if (window.XMLHttpRequest) {
        req2[cnt] = new XMLHttpRequest();
        //req[cnt].onreadystatechange = processReqChange_Regions;
	    eval("req2[cnt].onreadystatechange = function(){if (req2["+cnt+"].readyState == 4) {if (req2["+cnt+"].status == 200) {show_regions(req2["+cnt+"].responseText);} }}");
        req2[cnt].open('POST', url_regions, true);
        req2[cnt].setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
        req2[cnt].send(data);

    } else if (window.ActiveXObject) {
        req2[cnt] = new ActiveXObject('Microsoft.XMLHTTP')
	    if (req2[cnt]) {
            req2[cnt].onreadystatechange = 
		function(){ eval("if (req2["+cnt+"].readyState == 4) {if (req2["+cnt+"].status == 200) {show_regions(req2["+cnt+"].responseText);} }"); };
				//	alert('oko');
            req2[cnt].open('POST', url_regions, true);
            req2[cnt].setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
            req2[cnt].send(data);
        }
    }
}

function processReqChange_Regions1() {
    if (req[1].readyState == 4) {
        if (req[1].status == 200) {
            show_regions(req[1].responseText);

        } else {
            alert('There was a problem retrieving the XML data: ' +
                req[1].responseText);
        }
    }
}