
    var currentPage = 0;
    var currentSort = "";
    var currentSortOrder = "ASC";
    var maxPage;
    var defaultTableData;
    
    function $(id) {
    
        return document.getElementById(id);
    }
    
    function parseRecords(xml, nastepny_select, ost_wybor) {
	  if ($(nastepny_select)) { 
		nast_sel = $(nastepny_select);	
        record = xml.getElementsByTagName("record");
        result = "";
        for (i = 0; i < record.length; i++) {
            option = document.createElement("option");			
            nast_sel.appendChild(option);
            for (j = 0; j < 2; j++) {
			    if (j==0){
					option.setAttribute('value', record[i].childNodes[j].childNodes[0].nodeValue);	
				}else if(j==1){
					option.innerHTML = record[i].childNodes[j].childNodes[0].nodeValue;
				}	
            }
        }
		//$("dataStats").innerHTML = '<span style="font-weight: bold">Dane załadowane...</span>';
        return result;
      }	
    }
	
	function getDost(link_1, id_czesci){
	//alert(link_1+" --- "+id_czesci);
	advAJAX.get({
		url : link_1,		
        onSuccess : function(obj) {parseDost(obj.responseText, id_czesci);},										
		onError : function(obj) { alert("Error: " + obj.status); }
        });		
	}
	
	function  parseDost(tekst, id_czesci){
	    //alert(tekst);
	    img = document.getElementById(id_czesci);
		img.setAttribute("src",tekst);
	}
	
    function getRecords(parametr, nastepny_select, ost_wybor) {
	   //alert(parametr);
	   var ost = parseInt(ost_wybor);
	   if(! isNaN(ost)){
		//alert(parametr);
			advAJAX.get({
				url : parametr,		
				onInitialization : function() {
					// $("dataStats").innerHTML = '<span style="font-weight: bold">Pobieranie danych...</span>';
				   if ($("info")) {$("info").innerHTML = '<div id="info" class="progress"><img src="images/progress.gif" /></div>';}
			       if ($("info")) {$("info").style.visibility = "visible";}
				   if ($("auto")) {$("auto").style.visibility="hidden";};  
				},
					onSuccess : function(obj) {parseRecords(obj.responseXML, nastepny_select, ost_wybor);
									//if ($("info")) {$("info").style.visibility="hidden";}
									if ($("info")) {$("info").innerHTML="&nbsp;";}
                                    if(nastepny_select != "select3"){if ($("auto")) { $("auto").style.visibility="visible";} }  										
										},
					onError : function(obj) { alert("Error: " + obj.status); }
			});
		}		
    }

	function initDynamicTableIndex(link, sele1, sele2, customer_discount, zmiana) {
	 // alert(link+" "+sele1+" "+sele2+" "+customer_discount+" "+zmiana);
     	//alert ('initDynamicTableIndex');  
		if(zmiana == true){
		    if ($("wybranyNaglowek")){$("wybranyNaglowek").innerHTML = '';}
		}	
			if ($("wybrany")){
			   if(zmiana == true )
				// if ($("wybrany")) {$("wybrany").innerHTML = '&nbsp Wybierz samochód, do którego poszukujesz części';}
				if ($("wybrany")) {$("wybrany").innerHTML = '&nbsp';}
			   else
				$("wybrany").innerHTML = $("wybrany").innerHTML;
			}
			
			if ($("wybrany")){$("wybrany").innerHTML = $("wybrany").innerHTML;} //b. ważna funkcja dla prawidłowego działania pod IE !!!
	//	}	
		if ($("auto")){	
		   // alert('jestem');
			var x=$("auto").rows[0].cells;
			var y=$("auto").rows[1].cells;
			x[0].innerHTML = "wybierz markę samochodu, do którego szukasz części"
			sel = '';
			if ($("select2")){
				var sel = $("select2");
			}
			if ($("select1")){
				var sel = $("select1");
			}
			if ($("select")){
				var sel = $("select");
			}
		    if(sel != ''){
			//    alert('usuwamy');
				y[0].removeChild(sel);
			}	
			select = document.createElement("select");
			select.setAttribute("size","1");
			select.setAttribute("id","select");
			select.style.width="100%";
			select.style.fontFamily = "Courier New";
			y[0].appendChild(select);
			getRecords(link +"ajax.php?default=default", "select", 0);
			addEvent(select,'change', function(){ChangeSelection("select", link,'','', '', sele1, sele2);}, false);	
           		
		//}
		//else { 
		//	getRecords(link +"ajax.php?default=default", "select", 0);
		//}
	  }	
    }
	
	function ChangeSelection(select_id, link, customer_id, customer_discount, tablica, sele1, sele2){  
      sel = $(select_id);
	// alert('sele1: '+sele1+'  sele2: '+sele2);
	 if ($("nocategory")) { $("nocategory").style.visibility = "hidden";}
      id_typu = 0;
       	  
	  if(select_id == "select"){
	   // alert("ok");
		$('select').focus();
	    var tablica = new Array();
		tablica[0] = sel.value;
	    nast_select = "select1";
		usercar("off");		
		getmarka(sel.value, link, tablica, sele1, sele2);
		if ($("wybsam")) {$('wybsam').innerHTML = '<br>&nbsp;<br>&nbsp;Teraz wybierz <b>model</b> samochodu...';}
	//	$('select1').focus();
	  }
	  if(select_id == "select1"){ // model
	    if ($("nocategory")) {$("nocategory").style.visibility = "hidden";}
		//$("typ").style.visibility="visible";
		 $("select1").setAttribute("size","1");
		 tablica[1] = sel.value;
		 getmodel(sel.value, link, tablica, sele1, sele2);
		 if ($("wybsam")) {$('wybsam').innerHTML = '<br>&nbsp;<br>&nbsp;A teraz wybierz <b>typ</b> samochodu...';}
	    nast_select = "select2";
		
		usercar("off");
		//$('select2').focus();
	  }
	  if(select_id == "select2"){ //  typ
	    //alert("2");
		if ($("auto")) {$("auto").style.visibility="hidden";};
		if ($("nocategory")) {$("nocategory").style.visibility = "visible";}
		if ($("noprodContent")) {$("noprodContent").innerHTML = "Nie znalazłeś poszukiwanej kategorii?</br>";}
		if ($("hre")) {
			a = $("hre");
			a.setAttribute("href","contact_us.php?typ=" +sel.value);
			//a.setAttribute("href","javascript:popupWindow('popup_image.php?pID="+id_czesci+"')");
		}	
		if (customer_id != 0){
			var button = $("addusercar");
			button.typ = sel.value;
			button.myid = 1;
			button.myflag = "butt";
			button.link = link;
			button.customer_id = customer_id;
			if (button.addEventListener){
			    button.removeEventListener("click", getProfil,false);
				button.addEventListener("click",getProfil,false);
			}else{
				button.detachEvent('onclick',getProfil);
				button[getProfil] = null;
				button.attachEvent('onclick',getProfil);
			}
			usercar("on");
		}
		id_typu = sel.value;
		tablica[2] = sel.value;
		gettype(sel.value, link, tablica, sele1, sele2);
	    nast_select = "select3";
		//$('select3').focus();
	  }
	  if(select_id == "select3"){
	     $("nocategory").style.visibility = "visible";
		$("noprodContent").innerHTML = "Nie ma poszukiwanej podkategorii?</br>";
	    nast_select = "select4";
		tablica[3] = sel.value;
		getkategory(sel.value, link, tablica);
	//	$('select4').focus();
	  }
      if(select_id == "select4"){
		//id_typu = document.getElementById("select2").value;
		tablica[4] = sel.value;
		nast_select = "select5";
	  //  getRecordsEnd(link + "ajax.php?page=0&select=" +select_id+"&klucz="+sel.value+"&id_typu="+tablica[2], link,sel.value, customer_discount); 
      }
      else{	  
	    
	    //czysc_wynik();
		getRecords(link + "ajax.php?select=" +select_id+"&klucz="+sel.value, nast_select, sel.value);
	  }	
	}
		
	function sprawdz(parametr) {
	   //alert(parametr);
	   var komunikat = 'pusty';
        advAJAX.get({
			url : parametr,			
            onInitialization : function() {
            //    $("dataStats").innerHTML = '<span style="font-weight: bold">Pobieranie danych...</span>';
            },
            onSuccess : komunikat = function(obj){ kom = obj.responseText; return kom;},
			onError : function(obj) { alert("Error: " + obj.status); }
        });
		return komunikat;
    }
	
	function wew(obj){
	  return obj.responseText;
	}
	
	function Chmura(T,t){
		T.title=''
		T.parentNode.lastChild.style.display=t?'block':'none'
	}
	function Ch(evt){
		var e_out;
		var e_out_id;
		var ie_var = "srcElement";
		var prop_var = "myflag";
		var id = "myid";
		e_out_id = evt[ie_var][id];	 
		e_out = evt[ie_var][prop_var];	
		div = document.getElementById(e_out.id);	 
		//alert(div.id);
		//alert(e_out.title); 
		// e_out.parentNode.lastChild.style.display=e_out_id?'block':'none'
		if(e_out_id  == 1){
			e_out.style.display='block';}	
	}
	
	function Chm(evt){
		var e_out;
		var e_out_id;
		var ie_var = "srcElement";
		var prop_var = "myflag";
		var id = "myidm";
		e_out_id = evt[ie_var][id];	 
		e_out = evt[ie_var][prop_var];	
		div = document.getElementById(e_out.id);	 
		//alert(div.id);
		//alert(e_out.title); 
		// e_out.parentNode.lastChild.style.display=e_out_id?'block':'none'
		if(e_out_id  == 0){
			e_out.style.display='none';}
	}
	
	function addEvent(elm, evType, fn, useCapture) { 
		if (elm.addEventListener) { 
			elm.addEventListener(evType, fn, useCapture); 
			return true; 
		} else if (elm.attachEvent) { 
			var r = elm.attachEvent('on' + evType, fn); 
			return r; 
		} else {
			elm['on' + evType] = fn; 
		}
	}
	
	function changePage(p, link, maxPage, customer_discount) { 
        currentPage += p;
		sel = document.getElementById("select4");
		id_typu = $("select2").value;
		//alert("nast strona"+ currentPage + " link " + link + "id_typu "+ id_typu);
		getRecordsEnd(link+"ajax.php?p="+currentPage+"&maxPage="+maxPage+"&select=select4&klucz="+sel.value+"&id_typu="+id_typu, link, sel.value, customer_discount);
    }
	
	function usercar(str) {
		if (str == "on"){
			if ($("addusercar")) {$("addusercar").style.visibility = "visible";}
			if ($("usercar")) {$("usercar").style.visibility = "visible";}
			if ($("usercar")) {$("usercar").innerHTML = "Możesz ułatwić sobie życie <br>dodając wybrany samochód do swojego profilu";}
		}else if (str == "off"){
			if ($("addusercar")) {$("addusercar").style.visibility = "hidden";}
			if ($("usercar")) {$("usercar").style.visibility = "hidden";}
		}
	}
	
	function getProfil(evt){
		var e_out_link;
		var e_out_id_typu;
		var e_out_customer_id;
		var ie_var = "srcElement"; // dla IE
		var moz_var = "target";  // dla mozilli
		var prop_var = "myflag";
		var typ = "typ"; 
		var link = "link";
		var customer_id = "customer_id";
		evt[moz_var] ? e_out_link = evt[moz_var][link] : e_out_link = evt[ie_var][link];
		evt[moz_var] ? e_out_id_typu = evt[moz_var][typ] : e_out_id_typu = evt[ie_var][typ];
		evt[moz_var] ? e_out_customer_id = evt[moz_var][customer_id] : e_out_customer_id = evt[ie_var][customer_id];
		getCar(e_out_link, e_out_id_typu, e_out_customer_id);	 
		//alert(e_out);
	}
	
	function getCar(link ,id_typu, customer_id) {
	   alert("Dodałeś samochód do swojego profilu. \nMożesz używać go przy wyszukiwaniu części z naszej oferty\n\nZa chwilę zostaniesz przekierowany do strony głównej\ngdzie będziesz mógł wybierać części do \nTwojego samochodu w okienku 'kategorie'");
        advAJAX.get({
			url : link + "ajax.php?usercar&customer_id=" + customer_id + "&id_typu=" + id_typu,			
            onInitialization : function() {
            //    $("dataStats").innerHTML = '<span style="font-weight: bold">Pobieranie danych...</span>';
            },
           // onSuccess : komunikat = function(obj){ kom = obj.responseText; return kom;},
		    onSuccess: function(){window.location = link +'index.php';},
			onError : function(obj) { alert("Error: " + obj.status); }
        });
		//return komunikat;
    }
	
	function Zapotrzebowanie(customer_id, link){
	    var typ;
		var part;
		typ = $("select2");
		part = $("select4");
		//alert (typ.value + " - " + part.value+ " - " + customer_id);
		advAJAX.get({
			url : link + "ajax.php?needs&customer_id=" + customer_id + "&id_typu="+typ.value + "&subcategory_id=" + part.value,
			onSuccess : function(obj){
				alert(obj.responseText);
			}
		});
	}
	
	function getPart(){
		var sel = $("select4");
		alert (sel.value);
	}
	
	function loguj(link){
		var marka; 
		var model; 
		var typ; 
		var kat; 
		var podkat;
		marka = $("select");
		model = $("select1");
		typ = $("select2");
		kat = $("select3");
		podkat = $("select4");
		redirect = link + "login.php?marka=" +marka.value+"&model="+model.value+"&typ="+typ.value+"&kategoria="+kat.value+"&podkat="+podkat.value;
		window.location = redirect;
		
	}
	
	function onC(t){
		t.style.width = '240px';
		$("kat").style.width = '280px';
		$("podk").style.width = '155px';
	}
	function ofC(t){
		t.style.width = '150px';
		$("kat").style.width = '160px';
		$("podk").style.width = '145px';
	}
	function onS(t){
		t.style.width = '240px';
		$("kat").style.width = '175px';
		$("podk").style.width = '255px';
	}
	function ofS(t){
		t.style.width = '150px';
		$("kat").style.width = '160px';
		$("podk").style.width = '145px';
	}
	
	function test(){
		alert ("ok");
	}
	function stan(ilosc, id, link){
	//	alert("Opcja sprawdzania stanów chwilowo niedostepna..."+"\n\n"+"Skontaktuj się z nami w celu sprawdzenia"+"\n"+"dostępności tego produktu");
	//alert(ilosc +' '+ id +' '+ link);
 	sprStan(link,id, ilosc);
		
	}
	
	function sprStan(link, id, ilosc){
	 //alert(link+' '+id+' '+ilosc);
	 linki = link+'ssl-f-parser.php?id='+id+'&ilosc='+ilosc;
	advAJAX.get({
		url : linki,
        onInitialization : function() {
				if ($("info")) {$("info").style.visibility = "visible";}			 
				if ($("info")) {$("info").innerHTML = '<div id="info" class="progress"><img src="images/progress.gif" /></div>';}
				/*if ($(id)) {
				    atr = $(id).getAttribute("src");
					$(id).setAttribute("src","images/progress.gif");} */
           },		
        onSuccess : function(obj) {parseStan(obj.responseText);
					 if ($("info")) {$("info").style.visibility="hidden";}
					 if ($("info")) {$("info").innerHTML = '&nbsp;';}
					 i//f ($(id)) { $(id).setAttribute("src",atr);}
					},										
		onError : function(obj) { alert("Error: " + obj.status); }
        });		
	}
	function  parseStan(tekst){
	    alert(tekst);
	    //img = document.getElementById(id_czesci);
		//img.setAttribute("src",tekst);
	}
	
	function zast(){
		alert("ok");
	}
	
	function getmarka(wybor, link, tablica, sele1, sele2){
	// alert('jestem w getmarka ',wybor, link, tablica, sele1, sele2);
	 var x=$("auto").rows[0].cells;
	 var y=$("auto").rows[1].cells; 
	 x[0].innerHTML = "wybierz model samochodu"
     if($("select")){
		var sel = $("select");	
		 y[0].removeChild(sel);
	 }
	 if($("select2")){
		var sel = $("select2");
		 y[0].removeChild(sel);	
	 }		 
	// y[0].removeChild(sel);
	 //alert(sel.id);
	 select = document.createElement("select");
	 select.setAttribute("size","1");
	 select.setAttribute("id","select1");
	 select.style.width="100%";
	 select.style.fontFamily = "Courier New";
	y[0].appendChild(select);
	
    addEvent(select,'change', function(){ChangeSelection("select1", link, '', '', tablica, sele1, sele2);}, false);	 
	// ur = link + "ajax.php?marka=" + wybor;
	ur = "http://e-autoparts.pl/catalog/ajax.php?marka=" + wybor;
    // alert(ur);	 
	 advAJAX.get({
			url : ur,
			onSuccess : function(obj){  $("wybranyNaglowek").innerHTML = "<b>Wybrany samochód:</b>";
										//$("wybrany").innerHTML = "<b><a href=\"" +link +"\">" + obj.responseText +"</a></b>";
										//$("wybrany").innerHTML = "<span id=\"sele\"><b>" + obj.responseText +"</b></span>";
										span = document.createElement("span");
										$("wybrany").innerHTML="";
										$("wybrany").appendChild(span);
										span.setAttribute('id','spanmarka');
										span.innerHTML = "<b>" + obj.responseText +"</b>";
										addEvent(span,'click', function(){initDynamicTableIndex(link, sele1, sele2, 0, true);}, false);
										span.style.cursor = "pointer";
							            addEvent(span,'mouseover', function(){span.style.color="red"}, false);
										addEvent(span,'mouseout', function(){span.style.color="black"}, false);
									 },
			onError : function(obj){ alert("błąd bazy - spróbuj ponownie");}
		});
	}
	
 function test(par, link){
    alert(par);	 
  }
  
	function getmodel(wybor, link, tablica, sele1, sele2){
	//alert(tablica[0] + " - " + tablica[1]);
	 var zawar;
	 zawar = $("wybrany").innerHTML;
	 var x=$("auto").rows[0].cells;
	 var y=$("auto").rows[1].cells;
	 x[0].innerHTML = "typ &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp data prod. &nbsp&nbsp&nbsp od... &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp do... &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp ccm &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp KM &nbsp&nbsp&nbsp&nbsp KW &nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp silnik ";
	 var sel = $("select1");
	 y[0].removeChild(sel);
	 select = document.createElement("select");
	 select.setAttribute("size","1");
	 select.style.fontFamily = "Courier New";
	 select.setAttribute("id","select2");
	 select.style.width="100%";
	 y[0].appendChild(select);
     addEvent(select,'change', function(){ChangeSelection("select2", link, '', '', tablica, sele1, sele2);}, false);
	 advAJAX.get({
			url : link + "ajax.php?model=" + wybor,
			onSuccess : function(obj){ //$("wybrany").innerHTML = zawar + "<b> &raquo <a href=\"" +link +"\">" + obj.responseText +"</a></b>";
			                            strzalka = document.createElement("span");
 										$("wybrany").appendChild(strzalka);
										strzalka.innerHTML = "<b> &raquo </b>";
										spanmodel = document.createElement("span");
										$("wybrany").appendChild(spanmodel);
										spanmodel.setAttribute('id','spanmodel');
										spanmodel.innerHTML = "<b>" + obj.responseText +"</b>";
										addEvent(spanmodel,'click', function(){zmianaSamochodu('select', link, tablica, sele1, sele2);}, false);
										spanmodel.style.cursor = "pointer";
							            addEvent(spanmodel,'mouseover', function(){spanmodel.style.color="red"}, false);
										addEvent(spanmodel,'mouseout', function(){spanmodel.style.color="black"}, false);
										
										
			},
			onError : function(obj){ alert("błąd bazy - spróbuj ponownie");}
		});
	}
	
	function gettype(wybor, link, tablica, sele1, sele2){
	 var zawar;
	 zawar = $("wybrany").innerHTML;
	 var sel = $("select2");
	 //y[0].removeChild(sel);
	 advAJAX.get({
			url : link + "ajax.php?typ=" + wybor,
			onSuccess : function(obj){ $("wybrany").innerHTML = zawar + " <b> &raquo <a href=\"" +link +"\">" + obj.responseText +"</a></b>";
			}
		});
	 if(sele1 != 0 && sele2 !=0)	
		window.location = link+"\index.php?cPath="+sele1+"_"+sele2+"&id_typu="+wybor;
     else if(sele1 == 0)
		window.location = link+"\index.php?id_typu="+wybor;
	 else if(sele1 != 0	&& sele2 == 0)
		window.location = link+"\index.php?cPath="+sele1+"&id_typu="+wybor;
	}
	
	function zmianaSamochodu(select, link, tablica, sele1, sele2){
	   //alert(tablica[0]);
		if(select = 'select'){ // zmiana modelu
		    //alert(link+" "+tablica[0]+"&"+sele1+"&"+sele2);
			getmarka(tablica[0], link, tablica, sele1, sele2);
			getRecords(link + "ajax.php?select=select&klucz="+tablica[0], 'select1', tablica[0]);
		}
	/*	if(select = 'select1'){ // zmiana typu
		    //alert(tablica[0]+"&"+sele1+"&"+sele2);
			getmodel(tablica[1], link, tablica, sele1, sele2);
			getRecords(link + "ajax.php?select=select1&klucz="+tablica[1], 'select2', tablica[1]);
		}
	*/	
	}
