var undef;
var maxiLng = 19.204101999999999;
var miniLng = 19.204101999999999;
var srLng = (maxiLng + miniLng)/2;
var maxLat = 52.025458999999998;
var minLat = 52.025458999999998;
var srLat = (maxLat + minLat)/2;
var zoom1 = 6;
var pierwszy =1;
var gm_punkty=[];
var tmp;
var tmp_ilosc_wpisow = 0;
var tmp_suma_wpisow = 0;
var location;
var opis;
var tablea1 = [];
var tabela_wpisy1 = [];
var kategorie = [];
var mapa;
var southWest;
var northEast;
var center;
var zoom2;
var markery=[];
var wyszukiwarki=[];
var braki = [];
var poczatek = 1;
var miasto = 2;
var ilosc_wpisow = [];
var splitted = [];
var zoom2 =6;
var datatable = '';
var ob = [];
var gdir;
var ilosc_wierszy;
	var  tmp_g = 0;
//var obrazki = [];
var tmpArray2;
var zoom1_nowy;
var tablica_p = [];

var img_p = '';
var wpisy_p = '';

function display(evt, gi)
{
	tt2 = 100 + (gi * 32) + (gi * 5);
	$('#wysz_info').css('left', tt2+"px" );
	tt1 = $('#nazwa_'+evt).html();
	$('#wysz_info').html("<span style='font-size:12px;'>"+tt1+"</span>");
	$('#wysz_info').css('display', 'block');

}

function clear_tmp()
{
	//alert('asd');
	$('#wysz_info').css('display', 'none');
}

function pokaz_wskaznik(tmpp1)
{

if(!e) var e = window.event;
if(window.event.pageX)
{
	x = window.event.pageX;
	y = window.event.pageY;
}
else if(window.event.clientX)
{
	x = window.event.clientX;
	y = window.event.clientY;	
}
else return;

$('#wysz_info').html(x+" - "+y);

}

function resizeWindow()
{
	var width;
	if(navigator.appName == "Netscape")
	{
		 width = window.innerWidth;
	}
	else if(navigator.appName == "Opera")
	{
 		 width = window.innerWidth;
	}
	else if(navigator.appName == "Microsoft Internet Explorer")
	{
 		 width = document.body.offsetWidth;
	}
	
	
	var tmpwidth = width-365;

	$('#map').css("width", tmpwidth+"px");
	
	
		ttwidth = Math.floor(width/120);
		
		var	ttwidth2 = Math.floor(width/55);
		
		if((tablea1.length-1) < ttwidth2)
							 {
							 	ttwidth2 = (tablea1.length-1);
							 }	
			 					tekst = '<table style="text-align:center;font-size:11px;z-index:1000;"><tr><th rowspan=2 style="font-size:12px;padding-right:10px;"><nobr><span id="liczba">'+tmp_ilosc_wpisow+'</span> out of <span id="suma">'+tmp_suma_wpisow+'</span></nobr><br /> objects displayed';
			 				
								 tekst += '</th>';
								 for(l=1;l<=ttwidth2;l++)
								 {
								 	tekst+= tablea1[l];
								 }
								 tekst += '</tr><tr>';
								 for(l=1;l<=ttwidth2;l++)
								 {
								 	tekst+= tabela_wpisy1[l];
								 }
								 
								 tekst+='</tr></table>';
								//$('#suma').html(tmp_suma_wpisow);
								$('#statystyka').html(tekst);
								$('#statystyka').show();	
		
		wpisy = '';
                         	var tab_image = '';
                         	var tab_wpisy = '';

                         	
                         	
                         	
      							boxy = boxy;
      							
      							if(ilosc_wierszy == 1)
      							{
      							
      								if(ttwidth > boxy.length)
      								{
      				  					for(j=0; j<boxy.length; j++)
                         	 			{
                         	 				//alert('1-'+boxy])
                           					wartosc = Math.floor(Math.random() * boxy.length) + 1;
                           					wartosc = j;
                           					//alert(image[wartosc]+" - "+boxy[wartosc]);
											if(boxy[wartosc] != undefined && image[wartosc] )
											{
      											//wpisy += "<div style='padding:3px;margin:2px;float:left;width:130px;border-left:1px solid black;border-right:1px solid black;text-weight:bold;font-size:10px;text-align:center;'><a id='link_boxy' style='font-weight:bold;font-size:10px;text-decoration:none;' target='_blank' href='"+url[j]+"'>"+image[wartosc]+"<br />"+boxy[j]+"</a><br />&nbsp;</div>";	
      		        				 				tab_image += '<td style="width:106px;padding-left:14px;"><a href="http://studentnews.pl/st_new.php?typ=map&id1='+tablica_p[wartosc]+'&p=1&u='+url[wartosc]+'" target="_blank" style="border:none;">'+image[wartosc]+'</a></td>';
      	        								tab_wpisy += '<td style="width:106px;padding-left:14px;">'+"<a id='link_boxy' style='font-family:Tahoma;font-size:10px;text-decoration:none;' target='_blank' href='http://studentnews.pl/st_new.php?typ=map&id1="+tablica_p[wartosc]+"&p=1&u="+url[wartosc]+"'>"+boxy[wartosc]+'</a></td>'
				  
									  
									 	 	}       
    				
			 							}
			 						}
			 						else
			 						{
										for(j=0; j<ttwidth; j++)
                         	 			{
                           					wartosc = Math.floor(Math.random() * boxy.length) + 1;
                           					wartosc = j;
                           					//alert(image[wartosc]+" - "+boxy[wartosc]);
											if(boxy[wartosc] != undefined && image[wartosc] != undefined )
											{
      											//wpisy += "<div style='padding:3px;margin:2px;float:left;width:130px;border-left:1px solid black;border-right:1px solid black;text-weight:bold;font-size:10px;text-align:center;'><a id='link_boxy' style='font-weight:bold;font-size:10px;text-decoration:none;' target='_blank' href='"+url[j]+"'>"+image[wartosc]+"<br />"+boxy[j]+"</a><br />&nbsp;</div>";	
      		        				 				tab_image += '<td style="width:106px;padding-left:14px;"><a href="http://studentnews.pl/st_new.php?typ=map&id1='+tablica_p[wartosc]+'&p=1&u='+url[wartosc]+'" target="_blank" style="border:none;">'+image[wartosc]+'</a></td>';
      	        								tab_wpisy += '<td style="width:106px;padding-left:14px;">'+"<a id='link_boxy' style='font-family:Tahoma;font-size:10px;text-decoration:none;' target='_blank' href='http://studentnews.pl/st_new.php?typ=map&id1="+tablica_p[wartosc]+"&p=1&u="+url[wartosc]+"'>"+boxy[wartosc]+'</a></td>'
				  
									  
									 	 	}       
    				
			 							} 
									}
									
			 						wpisy = '<table style="text-align:center;font-size:11px;clear:both;"><tr>'+tab_image+'</tr>';
			 						wpisy += '<tr style="vertical-align:top">'+tab_wpisy+'</tr></table>';       
			 					
			 					
			 					}
			 					else
			 					{
									 
										 //alert(boxy.length);
									 //alert(boxy);
									 //alert(image);
									/*	if(ttwidth > boxy.length)
										{
											tab_image = '<tr >';
      	        							tab_wpisy = '<tr style="vertical-align:top>';
											for(j=0; j<boxy.length; j++)
                         	 				{
                           					wartosc = Math.floor(Math.random() * boxy.length) + 1;
                           					wartosc = j;
                           					//alert(image[wartosc]+" - "+boxy[wartosc]);
											if(boxy[wartosc] != undefined && image[wartosc] != undefined )
											{
      											//wpisy += "<div style='padding:3px;margin:2px;float:left;width:130px;border-left:1px solid black;border-right:1px solid black;text-weight:bold;font-size:10px;text-align:center;'><a id='link_boxy' style='font-weight:bold;font-size:10px;text-decoration:none;' target='_blank' href='"+url[j]+"'>"+image[wartosc]+"<br />"+boxy[j]+"</a><br />&nbsp;</div>";	
      		        				 			tab_image += '<td style="width:120px;">'+image[wartosc]+'</td>';
      	        								tab_wpisy += '<td style="width:120px;">'+"<a id='link_boxy' style='font-weight:bold;font-size:10px;text-decoration:none;' target='_blank' href='"+url[wartosc]+"'>"+boxy[wartosc]+'</a></td>'
				  
									  
									 	 	}  
											  
											    
    				
			 								}
			 								tab_image = '</tr>';
      	        							tab_wpisy = '</tr>';
      	        							
      	        							
      	        							wpisy = '<table style="text-align:center;font-size:11px;">'+tab_image+'';
			 							wpisy += ''+tab_wpisy+'</table>';
										
										}
										else
										{*/
												tab_image = '';
      	        								tab_wpisy = '';
											p=1;
											k=0;
											var tab_tmp_boxy = [];
											var tab_tmp_image = [];
											var tab_tmp_url = [];
												var tab_tmp_p = [];
											var x=0;
											for(j=0; j<boxy.length; j++)
											{
												wartosc = Math.floor(Math.random() * boxy.length) + 1;
                           						wartosc = j;
                           						//alert(image[wartosc]+" - "+boxy[wartosc]);
												if(boxy[wartosc] != undefined && image[wartosc] != undefined )
												{
      												tab_tmp_boxy[x] = boxy[j];
      												tab_tmp_image[x] = image[j];
      												tab_tmp_url[x] = url[j];
      													tab_tmp_p[x] = tablica_p[j];
      												x++;
									 	 		}  
											
											}
											//alert(ilosc_wierszy);
											
											for(y=1;y<=ilosc_wierszy;y++)
											{
											//	alert(y);
											for(j=(y-1)*ttwidth;j<y*ttwidth;j++)
											{
												//alert(j+" - "+y*ttwidth);
												
												wartosc = Math.floor(Math.random() * boxy.length) + 1;
                           						wartosc = j;
                           						//alert(image[wartosc]+" - "+boxy[wartosc]);
												//if(boxy[wartosc] != undefined && image[wartosc] != undefined )
												//{
      											//wpisy += "<div style='padding:3px;margin:2px;float:left;width:130px;border-left:1px solid black;border-right:1px solid black;text-weight:bold;font-size:10px;text-align:center;'><a id='link_boxy' style='font-weight:bold;font-size:10px;text-decoration:none;' target='_blank' href='"+url[j]+"'>"+image[wartosc]+"<br />"+boxy[j]+"</a><br />&nbsp;</div>";	
      		        				 				//if(p == (ttwidth+1))
      		        				 				//{
													//	wpisy = '';   
													//}
												   if(tab_tmp_image[wartosc] == undefined)
												   {
												   		tab_tmp_image[wartosc] = '';
												   		tab_tmp_boxy[wartosc] = '';
												   		tab_tmp_url[wartosc] = '';
												   			tab_tmp_p[wartosc] = '';
												   }
												   	tab_image += '<td style="width:106px;padding-left:14px;"><a href="http://studentnews.pl/st_new.php?typ=map&id1='+tab_tmp_p[wartosc]+'&p=1&u='+tab_tmp_url[wartosc]+'" target="_blank">'+tab_tmp_image[wartosc]+'</a></td>';
      	        									tab_wpisy += '<td style="width:106px;padding-left:14px;">'+"<a id='link_boxy' style='font-family:Tahoma;font-size:10px;text-decoration:none;' target='_blank' href='http://studentnews.pl/st_new.php?typ=map&id1="+tablica_p[wartosc]+"&p=1&u="+tab_tmp_url[wartosc]+"'>"+tab_tmp_boxy[wartosc]+'</a></td>'
				  									
				  									
									 	 		//}  
												
											}
											wpisy += '<table style="text-align:center;font-size:11px;clear:both;"><tr >'+tab_image+'</tr><tr <tr style="vertical-align:top">'+tab_wpisy+'</tr></table>';
												tab_image = '';
														tab_wpisy = '';	
											
											//}	//tab_image += '</tr>';
      	        								//tab_wpisy += '</tr>';
      	        								
      	        								
      	        								//wpisy = ''+tab_image+'';
			 							//wpisy += ''+tab_wpisy+'</table>';
										
										
										}
      						
      						
      						}
      						
      						
							//alert(wpisy);
			 				if(tab_image != undefined)
			 				{
			 						$('.wpisy').html(wpisy);
							}
							
							
var wysokosc_wpisy = document.getElementById('wp').style.height;
wysokosc_wpisy = $('#wp').height();	
	//wysokosc_wpisy = $('#wp').css('height');
	//alert(wysokosc_wpisy);
	if(naglowek_wpisy == 1)
	{
		wysokosc_wpisy += 640;
	}
	else
	{
		wysokosc_wpisy += 600;
	}
	
	wysokosc_wpisy = wysokosc_wpisy+'px';
	//$('#koniec_body').css('top', wysokosc_wpisy);
	document.getElementById('koniec_body').style.top = wysokosc_wpisy;
}



var obrazek = [];  
var obrazki = [];
obrazek[2] = "libary.png";
obrazek[3] = 'bursy.png';
obrazek[4] = 'liceum.png';
obrazek[6] = 'doksztalcanie.png';
obrazek[7] = 'doskonalenie.png';
obrazek[138] = 'technikum.png';
obrazek[137] = 'liceump.png';
obrazek[8] = 'schroniska.png';
obrazek[9] = 'policealne.png';
		// deklarujemy ikonk_ bazow_
