//<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2"> 
var brzeg = new Array();







brzeg.push('');
brzeg.push('LB');
brzeg.push('LB');
brzeg.push('PB');
brzeg.push('LB');
brzeg.push('PB');
brzeg.push('LB');
brzeg.push('LB');
brzeg.push('PB');
brzeg.push('LB');
brzeg.push('LB');
brzeg.push('LB');
brzeg.push('LB');
brzeg.push('LB');
brzeg.push('LB');
brzeg.push('LB');
brzeg.push('LB');
brzeg.push('LB');
brzeg.push('LB');
brzeg.push('PB');
brzeg.push('LB');
brzeg.push('PB');
brzeg.push('PB');
brzeg.push('PB');
brzeg.push('LB');
brzeg.push('LB');
brzeg.push('LB');
brzeg.push('LB');
brzeg.push('PB');
brzeg.push('LB');
brzeg.push('LB');
brzeg.push('LB');
brzeg.push('LB');
brzeg.push('LB');
brzeg.push('LB');
brzeg.push('LB');
brzeg.push('LB');
brzeg.push('PB');
brzeg.push('PB');
brzeg.push('LB');
brzeg.push('LB');
brzeg.push('LB');
brzeg.push('LB');
brzeg.push('LB');
brzeg.push('LB');
brzeg.push('LB');
brzeg.push('LB');
brzeg.push('LB');
brzeg.push('LB');
brzeg.push('PB');
brzeg.push('PB');
brzeg.push('LB');
brzeg.push('LB');
brzeg.push('LB');
brzeg.push('LB');
brzeg.push('LB');
brzeg.push('LB');
brzeg.push('LB');
brzeg.push('LB');
brzeg.push('LB');
brzeg.push('LB');
brzeg.push('LB');
brzeg.push('PB');
brzeg.push('LB');
brzeg.push('LB');
brzeg.push('LB');
brzeg.push('LB');
brzeg.push('PB');
brzeg.push('LB');
brzeg.push('PB');
brzeg.push('PB');
brzeg.push('LB');
brzeg.push('PB');

nn4 = (document.layers) ? true:false;
ie4 = (document.all) ? true:false;

DayName = new Array(7)
DayName[0] = "niedziela "
DayName[1] = "poniedziałek "
DayName[2] = "wtorek "
DayName[3] = "środa "
DayName[4] = "czwartek "
DayName[5] = "piątek "
DayName[6] = "sobota "

MonthName = new Array(12)
MonthName[0] = "stycznia "
MonthName[1] = "lutego "
MonthName[2] = "marca "
MonthName[3] = "kwietnia "
MonthName[4] = "maja "
MonthName[5] = "czerwca "
MonthName[6] = "lipca "
MonthName[7] = "sierpnia "
MonthName[8] = "września "
MonthName[9] = "października "
MonthName[10] = "listopada "
MonthName[11] = "grudnia "

