function CheckData(checkForm)
{

	if(emptyField(checkForm.shasi))
	{
		checkForm.shasi.value="";
		checkForm.shasi.focus();
		alert('Моля, попълнете задължителните полета!');
		return false;
	}
	
	if(checkForm.broj.value == 0)
	{
		checkForm.broj.value="";
		checkForm.broj.focus();
		alert('Моля, в полето брой въведете число по-голямо от 0!');
		return false;
	}
	else if(IntCheck(checkForm.broj))
	{
		checkForm.broj.value="";
		checkForm.broj.focus();
		alert('Моля, в полето брой въведете коректни данни!');
		return false;
	}
	
	if(emptyField(checkForm.name))
	{
		checkForm.name.value="";
		checkForm.name.focus();
		alert('Моля, попълнете задължителните полета!');
		return false;
	}
	
	if(emptyField(checkForm.family))
	{
		checkForm.family.value="";
		checkForm.family.focus();
		alert('Моля, попълнете задължителните полета!');
		return false;
	}
	
	if(emptyField(checkForm.phone))
	{
		checkForm.phone.value="";
		checkForm.phone.focus();
		alert('Моля, попълнете задължителните полета!');
		return false;
	}
	
	else if(phoneCheck(checkForm.phone))
	{
		checkForm.phone.value="";
		checkForm.phone.focus();
		alert('Моля, въведете валиден телефонен номер!');
		return false;
	}
	
	if(!emptyField(checkForm.mail))
	{
		if(checkEmail(checkForm.mail))
		{
		checkForm.mail.value="";
		checkForm.mail.focus();
		alert('Моля, въведете валиден e-mail адрес!');
		return false;
		}
	}


return true;
}
/*============================================================================*/
function emptyField(fieldObj)
{
	var result = true;

	if(fieldObj.value.length == 0)
	{
	result = true;
	}
	else
	{
		var i, ch;
			for(var i = 0; i < fieldObj.value.length; i++)
			{
				ch = fieldObj.value.charAt(i);
				if(ch != ' ' && ch != '\t')
				{
					result = false;
					break;
				}
			}
	}
	return result;
}
/*============================================================================*/
function checkEmail(fieldObj)
{
var emailExpression = /^[0-9a-zA-Z-\.\_]+@[0-9a-zA-Z-\.]+\.[a-z]{2,3}$/;
var userInput = fieldObj.value;

	if(emailExpression.test(userInput))
		return false;
	else
		return true;

}
/*============================================================================*/
function phoneCheck(fieldObj)
{
var phoneExpression = /^[0-9]{6,13}$/;
var phoneInput = fieldObj.value;

	if(phoneExpression.test(phoneInput))
		return false;
	else
		return true;
}
/*============================================================================*/
function IntCheck(fieldObj)
{
var IntExpression = /^[0-9]{1,11}$/;
var IntInput = fieldObj.value;

	if(IntExpression.test(IntInput))
		return false;
	else
		return true;
}
/*============================================================================*/
function CteareListWithYears(checkForm)
{
	var my_date = new Date();
	var my_year = my_date.getFullYear();
	var start = 1970;
	
	for(i = start; i <= my_year; i++)
	{
		selected_value = i;
		selected_text = i;
		checkForm.year.options[checkForm.year.length] = new Option(selected_text,selected_value);
	}
}
/*============================================================================*/


/*============================================================================*/