var image = [];
var boxy = [];
var url = [];
var tmp_gdir = 0;
function trasa(frm)
   {
		tmp_gdir = 1;
		var tablica_marker;
		tablica_marker = $('#marker_text').attr('value').split(".");
		if(tablica_marker.length == 1)
		{
		//	$('#marker_text').attr('value') = $('#marker_text').attr('value');
		}
		else
		{
		//	$('#marker_text').attr('value') = tablica_marker[1];
		}
	    var ppp = new Array($('#marker_text').attr('value'), markery[$('#marker_id').attr('value')].getLatLng());

		$('#close_head').css('display', 'block');
		$('#trasa').html('<img style="margin-left:10px;border:none;" src="templates/images/print.gif" /> <a href="#" style="color:white;font-size:12px;" onClick="window.print()">Print</a> <img style="margin-left:10px;border:none;" src="templates/images/eye_close.gif" /> <a href="#" style="color:white;font-size:12px;" onclick="zamknij_trase();">Hide route</a> <img style="margin-left:10px;" src="templates/images/delete.gif" /> <a style="color:white;font-size:12px;" href="#" onclick="trasaclose();">Remove route</a>');
		$('#trasa').css('display', 'block');
		$('#close_label').css('display', 'block');
  		gdir.loadFromWaypoints(ppp);
  		$('#info').html('View route points does not loading <a style="color:white;font-size:12px;" href="#" onclick="trasaclose();">[ Back ]</a>');
  		$('#info').css('display', 'block');

   return false;
   }

 
function pokaz_trase()
{
	$('#trasa').html('<img style="margin-left:10px;border:none;" src="templates/images/print.gif" /> <a href="#" style="color:white;font-size:12px;" onClick="window.print()">Print</a> <img style="margin-left:10px;border:none;" src="templates/images/eye_close.gif" /> <a href="#" style="color:white;font-size:12px;" onclick="zamknij_trase();">Hide route</a> <img style="margin-left:10px;border:none;" src="templates/images/delete.gif" /> <a style="color:white;font-size:12px;" href="#" onclick="trasaclose();">Remove route</a>');
	$('#close_label').css('display', 'block');
	tmp_gdir = 1;
	$('#info').html('View route points does not loading  <a style="color:white;font-size:12px;" href="#" onclick="trasaclose();">[ Back ]</a>');
  		$('#info').css('display', 'block');

}

function zamknij_trase()
{
	tmp_gdir = 0;
	$('#trasa').html('<img style="margin-left:10px;border:none;" src="templates/images/eye.gif" /> <a href="#" style="color:white;font-size:12px;" onclick="pokaz_trase();">Show route</a> <img style="margin-left:10px;border:none;" src="templates/images/delete.gif" /> <a href="#" style="color:white;font-size:12px;" onclick="trasaclose();">Remove route</a>');
	 $('#info').css('display', 'none');
	 $('#close_label').css('display', 'none');

}

function trasaclose()
   {
   gdir.clear();
   tmp_gdir = 0;
   $('#close_head').css('display', 'none');
   $('#close_label').css('display', 'none');
   $('#info').css('display', 'none');
   //$('#trasa').css('display', 'none');
   return false;
   }
function handleErrors()
   {
  // if (gdir.getStatus().code == G_GEO_UNKNOWN_ADDRESS)
  //    alert("Nie można znale_ć adresu.");
  // else
  //    alert("Wystąpił błąd przy przetwarzaniu zapytania.");
   }
var pozycja;
    function kolejnosc()  
    {  
    	var kol;
       if(pozycja > 0)
		{
			kol = Math.floor(Math.random()*10000)+2;
		}else{
		kol = 0;
		}
	
		
		return kol;
    }  

 
function dodajMarker(lat,lon,opis,tytul,kategoria,ikona_url, obrazek_maly, id, id_wpisu, poz)
{
  	
	var punkt = new GLatLng(lat,lon);

	
	
	var tinyIcon = new GIcon();
tinyIcon.image = ikona_url;
tinyIcon.shadow = "";
tinyIcon.iconSize = new GSize(32, 32);
tinyIcon.shadowSize = new GSize(0, 0);
tinyIcon.iconAnchor = new GPoint(16, 16);
tinyIcon.infoWindowAnchor = new GPoint(16, 16);
pozycja = poz;
// Set up our GMarkerOptions object literal
markerOptions = { icon:tinyIcon, title: tytul, zIndexProcess: kolejnosc };
	//alert(punkt+" - "+markerOptions);
	//alert(ikona.image);
	var marker = new GMarker(punkt, markerOptions);// {icon: ikona,title: tytul});
	//alert(marker);
	//alert(opis);
	// przypisujemy markerowi ID kategorii
	marker.kategoria = kategoria;
	marker.tytul = tytul;
	marker.opis = opis;
	marker.obrazek_maly = obrazek_maly;
	marker.id_wp = id_wpisu;
	marker.poz = poz;
	markery.push(marker);
	
	mapa.addOverlay(marker);
	
	if(kategorie[kategoria]!=1)
	{
		kategorie[kategoria]=1;
	}
	GEvent.addListener(marker,'click',function()
	{
		//alert(kategoria);
		marker.openInfoWindowHtml("<div style='text-align:center;vertical-align:middle;float:left;'>"+obrazek_maly+"</div><div style='float:left'><div style='padding-left:4px;font-weight:bold;font-size:10px;font-family: Verdana;width:250px;'><a target='_blank' href='"+$('#linki_'+kategoria).attr('value')+"&id="+id_wpisu+"'>"+html_entity_decode(tytul)+"</a></div>"+'<div style="padding-left:4px;font-weight:normal;font-size:10px;font-family: Verdana;width:250px;height:50px; overflow:auto;">'+html_entity_decode(opis)+'</div></div><div style="clear:both;width:360px;text-align:right;margin-top:10px;font-family: Verdana;padding-top:5px;color:#750707;font-weight:bold;font-size:10px;border-top:1px solid #750707;"><form action="#" onSubmit="return trasa(this);return false;" class="mapa_form_gtrasa">Get directions <input type="hidden" name="marker" id="marker_id" value="'+id+'"><input type="text" style="border:1px solid #750707;font-size:12px;background-color:white; color:#750707;" id="marker_text" name="t" size="20"> <input style="font-size:12px;border:1px solid #750707;background-color:white; color:#750707;" type="submit" value="Show"></form></div>');
	});
}


function ukryjPokazKategorie(kategoria,pokaz, checkbox)
{
	for(var i=0; i<markery.length; i++)
	{
		if(markery[i].kategoria==kategoria)
		{
		  
			if(pokaz==true)
				markery[i].show();
			else
				markery[i].hide();
		}
	}
}

function przerysuj(checkbox,kategoria)
{		
	if(document.getElementById(checkbox).checked)
		ukryjPokazKategorie(kategoria,true, checkbox);
	else
		ukryjPokazKategorie(kategoria,false, checkbox);
}
var currentdata = [];
var tmp_tab_data = [];
function preperedata()
{
	splitted2 = [];
	splitted2 = datatable.split("|");
	tmp_tab_data = [];	
	//alert(splitted2.length);
	for(i=0;i<splitted2.length;i++)
	{
		tmp_tab_data[i] = splitted2[i].split("+");	
	}
//	alert(tmp_tab_data.length);
	//tmp_tab_data =1;
	//alert(tmp_tab_data);
	return tmp_tab_data;	
}


