
	//===========================================================================
	// Praktyczny.pl - Polskie Katalogi Tematyczne
	//---------------------------------------------------------------------------
	// 
	// copyright (c)2006 by Sikora Dominik, Praktyczny.pl
	//===========================================================================
	
	var isIE = (navigator.appName == "Microsoft Internet Explorer");
	var isOP = false;
	var develop = false;
	var tabcount = 5;
	
	if (window.opera){
		  isIE = false;
		  isOP = true;
	}


	function start( ts ){
		
		var sts=1;
		
		// ukrywamy wszystkie
		for( i=1; i<=tabcount; i++ ){
			document.getElementById( "stz_" + i ).setAttribute("style","");
			document.getElementById( "st_" + i ).style.display = "none";
			document.getElementById( "str_" + i ).style.display = "none";
		}
		
		// pokazujemy domyslny (lub ulubiony)
		document.getElementById( "stz_" + sts ).setAttribute("style","color: #0066CC; background-color:#f7f7f7; border: 1px solid #e2e2e2; border-bottom: 1px solid #f7f7f7; border-top: 4px solid #0066CC;");
		document.getElementById( "st_" + sts ).style.display = "";
		document.getElementById( "str_" + sts ).style.display = "";
		
		// pokazujemy
		//document.getElementById('tab').setAttribute("style","display: block;");

		// ukrywamy wszystkie
		for( i=1; i<=tabcount; i++ ){
			document.getElementById( "tz_" + i ).setAttribute("style","");
			document.getElementById( "t_" + i ).style.display = "none";
			document.getElementById( "tr_" + i ).style.display = "none";
		}
		
		// pokazujemy domyslny (lub ulubiony)
		document.getElementById( "tz_" + ts ).setAttribute("style","color: #0066CC; background-color:#f7f7f7; border: 1px solid #e2e2e2; border-bottom: 1px solid #f7f7f7; border-top: 4px solid #0066CC;");
		document.getElementById( "t_" + ts ).style.display = "";
		document.getElementById( "tr_" + ts ).style.display = "";
		
		// pokazujemy
		document.getElementById('tab').setAttribute("style","display: block;");
		
	}

	function gtab( active ){
		

		for (var i=0; i<sgtab.length; i++) {
			
			if(isIE) document.getElementById('gpan_'+sgtab[i]).className = (sgtab[i]==active ? 'act' : '');
				else document.getElementById('gpan_'+sgtab[i]).setAttribute("class",(sgtab[i]==active ? 'act' : ''));
				
			document.getElementById('gpanU_'+sgtab[i]).style.display = (sgtab[i]==active ? 'block' : 'none');
		}
		document.getElementById('wh').value = active;
		
		// zapamietujemy
		setCookie( 'gtab', active );

		//blur();
		
	}

	//===========================================================================
	// przelaczanie widoku elementow
	//===========================================================================
	function tab( box, pid ) {
		//
		
		// ukrywamy wszystkie
		for( i=1; i<=5; i++ ){
			if(i != pid){
				//alert("tbd_" + box + "_" + i);
				document.getElementById('tbz_' + box + '_' + i).className = '';
				document.getElementById( "tbd_" + box + "_" + i ).style.display ='none';
				//document.getElementById( "sbarb_" + i ).style.display = "none";
			}
		}
		
		// pokazujemy to co nas interesuje
		//border-bottom: 4px solid #0066CC; padding-bottom: 2px; background: transparent; color: #0066CC;
		//document.getElementById( "tbz_" + box + "_" + pid ).setAttribute("class","active");
		document.getElementById( "tbz_" + box + "_" + pid ).className = 'active';
		document.getElementById('tbd_' + box + '_' + pid).style.display = "block";
		//document.getElementById( "sbarb_" + pid ).style.display = "";
		
		// zapamietujemy
		//setCookie( 'tsel', pid );
		//window.document.blur();
	} 
	
	function stab( pid ) {
		
		// ukrywamy wszystkie
		for( i=1; i<=tabcount; i++ ){
			if(i != pid){
				document.getElementById( "stz_" + i ).setAttribute("style","");
				document.getElementById( "st_" + i ).style.display = "none";
				document.getElementById( "str_" + i ).style.display = "none";
			}
		}
		
		// pokazujemy to co nas interesuje
		
		//border-bottom: 4px solid #0066CC; padding-bottom: 2px; background: transparent; color: #0066CC;
		document.getElementById( "stz_" + pid ).setAttribute("style","color: #0066CC; background-color:#f7f7f7; border: 1px solid #e2e2e2; border-bottom: 1px solid #f7f7f7; border-top: 4px solid #0066CC;");		
		document.getElementById( "st_" + pid ).style.display = "";
		document.getElementById( "str_" + pid ).style.display = "";
		
		// zapamietujemy
		setCookie( 'stsel', pid );
	} 
	
	//===========================================================================
	// save user settings
	//===========================================================================
	function sSave()
    {
        
		var box = new Array('logowanie','raporty','narzedzia','ustawienia','uslugi','monitor_pozycja','analiza_slow','raport');
		var mesg = '';
		
		for(i in box) {
			mesg += box[i] + '=' + ((document.getElementById( box[i] + '_on').style.display == 'none') ? 0 : 1) + ':';
		}
		
		setCookie('mps_set', mesg);
    }
	
	//===========================================================================
	// save settings on cookies
	//===========================================================================
	function setCookie (name, value)
	{
        document.cookie = name + '=' + escape (value) + '; expires=Wed, 1 Jan 2106 00:00:00 GMT; domain=*.szukajka.net;';
    }
	
	//---------------------------------------------------------------------------
	// przelaczanie widoku elementow
	//---------------------------------------------------------------------------
	function tvm_stp( sid, kid , bit ) {
		//kon_{serwis.id}_{klucz.id}
		var c=4;
		
		if( bit ) {
			
			// switch layer
			document.getElementById( "kof_" + sid + "_" + kid ).style.display = "";
			document.getElementById( "kon_" + sid + "_" + kid ).style.display = "none";
			
			// hidden children 
			for(i=0;i<=5;i++) document.getElementById( "kon" + i + "_" + sid + "_" + kid ).style.display = 'none';
			
		} else {
			
			// switch layer
			document.getElementById( "kof_" + sid + "_" + kid ).style.display = "none";
			document.getElementById( "kon_" + sid + "_" + kid ).style.display = "";
			
			// children visiblity
			for(i=0;i<=5;i++) document.getElementById( "kon" + i + "_" + sid + "_" + kid ).style.display = '';
		}
	} 
	
	//---------------------------------------------------------------------------
	// okienko pomocy
	//---------------------------------------------------------------------------
	function pomoc(id){
		
		var ll=(screen.width-600)/2; 
		var lt=(screen.height-480)/2;
		
		var parametr='top='+ lt +',left=' + ll + ',toolbar=no,menubar=no,scrollbars=yes,width=700,height=550';
		var adres='http://pomoc.praktyczny.pl/pomoc/?id='+id;
		
		window.open(adres,'pomoc',parametr);
	}	

	//---------------------------------------------------------------------------
	// sbar
	//---------------------------------------------------------------------------

