<!--

function foto(url, awidth, aheight) {
  var title="MARCOM "+url;
  var _left = (screen.width) ? (screen.width - awidth) / 2 : 0;
  var _top = (screen.height) ? (screen.height - aheight) / 2 : 0;

  cfg = 'left='+_left+',top='+_top+',width='+awidth+',height='+aheight+
        ',innerheight='+awidth+',innerwidth='+aheight+
        ',toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=no';

  awin=window.open('', 'foto', cfg);

  awin.document.open();
  awin.document.clear();
  awin.document.writeln("<html><head><title>"+title+"</title></head>");
  awin.document.writeln("<script language=javascript>");
  awin.document.writeln("  function asize() { window.resizeto("+awidth+","+aheight+"); }");
  awin.document.writeln("  function checksize() {");
  //awin.document.writeln("    ");
  awin.document.writeln("    if (document.images[0].complete) {");
  awin.document.writeln("      window.resizeTo(document.images[0].width+32,document.images[0].height+48);");
  //awin.document.writeln("      settimeout('aclose()',500);");
  awin.document.writeln("    } else { asize(); settimeout('checksize()',250); }");
  awin.document.writeln("  }");
  awin.document.writeln("</script>");
  awin.document.writeln("<body oonload='checksize()' style='margin:0; vertical-align:middle; text-align:left; background:white;'>");
  awin.document.writeln("  <a href='javascript:window.opener.focus; window.close();'><img src='"+url+"' border=0 vspace=0 hspace=0></a>");
  awin.document.writeln("</body></html>");
  awin.document.close();
  awin.focus();
}

function picture(url, awidth, aheight) {
  foto('_pix/'+url, awidth, aheight);
}

function gb_picture(Image,imgWidth,imgHeight) {
    var border = 24;
    var img = Image;
    var features;
    var w;
    var h;
    winWidth = (imgWidth<100) ? 100 : imgWidth+border;
    winHeight = (imgHeight<100) ? 100 : imgHeight+border;
    if (imgWidth+border > screen.width) {
        winWidth = screen.width-10;
        w = (screen.width - winWidth)/2;
        features = "scrollbars=yes";      
    } else {
        w = (screen.width - (imgWidth+border))/2;
    }
    if (imgHeight+border > screen.height) {
        winHeight = screen.height-60;
        h = 0;
        features = "scrollbars=yes";      
    } else {
        h = (screen.height - (imgHeight+border))/2 - 20;
    }
    winName = (img.indexOf("t_") == -1) ? img.substr(4,(img.length-8)) : img.substr(6,(img.length-10));
    features = features+',toolbar=no,width='+winWidth+',height='+winHeight+',top='+h+',left='+w;
    theURL = 'http://kyokushin.nysa.pl/guestbook/picture.php?img='+Image;
    popup = window.open(theURL,winName,features);
    popup.focus();  
}

function check_str(astring, acharset) {
  var allgood = true;
  for (i=0; i<astring.length; i++) {
    c = astring.charAt(i);
    for (j=0; j<acharset.length; j++)
      if (c==acharset.charAt(j)) break;
    if (j==acharset.length) { allgood=false; break; }
  }
  return(allgood);
}


function check_orderform() {
  // get payment value
  j=orderform.payment.length; //alert(j)
  for (i=0; i<j; i++) {
    if(orderform.payment[i].checked) 
      var _payment=orderform.payment[i].value;
  }
  // get delivery value
  j=orderform.delivery.length; //alert(j)
  for (i=0; i<j; i++) {
    if(orderform.delivery[i].checked) 
      var _delivery=orderform.delivery[i].value;
  }

  if ( (_payment=="3") && (_delivery!="1") ) {
    alert("Wybrana jest zapłata przy odbiorze. W tej sytuacji musisz wybrać również jako formę dostawy PRZESYŁKĘ POCZTOWˇ.");
    orderform.delivery[1].focus();
    return(false);
  }
  //alert("ok "+_payment+" "+_delivery);
  return(true);
}


function check_orderform_1() {
  var digitstr = "0123456789";
  var alphastr = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
  var alphapolstr = alphastr + "±ćęłńó¶żĽˇĆĘŁŃÓ¦Ż¬";
  var numstr = alphastr + digitstr + "()/-+, ";
  var emailstr = alphapolstr + digitstr + "_-.@";
  var namestr = alphapolstr + "-.' ";
  var streetstr = alphapolstr + digitstr + "-./,'() ";
  var codestr = digitstr + "-";
  var aform = orderform;

  if ( !check_str(aform.forename.value,namestr) || (aform.forename.value=="") ) {
    alert("Proszę podać poprawne imię.");
    aform.forename.focus();
    return(false);
  }
  if ( !check_str(aform.surname.value,namestr) || (aform.surname.value=="") ) {
    alert("Proszę podać poprawne nazwisko.");
    aform.surname.focus();
    return(false);
  }
  if ( !check_str(aform.nip.value,codestr) ) {
    alert("Proszę podać poprawny numer NIP.");
    aform.nip.focus();
    return(false);
  }
  if ( !check_str(aform.street.value,streetstr) || (aform.street.value=="") ) {
    alert("Proszę podać poprawny adres.");
    aform.street.focus();
    return(false);
  }
  if ( !check_str(aform.street_n1.value,numstr) || (aform.street_n1.value=="") ) {
    alert("Proszę podać poprawny numer budynku.");
    aform.street_n1.focus();
    return(false);
  }
  if ( !check_str(aform.street_n2.value,numstr) ) {
    alert("Proszę podać poprawny numer lokalu.");
    aform.street_n2.focus();
    return(false);
  }
  if ( !check_str(aform.city.value,namestr) || (aform.city.value=="") ) {
    alert("Proszę podać poprawn± nazwę miejscowo¶ci.");
    aform.city.focus();
    return(false);
  }
  if ( !check_str(aform.postcode.value,codestr) || (aform.postcode.value=="") ) {
    alert("Proszę podać poprawn± kod pocztowy.");
    aform.postcode.focus();
    return(false);
  }

  if ( !check_str(aform.phone.value,numstr) ) {
    alert("Proszę podać poprawny numer telefonu.");
    aform.phone.focus();
    return(false);
  }
  if ( !check_str(aform.fax.value,numstr) ) {
    alert("Proszę podać poprawny numer faxu.");
    aform.fax.focus();
    return(false);
  }
  if ( !check_str(aform.email.value,emailstr) ) {
    alert("Proszę podać poprawny adres poczty elektronicznej.");
    aform.email.focus();
    return(false);
  }
  if ( !aform.agree.checked ) {
    alert("Proszę zaznaczyć pole \"Wyrażam zgodę na przetwarzanie danych\".");
    aform.agree.focus();
    return(false);
  }
  return(true);
}


// End -->