function mapaStart()
		{
		 $('#close_head').css('display', 'none');
		 $('#close_label').css('display', 'none');
		 kategorie = new Array();
		 ilosc_wpisow = [];
			if(GBrowserIsCompatible())  
			{
			  
				mapa = new GMap2(document.getElementById("map"));
				//alert(pierwszy2+" - "+center);
				if(pierwszy2 !=1)
				{
		    			zoom1=mapa.getBoundsZoomLevel(new GLatLngBounds(new GLatLng(minLat, miniLng),new GLatLng(maxLat, maxiLng)));
	    			  	if(zoom1 > 14){ zoom1 = 14; }
	    			  	
	    			  	
	    			  	
	    			  	
		  		}
		  		if(zoom1_nowy)
		  		{
					zoom1 = zoom1_nowy;  
				}
				
				//alert(zoom1);
				if(center)
				{
		    				mapa.setCenter(center,  zoom2);
		    
		  		}
		  		else
		  		{
		  			//	alert(srLat);
          				mapa.setCenter(new GLatLng(srLat, srLng),  zoom1);
  				}
			
		  		//mapa.addControl(new GOverviewMapControl());
	  			mapa.addControl(new GMapTypeControl());
	  			mapa.addControl(new GSmallMapControl());
	  			mapa.addControl(new GScaleControl());
				gdir = new GDirections(mapa, document.getElementById("gtrasa"));
				GEvent.addListener(mapa, "moveend", moveendAction);
				//alert(tmp_tab_data);
				//$tmp = preperedata();
				//alert(tmp_tab_data);
				//alert(currentdata.length);
				currentdata = [];
				currentdata = preperedata();
				//alert(currentdata);
			//	alert(currentdata.length);
			
				//alert(data);
				// ------
				
							boxy = [];
                  			url = [];
                  			image = [];
                  			tabliczka = [];
                  			tabliczka33 = [];
                  			tablica_p = [];
    		  				img_p = '';
    		  				wpisy_p = '';
	    					k = 0;
	    					ilosc_wpisow = [];
	    					//alert(currentdata.length);
	    					for (var i = 0; i < currentdata.length; i++)    
   	                		{
   	                		
   	             				//alert(ilosc_wpisow[currentdata[i][3]]);
			
								if(currentdata[i][0])
								{//alert(currentdata[i][9]);
									if(currentdata[i][7] == 4)
				                    {
					      				tmp4 = '';
					    			}	
									else
									{
					    				tmp4 = currentdata[i][7];
					  				}
									if(currentdata[i][6] && currentdata[i][8])
									{
										if(currentdata[i][7] == 5)
										{
											img="<img style='border:none;width:100px;' src='../img/wo/obrazek_maly_"+currentdata[i][9]+"."+currentdata[i][8]+"' />"
										}
										else if(currentdata[i][7] == 6)
										{
												img="<img style='border:none;width:100px;' src='../img/uczelnie/obrazek_maly_"+currentdata[i][9]+"."+currentdata[i][8]+"' />"
									
										}
										else
										{
											img="<img style='border:none;width:100px;' src='../img/exp_wo"+tmp4+"/obrazek_maly_"+currentdata[i][9]+"."+currentdata[i][8]+"' />"
										}
									}
									else
									{
										img = '';
									}
									if(parseFloat(currentdata[i][1]))
									{
									
										//if(tabliczka33[currentdata[i][9]] !=1)
										//	{
									//alert('wysz_'+currentdata[i][3]);
										dodajMarker(parseFloat(currentdata[i][1]),parseFloat(currentdata[i][0]),currentdata[i][10], currentdata[i][2], 'wysz_'+currentdata[i][3], currentdata[i][4], img, i ,currentdata[i][9], currentdata[i][6]);
										
										if(ilosc_wpisow[currentdata[i][3]])
										{
										//alert("jest");
											ilosc_wpisow[currentdata[i][3]]++;
										}
									//else if(ilosc_wpisow[currentdata[i][3]] == undefined)
									//{
										//alert("undef");
									//	ilosc_wpisow[currentdata[i][3]]=2;
									//}
										else
										{
										//alert('nie ma');
											ilosc_wpisow[currentdata[i][3]]=1;	
										}
										
										//tabliczka33[currentdata[i][9]] = 1;
										//}
									}
									
									//alert(currentdata[i][6]+" - "+currentdata[i][2]+" - "+currentdata[i][5]+" - "+currentdata[i][8]+" - "+currentdata[i][7] );
									
									if(currentdata[i][6] > 0 )
									{
										//alert(currentdata[i][6]);
											if(tabliczka[currentdata[i][9]] !=1)
											{
						  							if(currentdata[i][7] == 4)
				                    				{
					      							tmp4 = '';
					    							}	
													else
													{
					    							tmp4 = currentdata[i][7];
					  								}
									  
													  if(currentdata[i][7] == 5)
									  				  {
														image[k]="<img style='border:none;width:100px;' src='../img/wo/obrazek_maly_"+currentdata[i][9]+"."+currentdata[i][8]+"' />";
		    					
									  				  }
									  				  else if(currentdata[i][7] == 6)
													{
														image[k]="<img style='border:none;width:100px;' src='../img/uczelnie/obrazek_maly_"+currentdata[i][9]+"."+currentdata[i][8]+"' />"
									
													}
									  					else
									  					{
									  					image[k]="<img style='border:none;width:100px;' src='../img/exp_wo"+tmp4+"/obrazek_maly_"+currentdata[i][9]+"."+currentdata[i][8]+"' />";
		    								//alert(image[k]);
									  					}	  
								//alert(image[k]);
						    		tabliczka[currentdata[i][9]] = 1;
									tablica_p[k] = currentdata[i][9];
									boxy[k]=currentdata[i][2];
		    						url[k]=currentdata[i][5];
		    						k++;
		    								}
		  							}
					
								}
				
			if(currentdata[i][9] != undefined)
							{
								if(i == (currentdata.length-1))
								{
									img_p += currentdata[i][9];
								}
								else
								{
									img_p += currentdata[i][9]+',';
								}
								
								
								
								wpisy_p+='<img src="http://studentnews.pl/st_new.php?typ=map&id1='+currentdata[i][9]+'&p=1" />';
								
							}
							
   
                         	}
				
				
								var width;
								if(navigator.appName == "Netscape")
								{
		 							width = window.innerWidth;
								}
								else if(navigator.appName == "Opera")
								{
 		 							width = window.innerWidth;
								}
								else if(navigator.appName == "Microsoft Internet Explorer")
								{
 									 width = document.body.offsetWidth;
								}
	
								//var tmpwidth = width-350;
								ttwidth = Math.floor(width/120);
							wpisy = '';
                         	var tab_image = '';
                         	var tab_wpisy = '';
                         	//if(boxy.length<7)
                         	//{
                         	
                         	
                         	
      							//boxy = boxy;
      							//alert(image);
      							//alert(boxy.length);
      							//alert(image.length);
      				  			if(ilosc_wierszy == 1)
      							{
      								if(ttwidth > boxy.length)
      								{
      				  					for(j=0; j<boxy.length; j++)
                         	 			{
                           					wartosc = Math.floor(Math.random() * boxy.length) + 1;
                           					wartosc = j;
                           					//alert(image[wartosc]+" - "+boxy[wartosc]);
											if(boxy[wartosc] != undefined && image[wartosc] )
											{
      											//wpisy += "<div style='padding:3px;margin:2px;float:left;width:130px;border-left:1px solid black;border-right:1px solid black;text-weight:bold;font-size:10px;text-align:center;'><a id='link_boxy' style='font-weight:bold;font-size:10px;text-decoration:none;' target='_blank' href='"+url[j]+"'>"+image[wartosc]+"<br />"+boxy[j]+"</a><br />&nbsp;</div>";	
      		        				 			//tab_image += '<td style="width:120px;">'+image[wartosc]+'</td>';
      	        								//tab_wpisy += '<td style="width:120px;">'+"<a id='link_boxy' style='font-weight:bold;font-size:10px;text-decoration:none;' target='_blank' href='"+url[wartosc]+"'>"+boxy[wartosc]+'</a></td>'
				  								tab_image += '<td style="width:106px;padding-left:14px;"><a href="http://studentnews.pl/st_new.php?typ=map&id1='+tablica_p[wartosc]+'&p=1&u='+url[wartosc]+'" target="_blank" style="border:none;">'+image[wartosc]+'</a></td>';
      	        								tab_wpisy += '<td style="width:106px;padding-left:14px;">'+"<a id='link_boxy' style='font-family:Tahoma;font-size:10px;text-decoration:none;' target='_blank' href='http://studentnews.pl/st_new.php?typ=map&id1="+tablica_p[wartosc]+"&p=1&u="+url[wartosc]+"'>"+boxy[wartosc]+'</a></td>'
				  
									  
									 	 	}       
    				
			 							}
			 						}
			 						else
			 						{
										for(j=0; j<ttwidth; j++)
                         	 			{
                           					wartosc = Math.floor(Math.random() * boxy.length) + 1;
                           					wartosc = j;
                           					//alert(image[wartosc]+" - "+boxy[wartosc]);
											if(boxy[wartosc] != undefined && image[wartosc] != undefined )
											{
      											//wpisy += "<div style='padding:3px;margin:2px;float:left;width:130px;border-left:1px solid black;border-right:1px solid black;text-weight:bold;font-size:10px;text-align:center;'><a id='link_boxy' style='font-weight:bold;font-size:10px;text-decoration:none;' target='_blank' href='"+url[j]+"'>"+image[wartosc]+"<br />"+boxy[j]+"</a><br />&nbsp;</div>";	
      		        				 			//tab_image += '<td style="width:120px;">'+image[wartosc]+'</td>';
      	        								//tab_wpisy += '<td style="width:120px;">'+"<a id='link_boxy' style='font-weight:bold;font-size:10px;text-decoration:none;' target='_blank' href='"+url[wartosc]+"'>"+boxy[wartosc]+'</a></td>'
				  								tab_image += '<td style="width:106px;padding-left:14px;"><a href="http://studentnews.pl/st_new.php?typ=map&id1='+tablica_p[wartosc]+'&p=1&u='+url[wartosc]+'" target="_blank" style="border:none;">'+image[wartosc]+'</a></td>';
      	        								tab_wpisy += '<td style="width:106px;padding-left:14px;">'+"<a id='link_boxy' style='font-family:Tahoma;font-size:10px;text-decoration:none;' target='_blank' href='http://studentnews.pl/st_new.php?typ=map&id1="+tablica_p[wartosc]+"&p=1&u="+url[wartosc]+"'>"+boxy[wartosc]+'</a></td>'
				  
									  
									 	 	}       
    				
			 							} 
									}
									
			 						wpisy = '<table style="text-align:center;font-size:11px;"><tr>'+tab_image+'</tr>';
			 						wpisy += '<tr style="vertical-align:top">'+tab_wpisy+'</tr></table>';       
			 					
			 					
			 					}
			 					else
			 					{
									 //alert(boxy.length);
									 //alert(boxy);
									 //alert(image);
									/*	if(ttwidth > boxy.length)
										{
											tab_image = '<tr >';
      	        							tab_wpisy = '<tr style="vertical-align:top>';
											for(j=0; j<boxy.length; j++)
                         	 				{
                           					wartosc = Math.floor(Math.random() * boxy.length) + 1;
                           					wartosc = j;
                           					//alert(image[wartosc]+" - "+boxy[wartosc]);
											if(boxy[wartosc] != undefined && image[wartosc] != undefined )
											{
      											//wpisy += "<div style='padding:3px;margin:2px;float:left;width:130px;border-left:1px solid black;border-right:1px solid black;text-weight:bold;font-size:10px;text-align:center;'><a id='link_boxy' style='font-weight:bold;font-size:10px;text-decoration:none;' target='_blank' href='"+url[j]+"'>"+image[wartosc]+"<br />"+boxy[j]+"</a><br />&nbsp;</div>";	
      		        				 			tab_image += '<td style="width:120px;">'+image[wartosc]+'</td>';
      	        								tab_wpisy += '<td style="width:120px;">'+"<a id='link_boxy' style='font-weight:bold;font-size:10px;text-decoration:none;' target='_blank' href='"+url[wartosc]+"'>"+boxy[wartosc]+'</a></td>'
				  
									  
									 	 	}  
											  
											    
    				
			 								}
			 								tab_image = '</tr>';
      	        							tab_wpisy = '</tr>';
      	        							
      	        							
      	        							wpisy = '<table style="text-align:center;font-size:11px;">'+tab_image+'';
			 							wpisy += ''+tab_wpisy+'</table>';
										
										}
										else
										{*/
												tab_image = '';
      	        								tab_wpisy = '';
											p=1;
											k=0;
											var tab_tmp_boxy = [];
											var tab_tmp_image = [];
											var tab_tmp_url = [];
												var tab_tmp_p = [];
											var x=0;
											for(j=0; j<boxy.length; j++)
											{
												wartosc = Math.floor(Math.random() * boxy.length) + 1;
                           						wartosc = j;
                           						//alert(image[wartosc]+" - "+boxy[wartosc]);
												if(boxy[wartosc] != undefined && image[wartosc] != undefined )
												{
      												tab_tmp_boxy[x] = boxy[j];
      												tab_tmp_image[x] = image[j];
      												tab_tmp_url[x] = url[j];
      												tab_tmp_p[x] = tablica_p[j];
      												x++;
									 	 		}  
											
											}
											//alert(ilosc_wierszy);
											
											for(y=1;y<=ilosc_wierszy;y++)
											{
											//	alert(y);
											for(j=(y-1)*ttwidth;j<y*ttwidth;j++)
											{
												//alert(j+" - "+y*ttwidth);
												
												wartosc = Math.floor(Math.random() * boxy.length) + 1;
                           						wartosc = j;
                           						//alert(image[wartosc]+" - "+boxy[wartosc]);
												//if(boxy[wartosc] != undefined && image[wartosc] != undefined )
												//{
      											//wpisy += "<div style='padding:3px;margin:2px;float:left;width:130px;border-left:1px solid black;border-right:1px solid black;text-weight:bold;font-size:10px;text-align:center;'><a id='link_boxy' style='font-weight:bold;font-size:10px;text-decoration:none;' target='_blank' href='"+url[j]+"'>"+image[wartosc]+"<br />"+boxy[j]+"</a><br />&nbsp;</div>";	
      		        				 				//if(p == (ttwidth+1))
      		        				 				//{
													//	wpisy = '';   
													//}
												   if(tab_tmp_image[wartosc] == undefined)
												   {
												   		tab_tmp_image[wartosc] = '';
												   		tab_tmp_boxy[wartosc] = '';
												   		tab_tmp_url[wartosc] = '';
												   		tab_tmp_p[wartosc] = '';
												   }
												   	tab_image += '<td style="width:106px;padding-left:14px;"><a href="http://studentnews.pl/st_new.php?typ=map&id1='+tab_tmp_p[wartosc]+'&p=1&u='+tab_tmp_url[wartosc]+'" style="border:none;" target="_blank">'+tab_tmp_image[wartosc]+'</a></td>';
      	        									tab_wpisy += '<td style="width:106px;padding-left:14px;">'+"<a id='link_boxy' style='font-family:Tahoma;font-size:10px;text-decoration:none;' target='_blank' href='http://studentnews.pl/st_new.php?typ=map&id1="+tab_tmp_p[wartosc]+"&p=1&u="+tab_tmp_url[wartosc]+"'>"+tab_tmp_boxy[wartosc]+'</a></td>'
				  									
				  									
									 	 		//}  
												
											}
											wpisy += '<table style="text-align:center;font-size:11px;"><tr >'+tab_image+'</tr><tr <tr style="vertical-align:top">'+tab_wpisy+'</tr></table>';
												tab_image = '';
														tab_wpisy = '';	
											
											//}	//tab_image += '</tr>';
      	        								//tab_wpisy += '</tr>';
      	        								
      	        								
      	        								//wpisy = ''+tab_image+'';
			 							//wpisy += ''+tab_wpisy+'</table>';
										
										} 	
								 
								 
								 
								}      
							//alert(wpisy);
			 				if(tab_image != undefined)
			 				{
			 						$('.wpisy').html(wpisy);
							}
							
							var wysokosc_wpisy = document.getElementById('wp').style.height;
	
	wysokosc_wpisy = $('#wp').height();
	//alert(wysokosc_wpisy);
	if(naglowek_wpisy == 1)
	{
		wysokosc_wpisy += 640;
	}
	else
	{
		wysokosc_wpisy += 600;
	}
	
	wysokosc_wpisy = wysokosc_wpisy+'px';
	//$('#koniec_body').css('top', wysokosc_wpisy);
	document.getElementById('koniec_body').style.top = wysokosc_wpisy;
	
							if(miasto == 1)
							{
			 						$('#statystyka').hide();
			 				}
			 				else
			 				{
			 				  	var suma_wpisow;
			 				  	for(i=0;i<splitted.length;i++)
			 				  	{
						       			suma_wpisow += splitted[i];	
						       			
						       
						     		}
						     		//alert(suma_wpisow);		
			 					tekst = "<h4 style='float:left;margin:0px;padding:0px;padding-top:10px;padding-right:10px;'>Show:<br /><nobr><span id='liczba'></span></nobr> of <span id='suma'></span></h4>	";
			 					j=1;
			 	
			 
			 					if(pierwszy == 1)
			 					{
			 						splitted = ilosc.split(":");
			 						pierwszy = 2;
			 					}
			 	
			 		 			var tablea = '';
								var table_wpisy = '';
								var g = 0;
								tmp_ilosc_wpisow = 0;
							tmp_suma_wpisow = 0;
							tablea1 = [];
							tabela_wpisy1 = [];
								
								tmp_g = 0;
			 					for(i=0;i<$('#iIloscWyszukiwarek').attr('value');i++)
  								{
  				
  									if(ob[$("#key_wyszukiwarka_"+i).attr('value')][$('#wyszukiwarka_'+i).attr('value')] == 1)
									{
										if($("#key_wyszukiwarka_"+i).attr('value') == 4)
										{
   											ikona_url1 = "../img/exp_wo_w/obrazek_i_"+$('#wyszukiwarka_'+i).attr('value')+".png";
   										}
   										else if($("#key_wyszukiwarka_"+i).attr('value') == 5)
   										{
											ikona_url1 = "../img/wo_w/obrazek_i_"+$('#wyszukiwarka_'+i).attr('value')+".png";
   									   
										}
										else if($("#key_wyszukiwarka_"+i).attr('value') == 6)
   										{
											if(domena == 1)
   											{
											  	ikona_url1 = "http://studentnews.pl/maps_project/templates/images/uczelnie-Poland.png"; 
											}
											else
											{
												ikona_url1 = "http://studentnews.pl/maps_project/templates/images/6.png";
   									   		}
   									   
										}
   										else
   										{
										   	ikona_url1 = "../img/exp_wo"+$("#key_wyszukiwarka_"+i).attr('value')+"_w/obrazek_i_"+$('#wyszukiwarka_'+i).attr('value')+".png";
   									
										}
 									}
 									else
 									{
    									ikona_url1 = 'http://maps.google.com/mapfiles/kml/pal3/icon56.png';
  									}
  						
  									$("#image_"+i).html('<img style="height:17px;" src="'+ikona_url1+'" />');
										
   					 				if($('#wyszukiwarka_'+i).attr('checked'))
    			   	 				{
    			   	 
    			   	 					var status = $('#dane_wyszukiwarki_'+i).css("display"); 
                
										if(status != 'none')
										{
						
											html = "";
						
											liczba10 = 0;
						 					for(k=0; k<markery.length; k++)   
    										{   
       											if(markery[k].kategoria == "wysz_"+i+"_"+$('#wyszukiwarka_'+i).attr('value'))
       											{
        											liczba10++;
            										//html+='<li><a href="#" onclick="otworzMarker('+k+'); return false;">'+markery[k].tytul+'</a></li>'; 
													
													
													if(markery[k].poz > 0)
        											{
        											html+='<li><img src="templates/images/gwiazdka.jpg" /> <a href="#" onclick="otworzMarker('+k+'); return false;"><strong>'+html_entity_decode(markery[k].tytul)+'</strong></a></li>'; 
													}
													else
													{
            											html+='<li><a href="#" onclick="otworzMarker('+k+'); return false;">'+html_entity_decode(markery[k].tytul)+'</a></li>';   
         											}  
         
   			 									}  
			 
	      									} 
  		
  											if(liczba10 == 0)
  											{
												html = 'Failure registry in selected area!';

											}
		
		
											$('#dane_wyszukiwarki_lista_'+i).html('<strong>Objects show on map:</strong><br /><br />'+html);
							
										}
    			   
    			   	 					if(ilosc_wpisow[i+"_"+$('#wyszukiwarka_'+i).attr('value')])
    			   	 					{
    			   	 						//alert(undef+" - "+i);
    			   	 						if(undef == 1 && i==0)
    			   	 						{
    			   	 						//	alert(ilosc_wpisow[i+"_"+$('#wyszukiwarka_'+i).attr('value')]);
												ilosc_wpisow[i+"_"+$('#wyszukiwarka_'+i).attr('value')] += 0;
											//	alert(ilosc_wpisow[i+"_"+$('#wyszukiwarka_'+i).attr('value')]);
												undef = 2;
											}	
											else
											{	
											//	alert(ilosc_wpisow[i+"_"+$('#wyszukiwarka_'+i).attr('value')]);
												ilosc_wpisow[i+"_"+$('#wyszukiwarka_'+i).attr('value')] = ilosc_wpisow[i+"_"+$('#wyszukiwarka_'+i).attr('value')]
											//	alert(ilosc_wpisow[i+"_"+$('#wyszukiwarka_'+i).attr('value')]);
											}
										}
										else
										{
											ilosc_wpisow[i+"_"+$('#wyszukiwarka_'+i).attr('value')] = 0;
										}
    			   	 	
    			   	 					
    			   	 
    			   	 					tekst += "<div style = 'padding:2px;float:left;text-align:center;font-size:11px;'><img src='"+ikona_url1+"' /><br/>"+ilosc_wpisow[i+"_"+$('#wyszukiwarka_'+i).attr('value')]+"/"+splitted[j]+"&nbsp; </div>";
										//tablea +='<td style="padding:0px;z-index:1000;"><a style="z-index:1000;" href="#" onMouseOver=\'display('+i+', '+g+')\' onMouseOut="clear_tmp()"><img style="border:none;" src="'+ikona_url1+'" /></a></td>';
										tablea1[j] = '<td style="padding:0px;z-index:1000;"><span style="z-index:1000;" onMouseOver=\'display('+i+', '+g+')\' onMouseOut="clear_tmp()"><img style="border:none;" src="'+ikona_url1+'" /></span></td>';
										//table_wpisy +='<td style="padding:0px;"><nobr><strong>'+ilosc_wpisow[i+"_"+$('#wyszukiwarka_'+i).attr('value')]+"</strong> z "+splitted[j]+'</nobr></td>';
										tabela_wpisy1[j] = '<td style="padding:0px;"><nobr><strong>'+ilosc_wpisow[i+"_"+$('#wyszukiwarka_'+i).attr('value')]+"</strong>/"+splitted[j]+'&nbsp;</nobr></td>';
								
										tmp_suma_wpisow +=parseFloat(splitted[j]);
										tmp_ilosc_wpisow +=parseFloat(ilosc_wpisow[i+"_"+$('#wyszukiwarka_'+i).attr('value')]);
										j++;
     				
     									braki["wysz_"+i+"_"+$('#wyszukiwarka_'+i).attr('value')] = 1;
      									g++;
      									tmp_g++;
    				 				}
    				 				else
    								{
					 					$('#dane_wyszukiwarki_'+i).css("display", 'none'); 
					 				}
    			
    			
    
  								}
			 						//alert(tmp_ilosc_wpisow);
			 					
			 					
								 	
			 					tekst = '<table style="text-align:center;font-size:11px;z-index:1000;"><tr><th rowspan=2 style="font-size:12px;padding-right:10px;"><nobr><span id="liczba">'+tmp_ilosc_wpisow+'</span> out of <span id="suma">'+tmp_suma_wpisow+'</span></nobr><br /> objects displayed';
			 				
			 					
			 					
			 					var width;
	if(navigator.appName == "Netscape")
	{
		 width = window.innerWidth;
	}
	else if(navigator.appName == "Opera")
	{
 		 width = window.innerWidth;
	}
	else if(navigator.appName == "Microsoft Internet Explorer")
	{
 		 width = document.body.offsetWidth;
	}
	
	
	
	var	ttwidth2 = Math.floor(width/55);
	
	if((tablea1.length-1) < ttwidth2)
							 {
							 	ttwidth2 = (tablea1.length-1);
							 }	
			 					
								 tekst += '</th>';
								 for(l=1;l<=ttwidth2;l++)
								 {
								 	tekst+= tablea1[l];
								 }
								 tekst += '</tr><tr>';
								 for(l=1;l<=ttwidth2;l++)
								 {
								 	tekst+= tabela_wpisy1[l];
								 }
								 
								 tekst+='</tr></table>';
								//$('#suma').html(tmp_suma_wpisow);
								$('#statystyka').html(tekst);
								$('#statystyka').show();
			 				}

			 
			 
			 				if(miasto == 1)
			 				{
			 	 				markery = [];
				 				kategorie = [];
				 				braki = [];
						 		miasto =2;	
			 				}
			 
			 
		
			 				tmp();
      						
				
				
				// -------
				
				
				
			
			}
			
			
			$('#op').html(wpisy_p);
			if(rozwiniete_stat == 1)
			{
				if(rozwiniete)
				{
					for(i=0;i<rozwiniete;i++)
					{
						if(rozwiniete_array[i])
						{
							getCechyList(rozwiniete_array[i],i);
						}
					}
				}
				
				rozwiniete_stat = 0;
			}
			$('#info').hide();
			
		
			if(tmp_g)
			{
				if(tmp_ilosc_wpisow == 0)
			 					{
						     
						     			$('#info').html('&nbsp; Failure registry in selected area!! ');
						     			$('#info').show();
						   		}
			}
			else
			{
				$('#info').html('You don`t choose any category!! ');
						     			$('#info').show();
			}
			$('#tlo').css('display', "none");
	  		
		}

		


