
function LivePopUp(name) {
        winKat = window.open(name,'_blank',
	'width=620, height=620,toolbar=no, location=no, status=no,\
	menubar=no, scrollbars=no, resizable=yes');          
}

   function odliczaj() {
    s=s-1;
    if (s<1) { sp = '<font color="red">0</font>'; } else { sp=s; };
    if (document.layers) {
     document.layers.sekundy.document.write(sp);
     document.layers.sekundy.document.close();
    } else if (document.all) {
     sekundy.innerHTML="<b>Zostało Ci: <font color=#ffcc00>"+sp+"</font> s.</b>";
    };
    setTimeout("odliczaj()",1000);
   } 
   function odlicz() {
    s = 60;
    odliczaj();
   };


/************************************************
* AUKCJE.JS                                     *
* funkcje JavaScript wykorzystywane w serwisie  *
* by: maj/sk,  ver: 02/06/2002                  *
************************************************/

/**************************************************
* WINLOGUJ(id_klienta)
* Wy¶wietla PopUp z formularzem logowania klienta */
function WinLoguj(id_klienta) {
	if (id_klienta==0) {
		winKat = window.open('http://aukcje.agraart.pl/login.php?act=1','_blank',
		  'width=290, height=280,toolbar=no, location=no, status=no,\
		  menubar=no, scrollbars=no, resizable=no');          
  	} else {
		winKat = window.open('http://aukcje.agraart.pl/login.php?act=3','_blank',
		  'width=290, height=280,toolbar=no, location=no, status=no,\
		  menubar=no, scrollbars=no, resizable=no');          
	}
}

/************************
/* POPUP(name)
/* Okienko bez dodatkow */
function PopUp(name) {
	settings="toolbar=no,location=no,directories=no,";
        settings=settings+"status=no,menubar=no,scrollbars=yes,resizable=yes,";
	settings=settings+"width=450,height=450";
	MyNewWindow=window.open(name,'popup',settings);	
}

/************************
/* POPUPFULL(name)
/* Okienko z dodatkami */
function PopUpFull(name) {
	settings="toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,width=600,height=800";
	MyNewWindow=window.open(name,'popup',settings);	
}


function OpenCertDetails() {
	thewindow = window.open('https://www.thawte.com/cgi/server/certdetails.exe?code=PLAGRA1-1',
	  'anew',config='height=400,width=450,toolbar=no,menubar=no, \
	  scrollbars=yes,resizable=no,location=no,directories=no,status=yes');
}

function WinOpener(adres) {
	opener.location.href = adres;
	self.close();
}

function alarm(link) {
	if (confirm("Czy jestes pewien/pewna ?")) {
		window.location.href=link;
	}
}

/*************************/
/* Detekcja przegladarki */
/*************************/
nn4 = (document.layers) ? true:false;
ie4 = (document.all) ? true:false;

/*************************/
/* Przeladuj cala strone */
/*************************/
function ReDo() {
	if(nn4) {
		if (innerWidth != oknoW+16 || innerHeight != oknoH) {
			location.reload();
		}
	} else location.reload();
}

/*************/
/* Losowanie */
/*************/
function Rand(max) {
	x = max*Math.random()
	x = Math.floor(x);
	return x;
}

/**********************************/
/* Obcina adres do głównej części */
/**********************************/
function BasicHref(adress) {
	adressLength = adress.length;
	newAdress = "";
	if(adressLength > 0) {
		nrCounter = 0;
		lastIndex = adress.lastIndexOf("/");
		if( lastIndex != adressLength && lastIndex!=-1) {
			while (nrCounter <= lastIndex ) {
				newAdress = newAdress + adress.charAt(nrCounter);
				nrCounter++
			}
		}
	}
	return newAdress;
}

/*************************/
/* Wyczysc pasek statusu */
/*************************/
function stClear() {
    	self.status=" ";
    	return true;
}

/************************/
/* Tekst na pasek stanu */
/************************/
function stWrite(text)
{
    	self.status=text;
    	return true;
}

function WinPrzypomnij(do_strony) {
         znak_zap = "[";
         znak_and = "]";
         do_mody = do_strony.replace(/\?/g,znak_zap);
         do_mody = do_mody.replace(/\&/g,znak_and);
         self.location.href= "/cgi-bin/klient?act=8&do_strony="+do_mody;
}