// testy 	
	
function addEventParams( obj, type, fn, p ){    
	obj["e"+type+fn] = fn;  
	if (obj.addEventListener){    
		eval( 'obj.addEventListener( type, function(event){obj["e"+type+fn](event, ' + p + ')}, false );' );  
	}  
	else if (obj.attachEvent){    
		obj[type+fn] = function(){ eval ( 'obj["e"+type+fn](window.event, ' + p + ');' ); }    
		obj.attachEvent("on"+type, obj[type+fn]);  
	}
}
	//wywołanie
function pokaz(e, a, b){
	 alert(a+b);  (e.preventDefault) ? e.preventDefault() : (e.returnValue = false);//anuluj domyślną akcję}
}

function addprofil(customer_id, typ, link){
	zapiszTyp(customer_id, typ, link);
}	

function zapiszTyp(customer_id, typ, link){
	advAJAX.get({
		url : link + "ajax.php?zapiszTyp=" + typ +"&customer_id=" +customer_id,
		onSuccess : function(obj){ $("dodany").innerHTML = " ! pojazd zapamiętany w Twoim profilu !";
	               }
	});
}
function wylacz_profil(link){
   // alert(link);
	advAJAX.get({
		url : link + "ajax.php?usunTyp=ok",
		onSuccess : function(obj){ $("profil").innerHTML = "";
	               }
	});
}	
function testObrazek(products_id, link){
   //alert("ok");
   //alert(products_id +' -- ' +link);
	//advAJAX.get({
	//	url : "ajax.php?maObrazek=" +,
	//	onSuccess : function(obj){ $("profil").innerHTML = "";
	 //              }
	//});
}