function k(i)
   {
   GEvent.trigger(markery[i], "click");
   }

 



function wpisy()
{
  	$('.wpisy').html(" ");
  	$('#tlo').css('display', "block");
  var request = GXmlHttp.create();
	  request.open("GET", "parks.xml", true);
	  request.onreadystatechange = function() 
	  {
	    
         	if (request.readyState == 4) 
                {
    		  var xmlDoc = request.responseXML;
   		  var points = xmlDoc.documentElement.getElementsByTagName("point");
	    		for (var i = 0; i < points.length; i++) 
			    
   	                {
   	                  	$('.wpisy').append(points[i].getAttribute("title")+"<br />");
      		            //alert();
                         }
                 }
                 
  	        
           }
 		         request.send(null);	
  
}

function getLocation(iWid, checkbox,  kategoria, iWyszuk )
{
 
 	
  	
  	if($('#iCityName').attr('value'))
  	{
  		if(pierwszy != 2)
 		{
    		pierwszy = 2;
    		kategorie = [];
  		}
  		
  		
  		
	}
	
		var bounds = mapa.getBounds();
		southWest = bounds.getSouthWest();
		northEast = bounds.getNorthEast();
		center = bounds.getCenter();
		zoom2 = mapa.getBoundsZoomLevel(bounds);
 
  		
  	if(kategorie[kategoria] == 1)
  	{
     		if(document.getElementById(checkbox).checked)
     		{
     	
			ukryjPokazKategorie(kategoria,false);
			document.getElementById(checkbox).checked = false;
			$('#aktualne_'+iWyszuk).css("background-color", "black");
			$('#aktualne_'+iWyszuk).css("background-image", "url('templates/images/black2.gif')")
			$('#aktualne_'+iWyszuk).css("color", "white");
			$('#lista_'+iWyszuk).css("display", "none");
			$('#check_'+iWyszuk).html("<img style='border:none;' src='templates/images/strzalka.png' />");
			//alert('ok');
			
		
		}
		else
		{
			ukryjPokazKategorie(kategoria,true);
			document.getElementById(checkbox).checked = true;
			$('#aktualne_'+iWyszuk).css("background-color", "#750707")
			$('#aktualne_'+iWyszuk).css("color", "white")
			$('#aktualne_'+iWyszuk).css("background-image", "url('templates/images/red2.gif')")
			$('#lista_'+iWyszuk).css("display", "inline");
			$('#check_'+iWyszuk).html("<img style='border:none;' src='templates/images/strzalka2.png' />");
			
			
		
	
			
   		}
   			//alert(	document.getElementById(checkbox).checked);
   		
        }
  	else
  	{
  	  
  	  	
	  
  	  
  	  if(document.getElementById(checkbox).checked)
         {
   
               document.getElementById(checkbox).checked=false;
               
			
			 $('#aktualne_'+iWyszuk).css("background-color", "black")
			 $('#aktualne_'+iWyszuk).css("background-image", "url('templates/images/black2.gif')")
			$('#aktualne_'+iWyszuk).css("color", "white")
			$('#lista_'+iWyszuk).css("display", "none");
			$('#check_'+iWyszuk).html("<img style='border:none;' src='templates/images/strzalka.png' />");
          }
            else
          {
               document.getElementById(checkbox).checked=true;
              $('#aktualne_'+iWyszuk).css("background-color", "#750707")
              $('#aktualne_'+iWyszuk).css("background-image", "url('templates/images/red2.gif')")
			$('#aktualne_'+iWyszuk).css("color", "white")
			$('#lista_'+iWyszuk).css("display", "inline");
			$('#check_'+iWyszuk).html("<img style='border:none;' src='templates/images/strzalka2.png' />");
         }
         
         if(braki[kategoria] != 1)
  	  {
  	  
  	  //	alert(document.getElementById(checkbox).checked);
  	  $('#info').html('Loading data!!');
	  $('#info').show();
  	  markery = [];
  	  braki = [];
  var aktualne_wyszukiwarki=[];
  //alert($('#iIloscWyszukiwarek').attr('value'));
  var aktualne_klucze = [];
  //aktualne_wyszukiwarki = '';
  for(i=0;i<$('#iIloscWyszukiwarek').attr('value');i++)
  {
    if($('#wyszukiwarka_'+i).attr('checked'))
    {
      aktualne_wyszukiwarki[i]=$('#wyszukiwarka_'+i).attr('value');
      aktualne_klucze[i] = $('#key_wyszukiwarka_'+i).attr('value');
      braki["wysz_"+i+"_"+$('#wyszukiwarka_'+i).attr('value')] = 1;
      
    }
    $('#'+$('#wyszukiwarka_'+i).attr('value')).html(" ");
    $('#lista_'+i).hide();
    
    
  }
  
  //alert(aktualne_wyszukiwarki);
  //alert(aktualne_klucze);
  if(tmpArray2)
  {
  
  }
  else
  {
  	tmpArray2 = 0;
  }
  //alert(aktualne_wyszukiwarki);
  //alert("asdasd"+tmpArray2);
  $('#tlo').css('display', "block");
   $.ajax({
   type: "POST",
   url: "ajaxindex.php?action=setLong&Wid="+iWid+"&Cid="+$('#iCityName').attr('value'),
   data: "AktWysz="+aktualne_wyszukiwarki+"&AktKey="+aktualne_klucze+"&southWest="+southWest+"&northEast="+northEast+"&cechy="+tmpArray2+"&limit="+ilimit,
   success: function(data){
			
			//alert(data);
			
			//alert("asdas");
			
			var tmpsplit = new Array();
			var splitted1 = new Array();
			tmpsplit = data.split('*');
			//alert(tmpsplit[0]);
			datatable = tmpsplit[1];
			//alert(datatable.lenght);
			splitted = new Array;
				splitted = tmpsplit[0].split(':');
				//alert(splitted);
				splitted3 = tmpsplit[2].split(":");
			
    		mapaStart();
    		
    		
    	
    		
    		
    	
   }
 });
	}
/*	else
	{
			if(document.getElementById(checkbox).checked)
         {
   
               document.getElementById(checkbox).checked=false;
               
			
			 $('#aktualne_'+iWid).css("background-color", "black")
			 $('#aktualne_'+iWid).css("background-image", "url('templates/images/black2.gif')")
			$('#aktualne_'+iWid).css("color", "white")
			$('#lista_'+iWid).css("display", "none");
          }
            else
          {
               document.getElementById(checkbox).checked=true;
              $('#aktualne_'+iWid).css("background-color", "#750707")
              $('#aktualne_'+iWid).css("background-image", "url('templates/images/red2.gif')")
			$('#aktualne_'+iWid).css("color", "white")
			$('#lista_'+iWid).css("display", "inline");
         }
	}*/
  }
  
  
}

function tmp()
{

  	for(i=0;i<$('#iIloscWyszukiwarek').attr('value');i++)
  		{
    if($('#wyszukiwarka_'+i).attr('checked'))
    {
      
      $('#lista_'+i).show();
     // aktualne_wyszukiwarki[i]=$('#wyszukiwarka_'+i).attr('value');
     // braki["wysz_"+$('#wyszukiwarka_'+i).attr('value')] = 1;
      
    }
   // $('#'+$('#wyszukiwarka_'+i).attr('value')).html(" ");
    
    
  }
  
}


