
function dokosza(min,ile)
{
	if (ile<min)
	{
		alert('Minimalna ilość do zamówienia: '+min+' lub wielokrotność '+min+' szt.');
		return false;
	} else if (ile % min != 0)
	{
		alert('Minimalna ilość do zamówienia: '+min+' lub wielokrotność '+min+' szt.');
		return false;
	}
}

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 sprawdz(adres) {
	if (adres != "") {
		var re = new RegExp("[^@]{1,}[@]{1}[^@.]{1,}[.]{1}[^@]{1,}","gi");
		var wynik = re.test(adres);
		if (wynik == true) {
			return true;
		}
		if (wynik == false) {
			alert("Podaj prawidłowy adres e-mail");
			return false;
		}
	}
}
function rozzwi ()
{
	var myDiv=document.getElementById('zwin');
	myDiv.innerHTML='&#9650';
}

function SendRequest(file,div) {
	var req = mint.Request();
	req.Send(file, div);
	//req.onLoading=document.getElementById(div).innerHTML='<img src="js/loading.gif" style="margin:5px 0 0 30px" />'; 
	mint.fx.Fade(div, 100, 20, 0);
}
function FadeOut(div) {
	mint.fx.Fade(div+'1', 0, 20, 500, null, function () {SendRequest(div+'1',div)});
}
function FadeIn(file,div) {
	mint.fx.Fade(div, 0, 20, 500, null, function () {SendRequest(file,div)});
}
function SendForm(file,pole,div) {
	var req = mint.Request();
	req.AddParam(pole, $(pole).value);
	req.Send(file, div);
}
function FadeOutSave(file,pole,div) {
	mint.fx.Fade(div, 100, 20, 500, null, function () {SendForm(file,pole,div)});
}

function razem (x,y)
{
	var myDiv=document.getElementById('razem');
	myDiv.innerHTML=number_format(x+y, 2, ' ', '.');
}
function razemil (x,y)
{
	var myDiv=document.getElementById('razem');
	myDiv.innerHTML=number_format(x*(1-y), 2, ' ', '.');
}

