 

function Validar_contactenos(theForm)
<!-- Validacion de Formulario INGRESO USUARIO -->
{
	
	 var checkStr = theForm.nombre.value;
  if (checkStr.length==0)
	{
    alert("Ingrese su nombre, por favor.");
    theForm.nombre.focus();
    return (false);
	}	
			if (checkStr.length!=0) {
		if (checkStr.replace(/ /g, '') == '')
		{
			alert("No se aceptan espacios en blanco.");
			theForm.nombre.focus();
			theForm.nombre.select();
			return (false);
			}
		}
	
	 var checkStr = theForm.telefono.value;
	if (checkStr.length==0)
	{
    alert("Ingrese su telefono, por favor.");
    theForm.telefono.focus();
    return (false);
	}	
	
	 var checkStr = theForm.email.value;
  if (checkStr.length==0)
	{
    alert("Ingrese un E-mail, por favor.");
    theForm.email.focus();
    return (false);
	}	
 
 // Validamos el email.
		   oRegEmail = new RegExp ("^([A-Z]|[a-z]|[0-9]|[_]|[-]|[.])+[@]([A-Z]|[a-z]|[0-9]|[_]|[-]|[.]|[;]|[@])+$");
			if (!oRegEmail.test(theForm.email.value)) 
			{
			  alert("Por favor, ingrese una dirección de e-mail válida");
			  theForm.email.focus();
			  return(false);
			}
	
	 

 
			
//*****************  validacion de textarea
theForm.mensaje.required = "true"; 
for (i = 0; i <theForm.elements.length; i++){
if ((theForm.elements[i].type == "textarea") &&  theForm.elements[i].required=="true" && theForm.elements[i].value=='')
{
  alert('Por favor, envie su cometario'); 
		 return (false);
		break;
	}
}
//************************************ 

	 
 return (true);
}

function Validar_consulta(theForm)
{
var checkStr = theForm.razonsocial.value;
if (checkStr.length!=0) {
	if (checkStr.replace(/ /g, '') == '')
	{
		alert("No se aceptan espacios en blanco.");
		theForm.razonsocial.focus();
		theForm.razonsocial.select();
		return (false);
	}
}
	
var checkStr = theForm.razonsocial.value;
  if (checkStr.length==0)
	{
    alert("Ingrese su Nombre , por favor.");
    theForm.razonsocial.focus();
    return (false);
	}	
 var checkStr = theForm.direccion.value;
  if (checkStr.length==0)
	{
    alert("Ingrese su dirección, por favor.");
    theForm.direccion.focus();
    return (false);
	}	
 var checkStr = theForm.telefono.value;
	if (checkStr.length==0)
	{
    alert("Ingrese su telefono, por favor.");
    theForm.telefono.focus();
    return (false);
	}	
 var checkStr = theForm.email.value;
  if (checkStr.length==0)
	{
    alert("Ingrese un E-mail, por favor.");
    theForm.email.focus();
    return (false);
	}	
 
 // Validamos el email.
		   oRegEmail = new RegExp ("^([A-Z]|[a-z]|[0-9]|[_]|[-]|[.])+[@]([A-Z]|[a-z]|[0-9]|[_]|[-]|[.]|[;]|[@])+$");
			if (!oRegEmail.test(theForm.email.value)) 
			{
			  alert("Por favor, ingrese una dirección de e-mail válida");
			  theForm.email.focus();
			  return(false);
			}
			
var checkStr = theForm.mensaje.value;
if (checkStr.length!=0) {
	if (checkStr.replace(/ /g, '') == '')
	{
		alert("No se aceptan espacios en blanco.");
		theForm.mensaje.focus();
		theForm.mensaje.select();
		return (false);
	}
}

//*****************  validacion de textarea
theForm.mensaje.required = "true"; 
for (i = 0; i <theForm.elements.length; i++){
if ((theForm.elements[i].type == "textarea") &&  theForm.elements[i].required=="true" && theForm.elements[i].value=='')
{
  alert('Por favor, envie su cometario'); 
  theForm.mensaje.focus();
		 return (false);
		break;
	}
}
//************************************ 

	 
 return (true);
}

/*************************/
/************************   OPCIONES VER GENERAL **************/ 
/*************************/

 
 
/*************************/
/*************************/
function ENVIAR_MAIL(VER,ENVIAR)
{
if (Validar_contactenos(window.document.FormContact))
{
	window.document.FormContact.enviar.value=ENVIAR;
	window.document.FormContact.ver_opt.value=VER;
// 	window.document.formulario.id_pre.value=CODIGO;
 	 //alert(ENVIAR);
 //alert(VER);
 //alert(CODIGO);
 window.document.FormContact.submit();

}
}

function enviar_consulta(VER,ENVIAR)
{
if (Validar_consulta(window.document.FormContact))
{
	window.document.FormContact.enviar.value=ENVIAR;
	window.document.FormContact.ver_opt.value=VER;
// 	window.document.formulario.id_pre.value=CODIGO;
 //	 alert(ENVIAR);
 //alert(VER);
 //alert(CODIGO);
 window.document.formuFormContactlario.submit();

}
}