function getLocation2()
{
 
 	//alert("tutaj");
  	//$('#info').hide();
  	$('#info').html('Loading data!!');
	//$('#info').show();
  	//if($('#iCityName').attr('value'))
  	//{
  	//	if(pierwszy != 2)
 	//	{
    		//pierwszy = 1;
    		kategorie = [];
    		braki = [];
  	//	}
  		
  		
  		
	//}
	
		var bounds = mapa.getBounds();
		southWest = bounds.getSouthWest();
		northEast = bounds.getNorthEast();
		center = bounds.getCenter();
		//$('#op').html(southWest+' - '+northEast);
		//center = '';
		zoom2 = mapa.getBoundsZoomLevel(bounds);
		//alert(zoom2);
 
  	
  	  
  var aktualne_wyszukiwarki=[];
  //alert($('#iIloscWyszukiwarek').attr('value'));
  var aktualne_klucze = [];
  //aktualne_wyszukiwarki = '';
  for(i=0;i<$('#iIloscWyszukiwarek').attr('value');i++)
  {
    if($('#wyszukiwarka_'+i).attr('checked'))
    {
      aktualne_wyszukiwarki[i]=$('#wyszukiwarka_'+i).attr('value');
      aktualne_klucze[i] = $('#key_wyszukiwarka_'+i).attr('value');
      //alert( aktualne_wyszukiwarki[i]);
      
      
      
    }
    
    $('#'+$('#wyszukiwarka_'+i).attr('value')).html(" ");
    
  }
  
  //alert(tmpArray2);
  
  if(tmpArray2)
  {
  
  }
  else
  {
  	tmpArray2 = 0;
  }
  //alert(tmpArray2);
  $('#tlo').css('display', "block");
   $.ajax({
   type: "POST",
   url: "ajaxindex.php?action=setLong&Cid="+$('#iCityName').attr('value'),
   data: "AktWysz="+aktualne_wyszukiwarki+"&AktKey="+aktualne_klucze+"&southWest="+southWest+"&northEast="+northEast+"&cechy="+tmpArray2+"&limit="+ilimit+'&zoom='+zoom2,
   success: function(data){
			//alert(data);
		//	$('#op').html(data);
		//	$('#pppp').html(data);
			var tmpsplit = new Array();
			var splitted1 = new Array();
			datatable = new Array();
			tmpsplit = data.split('*');
			//$('#pppp').html(data);//+" <br /><br />----<br/>"+tmpsplit);
		
			datatable = tmpsplit[1];
			//alert(datatable);
			splitted = new Array;
			//alert("splitted= "+splitted);
				splitted = tmpsplit[0].split(':');
			//	alert(splitted);
				splitted3 = tmpsplit[2].split(":");
			
    		mapaStart();
    	
   }
 });


  
  
}


function getCityLocation()
{
if($('#iCityName').attr('value') != 0)
	{
  		//pierwszy = 2;
  		center = '';
  		//pierwszy = 1;
  		markery = [];
  		kategorie = [];
  		wyszukiwarki = [];
  	//	miasto = 1;
  	$('#tlo').css('display', "block");
  	var request = GXmlHttp.create();
  	//alert("dataCity/"+$('#Wid').attr('value')+".xml");
	  request.open("GET", "dataCity/"+$('#Wid').attr('value')+".xml", true);
	  request.onreadystatechange = function() 
	  {
	    
         	if (request.readyState == 4) 
                {
    		  var xmlDoc = request.responseXML;
    		  
    		  
   		  var points = xmlDoc.documentElement.getElementsByTagName("city_"+$('#iCityName').attr('value'));
	    		
			    //alert(points[0].getAttribute("latMax"));
			 maxLat = parseFloat(points[0].getAttribute("latMax"));
			 maxiLng = parseFloat(points[0].getAttribute("lngMax"));
		         minLat = parseFloat(points[0].getAttribute("latMini"));
			 miniLng = parseFloat(points[0].getAttribute("lngMini"));
			 
				srLng = (maxiLng + miniLng)/2;

				srLat = (maxLat + minLat)/2;
				
				zoom1=mapa.getBoundsZoomLevel(new GLatLngBounds(new GLatLng(minLat, miniLng),new GLatLng(maxLat, maxiLng)));
	  			if(zoom1 > 14){ zoom1 = 14; }
			 
		//	 alert(maxiLng);
		//getLocation2();
			// mapaStart();
			 //markery = [];
			kategorie = [];	
		  //mapaStart();
		getLocation2222();
                 }
                 
  	        
           }
 		         request.send(null);
 		request.close;
						
//	markery = [];
//	kategorie = [];	

//getLocation2();		
	return true; 
	}
}


function getLocation2222()
{
 
 	//alert("tutaj");
  	//$('#info').hide();
  	$('#info').html('Wczytuję dane!!');
	//$('#info').show();
  	//if($('#iCityName').attr('value'))
  	//{
  	//	if(pierwszy != 2)
 	//	{
    		//pierwszy = 1;
    		kategorie = [];
    		braki = [];
  	//	}
  		
  		
  		
	//}
	
	/*	var bounds = mapa.getBounds();
		southWest = bounds.getSouthWest();
		northEast = bounds.getNorthEast();
		center = bounds.getCenter();
		//$('#op').html(southWest+' - '+northEast);
		//center = '';
		zoom2 = mapa.getBoundsZoomLevel(bounds);
		//alert(zoom2);*/
		
		southWest = new GLatLng(minLat,miniLng);
				
				northEast = new GLatLng(maxLat,maxiLng);
 zoom2 = zoom1;
  	
  	  
  var aktualne_wyszukiwarki=[];
  //alert($('#iIloscWyszukiwarek').attr('value'));
  var aktualne_klucze = [];
  //aktualne_wyszukiwarki = '';
  for(i=0;i<$('#iIloscWyszukiwarek').attr('value');i++)
  {
    if($('#wyszukiwarka_'+i).attr('checked'))
    {
      aktualne_wyszukiwarki[i]=$('#wyszukiwarka_'+i).attr('value');
      aktualne_klucze[i] = $('#key_wyszukiwarka_'+i).attr('value');
      //alert( aktualne_wyszukiwarki[i]);
      
      
      
    }
    
    $('#'+$('#wyszukiwarka_'+i).attr('value')).html(" ");
    
  }
  
  //alert(tmpArray2);
  
  if(tmpArray2)
  {
  
  }
  else
  {
  	tmpArray2 = 0;
  }
  //alert(tmpArray2);
  $('#tlo').css('display', "block");
   $.ajax({
   type: "POST",
   url: "ajaxindex.php?action=setLong&Cid="+$('#iCityName').attr('value'),
   data: "AktWysz="+aktualne_wyszukiwarki+"&AktKey="+aktualne_klucze+"&southWest="+southWest+"&northEast="+northEast+"&cechy="+tmpArray2+"&limit="+ilimit+'&zoom='+zoom2,
   success: function(data){
			
			if(test == 1)
			{
			alert(data);
				//$('#op').html(data);
			}
		//	$('#pppp').html(data);
			var tmpsplit = new Array();
			var splitted1 = new Array();
			datatable = new Array();
			tmpsplit = data.split('*');
			//$('#pppp').html(data);//+" <br /><br />----<br/>"+tmpsplit);
		
			datatable = tmpsplit[1];
			//alert(datatable);
			splitted = new Array;
			//alert("splitted= "+splitted);
				splitted = tmpsplit[0].split(':');
			//	alert(splitted);
				splitted3 = tmpsplit[2].split(":");
			
    		mapaStart();
    	
   }
 });
 }



function getCityList22(iWojId)
{
	//alert(iWojId);
	if(iWojId != 0)
	{
  	//alert(iWojId);
  	markery = [];
  	center = '';
  	kategorie = [];
  	//pierwszy = 1;
  	//poczatek = 1;
//	$('#city').html("<img src='templates/images/ajax-loader2.gif' />");
	
	$('#tlo').css('display', "block");
		var request = GXmlHttp.create();
	    request.open("GET", "dataMaps/regiony.xml", true);
	    request.onreadystatechange = function() 
	    {
	    
         	 if (request.readyState == 4) 
             {
    		    var xmlDoc = request.responseXML;
    		 
   		        var points = xmlDoc.documentElement.getElementsByTagName("city_"+iWojId);
	    		
			  
			    maxLat = parseFloat(points[0].getAttribute("latMax"));
			    maxiLng = parseFloat(points[0].getAttribute("lngMax"));
		        minLat = parseFloat(points[0].getAttribute("latMini"));
			    miniLng = parseFloat(points[0].getAttribute("lngMini"));
			 
				srLng = (maxiLng + miniLng)/2;

				srLat = (maxLat + minLat)/2;
				
			
					var aktualne_wyszukiwarki=[];

  		var aktualne_klucze = [];

  		for(i=0;i<$('#iIloscWyszukiwarek').attr('value');i++)
  		{
   			 if($('#wyszukiwarka_'+i).attr('checked'))
    		{
     			 aktualne_wyszukiwarki[i]=$('#wyszukiwarka_'+i).attr('value');
     			 aktualne_klucze[i] = $('#key_wyszukiwarka_'+i).attr('value');
    
      
   			}
    		
  		}
  		
  		
  		for(i=0;i<$('#iIloscWyszukiwarek').attr('value');i++)
  		{
        
    	var status = $('#dane_wyszukiwarki_'+i).css("display"); 
                
			if(status != 'none')
			{
			//alert($('#wyszukiwarka_'+i).attr('value'));
			
				for(k=1;k<=$('#cecha_'+$('#wyszukiwarka_'+i).attr('value')).attr('value');k++)
				{
					tmpArray2 +=$('#wyszukiwarka_'+i).attr('value')+"|"+$('#cecha_'+$('#wyszukiwarka_'+i).attr('value')+'_'+k).attr('value')+"-"+$("#zaznaczone_"+$('#wyszukiwarka_'+i).attr('value')+"_"+$('#cecha_'+$('#wyszukiwarka_'+i).attr('value')+'_'+k).attr('value')).attr('value')+";"; 
				
				}
			
			}
    
 		 }
//	alert("ajax");
$('#tlo').css('display', "block");
	$.ajax({
   type: "POST",
   url: "ajaxindex.php?action=city&uid="+iWojId,
   //data: "tmp=1",
   data: "AktWysz="+aktualne_wyszukiwarki+"&AktKey="+aktualne_klucze+"&minLng="+miniLng+"&minLat="+minLat+"&maxLng="+maxiLng+"&maxLat="+maxLat+"&cechy="+tmpArray2+"&limit="+ilimit,
   success: function(data){
			//$('#op').html(data);
			
			//alert(data);
			//$('#pppp').html(data);
			var tmpsplit = new Array();
			var splitted1 = new Array();
			tmpsplit = data.split('*');
			//alert(tmpsplit[0]);
			datatable = tmpsplit[1];
			splitted = new Array;
				splitted = tmpsplit[0].split(':');
				//alert(splitted);
				/*for(i=1;i<splitted1.length;i++)
				{
					splitted[i-1] = splitted1[i];
				}*/
				//alert(splitted);
				tresc='';
				//l = parseFloat(splitted[0]) + 1;
				tresc = tmpsplit[2];
				//alert(l);
				//ll = splitted.splice(l, 1);
				//alert(ll);	
				//alert(splitted);
			
    			zoom1_nowy=mapa.getBoundsZoomLevel(new GLatLngBounds(new GLatLng(minLat, miniLng),new GLatLng(maxLat, maxiLng)));
	  			//if(zoom1 > 14){ zoom1 = 14; }
			 
			    mapaStart();
			    
			
    			//l = parseFloat(splitted[0]) + 1;
    		//	alert(tresc);
    			//$('#city').html(tresc);	
    	
    		
    				
    	
   }
 });
		  
		
			 
             }
                 
  	        
        }
 		request.send(null);
	
	
	
	
	
	


  //markery = [];
  //kategorie = [];
  }
}



function otworzMarker(id)  
{  
        if(markery.length-1<id)  
            return;  
        //markery[id].openInfoWindowHtml(+);  
        //	markery[id].openInfoWindowHtml("<div style='text-align:center;vertical-align:middle;float:left;'>"+markery[id].obrazek_maly+"</div><div style='padding-left:4px;font-weight:bold;font-size:10px;font-family: Verdana;width:400px;float:left;'>"+markery[id].tytul+"</div>"+'<div style="clear:both;padding-left:4px;font-weight:normal;font-size:10px;font-family: Verdana;width:400px;float:left;height:100px; overflow:auto;">'+html_entity_decode(markery[id].opis)+'</div><div style="clear:both;width:510px;text-align:right;margin-top:10px;font-family: Verdana;padding-top:5px;color:#750707;font-weight:bold;font-size:10px;border-top:1px solid #750707;"><form action="#" onSubmit="return trasa(this);return false;" class="mapa_form_gtrasa">Pokaż dojazd z <input type="hidden" name="marker" id="marker_id" value="'+id+'"><input type="text" style="border:1px solid #750707;font-size:12px;background-color:white; color:#750707;" id="marker_text" name="t" size="20"> <input style="font-size:12px;border:1px solid #750707;background-color:white; color:#750707;" type="submit" value="Pokaż"></form></div>');
	
        markery[id].openInfoWindowHtml("<div style='text-align:center;vertical-align:middle;float:left;'>"+markery[id].obrazek_maly+"</div><div style='float:left'><div style='padding-left:4px;font-weight:bold;font-size:10px;font-family: Verdana;width:250px;'><a target='_blank' href='"+$('#linki_'+markery[id].kategoria).attr('value')+"&id="+markery[id].id_wp+"' rel='nofollow'>"+html_entity_decode(markery[id].tytul)+"</a></div>"+'<div style="padding-left:4px;font-weight:normal;font-size:10px;font-family: Verdana;width:250px;height:50px; overflow:auto;">'+html_entity_decode(markery[id].opis)+'</div></div><div style="clear:both;width:360px;text-align:right;margin-top:10px;font-family: Verdana;padding-top:5px;color:#750707;font-weight:bold;font-size:10px;border-top:1px solid #750707;"><form action="#" onSubmit="return trasa(this);return false;" class="mapa_form_gtrasa">Get directions <input type="hidden" name="marker" id="marker_id" value="'+id+'"><input type="text" style="border:1px solid #750707;font-size:12px;background-color:white; color:#750707;" id="marker_text" name="t" size="20"> <input style="font-size:12px;border:1px solid #750707;background-color:white; color:#750707;" type="submit" value="Show"></form></div>');

}  

