<!--

function go() { if (self != top) top.location.href = self.location.href; };
setTimeout ("go()", 1000);

function pomoc(plik,szer,wys,op) { 
	PX=0;
	PY=0;
	config='left='+PX+',top='+PY+',width='+szer+',height='+wys+',innerheight='+wys+',innerwidth='+szer+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars='+op+',resizable=0';
	kitekSC='oknopomoc';
	stadion=window.open('pomoc/'+plik,kitekSC,config)
	stadion.focus();
}

function zdalnapomoc(plik,szer,wys,op) {
        PX=0;
        PY=0;
        config='left='+PX+',top='+PY+',width='+szer+',height='+wys+',innerheight='+wys+',innerwidth='+szer+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars='+op+',resizable=0';
        kitekSC='oknopomoc';
        stadion=window.open(plik,kitekSC,config)
        stadion.focus();
}

function noe(formname,nextfield) {
	if(document.all && window.event && window.event.keyCode==13) {
		document.forms[formname].elements[nextfield].focus();
		return false; 
	}
}

function check(formname,chkfield) {
	document.forms[formname].elements[chkfield].checked=!(document.forms[formname].elements[chkfield].checked);
}

function checkHaslo(formname,fieldn) {
    if(!document.forms[formname].elements[fieldn].value.length) {
	alert('Nie podałeś hasła.\n Musisz wpisać swoje hasło.');
	return false;
    }
    return true;
}

function okno(plik,name,szer,wys) {
  config='left=0,top=0,width='+szer+',height='+wys+',innerheight='+wys+',innerwidth='+szer+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no';
  platnosc=window.open(plik,name,config)
    platnosc.focus();
}

function okno2(plik,name,szer,wys) {
  config='left=300,top=100,width='+szer+',height='+wys+',innerheight='+wys+',innerwidth='+szer+',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no';
  asaska=window.open(plik,name,config)
  asaska.focus();
}

function resizer(location,xres,yres) {
  adjx = 10;
  adjy = 30+12;
  ratio = .2;
  lamescape=4.75;
  xresnow = 300;
  yresnow = 300;
  var kitekk;

  if (navigator.appVersion.indexOf("Mac")!=-1 || (document.layers && parseFloat(navigator.appVersion)<lamescape)) {
    lleft=(screen.availWidth/2)-(xres/2);
    ttop=(screen.availHeight/2)-(yres/2);
    if (document.all) {
      xres-=0;
      yres-=0;
    }
    kitekk=window.open(location,'Pop','left='+lleft+',top='+ttop+',width='+(xres)+',height='+(yres+17)+',toolbar=0,status=0,location=0,scrollbars=no');
    return;
  } else if(document.layers) yres+=7;
  xres = xres+adjx;
  yres = yres+adjy;
  location = (location);
  xnew = xresnow+((xres-xresnow)*ratio);
  ynew = yresnow+((yres-yresnow)*ratio);
  setTimeout("resizeIt('"+location+"','"+xres+"','"+yres+"','"+xnew+"','"+ynew+"')",100);
}

function resizeIt(location,xres,yres,xnew,ynew){
  x = xresnow;
  y = yresnow;
  ow=0;
  oh=0;
  if (document.layers) {
    ow=-window.outerWidth+window.innerWidth+2;
    oh=-window.outerHeight+window.innerHeight;
  }
  kitekk.resizeTo(x+ow,y+oh);
  kitekk.moveTo(((screen.availWidth/2)-(xresnow/2)),((screen.availHeight/2)-(yresnow/2)));
  xresnow = xresnow+((xres-xresnow)*ratio)
    yresnow = yresnow+((yres-yresnow)*ratio)
    if (((xresnow-xres) <= .5)&&((xresnow-xres) >= -.5)) {  xnew=Math.floor(xres); ynew=Math.floor(yres); kitekk.resizeTo(xnew+ow,ynew+oh);}		
  if (xnew != xres) setTimeout("resizeIt('"+location+"','"+xres+"','"+yres+"','"+xnew+"','"+ynew+"')",30);
}

function oknoPrezentacja(theURL,winName,features) {
  if(document.all) {
    kitekk=window.open(theURL,winName,features);
    kitekk.focus();
  }
  resizer(theURL,742,427);
}
function attainAge(formname,fday,fmonth,fyear,falcohol,fcigarette,now) {
	var vday = parseInt(document.forms[formname].elements[fday].value);
	var vmonth = parseInt(document.forms[formname].elements[fmonth].value);
	var vyear = parseInt(document.forms[formname].elements[fyear].value);
	if ( !isAdult(vday, vmonth, vyear, now) ){
		document.forms[formname].elements[falcohol].disabled = true; 
		document.forms[formname].elements[falcohol].checked = false;
 		document.forms[formname].elements[fcigarette].disabled = true; 
		document.forms[formname].elements[fcigarette].checked = false;
	}else{
		document.forms[formname].elements[falcohol].disabled = false; 
		document.forms[formname].elements[fcigarette].disabled = false; 
	}

}
function isAdult(birthD, birthM, birthY, now){
	var nowY = parseInt(now.substr(0,4));
    var nowM = parseInt(now.substr(4,2));
    var nowD = parseInt(now.substr(6,2));
	if ( birthY == 0 || birthM == 0 || birthD == 0){
		return false;
	}
	if (nowY < birthY + 18){
		return false;
	}
	if (nowY == birthY +18){
		if (nowM > birthM){
			return true;
		}
		if (nowM < birthM){
			return false;
		}
		// gdy miesiac ten sam porownujemy dni
		if (nowD >= birthD){
			return true;
		} else {
			return false;
		}
	}else{
		// nowY > birthY + 18
		return true;
	}
}
function acceptAlert(acceptField, msg){
	if (!acceptField.checked) {
		alert(msg);
	}
}
//-->