function zrob_cene(cena){
	if (cena != null)
	{
	cena = cena.toString();
    var nowa_cena = '';
	if (cena < 1000) {nowa_cena = cena;  return nowa_cena;}
	if (cena < 10000) {nowa_cena = cena.substring(0,1)+' '+cena.substring(1,4);  return nowa_cena;}
	if (cena < 100000) {nowa_cena = cena.substring(0,2)+' '+cena.substring(2,5);  return nowa_cena;}
	if (cena < 1000000) {nowa_cena = cena.substring(0,3)+' '+cena.substring(3,6);  return nowa_cena;}
	if (cena < 10000000) {nowa_cena = cena.substring(0,1)+' '+cena.substring(1,4)+' '+cena.substring(4,7);  return nowa_cena;}
	if (cena < 100000000) {nowa_cena = cena.substring(0,2)+' '+cena.substring(2,5)+' '+cena.substring(5,8);  return nowa_cena;}
	if (cena < 1000000000) {nowa_cena = cena.substring(0,3)+' '+cena.substring(3,6)+' '+cena.substring(6,9);  return nowa_cena;}
	}
}
function JustSoPicWindow(imageName,imageWidth,imageHeight,alt,bgcolor,hugger,hugMargin) {
// by E Michael Brandt of ValleyWebDesigns.com - Please leave these comments intact.
// version 3.0.4  

	if (bgcolor=="") {
		bgcolor="#FFFFFF";
	}
	var adj=10
	var w = screen.width;
	var h = screen.height;
	var byFactor=1;

	if(w<740){
	  var lift=0.90;
	}
	if(w>=740 & w<835){
	  var lift=0.91;
	}
	if(w>=835){
	  var lift=0.93;
	}
	if (imageWidth>w){	
	  byFactor = w / imageWidth;			
	  imageWidth = w;
	  imageHeight = imageHeight * byFactor;
	}
	if (imageHeight>h-adj){
	  byFactor = h / imageHeight;
	  imageWidth = (imageWidth * byFactor);
	  imageHeight = h; 
	}
	   
	var scrWidth = w-adj;
	var scrHeight = (h*lift)-adj;

	if (imageHeight>scrHeight){
  	  imageHeight=imageHeight*lift;
	  imageWidth=imageWidth*lift;
	}

	var posLeft=0;
	var posTop=0;

	if (hugger == "hug image"){
	  if (hugMargin == ""){
	    hugMargin = 0;
	  }
	  var scrHeightTemp = imageHeight - 0 + 2*hugMargin;
	  if (scrHeightTemp < scrHeight) {
		scrHeight = scrHeightTemp;
	  } 
	  var scrWidthTemp = imageWidth - 0 + 2*hugMargin;
	  if (scrWidthTemp < scrWidth) {
		scrWidth = scrWidthTemp;
	  }
	  
	  if (scrHeight<100){scrHeight=100;}
	  if (scrWidth<100){scrWidth=100;}

	  posTop =  ((h-(scrHeight/lift)-adj)/2);
	  posLeft = ((w-(scrWidth)-adj)/2);
 	}

	if (imageHeight > (h*lift)-adj || imageWidth > w-adj){
		imageHeight=imageHeight-adj;
		imageWidth=imageWidth-adj;
	}
	posTop = parseInt(posTop);
	posLeft = parseInt(posLeft);		
	scrWidth = parseInt(scrWidth); 
	scrHeight = parseInt(scrHeight);
	
	var agt=navigator.userAgent.toLowerCase();
	if (agt.indexOf("opera") != -1){
	  var args= new Array();
	  args[0]='parent';
	  args[1]=imageName;
	  var i ; document.MM_returnValue = false;
	  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
	} else {
	newWindow = window.open("vwd_justso.htm","newWindow","width="+scrWidth+",height="+scrHeight+",left="+posLeft+",top="+posTop);
	newWindow.document.open();
	newWindow.document.write('<html><head><title>'+alt+'</title></head><body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" bgcolor='+bgcolor+' onBlur="self.close()" onClick="self.close()">');  
	newWindow.document.write('<table width='+imageWidth+' border="0" cellspacing="0" cellpadding="0" align="center" height='+scrHeight+' ><tr><td>');
	newWindow.document.write('<DIV style="z-index: 1;"><img src="'+imageName+'" width='+imageWidth+' height='+imageHeight+' alt="Klikinj by zamknac to okno"></div>'); 
	newWindow.document.write('<DIV style="z-index: 2; width:100%; height:100%; position: absolute; top: 0px;"><img src="/images/p.gif" width="100%" height="100%" alt="Klikinj by zamknac to okno"></div></td></tr></table></body></html>');
	newWindow.document.close();
	newWindow.focus();
	}
}	// end of the 'JustSoPicWindow()' function
function Zdjecia(pageName,imageWidth,imageHeight,hugger,hugMargin) {
	
	var adj=10
	var w = screen.width;
	var h = screen.height;
	var byFactor=1;

	if(w<740){
	  var lift=0.90;
	}
	if(w>=740 & w<835){
	  var lift=0.91;
	}
	if(w>=835){
	  var lift=0.93;
	}
	if (imageWidth>w){	
	  byFactor = w / imageWidth;			
	  imageWidth = w;
	  imageHeight = imageHeight * byFactor;
	}
	if (imageHeight>h-adj){
	  byFactor = h / imageHeight;
	  imageWidth = (imageWidth * byFactor);
	  imageHeight = h; 
	}
	   
	var scrWidth = w-adj;
	var scrHeight = (h*lift)-adj;

	if (imageHeight>scrHeight){
  	  imageHeight=imageHeight*lift;
	  imageWidth=imageWidth*lift;
	}

	var posLeft=0;
	var posTop=0;

	if (hugger == "hug image"){
	  if (hugMargin == ""){
	    hugMargin = 0;
	  }
	  var scrHeightTemp = imageHeight - 0 + 2*hugMargin;
	  if (scrHeightTemp < scrHeight) {
		scrHeight = scrHeightTemp;
	  } 
	  var scrWidthTemp = imageWidth - 0 + 2*hugMargin;
	  if (scrWidthTemp < scrWidth) {
		scrWidth = scrWidthTemp;
	  }
	  
	  if (scrHeight<100){scrHeight=100;}
	  if (scrWidth<100){scrWidth=100;}

	  posTop =  ((h-(scrHeight/lift)-adj)/2);
	  posLeft = ((w-(scrWidth)-adj)/2);
 	}

	if (imageHeight > (h*lift)-adj || imageWidth > w-adj){
		imageHeight=imageHeight-adj;
		imageWidth=imageWidth-adj;
	}
	posTop = parseInt(posTop);
	posLeft = parseInt(posLeft);		
	scrWidth = parseInt(scrWidth); 
	scrHeight = parseInt(scrHeight);
	
	var agt=navigator.userAgent.toLowerCase();
	if (agt.indexOf("opera") != -1){
	  var args= new Array();
	  args[0]='parent';
	  args[1]=imageName;
	  var i ; document.MM_returnValue = false;
	  for (i=0; i<(args.length-1); i+=2) eval(args[i]+".location='"+args[i+1]+"'");
	} else {
	//newWindow = window.open(pageName,"newWindow","width="+scrWidth+",height="+scrHeight+",left="+posLeft+",top="+posTop);
	//window.locationbar.visible="false";
	imageWidth=parseInt(imageWidth-20);
	imageHeight=parseInt(imageHeight-20);
	window.location.href=pageName+'&imageWidth='+imageWidth+'&imageHeight='+imageHeight;
	window.resizeTo((scrWidth),(scrHeight+55));
	//newWindow.document.open();
	//newWindow.document.close();
	window.focus();
	}
}	// end of the 'Zdjecia()' function
//----------------------------------------------------------------------------------------------------
function drukuj(kat_id, id, zdjecia){
	newWindow6 = window.open('drukuj.php?kat_id='+kat_id+'&id='+id+'&zdj='+zdjecia,'newWindow6','width=700,height=1000,scrollbars=yes,status=yes,menubar=yes'); 
	newWindow6.focus();
	
}
//----------------------------------------------------------------------------------------------------
function drukuj_ebiuro(id, zdjecia){
	newWindow6 = window.open('drukuj_ebiuro.php?id='+id+'&zdj='+zdjecia,'newWindow6','width=700,height=1000,scrollbars=yes,status=yes,menubar=yes'); 
	newWindow6.focus();
	
}
//----------------------------------------------------------------------------------------------------