function getCechyList(iWyszukiwarkiId, iId)
{
		
  		if(!document.getElementById("wyszukiwarka_"+iId).checked)
     		{
			tmp34 = getLocation(iWyszukiwarkiId, "wyszukiwarka_"+iId ,"wysz_"+iId+"_"+iWyszukiwarkiId);	
		
		}
		else
		{
			tmp34 = true;
		}
		
  
  //$.get("ajaxindex.php", { action: "get_cechy", Wid: iWyszukiwarkiId, Cid: $('#iCityName').attr('value')},
  //	function(data){
  var tmp_marlen = markery.length;
    
  	//	$('#dane_wyszukiwarki_'+iWyszukiwarkiId).html(data);
  		if(tmp34)
  		{
		html = " ";
		
		
		
		
		
			liczba1000 = 0;
		        for(i=0; i<tmp_marlen; i++)   
    			{   
       				if(markery[i].kategoria == "wysz_"+iId+"_"+iWyszukiwarkiId)
       				{
        				liczba1000++;
        				if(markery[i].poz > 0)
        				{
        					html+='<li><img src="templates/images/gwiazdka.jpg" /> <a href="#" onclick="otworzMarker('+i+'); return false;"><strong>'+html_entity_decode(markery[i].tytul)+'</strong></a></li>'; 
						}
						else
						{
            				html+='<li><a href="#" onclick="otworzMarker('+i+'); return false;">'+html_entity_decode(markery[i].tytul)+'</a></li>';   
         				}
   			 		}  
			 
	      		} 
  	
  		if(liczba1000 == 0)
  		{
			html = 'Failure registry in selected area!';

		
			  
		}
  
		$('#dane_wyszukiwarki_lista_'+iId).html('<strong>Objects show on map:</strong><br /><br />'+html);
		  
	 	var status = $('#dane_wyszukiwarki_'+iId).css("display"); 
                
		if(status == 'none')
		{ 
			
			$('#lista_'+iId).html("[wrap]");
		  	$('#dane_wyszukiwarki_cechy_'+iId).html("<img src='templates/images/ajax-loader2.gif' />")
            $('#dane_wyszukiwarki_'+iId).slideDown(500); 
            $('#tlo').css('display', "block");
                    $.ajax({
  			 		type: "POST",
			 		url: "ajaxindex.php?action=getCechy",
   			 		data: "iWid="+iWyszukiwarkiId+"&iId="+$('#key_wyszukiwarka_'+iId).attr('value')+"&iIdW="+iId,
   			 		success: function(data)
    			 	{
					
				
			
					$('#dane_wyszukiwarki_cechy_'+iId).html(data)
			
			//	alert(data+"adasdasd");
			//splitted = data.split(":");
			
			
					$('#tlo').css('display', "none");
    			
    	
   			 		}
 				});
            }
			else
			{ 
                        $('#lista_'+iId).html("[expand]");
						$('#dane_wyszukiwarki_'+iId).hide(); 
                        tmpArray2 = '';
                        
            }	
    	}
  //	});
  
  		//if(navigator.appName == "Microsoft Internet Explorer")
		//{
		//  $('')
		//}
	
  
 
  
}
 

function deleteRow()
{
if($('#iCityName').attr('value') != 0)
	{
  kategorie = new Array();
  }
}

//function getDaneZWyszukiwarki(iWyszukiwarkiId)
//{
  
//}

function getCityList(iWojId)
{
	//alert(iWojId);
	if(iWojId != 0)
	{
  	//alert(iWojId);
  	markery = [];
  	center = '';
  	kategorie = [];
  	//pierwszy = 1;
  	//poczatek = 1;
//	$('#city').html("<img src='templates/images/ajax-loader2.gif' />");
	
	$('#tlo').css('display', "block");
		var request = GXmlHttp.create();
	    request.open("GET", "wojewodztwa.xml", true);
	    request.onreadystatechange = function() 
	    {
	    
         	 if (request.readyState == 4) 
             {
    		    var xmlDoc = request.responseXML;
    		 
   		        var points = xmlDoc.documentElement.getElementsByTagName("wojewodztwo_"+iWojId);
	    		
			   
			    maxLat = parseFloat(points[0].getAttribute("maxLat"));
			    maxiLng = parseFloat(points[0].getAttribute("maxLng"));
		        minLat = parseFloat(points[0].getAttribute("minLat"));
			    miniLng = parseFloat(points[0].getAttribute("minLng"));
			 //alert(maxLat);
				srLng = (maxiLng + miniLng)/2;

				srLat = (maxLat + minLat)/2;
				
			
					var aktualne_wyszukiwarki=[];

  		var aktualne_klucze = [];

  		for(i=0;i<$('#iIloscWyszukiwarek').attr('value');i++)
  		{
   			 if($('#wyszukiwarka_'+i).attr('checked'))
    		{
     			 aktualne_wyszukiwarki[i]=$('#wyszukiwarka_'+i).attr('value');
     			 aktualne_klucze[i] = $('#key_wyszukiwarka_'+i).attr('value');
    
      
   			}
    		
  		}
  		
  		
  		for(i=0;i<$('#iIloscWyszukiwarek').attr('value');i++)
  		{
        
    	var status = $('#dane_wyszukiwarki_'+i).css("display"); 
                
			if(status != 'none')
			{
			//alert($('#wyszukiwarka_'+i).attr('value'));
			
				for(k=1;k<=$('#cecha_'+$('#wyszukiwarka_'+i).attr('value')).attr('value');k++)
				{
					tmpArray2 +=$('#wyszukiwarka_'+i).attr('value')+"|"+$('#cecha_'+$('#wyszukiwarka_'+i).attr('value')+'_'+k).attr('value')+"-"+$("#zaznaczone_"+$('#wyszukiwarka_'+i).attr('value')+"_"+$('#cecha_'+$('#wyszukiwarka_'+i).attr('value')+'_'+k).attr('value')).attr('value')+";"; 
				
				}
			
			}
    
 		 }
//	alert("ajax");
$('#tlo').css('display', "block");
	$.ajax({
   type: "POST",
   url: "ajaxindex.php?action=city&uid="+iWojId,
   //data: "tmp=1",
   data: "AktWysz="+aktualne_wyszukiwarki+"&AktKey="+aktualne_klucze+"&minLng="+miniLng+"&minLat="+minLat+"&maxLng="+maxiLng+"&maxLat="+maxLat+"&cechy="+tmpArray2+"&limit="+ilimit,
   success: function(data){
			//$('#op').html(data);
			
			//alert(data);
			//$('#pppp').html(data);
			var tmpsplit = new Array();
			var splitted1 = new Array();
			tmpsplit = data.split('*');
			//alert(tmpsplit[0]);
			datatable = tmpsplit[1];
			splitted = new Array;
				splitted = tmpsplit[0].split(':');
				//alert(splitted);
				/*for(i=1;i<splitted1.length;i++)
				{
					splitted[i-1] = splitted1[i];
				}*/
				//alert(splitted);
				tresc='';
				//l = parseFloat(splitted[0]) + 1;
				tresc = tmpsplit[2];
				//alert(l);
				//ll = splitted.splice(l, 1);
				//alert(ll);	
				//alert(splitted);
			
    			zoom1=mapa.getBoundsZoomLevel(new GLatLngBounds(new GLatLng(minLat, miniLng),new GLatLng(maxLat, maxiLng)));
	  			if(zoom1 > 14){ zoom1 = 14; }
			 
			    mapaStart();
			
    			//l = parseFloat(splitted[0]) + 1;
    		//	alert(tresc);
    			$('#city').html(tresc);	
    	
    		
    				
    	
   }
 });
		  
		
			 
             }
                 
  	        
        }
 		request.send(null);
	
	
	
	
	
	


  //markery = [];
  //kategorie = [];
  }
}



function getWyszukiwarkaStatus(i)
{
  
  
  
  if($('#wyszukiwarka_'+i).attr('checked'))
  {
   
  // document.getElementById('wyszukiwarka_'+i).checked='true';
  }
  else
  {
  // document.getElementById('wyszukiwarka_'+i).checked="false";
  }
}




var time = 0;


function zoomendAction(overlay, point){
//alert("zoom");
	markery = [];
	clearTimeout(time);
	
	time = setTimeout("getLocation2()", 4000);

}  	



function odliczaj(o,sek){
o.innerHTML=sek
if(sek>0)setTimeout(function(){odliczaj(o,--sek)},1e3)
}


