function zwin_rozwin2(id,i){

	var inp = document.getElementById('inp_'+id);
	//alert(i);
	var d = document.getElementById(id);
	if (i=='1'){
		d.style.display='none';
		inp.value='';
	}else{
		d.style.display='block';
		inp.value='1';
	}

}
function zwin_rozwin(id){

	var i = document.getElementById('inp_'+id);
	//alert(i);
	var d = document.getElementById(id);
	if (i.value=='1'){
		d.style.display='none';
		i.value='';
	}else{
		d.style.display='block';
		i.value='1';
	}

}
function zwin_rozwin3(id){

	var i = document.getElementById('inp_'+id);
	//alert(i);
	var d = document.getElementById(id);
	if (i.value=='1'){
		d.style.display='none';
		i.value='';
	}else{
		d.style.display='block';
		i.value='1';
	}

}
function dodajDoUlubionych( Tytul, link ) {
	if( window.sidebar && window.sidebar.addPanel ) {
		//Gecko (Netscape 6 etc.) - add to Sidebar
		window.addPanel( Tytul, link, '' );
	} else if( window.external && ( navigator.platform == 'Win32' || ( window.ScriptEngine && ScriptEngine().indexOf('InScript') + 1 ) ) ) {
		//IE Win32 or iCab - checking for AddFavorite produces errors for no
		//good reason, so I use a platform and browser detect.
		//adds the current page page as a favourite; if this is unwanted,
		//simply write the desired page in here instead of 'location.href'
		window.external.AddFavorite( window.location.href, document.title );
	} else if( window.opera && window.print ) {
		//Opera 6+ - add as sidebar panel to Hotlist
		return true;
	} else if( document.layers ) {
		//NS4 & Escape - tell them how to add a bookmark quickly (adds current page,
		//not target page)
		window.alert( 'Please click OK then press Ctrl+D to create a bookmark' );
	} else {
		//other browsers - tell them to add a bookmark (adds current page, not target page)
		window.alert( 'Please use your browser\'s bookmarking facility to create a bookmark' );
	}
	return false;
}

function okienko(adres, tytul, wys, szer)
{
	window.open(adres, tytul, 'menubar=no, toolbar=no, location=no, scrollbars=yes, resizable=yes, status=no, width='+szer+', height='+wys);

}

function otworzZTekstem(tekst, tytul, wys, szer)
{

	TextWindow = window.open('', tytul, 'toolbar=no, resizable=yes, top=200, left=200, width=' + szer + ', height=' + wys);
	TextWindow.document.open();
	TextWindow.document.write('<HTML lang="pl"><HEAD><meta http-equiv="content-type" content="text/html;charset=iso-8859-2"><TITLE>'+tytul+'</TITLE></HEAD>');
	TextWindow.document.write('<BODY marginheight="5" marginwidth="5" topmargin="" leftmargin="5">');
	TextWindow.document.write('<div style="color:#616161; font-size:11px; font-family:Tahoma, Arial, Verdana, sans-serif; font-weight:normal;text-align:justify;">');
	TextWindow.document.write('<font color=red><b>'+tytul+'</b></font><br><br>');
	TextWindow.document.write(tekst);
	TextWindow.document.write('</div>');
	TextWindow.document.write('</BODY></HEAD>');
	TextWindow.document.close();
	TextWindow.focus();

}

/* TRISTAR */
function clickClick(idNum) {
    var element = document.getElementById("folder_"+idNum);
    if (navigator.appName == "Microsoft Internet Explorer") {
	if (element.getAttribute("className") == "displayNone") {
	    element.setAttribute("className", "displayBlock");
	    document.getElementById("link_"+idNum).style.backgroundImage = "url(\'/p/TRISTAR/minus.png\')";
	}
	else if (element.getAttribute("className") == "displayBlock") {
	    element.setAttribute("className", "displayNone");
	    document.getElementById("link_"+idNum).style.backgroundImage = "url(\'/p/TRISTAR/plus.png\')";
	}
    }
    else {
	if (element.getAttribute("class") == "displayNone") {
	    element.setAttribute("class", "displayBlock");
	    document.getElementById("link_"+idNum).style.backgroundImage = "url(\'/p/TRISTAR/minus.png\')";
	}
	else if (element.getAttribute("class") == "displayBlock") {
	    element.setAttribute("class", "displayNone");
	    document.getElementById("link_"+idNum).style.backgroundImage = "url(\'/p/TRISTAR/plus.png\')";
	}
    }
}

function substrCount(needle, haystack) {
    var count = 0;
    for(i=0; i<haystack.length; i++) {
	if (needle == haystack.substr(i,needle.length))
	count++;
    }
    return count;
}
