function openImg(url,width,height)
{
var ZoomInWindow = window.open("","displayWindow",'width=' + width + ',height=' + height + ',resizable=1,scrollbars=1,menubar=no');
with(ZoomInWindow.document)
  {
	writeln('<html><head><title></title><base href="http://www.warynski.pl/" /></head>')
  writeln('<body topmargin=0 bottommargin=0 leftmargin=0 rightmargin=0 marginheight=0 marginwidth=0 onBlur="window.close();">')
  writeln('<a href="javascript:window.close()"><img src="' + url + '" alt="" border="0" /></a>')
  writeln('</body></html>');
  close();
  }
}
function change(poz){
	var poz = poz;
	for(var i=1; i<20; i++){
		document.getElementById("cel" + i).style.display="none";
		document.getElementById("cel" + poz).style.display="block";
	}
}
function displayWindow(url, width,height) {
        var Win = window.open(url,"displayWindow", 'width=' + width + ',height=' + height + ',resizable=0,scrollbars=yes,menubar=no' );
}

function print_email(user, site) {
  document.write('<a class="news" href=\"mailto:' + user + '@' + site + '\">');
  document.write(user+'@'+site+'</a>');
}

function maxLength1(o,v,m){
  document.getElementById(v).innerHTML=m-
    ((o.value=o.value.substr(0,m)).length);
	}
	
function printWindow(){
  bV = parseInt(navigator.appVersion)
  if (bV >= 4) window.print()
}

function popupWindow(url) {
  window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,width=850,height=500,screenX=150,screenY=150,top=150,left=150')
}

function zmien1 (name)
{
	myDiv = document.getElementById(name);
	myDiv.style.backgroundColor="#FFCFCF";
}
function zmien2 (name)
{
	myDiv = document.getElementById(name);
	myDiv.style.backgroundColor="#EFEFEF";
}
function zmien3 (name)
{
	myDiv = document.getElementById(name);
	myDiv.style.backgroundColor="#DFDFDF";
}

function zaznaczElementy(Od,Do){
	if(Do >= 0)
	{
		for(Od; Od <= Do; Od++)
		{
			zaznaczPole = "check_"+Od;
			document.getElementById(zaznaczPole).checked = true;
		}
	}
}

function odznaczElementy(Od,Do){
	if(Do >= 0)
	{
		for(Od; Od <= Do; Od++)
		{
			zaznaczPole = "check_"+Od;
			document.getElementById(zaznaczPole).checked = false;
		}
	}
}

function none (div)
{
	document.getElementById(div).style.display='none';
}
function block (div)
{
	document.getElementById(div).style.display='block';
}
function zmien (div)
{
	var mydiv=document.GetElementById(div);
	//mydiv.setAttribute('class','button red');
	mydiv.style.color="red";
}

function number_format(number, decimals, dec_point, t_sep)
{
   var intstr;
   var output = '';
   
   if(typeof(decimals) == 'undefined')
      decimals = 2;
      
   if(typeof(dec_point) == 'undefined')
      dec_point = '';
      
   if(typeof(t_sep) == 'undefined')
      t_sep = '';
   
   // czesc calkowita   
   int = parseInt(number);
   
   // czesc ulamkowa
   float = parseInt((parseFloat(number)-int)*Math.pow(10, decimals));
   
   intstr = int+'';
   
   j = intstr.length;
   
   if((i = j%3) != 0)
      output += intstr.substring(0, i);
   
   while(i < j)
   {
      output += dec_point+''+intstr.substring(i, i+3);
      i += 3;
   }
   
   if(float > 0)
      output += t_sep+''+float;
   
   return(output);
}

function cena (proc,cena)
{
	var myDiv=document.getElementById('rabat');
	rabat=cena*(1-proc);
	myDiv.innerHTML=number_format(rabat, 2, ',','.');
}
function ss() {
document.rabaty.submit();
}

function validSpec(id)
{
	var zaz = 0;
	var elements = document.forms[id].elements;
	for (var i = 0;i<elements.length ;i++ )
	{
		if (elements[i].type == "checkbox" && elements[i].name=='trzy[]')
		{
			if (elements[i].checked == true)
			{
				zaz++;
			} else
			{
				elements[i].disabled=false;
			}
		}
	}
	if (zaz>=2)
	{
		for (var i = 0;i<elements.length ;i++ )
		{
			if (elements[i].type == "checkbox" && elements[i].name=='trzy[]')
			{
				if (elements[i].checked == false)
				{
					elements[i].disabled=true;
				}
			}
		}
	}
}