var rxpDate = /(^[0-3]?[0-9]\/[0-1]?[0-9]\/[1-2][0-9][0-9][0-9]{3}$)|(^[0-3][0-9][0-1][0-9][1-2][0-9][0-9][0-9]{3}$)/; // (dd/mm/yyyy, d/m/yyyy OR ddmmyyyy)
var rxpTime = /[0-1][0-9]:[0-5][0-9]/; // (hh:mm)
var rxpZip = /(^[0-9]{5}$)/; // Zip
var rxpPhone = /^\([0-9]{3}\)[0-9]{3}\-[0-9]{4}\s?(\w|\.)*$/; // (xxx)xxx-xxxx or (xxx)xxx-xxxx xxxxxxx for extensions
var rxpSSN = /[0-9]{3}\-[0-9]{2}\-[0-9]{4}/; // (xxx-xx-xxxx)


function openWin(sURL, sWinName, iWidth, iHeight, bScroll) {
	window.open (sURL, sWinName, 'width=' + iWidth + ', height=' + iHeight + ', scrollbars=' + bScroll + ', status=0, toolbar=0, location=0, menubar=0, resizable=0, directories=0');
	return (true);
}	

function validarFormConsulta (t) {
var sErrorMsg = '';
var bRet = false;
// Valido el Nombre
if ((t.N.value == '') || (t.N.value == 'Nombre')) {
	sErrorMsg = 'Falta completar el NOMBRE!';
	// t.N.value = '';
}
// Valido el Apellido
if ((t.A.value == '') || (t.A.value == 'Apellido')) {
	sErrorMsg = 'Falta completar el APELLIDO!';
	// t.A.value = '';
}
// Valido el Telefono
if ((t.T.value == '') || (t.T.value == 'Teléfono')) {
	sErrorMsg = 'Falta completar el TELEFONO!';
	// t.N.value = '';
}
// Valido el Mail
if ((t.M.value == '') || !checkEmail(t.M.value)) {
	sErrorMsg = 'EMail incorrecto!';
}
// Valido el Comentario
if ((t.C.value == '') || (t.C.value == 'Comentario')) {
	sErrorMsg = 'Falta completar el COMENTARIO!';
	t.C.value = '';
}
if (sErrorMsg == '') {
	bRet = true;
}
if (bRet) {
	t.submit();
} else {
	alert (sErrorMsg)
}
}

function checkEmail(inputvalue){	
var pattern=/^([a-zA-Z0-9_.-])+@([a-zA-Z0-9_.-])+\.([a-zA-Z])+([a-zA-Z])+/;
if(pattern.test(inputvalue)){         
	return (true);
} else {   
	return (false); 
}
}

