
$(document).ready(function() {

	styleQuotes();
	
});



function styleQuotes()
{
	$('blockquote p').append("<span class=\"quote-close\">&nbsp;</span>");
}

function validateContactForm(_form)
{
	var _errors = '';
	
	if ( _form.Firstname.value.replace(/\s*/,'').length == 0 )
		_errors += " * Please enter your firstname\n";
	
	if ( _form.Lastname.value.replace(/\s*/,'').length == 0 )
		_errors += " * Please enter your lastname\n";

	if ( _form.Company.value.replace(/\s*/,'').length == 0 )
		_errors += " * Please enter your company name\n";

	if ( _form.Email.value.replace(/\s*/,'').length < 5 )
		_errors += " * Please enter your email address\n";
	else if ( ! isValidEmail(_form.Email.value) )
                _errors += " * Please enter a VALID email address\n";

	if ( _form.Telephone.value.replace(/\s*/,'').length == 0 )
		_errors += " * Please enter your telephone\n";

	if ( _form.Message.value.replace(/\s*/,'').length < 5 )
		_errors += " * Please enter your message\n";
					

	if ( _errors == '' )
		return true;
		
	alert("Your request could not be processed due to the following errors:\n\n"+_errors+"\nPlease correct them and try again");
	return false;
}

function validateEniscopeDemoForm(_form)
{
        var _errors = '';

	if ( _form.Name.value.replace(/\s*/,'').length < 2 )
		_errors += " * Please enter your Name\n";

	if ( _form.Email.value.replace(/\s*/,'').length < 5 )
                _errors += " * Please enter your email address\n";
	else if ( ! isValidEmail(_form.Email.value) )
		_errors += " * Please enter a VALID email address\n";

	if ( _errors == '' )
                return true;

	alert("Your request could not be processed due to the following errors:\n\n"+_errors+"\nPlease correct them and try again");
        return false;
}


function isValidEmail(str) 
{
	return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
}
