function submitForm(form) {	if (checkIt(form)) {		form.submit();  	}}function checkIt(form) {	//var name = formf.chat_name.value;	var email = form.chat_email.value;	var question = form.question.value;	var lib = form.library.value;	var msg = '';	//Display error message if library hidden field is blank. 	/*	if(lib.length < 1) {		alert("Your library has an error in this form. Please contact the library to alert them to the problem\r\n");		return false;	}	*/	//If e-mail field isn't blank, use emailCheck function to validate e-mail syntax.	if(email.length > 0) {		if (!emailCheck(email, true)) {      			return false;		}	}		if(question.length < 1) {		alert("La consulta debe rellenarse\r\n");		return false;	}	return true;}function emailCheck (emailStr, alertflag) {		var emailPat=/^(.+)@(.+)$/		var specialChars="\\(\\)<>@,;:\\\\\\\"\\.\\[\\]"		var validChars="\[^\\s" + specialChars + "\]"	var quotedUser="(\"[^\"]*\")"	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/	var atom=validChars + '+'			var word="(" + atom + "|" + quotedUser + ")"			var userPat=new RegExp("^" + word + "(\\." + word + ")*$")			var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$")			var matchArray=emailStr.match(emailPat)	if (matchArray==null) {		if (alertflag)			alert("El correo electr\u00F3nico parece incorrecto (comprueba @ y puntos).")		return false	}	var user=matchArray[1]	var domain=matchArray[2]	// See if "user" is valid 	if (user.match(userPat)==null) {		// user is not valid		if (alertflag) 			alert("El correo electr\u00F3nico parece incorrecto (comprueba @ y puntos).")		return false	}	/* if the e-mail address is at an IP address (as opposed to a symbolic	   host name) make sure the IP address is valid. */	var IPArray=domain.match(ipDomainPat)	if (IPArray!=null) {		// this is an IP address		for (var i=1;i<=4;i++) {			if (IPArray[i]>255) {				if (alertflag)					alert("La direcci\u00F3n IP no es correcta.")				return false			}		}		return true	}	// Domain is symbolic name	var domainArray=domain.match(domainPat)	if (domainArray==null) {		if (alertflag)			alert("El correo electr\u00F3nico parece incorrecto (comprueba @ y puntos).")		return false	}		var atomPat=new RegExp(atom,"g")	var domArr=domain.match(atomPat)	var len=domArr.length	musExp = /.museum/	isMus = domain.search(musExp)	if ( ( (domArr[domArr.length-1].length < 2) || (domArr[domArr.length-1].length > 6) ) ||		(domArr[domArr.length-1].length == 5) ||		( (domArr[domArr.length-1].length == 6) && (isMus == -1) ) ) {			// the address must end in a two, three, or four letter word or .museum			if (alertflag) 					alert("El correo electr\u00F3nico parece incorrecto (comprueba @ y puntos).")			return false	}	// Make sure there's a host name preceding the domain.	if (len<2) {		var errStr="El correo electr\u00F3nico parece incorrecto (comprueba @ y puntos)."		if (alertflag) 			alert(errStr)		return false	}	// If we've gotten this far, everything's valid!	return true;}