	var tresc_maila = '';	var stan_tiny = 0;			var http_tiny = false;	var odp_tiny = " please , be patient ";	var kontener_tiny = 'witam';	var my_newsletter_mail = '';//-------------- funkcje realizujace wielokrotne zapytania ajaksowe ---------/*definiuję, a w zasadzie deklaruje tablice zmiennych i zmienne do wielokrotnych zapytan ajaksowych*/var stan_request = true;var timer_request = [];var i_request = 0;var pytania = [];var pr = [];var box_request = [];var url_request = [];var murzyn_request = [];//---------------- funkcje kodujące utfvar Utf8 = { 	// public method for url encoding	encode : function (string) {		string = string.replace(/\r\n/g,"\n");		var utftext = ""; 		for (var n = 0; n < string.length; n++) { 			var c = string.charCodeAt(n); 			if (c < 128) {				utftext += String.fromCharCode(c);			}			else if((c > 127) && (c < 2048)) {				utftext += String.fromCharCode((c >> 6) | 192);				utftext += String.fromCharCode((c & 63) | 128);			}			else {				utftext += String.fromCharCode((c >> 12) | 224);				utftext += String.fromCharCode(((c >> 6) & 63) | 128);				utftext += String.fromCharCode((c & 63) | 128);			} 		} 		return utftext;	}, 	// public method for url decoding	decode : function (utftext) {		var string = "";		var i = 0;		var c = c1 = c2 = 0; 		while ( i < utftext.length ) { 			c = utftext.charCodeAt(i); 			if (c < 128) {				string += String.fromCharCode(c);				i++;			}			else if((c > 191) && (c < 224)) {				c2 = utftext.charCodeAt(i+1);				string += String.fromCharCode(((c & 31) << 6) | (c2 & 63));				i += 2;			}			else {				c2 = utftext.charCodeAt(i+1);				c3 = utftext.charCodeAt(i+2);				string += String.fromCharCode(((c & 15) << 12) | ((c2 & 63) << 6) | (c3 & 63));				i += 3;			} 		} 		return string;	} }//--------- funkcja podstawowa -------------------------function makeRequest(box_name, goto_url) {/*funkcja ustawia wartosci poczatkowe dla wszystkich zmiennych i pojemnikow na pojedyncze zapytanie ajaksoweoraz nagdaje mu indeks i_request*/timer_request[i_request] = false;box_request[i_request] = box_name;url_request[i_request] = goto_url;boo = document.getElementById(box_request[i_request]);boo.innerHTML = preloader();pytam_sie(i_request);i_request++;}//---------- funkcja wlaczajaca pytanie -------function pytam_sie(nr) {/*jesli przychodzi na nie kolejka, tzn. stan_request jest true, funkcja wykonuje zapytanie, jesli nie wlacza opoznienie i czeka za przyjdzie na nia czas */	if(stan_request == true) {		stan_request = false;		clearInterval(timer_request[nr])		wykonuje_pytanie(nr);	}	else	{		if(timer_request[nr] == false) {		czekam(nr);		}	}}function czekam(nr) {timer_request[nr] = self.setInterval("pytam_sie("+ nr +")", 50);}function wykonuje_pytanie(nr) {		murzyn_request[nr] = document.getElementById(box_request[nr]);		murzyn_request[nr].innerHTML = preloader();		pr[nr] = new Ajax.Request(url_request[nr], 		 {   			method:'post',    			onSuccess: function(transport){     			 var response = transport.responseText || "no response text";     				murzyn_request[nr].innerHTML = response;				stan_request = true;    			},    				onFailure: function(){ alert('brak polaczenia...'); stan_request = true; }  		});		} //--------- preloader : np. gif -----------function preloader() {return "<center><div style='width:60px; height:200px; background: url(image/preloader.gif) center center no-repeat'></div></center>";}//-xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx  mapy  xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx			var pytanie_mapa = false;		var odpowiedz_mapa;		function makeRequest_mapa(url) {			elm = document.getElementById(box);			elm.innerHTML = "<p style='text-align:center'><img src='image/load_video.gif' alt='logo' /></p>";			new Ajax.Request(url, 		 	{   				 method:'post',    				onSuccess: function(transport){     								 var response = transport.responseText || "no response text";     								 str = response;								arr = str.split(',');								lt=parseFloat(arr[0]);								lng=parseFloat(arr[1]);								point = new GLatLng(lt,lng);								marker = new GMarker(point);								mapka.addOverlay(marker);    								},    				onFailure: function(){ alert('brak polaczenia...') }  			});		}			function pinfo(ltt, lnt, tytul) {			myHtml = tytul			pkt = new GLatLng(ltt, lnt);			mapka.openInfoWindow(pkt, myHtml);			document.location.href='#gmapa'		}// -----------------------------ajax  tiny ---------------						function makeRequest_tiny(box,url) {		odp_tiny = kontener_tiny;        http_tiny = false;        if (window.XMLHttpRequest) { // Mozilla, Safari,...            http_tiny = new XMLHttpRequest();            if (http_tiny.overrideMimeType) {                http_tiny.overrideMimeType('text/xml');            }        } 				else if (window.ActiveXObject) { // IE            try {                http_tiny = new ActiveXObject("Msxml2.XMLHTTP");            } catch (e) {                try {                    http_tiny = new ActiveXObject("Microsoft.XMLHTTP");                } catch (e) {}            }        }		        if (!http_tiny) {            alert('sorry, critical error :(instantion object XMLHTTP not create');            return false;        }        http_tiny.onreadystatechange = function() { alertContents_tiny(http_tiny,box); laduj_tiny() ;};        http_tiny.open('POST', url, true);        http_tiny.send(null);    }		    function alertContents_tiny(http_zm,box) {		x = document.getElementById(box)		odp_tiny = kontener_tiny;		if (http_zm.readyState == 4) {            if (http_zm.status == 200) {                odp_tiny = http_zm.responseText;            } else {                odp_tiny = 'problem with ajax question';            }        }		kontener_tiny = ""		x.innerHTML = odp_tiny	}		// -------------------  maile ------------	function faktury_mail_do(author, event) {		okno = document.getElementById('admin_window')		makeRequest_tiny('admin_window','edytor_maili.php?odbiorca=' + author)		okno.style.display = 'block'		okno.style.top = '50px'	}		function wyslij_maila(elm) {	tab = elm.getElementsByTagName('input')	nazwa = tab[0].name	kolekcja = '';	for(i =0; i < (tab.length - 1); i++) {	kolekcja = kolekcja + '&' + tab[i].name + '=' + tab[i].value 	}	tresc = ajaxSave();	kolekcja = kolekcja + '&content_m=' + escape(tresc_maila)	adres = 'edytor_maili.php?'+ kolekcja + '&wyslano=1'	makeRequest('admin_window', adres);	}			//----------------- obsluga admin_window -------------function ukryj_admin() {var ek = document.getElementById('admin_window' );ek.style.display = 'none'//ek.innerHTML = ''if(document.forms[1]) {ukryj_tiny()}}		function submitForm() {	//make sure hidden and iframe values are in sync for all rtes before submitting form	updateRTEs();	//change the following line to true to submit form	return false;}function laduj_tiny() {if(!document.getElementById('content_m' )) {return false;}if(!stan_tiny) {tresc_maila = '';tinyMCE.init({mode : "textareas",theme : "advanced"}) } else {laduj_ponownie(); } } function ajaxLoad() {var ed = tinyMCE.get('content_m'); // Do you ajax call here, window.setTimeout fakes ajax called.setProgressState(1); // Show progresswindow.setTimeout(function() {ed.setProgressState(0); // Hide progressed.setContent('HTML content that got passed from server.');}, 3000);}  function laduj_ponownie() { document.forms[1].innerHTML = '<textarea id="content_m" name="content_m"></textarea>';tinyMCE.execCommand('mceAddControl',false,'content_m'); } function ukryj_tiny() {tinyMCE.execCommand('mceRemoveControl',false,'content_m');//document.forms[1].innerHTML = 'Text!'; }  function ajaxSave() {var ed = tinyMCE.get('content_m');tresc_maila = ed.getContent();ukryj_tiny()}	function tiny_do_edytora(elm) {var ed;if(ed = tinyMCE.get('content_m')) {var textutf = ed.getContent();elm.value = Utf8.encode(textutf);zamien_na_jedne(my_string);ukryj_tiny();}}//------------------------------------- szukacz projektow  ---			var hunts = Array();		function wybierz(elm) {		/*		push() //dodaje element do tablicy		slice() //usuwa okreslony element z tablicy		valueOf() //wywala tablice		*/			if(elm.style.color == 'black') {				elm.style.color = 'red'				hunts.push(elm.value)			}			else			{				elm.style.color = 'black'				//usun z tablicy element, ktory ma taka wartosc jak ten element				for(i =0; i < hunts.length ; i++) {				if(hunts[i] == elm.value)				kosz = hunts.splice(i,1)				}			}		}				function zeruj_hunts() {		adres = 'hunter.php?szukaj_pr=1&hunter_view=' + hunts.valueOf()		makeRequest('szukacz', adres)		hunts.length = 0;		}				function wysun_szukacza() {	az = document.getElementById('azor')	az.style.width = '605px'	az.style.left = '-640px'	az.style.padding = '5px'	az.style.paddingLeft = '30px'	}		function close_s() {	az = document.getElementById('azor')	az.style.width = '0px'	az.style.left = '0px'	az.style.padding = '0px'	az.style.paddingLeft = '0px'	az.innerHTML = '';	}	//------------------------------------------------  przenoszenie okna ---------------------------------		var draggable_admin = false;	var mouse_adminX, mouse_adminY, drawn_adminX, drawn_adminY;	var box_admin;		document.onmousemove = watchMouse_admin;		function watchMouse_admin(e) {	if(document.getElementById('drag_admin')) {	box_admin = document.getElementById('drag_admin') ;	}  // za³aczenie pozycji ekranu przegl¹darki, aby policzyæ pozycjê okienka  var sx = window.scrollX || document.documentElement.scrollLeft|| 0;  var sy = window.scrollY || document.documentElement.scrollTop|| 0;  if(!e) e = window.event; // pieprzone IE  mouse_adminX = e.clientX + sx;  mouse_adminY = e.clientY + sy; if(draggable_admin == true) { // przenoszenie okna  box_admin.style.left= (mouse_adminX - drawn_adminX) + 'px';  box_admin.style.top = (mouse_adminY - drawn_adminY) + 'px'; }}function drag_admin_start(e) { //oblicznie pozycji oknazz	if(document.getElementById('drag_admin')) {	box_admin = document.getElementById('drag_admin') ;	} draggable_admin = true;// wylaczanie wszuystkich funkcji na czas przenoszenia okna if(e.cancelable) { e.preventDefault(); } if(window.event) { box_admin.onselectstart = new Function('return false'); }   // za³aczenie pozycji ekranu przegl¹darki, aby policzyæ pozycjê okienka  var sx = window.scrollX || document.documentElement.scrollLeft|| 0;  var sy = window.scrollY || document.documentElement.scrollTop|| 0;  if(!e) e = window.event; // pieprzone IE  mouse_adminX = e.clientX + sx;  mouse_adminY = e.clientY + sy;  drawn_adminX = mouse_adminX - parseInt(box_admin.style.left); drawn_adminY = mouse_adminY - parseInt(box_admin.style.top); // przenioszenie okna box_admin.onmouseup = function() { draggable_admin = false; }} // Resizes the map's width and height by the given increment function dodomu() {  box_admin.style.top = '0px'  box_admin.style.left = '0px' } 	    function okno_glosa(nr,baza) {		okno = document.getElementById('admin_window');		makeRequest('admin_window','edytuj_glosa.php?id=' + nr + '&baza=' + baza);		okno.style.display = 'block';		if(sy = window.scrollY ) {		okno.style.top = (sy + 20) + 'px';		}		else if(sy = document.documentElement.scrollTop) {		okno.style.top = (sy + 20) + 'px';		}		else		{		okno.style.top = '20px';		}			} function okno_comment(nr,baza) {		okno = document.getElementById('admin_window')		makeRequest('admin_window','edytuj_comment.php?id=' + nr + '&baza=' + baza)		okno.style.display = 'block';		if(sy = window.scrollY ) {		okno.style.top = (sy + 20) + 'px'		}		else if(sy = document.documentElement.scrollTop) {		okno.style.top = (sy + 20) + 'px'		}		else		{		okno.style.top = '20px'		}	}function zmien_obrazek(rodzaj,nr,baza) {		okno = document.getElementById('admin_window')		makeRequest('admin_window','zmien_obrazek.php?id=' + nr + '&baza=' + baza + "&rodzaj=" + rodzaj)		okno.style.display = 'block';		if(sy = window.scrollY ) {		okno.style.top = (sy + 20) + 'px'		}		else if(sy = document.documentElement.scrollTop) {		okno.style.top = (sy + 20) + 'px'		}		else		{		okno.style.top = '20px'		}	}function wymien_obrazek(obrazek) {		okno = document.getElementById('admin_window')		makeRequest('admin_window','zmien_obrazek_menu.php?obrazek='+obrazek)		okno.style.display = 'block';		if(sy = window.scrollY ) {		okno.style.top = (sy + 20) + 'px'		}		else if(sy = document.documentElement.scrollTop) {		okno.style.top = (sy + 20) + 'px'		}		else		{		okno.style.top = '20px'		}						} function okno_intervencja_add(nr) {		okno = document.getElementById('admin_window')		makeRequest('admin_window','dodaj_intervencja.php?id=' + nr + '&baza=straznicy')		okno.style.display = 'block';		if(sy = window.scrollY ) {		okno.style.top = (sy + 20) + 'px'		}		else if(sy = document.documentElement.scrollTop) {		okno.style.top = (sy + 20) + 'px'		}		else		{		okno.style.top = '20px'		}	}	 function okno_intervencja_edit(nr) {		okno = document.getElementById('admin_window')		makeRequest('admin_window','edit_intervencja.php?id=' + nr + '&baza=straznicy')		okno.style.display = 'block';		if(sy = window.scrollY ) {		okno.style.top = (sy + 20) + 'px'		}		else if(sy = document.documentElement.scrollTop) {		okno.style.top = (sy + 20) + 'px'		}		else		{		okno.style.top = '20px'		}	}		 function zmien_intervencja(nr) {		okno = document.getElementById('admin_window')		makeRequest('admin_window','edit_intervencja.php?baza=straznicy')		okno.style.display = 'block';		}/*		 function zmien_glosa(nr) {		okno = document.getElementById('admin_window')		makeRequest('admin_window','edytuj_glosa.php?baza=straznicy')		okno.style.display = 'block';		}	*/			function zmien_glosa(elm) {
	/*	tab = elm.getElementsByTagName('input')	nazwa = tab[0].name	kolekcja = '';	for(i =0; i < (tab.length - 1); i++) {
	var raz = '';
	var dwa = '';		

	raz = tab[i].value;
	var ilea = raz.length;	
	for(a = 0; a < ilea; a++) {	
	dwa = raz.replace(/&/,'xax');
	raz = dwa.replace(/&/,'xax');
	}
	bez_malp = dwa.replace(/&/,'xax');	
	
	kolekcja = kolekcja + '&' + tab[i].name + '=' + bez_malp;	}
	*/
	kolekcjan = bez_malpy(elm);	adres = 'edytuj_glosa.php?'+ kolekcjan + '&wyslano=1'	makeRequest('admin_window', adres);	}	

	function zmien_comment(elm) {	/*	
	tab = elm.getElementsByTagName('input')	nazwa = tab[0].name	kolekcja = '';	for(i =0; i < (tab.length - 1); i++) {
	var raz = '';
	var dwa = '';		

	raz = tab[i].value;
	var ilea = raz.length;	
	for(a = 0; a < ilea; a++) {	
	dwa = raz.replace(/&/,'xax');
	raz = dwa.replace(/&/,'xax');
	}
	bez_malp = dwa.replace(/&/,'xax');	
	kolekcja = kolekcja + '&' + tab[i].name + '=' + bez_malp;	}
	*/
	kolekcjan = bez_malpy(elm);	adres = 'edytuj_comment.php?'+ kolekcjan + '&wyslano=1'	makeRequest('admin_window', adres);	}	
