//ajax
ObiektXMLHttp = false;
if (window.XMLHttpRequest) {
    ObiektXMLHttp = new XMLHttpRequest();
}
else if (window.ActiveXObject) {
    ObiektXMLHttp = new ActiveXObject("Microsoft.XMLHTTP");
}

function getData(zrodlo, cel) {
    if(ObiektXMLHttp) {
        var cel = document.getElementById(cel);
        ObiektXMLHttp.open("GET", "./" + zrodlo);
        
        ObiektXMLHttp.onreadystatechange = function() {
            if (ObiektXMLHttp.readyState == 4) {
                cel.innerHTML = ObiektXMLHttp.responseText;
            }
            else {
            	cel.innerHTML = "<div align='center' style=\"padding-top:40px; color:#999999;\"><br /><img src='ajax-loader2.gif' alt=\"\" border='0' style='vertical-align:middle;'>&nbsp;&nbsp;... trwa ładowanie...</div>"
            }
        }
        ObiektXMLHttp.send(null);
    }
}

ObiektXMLHttpb = false;
if (window.XMLHttpRequest) {
    ObiektXMLHttpb = new XMLHttpRequest();
}
else if (window.ActiveXObject) {
    ObiektXMLHttpb = new ActiveXObject("Microsoft.XMLHTTP");
}

function getDatab(zrodlo, cel) {
    if(ObiektXMLHttpb) {
        var cel = document.getElementById(cel);
        ObiektXMLHttpb.open("GET", "./" + zrodlo);
        
        ObiektXMLHttpb.onreadystatechange = function() {
            if (ObiektXMLHttpb.readyState == 4) {
                cel.innerHTML = ObiektXMLHttpb.responseText;
            }
            else {
            	cel.innerHTML = "<div align='center' style=\"padding-top:40px; color:#999999;\"><br /><img src='ajax-loader2.gif' alt=\"\" border='0' style='vertical-align:middle;'>&nbsp;&nbsp;... trwa ładowanie...</div>"
            }
        }
        ObiektXMLHttpb.send(null);
    }
}

ObiektXMLHttp2 = false;
if (window.XMLHttpRequest) {
    ObiektXMLHttp2 = new XMLHttpRequest();
}
else if (window.ActiveXObject) {
    ObiektXMLHttp2 = new ActiveXObject("Microsoft.XMLHTTP");
}

function getData2(zrodlo, cel) {
    if(ObiektXMLHttp2) {
        var cel = document.getElementById(cel);
        ObiektXMLHttp2.open("GET", "./" + zrodlo);
        
        ObiektXMLHttp2.onreadystatechange = function() {
            if (ObiektXMLHttp2.readyState == 4) {
                cel.innerHTML = ObiektXMLHttp2.responseText;
            }
            else {
            cel.innerHTML = "<div align='center' style=\"padding-top:40px; color:#999999;\"><br /><img src='ajax-loader2.gif' alt=\"\" border='0' style='vertical-align:middle;'>&nbsp;&nbsp;... trwa ładowanie...</div>"
            }
        }
        ObiektXMLHttp2.send(null);
    }
}

ObiektXMLHttp3 = false;
if (window.XMLHttpRequest) {
    ObiektXMLHttp3 = new XMLHttpRequest();
}
else if (window.ActiveXObject) {
    ObiektXMLHttp3 = new ActiveXObject("Microsoft.XMLHTTP");
}

function getData3(zrodlo, cel) {
    if(ObiektXMLHttp3) {
        var cel = document.getElementById(cel);
        ObiektXMLHttp3.open("GET", "./" + zrodlo);
        
        ObiektXMLHttp3.onreadystatechange = function() {
            if (ObiektXMLHttp3.readyState == 4) {
                cel.innerHTML = ObiektXMLHttp3.responseText;
            }
            else {
            cel.innerHTML = "<div align='center' style=\"padding-top:40px; color:#999999;\"><br /><img src='ajax-loader2.gif' alt=\"\" border='0' style='vertical-align:middle;'>&nbsp;&nbsp;... trwa ładowanie...</div>"
            }
        }
        ObiektXMLHttp3.send(null);
    }
}


ObiektXMLHttp4 = false;
if (window.XMLHttpRequest) {
    ObiektXMLHttp4 = new XMLHttpRequest();
}
else if (window.ActiveXObject) {
    ObiektXMLHttp4 = new ActiveXObject("Microsoft.XMLHTTP");
}

function getData4(zrodlo, cel) {
    if(ObiektXMLHttp4) {
        var cel = document.getElementById(cel);
        ObiektXMLHttp4.open("GET", "./" + zrodlo);
        
        ObiektXMLHttp4.onreadystatechange = function() {
            if (ObiektXMLHttp4.readyState == 4) {
                cel.innerHTML = ObiektXMLHttp4.responseText;
            }
            else {
            cel.innerHTML = "";
            }
        }
        ObiektXMLHttp4.send(null);
    }
}
//ajax end


