$(document).ready(function(){
	
	var errorName;
	var errorPhone;
	var errorEmail;
	
	if (location.href.search("rus") == -1) {
		errorName = 'Please fill in your name and surname.';
		errorPhone = 'Please fill in your phone.';
		errorEmail = 'Please fill in your e-mail.';
	} else {
		errorName = 'Пожалуйста, введите ФИО.';
		errorPhone = 'Пожалуйста, введите телефон.';
		errorEmail = 'Пожалуйста, введите e-mail.';
	}

	$("table.regform td input").focus(function () {
		$(this).parent().siblings().css({'font-weight': 'bold'});
		$(this).css({'border': '2px solid #3366cc'});
	});
	
	$("table.regform td input").blur(function () {
		$(this).parent().siblings().css({'font-weight': 'normal'});
		$(this).css({'border': '1px solid #3399cc'});
	});
	
	$("input[type='submit']").click(function () {
		if ($("input[name='FIO']").attr("value") == '') {
			$("input[type='submit']").after('<font id="error" style="color: red; font-size: 80%; padding-left: 7px;">' + errorName + '</font>');
			$("input[name='FIO']").keypress(function () {
				$("#error").remove();
			});
			return false;
		} else if ($("input[name='email']").attr("value") == '') {
			$("input[type='submit']").after('<font id="error" style="color: red; font-size: 80%; padding-left: 7px;">' + errorEmail + '</font>');
			$("input[name='email']").keypress(function () {
				$("#error").remove();
			});
			return false;
		} else if ($("input[name='telephone']").attr("value") == '') {
			$("input[type='submit']").after('<font id="error" style="color: red; font-size: 80%; padding-left: 7px;">' + errorPhone + '</font>');
			$("input[name='telephone']").keypress(function () {
				$("#error").remove();
			});
			return false;
		} else {
			return true;
		}	
	});
	
});