/*	function zmien_comment(elm) {	tab = elm.getElementsByTagName('input')	nazwa = tab[0].name	kolekcja = '';	for(i =0; i < (tab.length - 1); i++) {	kolekcja = kolekcja + '&' + tab[i].name + '=' + tab[i].value 	}	adres = 'edytuj_comment.php?'+ kolekcja + '&wyslano=1'	makeRequest('admin_window', adres);	}	*/
	//-------------------------var zara;	function pqb(iden) {dge = document.getElementById(iden);dge.style.display = 'block';}	function poczekaj(iden) {dge = document.getElementById(iden);dge.style.display = 'none';}function pqn(iden) {	dge = document.getElementById(iden);	dge.style.display = 'none';}//obsluga ajaxafunction look(nr) {		okno = document.getElementById('admin_window')		makeRequest('admin_window','pokaz_zgloszenie.php?id=' + nr);		okno.style.display = 'block';		if(sy = window.scrollY ) {		okno.style.top = (sy + 20) + 'px'		}		else if(sy = document.documentElement.scrollTop) {		okno.style.top = (sy + 20) + 'px'		}		else		{		okno.style.top = '20px'		}	}	
function bez_malpy(elm) {
	tab = elm.getElementsByTagName('input')	nazwa = tab[0].name	kolekcja = '';	for(i =0; i < (tab.length - 1); i++) {
	var raz = '';
	var dwa = '';		

	raz = tab[i].value;
	var ilea = raz.length;	
	for(a = 0; a < ilea; a++) {	
	dwa = raz.replace(/&/,'xax');
	raz = dwa.replace(/&/,'xax');
	}
	bez_malp = dwa.replace(/&/,'xax');	
	
	raz = '';
	dwa = '';		
	//hashe
	raz = bez_malp;
	var ilea = raz.length;	
	for(a = 0; a < ilea; a++) {	
	dwa = raz.replace(/#/,'');
	raz = dwa.replace(/#/,'');
	}
	bez_malp = dwa.replace(/#/,'');
	//----------------------	

	kolekcja = kolekcja + '&' + tab[i].name + '=' + bez_malp;	}	

	return kolekcja;	
}


function wyslij_pobrania() {
	elm = document.getElementById("formularz_pobrania");
	kolekcjan = bez_malpy(elm);
	kolekcjan += '&wyslano=1';	adres = 'download.php?'+ kolekcjan;	makeRequest('download', adres);
}

//=========  G11 ================ menu w admin_window ================
function zeruj_sklad(ilosc) {
for(i = 1; i < ilosc + 1; i++) {
iden = "sklad_" + i;
document.getElementById(iden).style.display = "none";
iden_td = "sklad_td_" + i;
document.getElementById(iden_td).style.background = "none";
document.getElementById(iden_td).style.color = "#264e7c";
}
}

function pokaz_sklad(zakres, ilosc, elm) {
zeruj_sklad(ilosc);
iden = "sklad_" + zakres;
document.getElementById(iden).style.display = "block";
elm.style.background = "#264e7c";
elm.style.color = "#ffffff";
}//-------- SZUKACZ ------function hunt_like(iden) {	az = document.getElementById('azor');	tresc = document.getElementById(iden).value;	wysun_szukacza();	makeRequest('azor','szukam_like.php?baza=wspolpraca&like=' + tresc);	/*	alert('szukam: >> ' + tresc + ' << ale coś mi się jeszcze myli i wiesza' + "\n" + 'no nie wiem , nie mogę, kurcze , znaleźć, ' + "\n" + 'nie pamiętam, gdzie połozyłem, sorry ');	*/	}	