function drukuj_liste(kat_id, oferta_typ, zdjecia){
	newWindow7 = window.open('http://www.spn.com.pl/kategorie_drukuj.php?kat_id='+kat_id+'&oferta_typ='+oferta_typ+'&zdj='+zdjecia,'newWindow7','width=700,height=1000,scrollbars=yes,status=yes,menubar=yes'); 
	newWindow7.focus();
	
}
//-----------------------------------------------------------------------------------------------------
function drukuj_liste_ebiuro(kat_id, oferta_typ, zdjecia){
	newWindow7 = window.open('http://www.spn.com.pl/kategorie_drukuj_ebiuro.php?kat_id='+kat_id+'&oferta_typ='+oferta_typ+'&zdj='+zdjecia,'newWindow7','width=700,height=1000,scrollbars=yes,status=yes,menubar=yes'); 
	newWindow7.focus();
	
}
//-----------------------------------------------------------------------------------------------------

//----------------------------------------------------------------------------------------------------
function send_back(kat_id, id, nr_oferty){
	newWindow6 = window.open('send_back.php?kat_id='+kat_id+'&id='+id+'&nr='+nr_oferty,'newWindow6','width=450,height=350,scrollbars=no,status=yes'); 
	newWindow6.focus();
	
}
//-----------------------------------------------------------------------------------------------------
function send_back_ebiuro(kat_id, nr_oferty){
	newWindow6 = window.open('send_back_ebiuro.php?nr='+nr_oferty,'newWindow6','width=450,height=350,scrollbars=no,status=yes'); 
	newWindow6.focus();
	
}
//-----------------------------------------------------------------------------------------------------


