function emptyEbook(x){	return x == '';}function emailEbook(x){  email_regx = /^[^@]+@[^@]+.[a-z]{2,}$/i;	return !(x.search(email_regx) == -1); }	// Trim all is to check for the validation of leading spaces in the text boxes--By Boopathi	function trimAll( strValue ) 	{		var objRegExp = /^(\s*)$/;		//check for all spaces		if(objRegExp.test(strValue)) 		{			strValue = strValue.replace(objRegExp, '');			if(strValue.length == 0)				return strValue;		}		//check for leading & trailing spaces		objRegExp = /^(\s*)([\W\0]*)(\b\s*$)/;		if(objRegExp.test(strValue)) 		{			//remove leading and trailing whitespace characters			strValue = strValue.replace(objRegExp, '$2');		}		return strValue;	}	function validateEbookForm()	{		$error_count_ebook = 0;						if(emptyEbook(document.getElementById('name').value))		{					document.getElementById('name').className = 'field_error';			$error_count_ebook++;				}				else		{					document.getElementById('name').className = 'field';		}						if(emptyEbook(document.getElementById('email').value))		{					document.getElementById('email').className = 'field_error';			$error_count_ebook++;				}					else if(!emailEbook(document.getElementById('email').value))		{			document.getElementById('email').className = 'field_error';			$error_count_ebook++;		}		else		{					document.getElementById('email').className = 'field';		}						if($error_count_ebook > 0)		{			alert('You have either entered an invalid email address,\nor you have left one or more of the fields in the form blank.\nPlease make the necessary changes.');			}		else		{			document.getElementById('benefits').submit();			} 			}
