 function left(vstr,n) {

   return vstr.substr(0,n);

 }

  function right(vstr,n) {
     return vstr.substr(vstr.length-n,n);
 }

 function SetStatus(varg) {
  	window.status=varg;
  }

 function ClearStatus() {
  	window.status="";
	return true;
  }

 function open_dlgs(vcontent, w, h) {

	wnd=window.open(vcontent,"",'width='+w+',height='+h+', status=1,toolbars=0,scrollbars=1');
	//wnd.document.write(vcontent);
	//wnd.document.close();

 }


 function getfile(vtitle,srcfile) {

  wnd=window.open("","",'width=790 ,height=590 , status=0,toolbars=0,scrollbars=1,resizable=1');
  wnd.document.writeln('<html><head><title>'+vtitle+'</title></head>');
  wnd.document.writeln('<frameset><frame src="'+srcfile+'"></frame></frameset></html>');

 }


 function wind_open(vpath,tit) {

   if (typeof(tit)!="undefined") {
     wnd=window.open("","",'width=700 ,height=600, status=0,toolbars=0,scrollbars=1,resizable=1');
     wnd.document.open();
     wnd.document.writeln('<html><body bgcolor="#FFFFFF"><table height="100%" width="100%"><tr valign="middle"><td align="center"><img src='+vpath+"></td></tr></table></body></html>");
     wnd.document.close();
     wnd.document.title=tit;
   }
   else { window.open(vpath,"",'width=700 ,height=600, status=0,toolbars=0,scrollbars=1,resizable=1'); }
 }


 function CheckandSubmit() {
 
  var mess="";

  if (document.txtboxes.nazwa.value.length==0) 
   mess='Nazwa gabinetu/przychodni nie moÅ¼e byÄ‡ pominiÄ™ta';

  if ((document.txtboxes.ulica.value.length==0) && mess.length==0)
   mess='Nie wpisano danych adresowych: ulica/numer';

  if ((document.txtboxes.miasto.value.length==0) && mess.length==0)
   mess="Nie wpisano adresowych: miasto";

  if ((document.txtboxes.kodpoczt.value.length==0) && mess.length==0)
   mess="Nie wpisano adresowych: kod pocztowy";

  if ((document.txtboxes.telefon.value.length==0) && mess.length==0)
   mess="Nie wpisano adresowych: telefon";

  if ((document.txtboxes.email.value.length==0) && (mess.length==0) && (document.txtboxes.demokonf[1].checked))
   mess="JeÅ¼eli chcieliby PaÅ„stwo otrzymaÄ‡ DEMO ProDentis pocztÄ… elektronicznÄ… konieczne jest podanie poprawnego adresu e-mail";

  if (document.txtboxes.nip.value.length==0 && (mess.length==0) && (document.txtboxes.demokonf[0].checked)) 
   mess='NIP gabinetu/przychodni nie mo¿e byæ pominiÄ™ty';

  if (mess.length>0) {
   window.alert(mess+" - zamÃ³wienie nie zostaÅ‚o wysÅ‚ane");
  } 
   else {
     document.txtboxes.submit();
   }

 }
