    var obecnyKrok=1;
    var tabCount=tabCount2=tabCount3=2;

    function init(){
	if(obj=document.getElementById("formAplikacyjny")){
	    initDaneOsobowe();
	}

	if(obj=document.getElementById("oferty32"))  initOferty(32);
	if(obj=document.getElementById("oferty33"))  initOferty(33);
	if(obj=document.getElementById("oferty34"))  initOferty(34);
	if(obj=document.getElementById("oferty35"))  initOferty(35);
	if(obj=document.getElementById("oferty36"))  initOferty(36);
	if(obj=document.getElementById("oferty37"))  initOferty(37);
    }

    function initOferty(idBranza){
	order = 1;
//	x_loadOferty(idBranza, order, after_loadOferty);
    }

    function after_loadOferty(res){
	document.getElementById('cnt').innerHTML =  res;   
//	document.getElementById('tabelaOfertySrodek').innerHTML = "";
//	document.getElementById('tabelaOfertySrodek').innerHTML = res;
    }

    var oldColor=new Array();
  
    function rozwin(id){
	w = $("#szczegTR"+id)
	ww = $("szczeg"+id);
	o = $("img[@name=\"obraz_"+id+"\"]");
	w.toggle();
	o.toggle();
        color = $("td[@name=wiersz"+id+"]").css('background-color');
	if(color=="rgb(211, 225, 123)"||color=="rgb(211,225,123)"){
	    $("td[@name=wiersz"+id+"]").css('background-color',oldColor[id]);
	}
	else{
	    oldColor[id]=color;
	    $("td[@name=wiersz"+id+"]").css('background-color',"rgb(211, 225, 123)");
	}
    }

    function checkForms(){
	if(obecnyKrok==1){
	
		document.getElementById("errImie").style.display="none";
		document.getElementById("errNazwisko").style.display="none";
		document.getElementById("errEmail").style.display="none";
		document.getElementById("errTelefon").style.display="none";
		document.getElementById("errZgoda").style.display="none";
		document.getElementById("errBranza").style.display="none";
	
	    error = false;
	    if(document.formKrok1.imie.value==""){
		document.getElementById("errImie").style.display="inline";
		error = true;
	    } 
	    if(document.formKrok1.nazwisko.value==""){
		document.getElementById("errNazwisko").style.display="inline";
		error = true;
	    } 
	    if(document.formKrok1.email.value==""){
		document.getElementById("errEmail").style.display="inline";
		error = true;
	    } 
	    if(document.formKrok1.telstac.value==""&&document.formKrok1.telkom.value==""){
		document.getElementById("errTelefon").style.display="inline";
		error = true;
	    } 
	    if(document.formKrok1.obecnaBranza.options[document.formKrok1.obecnaBranza.selectedIndex].value==0){
		document.getElementById("errBranza").style.display="inline";
		error = true;
	    } 

	    if(document.formKrok1.wyrazamZgode.checked==false){
		document.getElementById("errZgoda").style.display="inline";
		error = true;
	    } 

	    if(error) return false;
	}
	return true;
    }

    function changeKrok(krok){
	IE = (document.all)? true:false;

	if(!checkForms())
	    return false;

	saveData(obecnyKrok);
        
	if(krok==5){
	}
	
	obj1 = document.getElementById("kroki2");
	obj1.style.backgroundImage="url(i/k"+krok+".png)";
	if(IE){
	    obj1.style.backgroundImage="";
	    obj1.style.filter="filter: progid:DXImageTransform.Microsoft.AlphaImageLoader(src='i/k"+krok+".png', sizingMethod='scale')";
	    obj1.style.zoom=1;
	}    
	for(i=1;i<6;i++){
	    obj2 = document.getElementById("formKrok"+i);
	    
	    
	    if(i==krok){
		obj2.style.display='inline';
	    }	
	    else{
		obj2.style.display='none';
	    }	
	}
    }
    
    
    function saveData(obecnyKrok){
    
	imie = document.formKrok1.imie.value;
	dane="";
	for(i=0;i<document.formKrok1.length;i++){
	    dane+=document.formKrok1[i].name+";;;"+document.formKrok1[i].value+"|||"
	}	
	for(i=0;i<document.formKrok2.length;i++){
	    dane+=document.formKrok2[i].name+";;;"+document.formKrok2[i].value+"|||"
	}	
	for(i=0;i<document.formKrok3.length;i++){
	    dane+=document.formKrok3[i].name+";;;"+document.formKrok3[i].value+"|||"
	}	
	for(i=0;i<document.formKrok4.length;i++){
	    dane+=document.formKrok4[i].name+";;;"+document.formKrok4[i].value+"|||"
	}
	x_dodajDaneOsobowe(dane, obecnyKrok, after_ddo);
    }
    
    function after_ddo(res){
	krok = res[1];
	document.getElementById("formKrok"+krok).IDK.value=res[0];
	document.getElementById("formKrok"+krok).submit();
    }
    
    function initDaneOsobowe(){
	ladujListaObecnaBranza();
	ladujListaStanowisko();
	ladujListaWyksztalcenieRodzaj();
	ladujListaJezyki();
	ladujListaStopnie();
    }
    
    function ladujListaJezyki(){
	x_ladujListaJezyki(after_ladujListaJezyki);
    }
    
    function ladujListaStopnie(){
	x_ladujListaStopnie(after_ladujListaStopnie);
    }		
    
    function ladujListaObecnaBranza(){
	x_ladujListaObecnaBranza(after_ladujListaObecnaBranza);
    }
    
    function ladujListaStanowisko(){
	x_ladujListaStanowisko(after_ladujListaStanowisko);
    }
    
    function ladujListaWyksztalcenieRodzaj(){
	x_ladujListaWyksztalcenieRodzaj(after_ladujListaWyksztalcenieRodzaj);
    }	
    
    function after_ladujListaObecnaBranza(res){
	c = res[0];
	data = res[1]; 
	obj = document.getElementById("obecnaBranzaSelect");
	for(i=0; i<c; i++){
	    obj.options[i] = new Option(data[i]["nazwaPL"], data[i]["id"]);
	}
	obj = document.getElementById("branzaSelect1");
	for(i=0; i<c; i++){
	    obj.options[i] = new Option(data[i]["nazwaPL"], data[i]["id"]);
	}
	obj = document.getElementById("branzaSelect2");
	for(i=0; i<c; i++){
	    obj.options[i] = new Option(data[i]["nazwaPL"], data[i]["id"]);
	}
	obj = document.getElementById("branzaSelect3");
	for(i=0; i<c; i++){
	    obj.options[i] = new Option(data[i]["nazwaPL"], data[i]["id"]);
	}
    }
    
    function after_ladujListaStanowisko(res){
	c = res[0];
	data = res[1]; 
	obj = document.getElementById("stanowiskoSelect");
	for(i=0; i<c; i++){
	    obj.options[i] = new Option(data[i]["nazwaPL"], data[i]["id"]);
	}
    }
    
    function after_ladujListaWyksztalcenieRodzaj(res){
	c = res[0];
	data = res[1]; 
	obj = document.getElementById("rodzajWyksztalcenia1Select");
	for(i=0; i<c; i++){
	    obj.options[i] = new Option(data[i]["nazwaPL"], data[i]["id"]);
	}
	obj = document.getElementById("rodzajWyksztalcenia2Select");
	for(i=0; i<c; i++){
	    obj.options[i] = new Option(data[i]["nazwaPL"], data[i]["id"]);
	}
	obj = document.getElementById("rodzajWyksztalcenia3Select");
	for(i=0; i<c; i++){
	    obj.options[i] = new Option(data[i]["nazwaPL"], data[i]["id"]);
	}
    }    
    
    function after_ladujListaJezyki(res){
	c = res[0];
	data = res[1]; 
	obj = document.getElementById("jezykSelect1");
	for(i=0; i<c; i++){
	    obj.options[i] = new Option(data[i]["nazwaPL"], data[i]["id"]);
	}
	obj = document.getElementById("jezykSelect2");
	for(i=0; i<c; i++){
	    obj.options[i] = new Option(data[i]["nazwaPL"], data[i]["id"]);
	}
	obj = document.getElementById("jezykSelect3");
	for(i=0; i<c; i++){
	    obj.options[i] = new Option(data[i]["nazwaPL"], data[i]["id"]);
	}
    }    
    
    function after_ladujListaStopnie(res){
	c = res[0];
	data = res[1]; 
	obj = document.getElementById("stopienSelect1");
	for(i=0; i<c; i++){
	    obj.options[i] = new Option(data[i]["nazwaPL"], data[i]["id"]);
	}
	obj = document.getElementById("stopienSelect2");
	for(i=0; i<c; i++){
	    obj.options[i] = new Option(data[i]["nazwaPL"], data[i]["id"]);
	}
	obj = document.getElementById("stopienSelect3");
	for(i=0; i<c; i++){
	    obj.options[i] = new Option(data[i]["nazwaPL"], data[i]["id"]);
	}
    }    

    function polec(obj){
	if(obj.mojemail.value==""){
	    document.getElementById("komunikat"+obj.rekr.value).innerHTML="Podaj swoj adres email";
	    return false;
	}
	
	if(obj.emailznajomy.value==""){
	    document.getElementById("komunikat"+obj.rekr.value).innerHTML="Podaj adres email znajomego";
	    return false;
	}
	x_polec(obj.mojemail.value, obj.mojeimie.value, obj.emailznajomy.value, obj.imieznajomy.value, obj.rekr.value, after_polec);
    }    
    
    function czyscKomunikaty(){
	    aaa = document.getElementsByName("komunikat");
	    for(i=0; i<aaa.length; i++){
		aaa[i].innerHTML="";
	    }
    }
    
    function after_polec(res){
	if(res!=""){
	    aaa = document.getElementsByName("komunikat");
	    for(i=0; i<aaa.length; i++){
		aaa[i].innerHTML="Dziekujemy za polecenie tej oferty swojemu znajomemu. "+res;
	    }
	}
	
	ooo = document.getElementsByName("fff");
	for(i=0; i<ooo.length; i++){
	    ooo[i].style.display="none";
	}
    }