function Set_Cookie( name, value, expires, path, domain, secure ) {
    
    var today = new Date();
    today.setTime( today.getTime() );
    
    if ( expires ) {
        expires = expires * 1000 * 60 * 60 * 24;
    }
    var expires_date = new Date( today.getTime() + (expires) );
    
    document.cookie = name + "=" +escape( value ) +
    ( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
    ( ( path ) ? ";path=" + path : "" ) +
    ( ( domain ) ? ";domain=" + domain : "" ) +
    ( ( secure ) ? ";secure" : "" );
}

function Get_Cookie( name ) {
    
    var start = document.cookie.indexOf( name + "=" );
    var len = start + name.length + 1;
    if ( ( !start ) &&
    ( name != document.cookie.substring( 0, name.length ) ) ) {
        return null;
    }
    if ( start == -1 ) return null;
    var end = document.cookie.indexOf( ";", len );
    if ( end == -1 ) end = document.cookie.length;
    return unescape( document.cookie.substring( len, end ) );
}

function zmien1(ind,id) {
    if (!ind) ind=1;
    
    max1=4;
    // wersja z div'ammi
    // for(i=1;i<=max1;i++) {
        //document.getElementById('ok'+i).style.display='none';
    //}
    //document.getElementById('ok'+ind).style.display='block';
    
    getData('okno_1.php?id='+ id, 'okno1');
    
    for(i=1;i<=max1;i++) {
        document.getElementById('zak'+i).className='zakladka1';
    }
    document.getElementById('zak'+ind).className='zakladka1akt';
    Set_Cookie('tabs_set', ind, 10, '/', '', '' );
}


function zmien2(ind,id) {
    if (!ind) ind=100;
    max2=104;
    Set_Cookie('tabs_set_dwa', ind, 10, '/', '', '' );
    getDatab('okno_2.php?id='+ id, 'okno2');
    document.getElementById('zak'+ind).className='zakladka1bakt';
    for(i=100;i<=max2;i++) {
    		if (i != ind) {
        document.getElementById('zak'+i).className='zakladka1b';
        }
    }
    document.getElementById('zak'+ind).className='zakladka1bakt';

}
function zmien_prawa(ind) {
    if (!ind) ind=201;
    
    max2=202;

    getData('okno_prawa.php?id='+ ind, 'okno_prawa');
    document.getElementById('zak'+ind).className='zakladka2akt';
    for(i=201;i<=max2;i++) {
    		if (i != ind) {
        document.getElementById('zak'+i).className='zakladka2';
        }
    }
    document.getElementById('zak'+ind).className='zakladka2akt';
    Set_Cookie( 'tabs_set_prawa', ind, 10, '/', '', '' );
}

function zmien_katalog(ind) {
    if (!ind) ind=301;
    
    max2=302;

    getData3('okno_katalog.php?id='+ ind, 'okno_katalog');
    document.getElementById('zak'+ind).className='zakladka1akt';
    for(i=301;i<=max2;i++) {
    		if (i != ind) {
        document.getElementById('zak'+i).className='zakladka1';
        }
    }
    document.getElementById('zak'+ind).className='zakladka1akt';
    Set_Cookie( 'tabs_set_katalog', ind, 10, '/', '', '' );
}

function zmien_radio(ind) {
    if (!ind) ind=401;
    
    max2=402;

    getData4('okno_katalog.php?id='+ ind, 'okno_katalog');
    document.getElementById('zak'+ind).className='zakladka1akt';
    for(i=401;i<=max2;i++) {
    		if (i != ind) {
        document.getElementById('zak'+i).className='zakladka1';
        }
    }
    document.getElementById('zak'+ind).className='zakladka1akt';
    Set_Cookie( 'tabs_set_radio', ind, 10, '/', '', '' );
}


function zmien_top(ind) {
    if (!ind) ind=1;
    
    max1=5;

	for(i=1;i<=max1;i++) {
        document.getElementById('okt'+i).style.display='none';
    }
    document.getElementById('okt'+ind).style.display='block';
    
    
    
    for(i=1;i<=max1;i++) {
        document.getElementById('zakt'+i).className='topmenu'+i;
    }
    document.getElementById('zakt'+ind).className='topmenu_sel'+ind;
    Set_Cookie( 'tabs_top_set', ind, 10, '/', '', '' );
}

function czy_na_pewno(param)
{
	if(confirm("Czy na pewno chcesz usun±ć tę pozycję?")==true)
	{
		document.location.href=param;
	}
}

function czy_na_pewno_znajomy(param)
{
	if(confirm("Czy na pewno chcesz usun±ć tę osobę z listy znajomych?")==true)
	{
		document.location.href=param;
	}
}

