
function wysw(id){
rodzaj = document.getElementById('warunek'+id).value;

	if (rodzaj=='p'){
		document.getElementById(id).style.visibility = 'visible';
		document.getElementById(id).style.display = 'block';
		
		document.getElementById("opis_od"+id).style.visibility = 'visible';
		document.getElementById("opis_do"+id).style.visibility = 'visible';
	}
	else{
		document.getElementById(id).style.display = 'block';
		document.getElementById(id).style.visibility = 'hidden';
		
		document.getElementById("opis_od"+id).style.visibility = 'hidden';
		document.getElementById("opis_do"+id).style.visibility = 'hidden';
	}
}
			

var popUpWin=0;
function pop_wnd(url,w_name,w_width,w_height,w_scroll) {

   if(popUpWin){
    if(!popUpWin.closed) popUpWin.close();
   }

     scr_width = screen.availWidth;
     scr_height = screen.availHeight;
     left_align = eval(scr_width/2)-eval(w_width/2);
     top_align = eval(scr_height/2)-eval(w_height/2);
popUpWin=window.open(""+url+"",""+w_name+"","width="+w_width+",height="+w_height+",left="+left_align+",top="+top_align+",status=yes,scrollbars="+w_scroll+",resizable=1");
}

function getexpirydate(nodays){
	var UTCstring;
	Today = new Date();
	nomilli=Date.parse(Today);
	Today.setTime(nomilli+nodays*24*60*60*1000);
	UTCstring = Today.toUTCString();
	return UTCstring;
}

function setcookie(name,value){
	cookiestring=name+"="+escape(value)+";EXPIRES="+ getexpirydate(365)+";PATH=/";
	document.cookie=cookiestring;
}

function getCookieData(label) {
	  var d = document
	  var labelLen = label.length
	  var cLen = d.cookie.length
	  var i = 0
	  while (i < cLen) {
		 var j = i + labelLen
		 if (d.cookie.substring(i,j) == label) {
			var cEnd = d.cookie.indexOf(";",j)
			if (cEnd == -1) {
				cEnd = d.cookie.length
			}
			return unescape(d.cookie.substring(j+1,cEnd)) // zwraca to jak cos jest
		 }
		 i++
	  }
	  return "puste" // ciasto nic nie ma
   }


function wyslij(){
	document.form.submit();
}


function usun(url, komunikat){
 if (confirm(komunikat)){
     window.location.href=url ;
    }
}


function zamykanieOkna(url){
     window.opener.location.href= url;
     window.close();
}					

function przek(url){
     window.opener.location.href= url;
}					

function zamykanieOknaNoR(){
     window.close();
}

function refresh(wartosc){
   document.getElementById('koszyk').innerHTML=wartosc;
}

function refresh_kosz(wartosc){
   parent.topFrame.document.getElementById('koszyk').innerHTML=wartosc;
}



function alter_kom(komunikat){
     alert(komunikat);
}

function PoprawnyAdr(EmailAdr) {
	ZleZnaki=" /:;,"
	if (EmailAdr=="") {
		return false
	}
	MalpaPoz=EmailAdr.indexOf("@", 0)
	if (MalpaPoz== -1 || MalpaPoz== 0) {
		return false
	}				
	if (EmailAdr.indexOf("@", MalpaPoz+1)!= -1) {
		return false }		
	return true
}


   function Wyslij(form){
      WyslijDane(form);
   }

	function PoprawnaLiczba(PoleCyfrowe,IloscCyfr) {
		if (PoleCyfrowe=="") {
			return false }
		   	for (i=0; i<PoleCyfrowe.length; i++){	
			    if (PoleCyfrowe.charAt(i) < "0") { 
					return false }
				if (PoleCyfrowe.charAt(i) > "9") {
					return false }					
			}	
			return true
	}

	function PoprawnaLiczba_n(PoleCyfrowe,IloscCyfr) {
		if (PoleCyfrowe!="") {
				for (i=0; i<PoleCyfrowe.length; i++){	
			    	if (PoleCyfrowe.charAt(i) < "0") { 
						return false }
					if (PoleCyfrowe.charAt(i) > "9") {
						return false }		
					if (PoleCyfrowe.length!=IloscCyfr) {
						return false }						
					
			  }	
   		}
			return true
	}

	function PoprawnyAdr(EmailAdr) {
		ZleZnaki=" /:;,"
		if (EmailAdr=="") {
			return false 
		}
		MalpaPoz=EmailAdr.indexOf("@", 0)
		if (MalpaPoz== -1 || MalpaPoz== 0) {
			return false
		}				
		if (EmailAdr.indexOf("@", MalpaPoz+1)!= -1) {
			return false }		
		return true
	}

	function PoprawnaTekst(PoleTekstowe) {
		if (PoleTekstowe=="") {
			return false }
			return true
	}
		
	function zaznacz(id){
		  var element=document.getElementById(id)
		  var tablica=element.getElementsByTagName('input')
		  for(var i=0;i<tablica.length;i++)
		   tablica[i].checked=true
	}
	
		
	
	function od_zaznacz(id){
		  var element=document.getElementById(id)
		  var tablica=element.getElementsByTagName('input')
		  for(var i=0;i<tablica.length;i++)
		   tablica[i].checked=false
	}
	
	
	function usunOpcjeListy(obSelect){
	 var indeksy=[],i;
	
	 for(i=0;i<obSelect.options.length;i++)
	    if(obSelect.options[i].text!='-')
	       indeksy[indeksy.length]=i;
	
	  for(i=0;i<indeksy.length;i++)
	    obSelect.options[indeksy[i]-i]=null;
	}
