 doc=window.document.forms

 function nic(){}

 function akcja(sel,qs)
 {
   s=sel.options[sel.selectedIndex]
   str=s.value
   if (qs!=undefined) str=str+'&'+qs;
   location.href='default.asp?'+str
 }

function get_radio(r)
{
 try {
	for (i=0;i<r.length;i++)  if (r[i].checked) return r[i].value;
 } catch (err) {}
 return false;
}

function check_radio(r,s)
{
  if (get_radio(r)==false) {alert(s); return false} else return true;
}

function set_menu() {
	try {doc[0].menu.selectedIndex=0} catch (err) {}
}

var _tmp_one_window=false

function pokaz_okno(adr)
{
   if (_tmp_one_window) _tmp_one_window.close()
  _tmp_one_window=window.open(adr,"","width=780px,height=440px, top=0px, left=0px, scrollbars=yes, resizable=yes,menubar=yes")
}


function pokaz_towar(id_sklepu,id_towaru,szablon,w,h,extra)
{
  if (extra==undefined)  extra='';
  if (_tmp_one_window) _tmp_one_window.close()
  _tmp_one_window=window.open('towar.asp?id_sklepu='+id_sklepu+'&id_towaru='+id_towaru+'&szablon='+szablon+extra,'','width='+w+'px,height='+h+'px, top='+(screen.height-h)/2+'px, left='+(screen.width-w)/2+'px, scrollbars=yes, resizable=yes,menubar=no')
}


function pokaz_dokument(id_sklepu,id,w,h)
{
  if (_tmp_one_window) _tmp_one_window.close()
  _tmp_one_window=window.open('dok.asp?id_sklepu='+id_sklepu+'&id='+id,'','width='+w+'px,height='+h+'px, top='+(screen.height-h)/2+'px, left='+(screen.width-w)/2+'px, scrollbars=yes, resizable=no,menubar=no')
}

function spr_email(email){
var wzor=/^[A-Za-z0-9_.\-]+[@][A-Za-z0-9_.\-]+[.][A-Za-z0-9_.\-]+/;

if(!wzor.test(email)){alert("Niepoprawny adres e-mail.");return false}
  else{return true};
}

function skasuj_enter(e)
{
	key = (document.getElementById && !document.all)? e.which:event.keyCode;
	if (key==13) return false;
}


function wson(t)
{
	window.status=t;
}

function wsoff()
{
	window.status='';
}

function przypomnij_haslo_click(){
	alert('1')
}

function frm_ustaw_pole(f,pole,wartosc) {
try {
	p=window.document.getElementById(pole);
	if (wartosc=='') return;

	if (p.type=='checkbox')
		{
			if (wartosc=='on') {p.checked=true;} else {p.checked=false;};
			p.fireEvent("onclick");
		} else
		{
			p.value=wartosc;
		};
} catch (e) {};
}


var JSFSplashWin = null;
function JSFSplashShowImage(url) {
width=height=25;
borderless=false;
ScrWidth = 640; ScrHeight = 480;
if (window.screen) {ScrWidth = window.screen.width; ScrHeight = window.screen.height}
PosX = Math.round((ScrWidth - width-200)/2);
PosY = Math.round((ScrHeight - height-200)/2);
if (JSFSplashWin != null && !document.layers) {JSFSplashWin.close();}
if (borderless && !document.layers) {
JSFSplashWin = window.open("", "splash", "fullscreen=1,toolbar=0,location=0,directories=0,status=0,menubar=0,scrollbars=0,resizable=0");
JSFSplashWin.resizeTo(width+20, height+20);
JSFSplashWin.moveTo(100, 100);
}
else
JSFSplashWin = window.open("", "splash", "menubar=no,toolbar=no,location=no,directories=no,status=no,scrollbars=no,resizable=yes,copyhistory=no,width=" + width + ",height=" + height + ",left=" + 100+ ",top=" + 100);
JSFSplashWin.document.open();
JSFSplashWin.document.clear();
JSFSplashWin.document.write("<html><head><title>Foto</title></head><body scroll='no' onload='window.resizeTo(document.images[0].width+10, document.images[0].height+25)' marginheight=0 marginwidth=0 leftmargin=0 topmargin=0><img src='"+url+"' border='0'></body></html>");
JSFSplashWin.document.close();
JSFSplashWin.focus();
}

function sprawdzDate(dzien, miesiac, rok)
{
  // inwersja na format "amerykanski" :)
  var date_string = miesiac + "/" + dzien + "/" + rok;
  var date_obj    = new Date(date_string);
 
  if(date_obj.getDate()     != dzien || 
     // JavaScript liczy miesiace od 0 do 11
     date_obj.getMonth()    != (miesiac - 1) ||
     date_obj.getFullYear() != rok)
       return false;
  return true;
}

function sprawdzCzas(godzina,minuta)
{
  var time_string = '2000/01/01 '+godzina+":"+minuta;
  var time_obj    = new Date(time_string);

  if(time_obj.getHours()    != godzina || 
     time_obj.getMinutes()    != minuta)
       return false;
  return true;
}

function trim(s) {
    return s.replace( /^\s*/, "" ).replace( /\s*$/, "" );
}

	function showInfo(s)
	{
		oDiv = document.createElement("<div style='z-index:100;position:absolute;display:block;background-color:#d0d0ff;'>");
		oDiv.style.width='600px';
		oDiv.style.height='400px';
		oDiv.style.top='10px';
		oDiv.style.left='10px';
		oDiv.style.paddingTop='180px';
		oDiv.style.textAlign='center';
		oDiv.innerHTML=s;
		if (parseInt(navigator.appVersion)>3) {
		if (navigator.appName=="Netscape") {
			  winW = window.innerWidth;
			  winH = window.innerHeight;
		 }
		 if (navigator.appName.indexOf("Microsoft")!=-1) {
			  winW = document.body.offsetWidth;
			  winH = document.body.offsetHeight;
		 }
		}

		oDiv.style.top=(winH-400)/2+'px';
		oDiv.style.left=(winW-600)/2+'px';
		document.body.insertBefore(oDiv);

		return oDiv;
	}


function validateNip(nip) {
nip+='';
nip=nip.replace(/[^0-9]+/g,'');
if(nip.length<10) return false;
if(nip.length>10) return false;
var controlSum=0;
controlSum+=parseInt(nip.charAt(0))*6;
controlSum+=parseInt(nip.charAt(1))*5;
controlSum+=parseInt(nip.charAt(2))*7;
controlSum+=parseInt(nip.charAt(3))*2;
controlSum+=parseInt(nip.charAt(4))*3;
controlSum+=parseInt(nip.charAt(5))*4;
controlSum+=parseInt(nip.charAt(6))*5;
controlSum+=parseInt(nip.charAt(7))*6;
controlSum+=parseInt(nip.charAt(8))*7;
if((controlSum%11)==parseInt(nip.charAt(9))) {
return true;
} else {
return false;
}
}

function validateKodPocztowy(kod)
{
	var wzor = new RegExp("[0-9]{2}-[0-9]{3}");
	if (wzor.test(kod)) {return true;} else {return false;}
}