function initPhoto(){
	
}
function photo(){
	$("info").innerHTML = '';
}

function laduj(link, products_id){
	advAJAX.get({
		url : link + "ajax.php?oe=ok&products_id="+products_id,
		onSuccess: function(obj){ $("oe").innerHTML = parseOE(obj.responseXML);
	               } 
	});
	advAJAX.get({
		url : link + "ajax.php?zamienniki=ok&products_id="+products_id,
		onInitialization : function() {
			if ($("info")) {$("info").style.visibility = "visible";}			 
			if ($("info")) {$("info").innerHTML = '<div id="info" class="progress"><img src="images/progress.gif" /></div>';}
         },
		onSuccess: function(obj){ $("zamienniki1").innerHTML = parseZam1(obj.responseXML);
		                          $("zamienniki2").innerHTML = parseZam2(obj.responseXML); 
								  $("zamienniki3").innerHTML = parseZam3(obj.responseXML);
								  if ($("info")) {$("info").style.visibility="hidden";}
								  if ($("info")) {$("info").innerHTML = '&nbsp;';}
	               } 
	});
}	
function parseOE(xml){
    str = '';
	record = xml.getElementsByTagName("record");
	  if(record.length > 0){ 
	    str =  str + '<b>numery OE:</b><br>';
		for (i = 0; i < record.length; i++) {	
			for (j = 0; j < 2; j++) {
				
			   // if(j == 0)
					//str = str +  " --- ";
				if(j == 1)
				    str = str + record[i].childNodes[j].childNodes[0].nodeValue + "<br>";
					//str = str + "/n";
			}	
		}
	 }
	return str;
}