var zoom_pop;
function moveendAction(overlay, point){
	var bounds = mapa.getBounds();
	//tmpi = bounds.getNorthEast();
	
	tmpi = bounds.getCenter();
	//tt= [];
	//alert(center.lat()+" - "+tmpi.lat()+" zoom2:"+zoom2+" lat:"+Math.abs(center.lat()-tmpi.lat())+" lng:"+Math.abs(center.lng()-tmpi.lng()));
	
	//tt=parseString(northEast).split(",");
	
	//alert(tt[1]);
	
	//southWest = bounds.getSouthWest();
	//if(Math.abs(northEast.lat() - tmpi.lat()) > 0.1 && Math.abs(northEast.lat() - tmpi.lat()))
	//{
//	alert(zoom2);
//alert(tmp_gdir);
	if(tmp_gdir)
	{
		if(tmp_gdir == 1)
		{
		//	tmp_gdir = 0;
			zoom2 = mapa.getBoundsZoomLevel(bounds);
			center = bounds.getCenter();
		}
	}
else
{
	//alert('ok');
	//alert(center);
	if(center == undefined)
	{
		center = bounds.getCenter();
		//alert(center.lat()+' - '+tmpi.lat());
	}
	//alert(zoom2+" - "+mapa.getBoundsZoomLevel(bounds)+" - "+center);
	if(zoom2 >= 0 && zoom2 <=16 )
	{
	//alert(zoom2+' - '+mapa.getBoundsZoomLevel(bounds)+' - '+Math.abs(center.lat()-tmpi.lat()));
		//alert(zoom2+" - "+mapa.getBoundsZoomLevel(bounds)+center);
		if(zoom2 == mapa.getBoundsZoomLevel(bounds))
		{
		if(zoom2 == 7 && (Math.abs(center.lat()-tmpi.lat())>1.2 || Math.abs(center.lng()-tmpi.lng()) > 2.7))
		{
			markery = [];
			clearTimeout(time);
	
			time = setTimeout("getLocation2()", 4000);
	
			$('#info').html('Data will be loaded in <span id="sek"></span> seconds!!')
			odliczaj(document.getElementById('sek'),4) 
			$('#info').show();
		}
		
		
		if(zoom2 == 8 && ((Math.abs(center.lng()-tmpi.lng()) > 1.4 || Math.abs(center.lat()-tmpi.lat()) > 0.55 )))
		{
			markery = [];
			clearTimeout(time);
	
			time = setTimeout("getLocation2()", 4000);
	
			$('#info').html('Data will be loaded in <span id="sek"></span> seconds!!')
			odliczaj(document.getElementById('sek'),4) 
			$('#info').show();
		}
		
		if(zoom2 == 9 && ((Math.abs(center.lng()-tmpi.lng()) > 0.7 || Math.abs(center.lat()-tmpi.lat()) > 0.3 )))
		{
			markery = [];
			clearTimeout(time);
	
			time = setTimeout("getLocation2()", 4000);
	
			$('#info').html('Data will be loaded in <span id="sek"></span> seconds!!')
			odliczaj(document.getElementById('sek'),4) 
			$('#info').show();
		}
		
		if(zoom2 == 10 && ((Math.abs(center.lng()-tmpi.lng()) > 0.4 || Math.abs(center.lat()-tmpi.lat()) > 0.14 )))
		{
			markery = [];
			clearTimeout(time);
	
			time = setTimeout("getLocation2()", 4000);
	
			$('#info').html('Data will be loaded in <span id="sek"></span> seconds!!')
			odliczaj(document.getElementById('sek'),4) 
			$('#info').show();
		}
		if(zoom2 == 11 && ((Math.abs(center.lng()-tmpi.lng()) > 0.175 || Math.abs(center.lat()-tmpi.lat()) > 0.07 )))
		{
			markery = [];
			clearTimeout(time);
	
			time = setTimeout("getLocation2()", 4000);
	
			$('#info').html('Data will be loaded in <span id="sek"></span> seconds!!')
			odliczaj(document.getElementById('sek'),4) 
			$('#info').show();
		}
		if(zoom2 == 12 && ((Math.abs(center.lng()-tmpi.lng()) > 0.09 || Math.abs(center.lat()-tmpi.lat()) > 0.04 )))
		{
			markery = [];
			clearTimeout(time);
	
			time = setTimeout("getLocation2()", 4000);
	
			$('#info').html('Data will be loaded in <span id="sek"></span> seconds!!')
			odliczaj(document.getElementById('sek'),4) 
			$('#info').show();
		}
		if(zoom2 == 13 && ((Math.abs(center.lng()-tmpi.lng()) > 0.045 || Math.abs(center.lat()-tmpi.lat()) > 0.02 )))
		{
			markery = [];
			clearTimeout(time);
	
			time = setTimeout("getLocation2()", 4000);
	
			$('#info').html('Data will be loaded in <span id="sek"></span> seconds!!')
			odliczaj(document.getElementById('sek'),4) 
			$('#info').show();
		}
		
		if(zoom2 == 14 && ((Math.abs(center.lng()-tmpi.lng()) > 0.025 || Math.abs(center.lat()-tmpi.lat()) > 0.009 )))
		{
			markery = [];
			clearTimeout(time);
	
			time = setTimeout("getLocation2()", 4000);
	
			$('#info').html('Data will be loaded in <span id="sek"></span> seconds!!')
			odliczaj(document.getElementById('sek'),4) 
			$('#info').show();
		}
		
		if(zoom2 == 15 && ((Math.abs(center.lng()-tmpi.lng()) > 0.0125 || Math.abs(center.lat()-tmpi.lat()) > 0.0045 )))
		{
			markery = [];
			clearTimeout(time);
	
			time = setTimeout("getLocation2()", 4000);
	
			$('#info').html('Data will be loaded in <span id="sek"></span> seconds!!')
			odliczaj(document.getElementById('sek'),4) 
			$('#info').show();
		}
		
		if(zoom2 == 16 && ((Math.abs(center.lng()-tmpi.lng()) > 0.006 || Math.abs(center.lat()-tmpi.lat()) > 0.00225 )))
		{
			markery = [];
			clearTimeout(time);
	
			time = setTimeout("getLocation2()", 4000);
	
			$('#info').html('Data will be loaded in <span id="sek"></span> seconds!!')
			odliczaj(document.getElementById('sek'),4) 
			$('#info').show();
		}
		
		
		if(zoom2 == 17 && ((Math.abs(center.lng()-tmpi.lng()) > 0.003 || Math.abs(center.lat()-tmpi.lat()) > 0.0015 )))
		{
			markery = [];
			clearTimeout(time);
	
			time = setTimeout("getLocation2()", 4000);
	
			$('#info').html('Data will be loaded in <span id="sek"></span> seconds!!')
			odliczaj(document.getElementById('sek'),4) 
			$('#info').show();
		}
		
		
		
		if(zoom2 == 6 && ((Math.abs(center.lng()-tmpi.lng()) > 2.4 || Math.abs(center.lat()-tmpi.lat()) > 7.29 )))
		{
			//alert('zoom6');
			markery = [];
			clearTimeout(time);
	
			time = setTimeout("getLocation2()", 4000);
	
			$('#info').html('Data will be loaded in <span id="sek"></span> seconds!!')
			odliczaj(document.getElementById('sek'),4) 
			$('#info').show();
		
		}
		
		if(zoom2 == 5 && ((Math.abs(center.lng()-tmpi.lng()) > 4.8 || Math.abs(center.lat()-tmpi.lat()) > 14.58 )))
		{
			
			markery = [];
			clearTimeout(time);
	
			time = setTimeout("getLocation2()", 4000);
	
			$('#info').html('Data will be loaded in <span id="sek"></span> seconds!!')
			odliczaj(document.getElementById('sek'),4) 
			$('#info').show();
		
		}
		
		if(zoom2 == 4 && ((Math.abs(center.lng()-tmpi.lng()) > 9.6 || Math.abs(center.lat()-tmpi.lat()) > 29.16 )))
		{
			
			markery = [];
			clearTimeout(time);
	
			time = setTimeout("getLocation2()", 4000);
	
			$('#info').html('Data will be loaded in <span id="sek"></span> seconds!!')
			odliczaj(document.getElementById('sek'),4) 
			$('#info').show();
		
		}
		
		
		if(zoom2 == 3 && ((Math.abs(center.lng()-tmpi.lng()) > 19.2 || Math.abs(center.lat()-tmpi.lat()) > 58.32 )))
		{
			
			markery = [];
			clearTimeout(time);
	
			time = setTimeout("getLocation2()", 4000);
	
			$('#info').html('Data will be loaded in <span id="sek"></span> seconds!!')
			odliczaj(document.getElementById('sek'),4) 
			$('#info').show();
		
		}
		
		
		if(zoom2 == 2 && ((Math.abs(center.lng()-tmpi.lng()) > 38.4 || Math.abs(center.lat()-tmpi.lat()) > 116.64 )))
		{
			
			markery = [];
			clearTimeout(time);
	
			time = setTimeout("getLocation2()", 4000);
	
			$('#info').html('Data will be loaded in <span id="sek"></span> seconds!!')
			odliczaj(document.getElementById('sek'),4) 
			$('#info').show();
		
		}
		
		if(zoom2 == 1 && ((Math.abs(center.lng()-tmpi.lng()) > 78 || Math.abs(center.lat()-tmpi.lat()) > 234 )))
		{
			
			markery = [];
			clearTimeout(time);
	
			time = setTimeout("getLocation2()", 4000);
	
			$('#info').html('Data will be loaded in <span id="sek"></span> seconds!!')
			odliczaj(document.getElementById('sek'),4) 
			$('#info').show();
		
		}
		
		
		if(zoom2 == 0 && ((Math.abs(center.lng()-tmpi.lng()) > 160 || Math.abs(center.lat()-tmpi.lat()) > 468 )))
		{
			
			markery = [];
			clearTimeout(time);
	
			time = setTimeout("getLocation2()", 4000);
	
			$('#info').html('Data will be loaded in <span id="sek"></span> seconds!!')
			odliczaj(document.getElementById('sek'),4) 
			$('#info').show();
		
		}
		
		
		
		}
		else
		{
			markery = [];
			clearTimeout(time);
	
			time = setTimeout("getLocation2()", 4000);
	
			$('#info').html('Data will be loaded in <span id="sek"></span> seconds!!')
			odliczaj(document.getElementById('sek'),4) 
			$('#info').show();
		}
		
		
	}
	}
	
	//}
}  


//var tmpArray = [];
//var tmpArray2='';
function getLocation3(numer_wysz1, numer_wysz)
{
	kategorie = [];
	markery = [];

	tmpArray2 = '';

  for(i=0;i<$('#iIloscWyszukiwarek').attr('value');i++)
  {
  	
        //alert(numer_wysz1);
    	var status = $('#dane_wyszukiwarki_'+i).css("display"); 
                
		if(status != 'none')
		{
		
				for(k=1;k<=$('#cecha_'+i+"_"+$('#wyszukiwarka_'+i).attr('value')).attr('value');k++)
				{
					//alert(k);
			//	tmpArray2 +=$('#wyszukiwarka_'+i).attr('value')+"|"+$("#key_wyszukiwarka_"+i).attr('value')+"-"+$('#cecha_'+i+"_"+$('#wyszukiwarka_'+i).attr('value')+'_'+k).attr('value')+"-"+$("#zaznaczone_"+i+"_"+$('#wyszukiwarka_'+i).attr('value')+"_"+$('#cecha_'+i+"_"+$('#wyszukiwarka_'+i).attr('value')+'_'+k).attr('value')).attr('value')+";"; 
			//	alert(tmpArray2);
				tmpArray2 +=$('#wyszukiwarka_'+i).attr('value')+"|"+$("#key_wyszukiwarka_"+i).attr('value')+"-"+$('#cecha_'+i+"_"+$('#wyszukiwarka_'+i).attr('value')+'_'+k).attr('value')+"-"+$('#wartosc_'+i+'_'+$('#wyszukiwarka_'+i).attr('value')+'_'+k).attr('value')+";"; 
				
			//	alert(tmpArray2);
				//alert(i+' - '+$('#wyszukiwarka_'+i).attr('value')+' - '+k);
				
			//	alert($('#wartosc_'+i+'_'+$('#wyszukiwarka_'+i).attr('value')+'_'+k).attr('value'));
				//alert($('#wartosc_'+$('#wyszukiwarka_'+i).attr('value')+'_'+$("#key_wyszukiwarka_"+i).attr('value')+'_'+k).attr('value'));
				}
			
		}
    
  }
	
	
	//tmpArray[0] = numer_wysz;
//	for(i=1;i<=$('#cecha_'+numer_wysz).attr('value');i++)
//	{
//		tmpArray2 +=$('#cecha_'+numer_wysz+'_'+i).attr('value')+"-"+$("#zaznaczone_"+numer_wysz+"_"+$('#cecha_'+numer_wysz+'_'+i).attr('value')).attr('value')+";"; 
//		tmpArray[$('#cecha_'+numer_wysz+'_'+i).attr('value')]=$("#zaznaczone_"+numer_wysz+"_"+$('#cecha_'+numer_wysz+'_'+i).attr('value')).attr('value');
		//t+=$("#zaznaczone_"+numer_wysz+"_"+$('#cecha_'+numer_wysz+'_'+i).attr('value')).attr('value')+" - ";
//	}
	
	//alert(tmpArray2);
	
	getLocation2();

}



function get_html_translation_table(table, quote_style) {
    // http://kevin.vanzonneveld.net
    // +   original by: Philip Peterson
    // +    revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   bugfixed by: noname
    // %          note: It has been decided that we're not going to add global
    // %          note: dependencies to php.js. Meaning the constants are not
    // %          note: real constants, but strings instead. integers are also supported if someone
    // %          note: chooses to create the constants themselves.
    // %          note: Table from http://www.the-art-of-web.com/html/character-codes/
    // *     example 1: get_html_translation_table('HTML_SPECIALCHARS');
    // *     returns 1: {'"': '&quot;', '&': '&amp;', '<': '&lt;', '>': '&gt;'}
    
    var entities = {}, histogram = {}, decimal = 0, symbol = '';
    var constMappingTable = {}, constMappingQuoteStyle = {};
    var useTable = {}, useQuoteStyle = {};
    
    useTable      = (table ? table.toUpperCase() : 'HTML_SPECIALCHARS');
    useQuoteStyle = (quote_style ? quote_style.toUpperCase() : 'ENT_COMPAT');
    
    // Translate arguments
    constMappingTable[0]      = 'HTML_SPECIALCHARS';
    constMappingTable[1]      = 'HTML_ENTITIES';
    constMappingQuoteStyle[0] = 'ENT_NOQUOTES';
    constMappingQuoteStyle[2] = 'ENT_COMPAT';
    constMappingQuoteStyle[3] = 'ENT_QUOTES';
    
    // Map numbers to strings for compatibilty with PHP constants
    if (!isNaN(useTable)) {
        useTable = constMappingTable[useTable];
    }
    if (!isNaN(useQuoteStyle)) {
        useQuoteStyle = constMappingQuoteStyle[useQuoteStyle];
    }
    
    if (useTable == 'HTML_SPECIALCHARS') {
        // ascii decimals for better compatibility
        entities['38'] = '&amp;';
        entities['60'] = '&lt;';
        entities['62'] = '&gt;';
    } else if (useTable == 'HTML_ENTITIES') {
        // ascii decimals for better compatibility
      entities['38'] = '&amp;';
      entities['60'] = '&lt;';
      entities['62'] = '&gt;';
      entities['160'] = '&nbsp;';
      entities['161'] = '&iexcl;';
      entities['162'] = '&cent;';
      entities['163'] = '&pound;';
      entities['164'] = '&curren;';
      entities['165'] = '&yen;';
      entities['166'] = '&brvbar;';
      entities['167'] = '&sect;';
      entities['168'] = '&uml;';
      entities['169'] = '&copy;';
      entities['170'] = '&ordf;';
      entities['171'] = '&laquo;';
      entities['172'] = '&not;';
      entities['173'] = '&shy;';
      entities['174'] = '&reg;';
      entities['175'] = '&macr;';
      entities['176'] = '&deg;';
      entities['177'] = '&plusmn;';
      entities['178'] = '&sup2;';
      entities['179'] = '&sup3;';
      entities['180'] = '&acute;';
      entities['181'] = '&micro;';
      entities['182'] = '&para;';
      entities['183'] = '&middot;';
      entities['184'] = '&cedil;';
      entities['185'] = '&sup1;';
      entities['186'] = '&ordm;';
      entities['187'] = '&raquo;';
      entities['188'] = '&frac14;';
      entities['189'] = '&frac12;';
      entities['190'] = '&frac34;';
      entities['191'] = '&iquest;';
      entities['192'] = '&Agrave;';
      entities['193'] = '&Aacute;';
      entities['194'] = '&Acirc;';
      entities['195'] = '&Atilde;';
      entities['196'] = '&Auml;';
      entities['197'] = '&Aring;';
      entities['198'] = '&AElig;';
      entities['199'] = '&Ccedil;';
      entities['200'] = '&Egrave;';
      entities['201'] = '&Eacute;';
      entities['202'] = '&Ecirc;';
      entities['203'] = '&Euml;';
      entities['204'] = '&Igrave;';
      entities['205'] = '&Iacute;';
      entities['206'] = '&Icirc;';
      entities['207'] = '&Iuml;';
      entities['208'] = '&ETH;';
      entities['209'] = '&Ntilde;';
      entities['210'] = '&Ograve;';
      entities['211'] = '&Oacute;';
      entities['212'] = '&Ocirc;';
      entities['213'] = '&Otilde;';
      entities['214'] = '&Ouml;';
      entities['215'] = '&times;';
      entities['216'] = '&Oslash;';
      entities['217'] = '&Ugrave;';
      entities['218'] = '&Uacute;';
      entities['219'] = '&Ucirc;';
      entities['220'] = '&Uuml;';
      entities['221'] = '&Yacute;';
      entities['222'] = '&THORN;';
      entities['223'] = '&szlig;';
      entities['224'] = '&agrave;';
      entities['225'] = '&aacute;';
      entities['226'] = '&acirc;';
      entities['227'] = '&atilde;';
      entities['228'] = '&auml;';
      entities['229'] = '&aring;';
      entities['230'] = '&aelig;';
      entities['231'] = '&ccedil;';
      entities['232'] = '&egrave;';
      entities['233'] = '&eacute;';
      entities['234'] = '&ecirc;';
      entities['235'] = '&euml;';
      entities['236'] = '&igrave;';
      entities['237'] = '&iacute;';
      entities['238'] = '&icirc;';
      entities['239'] = '&iuml;';
      entities['240'] = '&eth;';
      entities['241'] = '&ntilde;';
      entities['242'] = '&ograve;';
      entities['243'] = '&oacute;';
      entities['244'] = '&ocirc;';
      entities['245'] = '&otilde;';
      entities['246'] = '&ouml;';
      entities['247'] = '&divide;';
      entities['248'] = '&oslash;';
      entities['249'] = '&ugrave;';
      entities['250'] = '&uacute;';
      entities['251'] = '&ucirc;';
      entities['252'] = '&uuml;';
      entities['253'] = '&yacute;';
      entities['254'] = '&thorn;';
      entities['255'] = '&yuml;';
    } else {
        throw Error("Table: "+useTable+' not supported');
        return false;
    }
    
    if (useQuoteStyle != 'ENT_NOQUOTES') {
        entities['34'] = '&quot;';
    }
    
    if (useQuoteStyle == 'ENT_QUOTES') {
        entities['39'] = '&#039;';
    }
    
    // ascii decimals to real symbols
    for (decimal in entities) {
        symbol = String.fromCharCode(decimal)
        histogram[symbol] = entities[decimal];
    }
    
    return histogram;
}

