﻿function checkform(clang) {
	var reMail = /^[A-Za-z0-9_.-]+@[A-Za-z0-9_.-]+\.[A-Za-z]{2,3}$/;
	
	if (document.contact_form.name.value == '') {
		document.contact_form.name.focus();
		if(clang == 'bg') alert("Моля въведете име!");
		if(clang == 'en') alert("Please type your name!");
		return(false);
	}
	if ((document.contact_form.email.value == '') || !reMail.exec(document.contact_form.email.value)) {
		if(clang == 'bg') alert("Моля въведете валиден e-mail адрес!");
		if(clang == 'en') alert("Please type valid e-mail address!");
		document.contact_form.email.focus();
		return(false);
	}
	if (document.contact_form.subject.value == '') {
		if(clang == 'bg') alert("Моля въведете тема!");
		if(clang == 'en') alert("Please type subject!");
		document.contact_form.subject.focus();
		return(false);
	}
	if (document.contact_form.message.value == '') {
		if(clang == 'bg') alert("Моля въведете съобщение!");
		if(clang == 'en') alert("Please type message!");
		document.contact_form.message.focus();
		return(false);
	}
	if (document.contact_form.code.value == '') {
		if(clang == 'bg') alert("Моля въведете кода от изображението вдясно!");
		if(clang == 'en') alert("Please type code from image!");
		document.contact_form.code.focus();
		return(false);
	}
	return(true);
}