/* activMenu(Object menu)
   - nadaje objektowi 'menu' klasę active, pozostałym null
   - zmienia wartość stylu odpowiedniego 'div' display: block; 
     pozostałym display: none; [dotyczy div'ów z klasą 'subpanel']
*/
function activMenuBdy(menu) {
    menubox = document.getElementById('panels_bdy');
    links = menubox.childNodes;

    /* ustalamy clasę 'active' dla naszego odnośnika, a reszcie null */
    for(x=0;x<links.length; x++) {
        if(links[x].nodeName.indexOf('A') != -1) {
            links[x].className=null;
        }
    }
    menu.className='active';
    menu.blur();

    var divs = document.getElementsByTagName("div");
    /* chowamy wszystkie div'y prócz aktualnego */
    for (var i=0; i<divs.length; i++) {
        if(divs[i].className == 'tabsmain') {
            if(divs[i].getAttribute("name") == menu.innerHTML) {
                divs[i].style.display = 'block';
            } else {
                divs[i].style.display = 'none';
            }
        }
    }
    return false;
}

/* preparePanels()
   - odnajduje wszystkie div'y z klasą 'subpanel' i ukrywa wszystkie prócz pierwszego
   - nad tym pierwszym wyświetla odnośniki do wszystkich ukrytych div'ów
*/
function tabInit() {
    if (!document.getElementsByTagName || !document.createElement || !document.appendChild) return;
    /* pobieramy wszystkie div'y */
    var divs = document.getElementsByTagName("div");

    /* zmienna przechowująca nr. pierwsze div'a z klasą subpanel */
    var firstDiv = -1;

    /* tworzymy div na nasze menu */
    var menu = document.createElement("div");
    menu.className = "panels_bdy";
    menu.setAttribute("id","panels_bdy");

    for (var i=0; i<divs.length; i++) {
        /* jeśli klasa div'a to subpanel to czynimy co należy */
        if(divs[i].className == 'tabsmain') {
            if(firstDiv == -1) firstDiv = i;

            /* sprawdzamy istnienie atrybutu 'title' */
            var source = divs[i].getAttribute("name");
			var source_id = divs[i].getAttribute("id");
			
            if (!source) continue;

            /* chowamy div'a */
            divs[i].style.display='none';

            /* tworzymi odnosnik do div'a w naszym menu */
            var link = document.createElement("a");
            //link.setAttribute("href","#"+divs[i].id);
            link.setAttribute("style","cursor:pointer; ");
			//link.setAttribute("onclick","activMenuBdy(this); ");
			link.setAttribute("onmousemouve","activMenuBdy(this); ");
            link.setAttribute("id","menu_"+divs[i].id);
            link.onmousemove = new Function('activMenuBdy(this);');
            link.appendChild(document.createTextNode(source));

            /* jesli div jest pierwszym to go aktywujemy */
            if(i == firstDiv) {
                divs[i].style.display='block';
                link.setAttribute('class','act');
                link.className = "active";
            }

            /* dodajemy odnośnik do menu */
            menu.appendChild(link);

        }
    }
    /* wklejamy stworzone menu nad pierwszym div'em */
    divs[firstDiv].parentNode.insertBefore(menu,divs[firstDiv]);
}	

	function kategoria( id ){
		
		var sdv = '<iframe name="SelectFDB" id="SelectFDB" style="width: 480px; height: 180px;" frameborder="0" src="http://www.szukajka.net/popup/kategorie.php?from='+id+'"></iframe>';
		
		for(i=1;i<=katchoicer;i++) document.getElementById('t' + i + 'c' ).innerHTML = '';
		
		document.getElementById('t' + id + 'c' ).innerHTML = sdv;
	}
	
	function kategoria_ustaw( id ){
		document.getElementById('t' + id + 'c' ).innerHTML = '';	
	}
	
	function flip( rid ) {
		document.getElementById(rid).style.display = document.getElementById(rid).style.display == 'none' ? 'block' : 'none'
	}
	
	/* okienko pop-up dla aobrazka */
	function wFoto( f ){

		var aW = screen.availWidth * 0.9;
		var aH = screen.availHeight * 0.8;
		
		// otwieramy...
	  	var fotowindow = window.open( '/galeria.php?f='+ f , 'Photo', "height=" + aH + ",width=" + aW + ",top=20,left=20,resizable=no,scrollbars=yes,status=no;" );
		// ... i ustawiamy focus
		fotowindow.focus();
	}

	/* wysylanie formularzy metoda VdeAntySpam */
	function VdeAntySpam( FormID ){
		// ustawiamy dodatkowe pole ktorego nie widzi robot
		document.getElementById('VdeAntySpam').innerHTML = '<p>Weryfikacja antyspamowa: <b>OK</b></p><input name="nospam" value="vdeantyspam" type="hidden" />';
		// podstawiamy
		document.getElementById('formid').value = FormID;
		// wysylamy formularz ;]
		document.zgloszenie.submit();
		
	}
	