function doSubmit() {
    var form = document.forms[0];
    if (isEmpty(form.name.value)) {
        alert("Please, enter your name");
        form.name.focus();
        return;
    }

    if (isEmpty(form.email.value)) {
        alert("Please, enter your email address");
        form.email.focus();
        return;
    }

    if (!checkEmail(form.email.value)) {
        alert("Entered Email address is invalid");
        form.email.focus();
        return;
    }

    form.submit();
}
function isEmpty(str) {
    return str.replace(/ /, "") == "";
}

function checkEmail(email_value) {
    return (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,4})+$/.test(email_value));
}



/*----blur_form-----*/
function InputPlaceholder (input, value, cssFilled, cssEmpty)
{
	var thisCopy = this

	this.Input = input
	this.Value = value
	this.SaveOriginal = (input.value == value)
	this.CssFilled = cssFilled
	this.CssEmpty = cssEmpty

	this.setupEvent (this.Input, 'focus', function() {return thisCopy.onFocus()})
	this.setupEvent (this.Input, 'blur',  function() {return thisCopy.onBlur()})
	this.setupEvent (this.Input, 'keydown', function() {return thisCopy.onKeyDown()})

	if (input.value == '') this.onBlur();

	return this
}

InputPlaceholder.prototype.setupEvent = function (elem, eventType, handler)
{
	if (elem.attachEvent)
	{
		elem.attachEvent ('on' + eventType, handler)
	}

	if (elem.addEventListener)
	{
		elem.addEventListener (eventType, handler, false)
	}
}

InputPlaceholder.prototype.onFocus = function()
{
	if (!this.SaveOriginal &&  this.Input.value == this.Value)
	{
		this.Input.value = ''
	}
	else
	{
			this.Input.className = ''
	}
}

InputPlaceholder.prototype.onKeyDown = function()
{
	this.Input.className = ''
}

InputPlaceholder.prototype.onBlur = function()
{
	if (this.Input.value == '' || this.Input.value == this.Value)
	{
		this.Input.value = this.Value
		this.Input.className = this.CssEmpty
	}
	else
	{
		this.Input.className = this.CssFilled
	}
}


/*------------------Feedback--------------------*/
function submitFeedback(form) {
    if (isEmpty(form.country.value)) {
        alert("Please, enter your Country");
        form.country.focus();
        return;
    }
    form.submit();
}