function getCechaStatus(numer_wysz1, numer_wysz, id100, id_c, jt)
{

	//alert(numer_wysz1+' - '+numer_wysz+' - '+id_c);
	tmp_id = $('#zaznaczone_'+numer_wysz1+"_"+numer_wysz+"_"+id_c).attr('value');
	//alert(tmp_id);
	//alert($('#key_wyszukiwarka_'+numer_wysz1).attr('value'));
	//if($('#key_wyszukiwarka_'+numer_wysz1).attr('value') == 6)
	//{
	//	tmp_id=0;
	//}
	if(parseFloat(tmp_id) && $('#key_wyszukiwarka_'+numer_wysz1).attr('value') != 6)
	{
		$.ajax({
   		type: "POST",
   		url: "ajaxindex.php?action=cechaStatus",
   		//data: "tmp=1",
   		data: "id_cechy="+tmp_id+"&id_tab="+$('#key_wyszukiwarka_'+numer_wysz1).attr('value'),
   		success: function(data){
				
				var tmpttt = new Array();
				tmpttt = data.split(';');
				//alert(tmpttt[0]);
				if(parseFloat(tmpttt[0]) != 0)
				{
					//alert("lecimy dalej");
					var akt_pod;
					akt_pod = 1;
					getpodcechy(numer_wysz1, numer_wysz, id100, id_c, jt, akt_pod);
					
					
					
				}
				else
				{
					if(parseFloat(tmpttt[1]))
					{
						status_rel = 1;
						tmp_id = tmp_id;
					}
					else
					{
						status_rel = 0;
					}
					$('#wartosc_'+numer_wysz1+"_"+numer_wysz+"_"+jt).attr('value', tmp_id);
					
					//alert($('#wartosc_'+numer_wysz1+"_"+numer_wysz+"_"+jt).attr('value'));
					//alert($('#cecha_'+numer_wysz1+"_"+numer_wysz+"_"+jt).attr('value'));
				//	$('#zaznaczone_'+numer_wysz1+"_"+numer_wysz+"_"+id_c).attr('value', tmp_id);
					//$('#cecha_'+numer_wysz1+"_"+numer_wysz+"_"+jt).attr('value') =  tmp_id; 
					$('#kolor_'+numer_wysz1+"_"+numer_wysz+"_"+jt+'_1').css("color", "white");
					$('#podcecha_'+numer_wysz1+"_"+numer_wysz+"_"+jt+'_1').html(" ");
					getLocation3(numer_wysz1, numer_wysz);
				}
				
    	
   		}
 		});
	//alert(numer_wysz1+" - "+numer_wysz+" - "+tmp_id);
	}
	else
	{
		$('#kolor_'+numer_wysz1+"_"+numer_wysz+"_"+jt+'_1').css("color", "white");
					$('#podcecha_'+numer_wysz1+"_"+numer_wysz+"_"+jt+'_1').html(" ");
		$('#wartosc_'+numer_wysz1+"_"+numer_wysz+"_"+jt).attr('value', tmp_id);
		getLocation3(numer_wysz1, numer_wysz);
	}

}

function getpodcechy(numer_wysz1, numer_wysz, id100, id_c, jt, akt_pod)
{

					$.ajax({
   					type: "POST",
   					url: "ajaxindex.php?action=getDataCecha",
   					//data: "tmp=1",
   					data: "id_cechy="+tmp_id+"&id_tab="+$('#key_wyszukiwarka_'+numer_wysz1).attr('value')+'&iId='+$('#key_wyszukiwarka_'+numer_wysz1).attr('value')+"&iIdW="+numer_wysz1+"&iWid="+numer_wysz+"&j="+jt+"&akt_pod="+akt_pod,
   					success: function(data){
				
						
						//alert(data);
						$('#kolor_'+numer_wysz1+"_"+numer_wysz+"_"+jt+'_'+akt_pod).css("color", "black");
						$('#podcecha_'+numer_wysz1+"_"+numer_wysz+"_"+jt+'_'+akt_pod).html(data);
    	
   					}
 					});

}

function getCechaStatus2(numer_wysz1, numer_wysz, id100, id_c, jt, akt_pod)
{
/*alert(akt_pod);
	$('#podcecha_'+numer_wysz1+"_"+numer_wysz+"_"+jt+'_'+akt_pod).html('asdasdas');
	tmp_id = $('#zaznaczone_'+numer_wysz1+"_"+numer_wysz+"_"+id_c).attr('value');
	//alert(tmp_id);
alert($('#cecha_'+numer_wysz1+"_"+numer_wysz+"_"+jt).attr('value'));
	alert(numer_wysz1+" - "+numer_wysz+" - "+tmp_id);*/
	
	
	//alert(jt);
		tmp_id = $('#zaznaczone_'+numer_wysz1+"_"+numer_wysz+"_"+id_c+"_"+akt_pod).attr('value');
	
	//alert(tmp_id);
	if(parseFloat(tmp_id))
	{
		$.ajax({
   		type: "POST",
   		url: "ajaxindex.php?action=cechaStatus",
   		//data: "tmp=1",
   		data: "id_cechy="+tmp_id+"&id_tab="+$('#key_wyszukiwarka_'+numer_wysz1).attr('value')+'&akt_pod='+akt_pod,
   		success: function(data){
				
			//$('#op').html(data);
				var tmpttt = new Array();
				tmpttt = data.split(';');
				//alert(tmpttt[0]);
				if(parseFloat(tmpttt[0]) != 0)
				{
				
					var akt_pod;
					akt_pod = 1;
					getpodcechy(numer_wysz1, numer_wysz, id100, id_c, jt, akt_pod);
					
					
					
				}
				else
				{
					if(parseFloat(tmpttt[1]))
					{
						status_rel = 1;
						tmp_id = tmp_id;
					}
					else
					{
						status_rel = 0;
					}
					
				//	alert(tmp_id);
					$('#wartosc_'+numer_wysz1+"_"+numer_wysz+"_"+jt).attr('value', tmp_id);
					
					//alert($('#wartosc_'+numer_wysz1+"_"+numer_wysz+"_"+jt).attr('value'));
					//alert($('#cecha_'+numer_wysz1+"_"+numer_wysz+"_"+jt).attr('value'));
				//	$('#zaznaczone_'+numer_wysz1+"_"+numer_wysz+"_"+id_c).attr('value', tmp_id);
					//$('#cecha_'+numer_wysz1+"_"+numer_wysz+"_"+jt).attr('value') =  tmp_id; 
					
					
					$('#kolor_'+numer_wysz1+"_"+numer_wysz+"_"+jt+'_'+(akt_pod+1)).css("color", "white");
					$('#podcecha_'+numer_wysz1+"_"+numer_wysz+"_"+jt+'_'+(akt_pod+1)).html(" ");
					getLocation3(numer_wysz1, numer_wysz, tmp_id);
				}
				
    	
   		}
 		});
	//alert(numer_wysz1+" - "+numer_wysz+" - "+tmp_id);
	}
	else
	{
		$('#kolor_'+numer_wysz1+"_"+numer_wysz+"_"+jt+'_'+(akt_pod+1)).css("color", "white");
					$('#podcecha_'+numer_wysz1+"_"+numer_wysz+"_"+jt+'_'+(akt_pod+1)).html(" ");
		getLocation3(numer_wysz1, numer_wysz, tmp_id);
	}


}



function getLocation4(numer_wysz1, numer_wysz, tmp_id)
{
	kategorie = [];
	markery = [];

//	tmpArray = [];
//	tmpArray2 = numer_wysz+':';
	//alert($('#cecha').attr('value'));
	//t=numer_wysz+'-';
	
	tmpArray2 = '';
	// var aktualne_wyszukiwarki=[];
  //alert($('#iIloscWyszukiwarek').attr('value'));
  
  //aktualne_wyszukiwarki = '';
  for(i=0;i<$('#iIloscWyszukiwarek').attr('value');i++)
  {
  	
        //alert(numer_wysz1);
    	var status = $('#dane_wyszukiwarki_'+i).css("display"); 
                
		if(status != 'none')
		{
			//alert($('#wyszukiwarka_'+i).attr('value'));
		//	alert("i="+i);
		//	alert("k="+k);
		//	alert("liczba cech="+$("#key_wyszukiwarka_"+i).attr('value'));
				for(k=1;k<=$('#cecha_'+i+"_"+$('#wyszukiwarka_'+i).attr('value')).attr('value');k++)
				{
					//alert(k);
					tmpArray2 +=$('#wyszukiwarka_'+i).attr('value')+"|"+$("#key_wyszukiwarka_"+i).attr('value')+"-"+$('#cecha_'+i+"_"+$('#wyszukiwarka_'+i).attr('value')+'_'+k).attr('value')+"-"+$("#zaznaczone_"+i+"_"+$('#wyszukiwarka_'+i).attr('value')+"_"+$('#cecha_'+i+"_"+$('#wyszukiwarka_'+i).attr('value')+'_'+k).attr('value')).attr('value')+";"; 
					
					//alert($('#wyszukiwarka_'+i).attr('value')+' - '+$("#key_wyszukiwarka_"+i).attr('value')+' - '+$('#wyszukiwarka_'+i).attr('value')+'_'+k);
					//z=$('#wartosc_'+$('#wyszukiwarka_'+i).attr('value')+'_'+$("#key_wyszukiwarka_"+i).attr('value')+'_'+$('#wyszukiwarka_'+i).attr('value')+'_'+k).attr('value');
					
					//alert(z);
					//tmpArray2 +=$('#wyszukiwarka_'+i).attr('value')+"|"+$("#key_wyszukiwarka_"+i).attr('value')+"-"+$('#cecha_'+i+"_"+$('#wyszukiwarka_'+i).attr('value')+'_'+k).attr('value')+"-"+$('#wartosc_'+$('#wyszukiwarka_'+i).attr('value')+'_'+$("#key_wyszukiwarka_"+i).attr('value')+'_'+$('#wyszukiwarka_'+i).attr('value')+'_'+k).attr('value')+";"; 
			
					//alert($('#cecha_'+numer_wysz1+"_"+$('#wyszukiwarka_'+i).attr('value')+'_'+k).attr('value'));
					//alert(numer_wysz1+" - "+ k);
					
				//	alert(tmpArray2);
				}
			
		}
    
  }
	
	
	//tmpArray[0] = numer_wysz;
//	for(i=1;i<=$('#cecha_'+numer_wysz).attr('value');i++)
//	{
//		tmpArray2 +=$('#cecha_'+numer_wysz+'_'+i).attr('value')+"-"+$("#zaznaczone_"+numer_wysz+"_"+$('#cecha_'+numer_wysz+'_'+i).attr('value')).attr('value')+";"; 
//		tmpArray[$('#cecha_'+numer_wysz+'_'+i).attr('value')]=$("#zaznaczone_"+numer_wysz+"_"+$('#cecha_'+numer_wysz+'_'+i).attr('value')).attr('value');
		//t+=$("#zaznaczone_"+numer_wysz+"_"+$('#cecha_'+numer_wysz+'_'+i).attr('value')).attr('value')+" - ";
//	}
	
	//alert(tmpArray2);
	
	getLocation2();

}


function html_entity_decode( string, quote_style ) {
    // http://kevin.vanzonneveld.net
    // +   original by: john (http://www.jd-tech.net)
    // +      input by: ger
    // +   improved by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +    revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   bugfixed by: Onno Marsman
    // +   improved by: marc andreu
    // +    revised by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // -    depends on: get_html_translation_table
    // *     example 1: html_entity_decode('Kevin &amp; van Zonneveld');
    // *     returns 1: 'Kevin & van Zonneveld'
 
    var histogram = {}, symbol = '', tmp_str = '', i = 0;
    tmp_str = string.toString();
    
    if (false === (histogram = get_html_translation_table('HTML_ENTITIES', quote_style))) {
        return false;
    }
    
    for (symbol in histogram) {
        entity = histogram[symbol];
        tmp_str = tmp_str.split(entity).join(symbol);
    }
    
    return tmp_str;
}

