function PopupSizes(nazwa,szer,wys,subtitle) {
  void newWin(nazwa,szer,wys,subtitle);
}
function Popup(nazwa, subtitle) {
  void newWin(nazwa,0,0,subtitle);
}
function myurlencode(string) {
    return escape(string).replace(/[+]/g, '%2B');
}
function doprint() {
  loc = document.location.href;
  if (loc.match(/[\?]/))
    NewHtm(loc + '&print=1',600,400);
  else
    NewHtm(loc + '?print=1',600,400);
}
function dorecommend() {
  loc = document.location.href;
  NewHtm('/recommend.php?qs='+escape(loc), 370, 530);
}
function newWin(nazwa,szer,wys,subtitle) {
var sizes = false;
if (wys>0) { 
    sizes = true;
    szer = szer+28;
    wys = wys+28;
    odlewa=(screen.width-szer)/2;
    odgory=(screen.height-wys)/2;
} else {
    szer = 800;
    wys = 600;
    odlewa=(screen.width)/4;
    odgory=(screen.height)/8;
}

config='left='+odlewa+',top='+odgory+',width='+szer+',height='+wys+',innerheight='+wys+',innerwidth='+szer+',toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=yes,scrollbars=auto';
cel=window.open('','okno',config)
cel.document.write('<HTML><HEAD>');
cel.document.write('<link rel="stylesheet" href="/style.css" type="text/css" />');
cel.document.write('<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2">');
cel.document.write('<TITLE>'+document.title+'</title>');
if (!sizes) {
  cel.document.write('<script language="javascript">');
  cel.document.write('	var temp=self.location.href.split("?");');
  cel.document.write('	var picUrl = (temp.length>1)?temp[1]:"";');
  cel.document.write('	var NS = (navigator.appName=="Netscape")?true:false;');
  cel.document.write('	function fitPic() {');
  cel.document.write('		iImg1 = document.getElementById("img1");');
  cel.document.write('		iWidth = (NS)?window.innerWidth:document.body.clientWidth;');
  cel.document.write('		iHeight = (NS)?window.innerHeight:document.body.clientHeight;');
  cel.document.write('		if (iImg1.width>800) iWidth = 640 - iWidth; else { iWidth = iImg1.width + 22 - iWidth; }');
  cel.document.write('		if (iImg1.height>600) iHeight = 700 - iHeight; else { iHeight = iImg1.height + '+((subtitle)?'64':'24')+' - iHeight; }');
  cel.document.write('		window.resizeBy(iWidth, iHeight-1);');
  cel.document.write('		self.focus();');
  cel.document.write('	};');
  cel.document.write('	function setTitle() {');
  cel.document.write('		self.document.title = top.opener.document.title;');
  cel.document.write('	};');
  cel.document.write('</script>');
}
cel.document.write('</HEAD>');
cel.document.write('<body class="imagepopup" scroll="auto">');
cel.document.write('<div id="image"><a href=# onclick="javascript:self.close();"><img src='+nazwa+' id="img1" class=obw alt="Kliknij aby zamkn±æ okno" onload="javascript: fitPic();" align=center border="0"></a></div>');
if (subtitle)
	cel.document.write('<div id="subtitle">'+subtitle+'</div>');
//if (!sizes) {
//  cel.document.write('<script language="javascript">');
//  cel.document.write('	setTitle();');
//  cel.document.write('</script>');
//}
cel.document.write('</body></html>');
cel.document.close();
cel.focus();
}

function NewHtm(nazwa,szer,wys) {
odlewa=(screen.width-szer)/2;
odgory=(screen.height-wys)/2;		
config='left='+odlewa+',top='+odgory+',width='+szer+',height='+wys+',innerheight='+wys+',innerwidth='+szer+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes';
stadion=window.open(nazwa,'okno',config);
stadion.focus();
}
function NewHtmNoScr(nazwa,szer,wys) {
odlewa=(screen.width-szer)/2;
odgory=(screen.height-wys)/2;		
config='left='+odlewa+',top='+odgory+',width='+szer+',height='+wys+',innerheight='+wys+',innerwidth='+szer+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes';
stadion=window.open(nazwa,'okno',config);
stadion.focus();
}

function gotables() {
    tables = document.getElementsByName('info');
    for (i=0; i<tables.length; i++) {
        trs = tables[i].getElementsByTagName('tr');
        for (j=0; j<trs.length; j++) {
            trs[j].className += ' line'+(j % 2);
        }
    }
}

function addBookmark(sTitle) {
	sUrl=document.location.href;
        // Mozilla
	if (window.sidebar) {
	    window.sidebar.addPanel(sTitle, sUrl, "");
	// Internet Explorer
	} else if (window.external) {
	    window.external.AddFavorite(sUrl, sTitle);
	// Opera
	} else if (window.opera && window.print) {
	    return true;
	}
    }
						    


function changeView(elemId){
	oprodukcie2 = document.getElementById('o_produkcie');
	gda2 = document.getElementById('gda');
	
	sposobpodania2 = document.getElementById('sposob_podania');
	przepisy2 = document.getElementById('przepisy');
	
	oprodukcie2.style.display='none';
	gda2.style.display='none';
	sposobpodania2.style.display='none';
	przepisy2.style.display='none';
	
	document.getElementById('m_o_produkcie').className=' ';
	document.getElementById('m_gda').className=' ';
	document.getElementById('m_sposob_podania').className=' ';
	document.getElementById('m_przepisy').className=' ';	
//	alert(elemId);	
	document.getElementById(elemId).style.display='block';	
	document.getElementById('m_'+elemId).className='selected';
}



function changeCategory(category){
	
	url="http://test.kapitannavi.pl/pl/nasza_oferta/"+category+".php"
	location.href=url;
//	alert(url);
}

function  cleartext(){
	document.getElementById('q').value=" ";
}

function dodaj() { 
    var tytul = 'Kapitannavi.pl'; 
    var adres = 'http://www.kapitannavi.pl'; 
    //FireFox 
    if (window.sidebar) { 
	window.sidebar.addPanel(tytul, adres, ""); 
	//IE 
    } else if (window.external) { 
	window.external.AddFavorite(adres, tytul); 
	//Opera 
    } else if (window.opera && window.print) { 
	var a = document.createElement('a'); 
	a.setAttribute('href', adres); 
	a.setAttribute('title', tytul); 
	a.setAttribute('rel','sidebar'); 
	a.click(); 
    } 
    } 
//    if (window.external || window.sidebar || (window.opera && window.print) ) { 
//	document.writeln('<a href="javascript:dodaj()"> Dodaj do ulubionych</a>'); 
//    }







 
