// ß
function blocktonone(obid){
var t=document.getElementById(obid).style.display;

if(t=='none')
{document.getElementById(obid).style.display='block'}
else{document.getElementById(obid).style.display='none'}
}



imgprefix="b";
imgext=".gif";
imgpath="_img/button/";




buttongif=new Array("l","m","r","h");

function makebutton(txt,adres){

if(adres!=""){
	ooc=" o"
}
else {ooc=""}

td="<table class=buttontb cellspacing=0 cellpadding=0><tr>";
for(i=0;i<buttongif.length-1;i++){
if(i==1){
td+="<td class=bu"+i+" style='background-image: url("+imgpath+imgprefix+buttongif[i]+imgext+")' onmouseover=this.style.backgroundImage='url("+imgpath+""+imgprefix+""+buttongif[3]+""+imgext+")'  onmouseout=this.style.backgroundImage='url("+imgpath+""+imgprefix+""+buttongif[1]+""+imgext+")' "+ooc+"nClick=location.href='"+adres+"'>"+txt+"</td>"; }
else
td+="<td class=bu"+i+" style='background-image: url("+imgpath+imgprefix+buttongif[i]+imgext+")'></td>";
}
td+="</tr></table>";
//buttonhtml="<table align=left class=buttontb cellspacing=0 cellpadding=0><tr>"+td+"</tr></table>"

document.write(td);
}

function niepuste(x){return x>''} 
function ismail(e){return /^[\w\.-]{2,}@[\w\.-]+\.[a-z]{2,5}$/i.test(e)} 

function mniejsze(x){if(x>''){ return x<=dostepnailosc}} 



function validate(f){ 
 var v,i,e ;
 for(i=0;e=f[i++];) 
  if(v=window[e.getAttribute('valid')]) 
   if(!v(e.value)) 
    {alert(e.getAttribute('alert'));e.focus();return 1} 


} 


function dodajdokoszyka(idkarton,ilosc,dostepne,cena,refs,refidkategorie,refsc){
	
	
	
	
	
	
	
	
	if(ilosc==0){alert('Prosimy wpisać ilość');return 0;}
	if(ilosc==''){alert('Prosimy wpisać ilość');return 0;}
	if(ilosc/1>dostepne/1){alert('Ilość musi być mniejsza lub równa '+dostepne);return 0;}
	
	location.href='_tools/zamowienieadd.php?idkarton='+idkarton+'&ilosc='+ilosc+'&dostepne='+dostepne+'&cena='+cena+'&refs='+refs+'&refidkategorie='+refidkategorie+'&refsc='+refsc;
	
	 
	
}


function zmienilosc(idkarton,ilosc,dostepne,cena){
	
	
	
	if(ilosc==0){alert('Prosimy wpisać ilość');return 0;}
	if(ilosc==''){alert('Prosimy wpisać ilość');return 0;}
	if(ilosc/1>dostepne/1){alert('Ilość musi być mniejsza lub równa '+dostepne);return 0;}
	
	location.href='_tools/zamowieniechange.php?idkarton='+idkarton+'&ilosc='+ilosc+'&dostepne='+dostepne+'&cena='+cena;
	
	 
	
}



function chko(ob){
	val=ob.value
	wyr_reg=/(\D*)/g
	strnew=val.replace(wyr_reg,"")
	
	ob.value=strnew
}