function WinHelp(act,j) {
         if (!j) {j="1"};
         helpIlosc=29;
         helpSize = new Array(helpIlosc+1);
         helpSize[0] = new Array("","");
         helpSize[1] = new Array("420","400");
         helpSize[2] = new Array("320","300");
         helpSize[3] = new Array("320","210");
         helpSize[4] = new Array("320","240");
         helpSize[5] = new Array("320","210");
         helpSize[6] = new Array("","");
         helpSize[7] = new Array("","");
         helpSize[8] = new Array("420","360");
         helpSize[9] = new Array("420","350");
         helpSize[10] = new Array("420","300");
         helpSize[11] = new Array("","");
         helpSize[12] = new Array("","");
         helpSize[13] = new Array("320","180");
         helpSize[14] = new Array("420","380");
         helpSize[15] = new Array("320","280");
         helpSize[16] = new Array("320","320");
         helpSize[17] = new Array("320","140");
         helpSize[18] = new Array("","");
         helpSize[19] = new Array("","");
         helpSize[20] = new Array("","");
         helpSize[21] = new Array("320","320");
         helpSize[22] = new Array("320","110");
         helpSize[23] = new Array("320","170");
         helpSize[24] = new Array("320","190");
         helpSize[25] = new Array("320","210");
         helpSize[26] = new Array("","");
         helpSize[27] = new Array("320","200");
         helpSize[28] = new Array("320","190");
         helpSize[29] = new Array("320","300");
	 helpSize[30] = new Array("320","190");
         helpSize[31] = new Array("400","420");
         helpSize[32] = new Array("350","350");
         helpSize[33] = new Array("350","350");
        winKat = window.open('/cgi-bin/help.cgi?act='+act+'&jezyk=1',
			'_blank','width='+helpSize[act][0]+',height='+helpSize[act][1]+',toolbar=no, \
                         location=no,status=no,menubar=no, \
                         scrollbars=no,resizable=no');          
}

function notEmpty(pole) {
	var str = document.forms[0].elements[pole].value;
        if (str == "") {
		alert("Musisz wypełnić pole "+document.forms[0].elements[pole].name+".");
           	document.forms[0].elements[pole].focus();
	        return false;
        }
        return true;
}

function textLength(pole,max,min) {
  textWpisany=document.forms[0].elements[pole];
  if(textWpisany.value.length>max) {
  	alert("Zbyt długi napis w polu "+textWpisany.name+".");
  	return false;
  }
  if(textWpisany.value.length<min) {
  	alert("Zbyt krótki napis w polu "+textWpisany.name+".");
  	return false;
  }
  return true;
}
  
function isNumber(pole) {
  numberPlace=document.forms[0].elements[pole];
  number=numberPlace.value;
   
  if(!isNaN(number)) {
	return true;
  }

  if(isNaN(number)) {
	for(i=0; i<number.length; i++) {
		if(isNaN(number.charAt(i)) && number.charAt(i)!="," && number.charAt(i)!=".") {
			alert("Napis w polu "+numberPlace.name+" nie jest liczb±.");
			return false;
		}
	}
  return true;
  }
}

function isInteger(pole) {
  numberPlace=document.forms[0].elements[pole];
  number=numberPlace.value;
    
  if(!isNaN(number)) {
	for(i=0; i<number.length; i++) {
		if(number.charAt(i)=="."){
			alert("Napis w polu "+numberPlace.name+" nie jest liczb± całkowit±.");
			return false;
		}
	}
  return true;
  }
alert("Napis w polu "+numberPlace.name+" nie jest liczb±.");
return false;
}

function isBetween(pole,min,max) {
	poleNazwa=document.forms[0].elements[pole].name;
	wartosc=document.forms[0].elements[pole].value;
	if((wartosc > min) && (wartosc < max)) {
	return true;
	}
	alert("Warto¶ć w polu "+poleNazwa+" musi zawierać się pomiędzy "+min+" a "+max+".");
	return false;
}

function isBigger(pole,liczba) {
	poleNazwa=document.forms[0].elements[pole].name;
	wartosc=document.forms[0].elements[pole].value;
	if(wartosc>liczba) {
		return true;
	}
	alert("Warto¶ć w polu "+poleNazwa+" musi być większa niż "+liczba+".");
	return false;
}
 
function testTags(pole) {
   textField=document.forms[0].elements[pole];
   text=textField.value;

  for(i=0; i<text.length; i++) {
    if(text.charAt(i)=="<" || text.charAt(i)==">") {
	alert("Nie wolno wstawiać znaczników HTML w polu "+textField.name+".");
	return false;
    }
  }
return true;
}

function mailCheck(mailAdr) {
  zleZnaki=" /:,;"
  if (mailAdr.value=="") {
	return false;
  }
  for (i=0; i<zleZnaki.length; i++) {
    zlyZnak=zleZnaki.charAt(i)
    if (mailAdr.indexOf(zlyZnak,0) != -1) {
      return false;
    }
  }
  malpaPoz=mailAdr.indexOf("@",0)
  if (malpaPoz == -1 || malpaPoz == 0) {
    return false;
  }
  if (mailAdr.indexOf("@",malpaPoz+1) != -1) {
    return false;
  }
  kropkaPoz=mailAdr.indexOf(".",malpaPoz)
  if (kropkaPoz == -1 || kropkaPoz == malpaPoz+1) {
    return false;
  }
  if (kropkaPoz+3 > mailAdr.length) {
    return false;
  }
  return true;
}

function mailVerify(mail) {
  adresMail=document.forms[0].elements[mail];
  if(!mailCheck(adresMail.value)) {
	alert("Nieprawidłowe wypełnienie pola "+adresMail.name+".");
	return false;
  }
  return true;
}

function czyRowne(pole1,pole2) {
	wartosc1=document.forms[0].elements[pole1];
	wartosc2=document.forms[0].elements[pole2];
	if(wartosc1.value != wartosc2.value) {
		alert("W polach "+wartosc1.name+" i "+wartosc2.name+" musza byc takie wartosci.");
		return false;
	}
	return true;
}
function zapytaj() {
	if (confirm("Czy na pewno chcesz podnie¶ć cenę?")) {
		return true;
	} else {
		return false;
	}
}
