
function validateIfFieldEmpty(id, message)
{
	var field = $(id);
	if (field.value == '')
	{
		Field.activate(field);
		alert(message);
		return false;
	}
	return true;
}

function validateFieldMaxLength(id, maxLength, message)
{
	var field = $(id);
	if (field.value.length > maxLength)
	{
		Field.activate(field);
		alert(message);
		return false;
	}
	return true;
}

function validateIfFieldEmail(id, message)
{
	var regExp = /^[a-z0-9_.\-]+@([a-z0-9_\-]+\.)+[a-z]{2,4}$/i;
	return validateIfFieldMatchRegexp(id, regExp, message)
}

function validateIfFieldMatchRegexp(id, regExp, message)
{
	var field = $(id);
	if (!regExp.test(field.value))
	{
		Field.activate(field);
		alert(message);
		return false;
	}
	return true;
}

function validateIfFieldPositiveInt(element, message)
{
	var regExp = /^[0-9]+$/;
	if (!regExp.test(element.value))
	{
		Field.activate(element);
		alert(message);
		return false;
	}
	return true;
}

function openWindow(url, winName)
{
	window.open(url, winName, "width=700,height=500,resizable=1,location=0,scrollbars=1,top=0,left=0");
}

function makeStart(link)
{
	link.style.behavior='url(#default#homepage)';
	link.setHomePage('http://sohnut.kharkov.ua/');
}

function addToFavorites()
{
	window.external.AddFavorite('http://sohnut.kharkov.ua/','Сохнут-Украина');
}

function clearSelect(selectId)
{
	var options = $(selectId).options;
	for (var i = 0; i < options.length; i++)
	{
		options[i].selected = false;
	}
}

function build_lnk(obj, ref){
   obj.href = ref;
}
