// JavaScript Document

function validate_required(field,alerttxt)
{
	with (field)
	{
		if (value==null||value=="")
			{alert(alerttxt);return false}
		else 
			{return true}
	}
}

function equality(field1, field2, alerttxt)
{
	if(field1.value!=field2.value)
		{alert(alerttxt); return false}
	else
		{return true}
}

function validate_form(thisform)
{
	with (thisform)
	{
		if (validate_required(email,"Pole email musi byc wypelnione!")==false)
		  {email.focus();return false}
		if (validate_required(first_name,"Pole imie musi byc wypelnione!")==false)
		  {first_name.focus();return false}
		if (validate_required(last_name,"Pole nazwisko musi byc wypelnione!")==false)
		  {email.focus();return false}
		if (validate_required(password2,"Pole potwierdzenia hasla musi byc wypelnione!")==false)
		  {email2.focus();return false}
		if (validate_required(password,"Pole haslo musi byc wypelnione!")==false)
		  {password.focus();return false}
		if (equality(password, password2, "Podane hasla nie sa identyczne")==false)
			{email2.focus();return false}
	}
	return true
}

function validate_form_submit()
{
	with (document.getElementById('daneForm'))
	{
		if (validate_required(email,"Pole email musi byc wypelnione!")==false)
		  {email.focus();return false}
		if (validate_required(first_name,"Pole imie musi byc wypelnione!")==false)
		  {first_name.focus();return false}
		if (validate_required(last_name,"Pole nazwisko musi byc wypelnione!")==false)
		  {email.focus();return false}
		if (validate_required(password2,"Pole potwierdzenia hasla musi byc wypelnione!")==false)
		  {email2.focus();return false}
		if (validate_required(password,"Pole haslo musi byc wypelnione!")==false)
		  {password.focus();return false}
		if (equality(password, password2, "Podane hasla nie sa identyczne")==false)
			{email2.focus();return false}
	}
	document.daneForm.submit()
}