function checkField(theForm, theField, theFieldDisplay, objRegex) {

	objField = eval("document." + theForm + "." + theField);

	if(!objRegex.test(objField.value))  {
		alert ('Por favor, introduce ' + theFieldDisplay);
		objField.select();
		objField.focus();
		return (false);
	}
	return (true);
}

function checkValid(theForm) {
	//Checking if there are any selected categories
	var total = 0;
	var objPatCCEmail = /^([a-zA-Z0-9])+([.a-zA-Z0-9_-])*@([a-zA-Z0-9_-])+(.[a-zA-Z0-9_-]+)+/;
	Check = eval("document." + theForm + ".condiciones");
	
	if (Check.checked) {
		if (checkField (theForm, 'email', ' el E-mail.', objPatCCEmail)) {
			return true;
		}
	} else {
		alert ('Por favor, acepta las condiciones legales.');
		return false;
	}
	return false;
}