function parseZam1(xml){
    str = '';

	record = xml.getElementsByTagName("record");
	  if(record.length > 0){ 
	  //alert(record.length);
	    str =  str + '<b>zamienniki:</b><br>';
		for (i = 0; i < record.length; i++) {	
			for (j = 0; j < 3; j++) {
				
			    if(j == 0)
					str = str + record[i].childNodes[j].childNodes[0].nodeValue + "<br>";
				//if(j == 1)
				    //str2 = str2 + record[i].childNodes[j].childNodes[0].nodeValue + "<br>";
					//str = str + "/n";
			}	
		}
	 }
	return str;
}
function parseZam2(xml){
    str = '';
    str =  str + '<b>cena&nbsp;&nbsp;&nbsp;&nbsp;</b><br><b>';
	record = xml.getElementsByTagName("record");
	  if(record.length > 1){ 
	  //alert(record.length);
		for (i = 0; i < record.length; i++) {	
			for (j = 0; j < 3; j++) {
				
			    if(j == 1)
					str = str + record[i].childNodes[j].childNodes[0].nodeValue + "<br>";
				//if(j == 1)
				    //str2 = str2 + record[i].childNodes[j].childNodes[0].nodeValue + "<br>";
					//str = str + "/n";
			}	
		}
	 }
	return str;
}
function parseZam3(xml){
    str = '';
	str =  str + '<b>producent</b><br>';
	record = xml.getElementsByTagName("record");
	  if(record.length > 1){ 
	   // str =  str + '<b>zamienniki:</b><br>';
	   //alert(record.length);
		for (i = 0; i < record.length; i++) {	
			for (j = 0; j < 3; j++) {
				
			   // if(j == 0)
					//str = str + record[i].childNodes[j].childNodes[0].nodeValue + "<br>";
				if(j == 2)
				    str = str + record[i].childNodes[j].childNodes[0].nodeValue + "<br>";
					//str = str + "/n";
			}	
		}
	 }
	return str;
}
function testowa(){
	alert ('ok');
}
