//js

function body_bg()
{
	
x1=screen.width;
y1=screen.height;

x=x1/2;
y=y1/2;
n_x=x-1000;
n_y=y-880;
document.body.style.backgroundPosition=n_x+"px "+n_y+"px";
};

function validate_required(field,alerttxt)
{
with (field)
  {
  if (value==null||value=="")
    {
    alert(alerttxt);return false;
    }
  else
    {
	field.className="";
	
    return true;
    }
  }
};


function validate_email(field,alerttxt)
{
with (field)
  {
  apos=value.indexOf("@");
  dotpos=value.lastIndexOf(".");
  if (apos<1||dotpos-apos<2)
    {alert(alerttxt);return false;}
  else {
	  field.className="";
	  return true;}
  }
};



function walidacja(thisform)
{
with (thisform)
  {
  
  

        if (validate_required(imie,"Imie jest polem wymaganym")==false)
          {
      	imie.className="error";
      	document.getElementById('lb_imie').className="error_label";
      	imie.focus();
      	return false;}	  
      	else {document.getElementById('lb_imie').className="";}
      	
      	
      	if (validate_required(nazwisko,"Nazwisko jest polem wymaganym")==false)
          {
      	nazwisko.className="error";
      	document.getElementById('lb_nazwisko').className="error_label";
      	nazwisko.focus();
      	return false;}
      	else {document.getElementById('lb_nazwisko').className="";}	  
      	
      	
      	if (validate_email(e_mail,"E-mail jest polem wymaganym, podaj poprawny e-mail")==false)
      	{
      	e_mail.className="error";
      	document.getElementById('lb_e_mail').className="error_label";
      	e_mail.focus();
      	return false;}
      	else {document.getElementById('lb_e_mail').className="";}
      	if (validate_required(telefon,"Telefon jest polem wymaganym")==false)
        {
    	telefon.className="error";
    	document.getElementById('lb_telefon').className="error_label";
    	telefon.focus();
    	
    	return false;}
    	else {document.getElementById('lb_telefon').className="";}
      	
      	document.getElementById('wer1').value='11';
      	
      	
      	
      	if(tresc.value==''||tresc.value==null)
      		{
      		tresc.focus();
      		alert('Prosze wypelnic tresc wiadomosci');
      		return false;
      		}
    
  }
};