function do_koszyka(kat_id, id){
	window.location.href='oferta_info.php?kat_id='+kat_id+'&id='+id+'&add=1';	
}
//-----------------------------------------------------------------------------------------------------
function doKoszyka(id)
	{
		document.getElementById('cartFrame').src='http://www.spn.com.pl/addToCart.php?add=1&id='+id ;
		document.getElementById('cart').href='http://www.spn.com.pl/cart_ebiuro.php'; 
		document.getElementById('cart').innerHTML='<img src="/images/add_cart.gif" align="middle" border="0">POKAŻ WYBRANE OFERTY';
		
	}
//-----------------------------------------------------------------------------------------------------

//---------------------------------------------------------------------------------------------------
function zrob_brzeg(selected_index){

if (brzeg[selected_index]=='L') {document.szukaj._dzielnica_brzeg.options[2].selected=true;}
else if (brzeg[selected_index]=='P') {document.szukaj._dzielnica_brzeg.options[1].selected=true;}
else document.szukaj._dzielnica_brzeg.options[0].selected=true;									
}
//----------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------
function pokaz_warstwe(nazwa){
	nn4 = (document.layers) ? true:false;
	ie4 = (document.all) ? true:false;
	if (nn4) { 
	//document.layers[nazwa].visibility='show'}
    document.layers[nazwa].visibility='hide';
	document.layers[nazwa].display='none';
	}
  else 
	if(ie4) { document.all[nazwa].style.visibility='hidden';
	//document.all[kryteria].style.visibility='visible'; 
	} 
}
//-----------------------------------------------------------------------------------------------------
function hideField(){
	if(document.szukaj.promotion_hidden.value=="0") {
		document.szukaj.promotionDescription.style.visibility="hidden";
		document.all('kryteria').style.display = 'none'; 		
	}
}
function showKategorieZaawansowane(){
	
	if(document.szukaj.kryteria_hidden.value=="0") {
		document.szukaj.kryteria_hidden.value = "1";
		document.szukaj.kryteria.checked = true;
		document.getElementById('kryteria').style.visibility='visible'; 
		document.getElementById('kryteria').style.display = 'inline'; 			
	}
	else if(document.szukaj.kryteria_hidden.value=="1") {
		document.szukaj.kryteria_hidden.value="0";
		document.szukaj.kryteria.checked = false;
		document.getElementById('kryteria').style.visibility='hidden'; 		
		document.getElementById('kryteria').style.display='none'; 		
	}	
	
}
//-------------------------------------------------------------------------------
function check_form_news(){
 var error = 0;
 var error_message = "Nie wpisano wszystkich danych:\n\n";

  if ( document.news.imie.value == '' || document.news.imie.value.length < 2) {
      error_message = error_message + "* Proszę wpisz swoje imię.\n";
      error = 1;
   }
 if ( document.news.nazwisko.value == '' || document.news.nazwisko.value.length < 2) {
      error_message = error_message + "* Proszę wpisz swoje nazwisko.\n";
      error = 1;
   }
   
var Email=/^[0-9a-z.-_]+(@)+[0-9a-z._-]+\.[a-z]{2,3}$/;	
var adres = document.news.adres.value;
if (adres.search(Email) <0 ) {
      error_message = error_message + "* Wpisany adres e-mail ma zły format lub jest nie wpisany.\n";
      error = 1;
    }

if ((error == 1)) {
    alert(error_message);
    return false;
  }else{
	return true;
  }  
	
}
