function isEmail(str) {
  // are regular expressions supported?
  var supported = 0;
  if (window.RegExp) {
    var tempStr = "a";
    var tempReg = new RegExp(tempStr);
    if (tempReg.test(tempStr)) supported = 1;
  }
  if (!supported) 
    return (str.indexOf(".") > 2) && (str.indexOf("@") > 0);
  var r1 = new RegExp("(@.*@)|(\\.\\.)|(@\\.)|(^\\.)");
  var r2 = new RegExp("^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$");
  return (!r1.test(str) && r2.test(str));
}

function forma_validar(theForm)
{
 	var year;
 	if (theForm.empresa.value == "")
  	{
    	alert("Por Favor, Ingrese Nombre de la Empresa!!");
    	theForm.empresa.focus();
    	return (false);
  	}
 	if (theForm.Email.value == "")
  	{
    	alert("Por Favor, Ingrese un email de contacto!!");
    	theForm.Email.focus();
    	return (false);
  	}
	else
	{
		if (!isEmail(theForm.Email.value)) 
		{
			alert("El formato del email no es válido!!");
			theForm.Email.focus();
			return (false);	
		}
	}
	if (theForm.Nit.value == "")
  	{
		alert("Por Favor, Ingrese Nit de la Empresa!!");
		theForm.Nit.focus();
		return (false);
  	}
 	if (theForm.Iss.value == "")
  	{
		alert("Por Favor, Ingrese No patronal ISS de la Empresa!!");
		theForm.Iss.focus();
		return (false);
  	}
 	if (theForm.direccion.value == "")
	{
		alert("Por Favor, Ingrese Direccion de la Empresa!!");
		theForm.direccion.focus();
		return (false);
  	}
 	if (theForm.Telefono.value == "")
  	{
		alert("Por Favor, Ingrese Telefono de la Empresa!!");
		theForm.Telefono.focus();
		return (false);
  	}
	
 	if (theForm.Representante.value == "")
  	{
    	alert("Por Favor, Ingrese Nombre del Representante Legal!!");
    	theForm.Representante.focus();
    	return (false);
  	}
 	if (theForm.Cedula_rep.value == "")
  	{
    	alert("Por Favor, Ingrese Cédula del Representante Legal!!");
    	theForm.Cedula_rep.focus();
    	return (false);
  	}
	else 
	{
		if (isNaN(theForm.Cedula_rep.value))
		{
			alert("Por Favor, la Cédula del Representante Legal debe ser Numérico!!");
			theForm.Cedula_rep.focus();
			return (false);	
		}
	}

 	if (theForm.Jefe_personal.value == "")
  	{
    	alert("Por Favor, Ingrese Nombre del Jefe de Personal!!");
    	theForm.Jefe_personal.focus();
    	return (false);
  	}
 	if (theForm.Cedula_jefe.value == "")
  	{
    	alert("Por Favor, Ingrese Cédula del Jefe de Personal!!");
    	theForm.Cedula_jefe.focus();
    	return (false);
  	}
	else 
	{
		if (isNaN(theForm.Cedula_jefe.value))
		{
			alert("Por Favor, la Cédula del Jefe de Personal debe ser Numérico!!");
			theForm.Cedula_jefe.focus();
			return (false);	
		}
	}
 	if (theForm.Actividad.value == "")
  	{
    	alert("Por Favor, Ingrese la Actividad Económica!!");
    	theForm.Actividad.focus();
    	return (false);
  	}

 	if (theForm.Trabajadores.value == "")
  	{
    	alert("Por Favor, Ingrese Número de Trabajadores!!");
    	theForm.Trabajadores.focus();
    	return (false);
  	}
	else 
	{
		if (isNaN(theForm.Trabajadores.value))
		{
			alert("Por Favor, el Número de Trabajadores debe ser Numérico!!");
			theForm.Trabajadores.focus();
			return (false);	
		}
	}
 	if (theForm.Nomina.value == "")
  	{
    	alert("Por Favor, Ingrese valor de la Nómina!!");
    	theForm.Nomina.focus();
    	return (false);
  	}
	else 
	{
		if (isNaN(theForm.Nomina.value))
		{
			alert("Por Favor, el valor de la Nómina debe ser Numérico!!");
			theForm.Nomina.focus();
			return (false);	
		}
	}
 	if (theForm.Auxilio.value == "")
  	{
    	alert("Por Favor, Ingrese valor del Auxilio!!");
    	theForm.Auxilio.focus();
    	return (false);
  	}
	else 
	{
		if (isNaN(theForm.Auxilio.value))
		{
			alert("Por Favor, el valor del Auxilio debe ser Numérico!!");
			theForm.Auxilio.focus();
			return (false);	
		}
	}
 	if (theForm.Hijos.value == "")
  	{
    	alert("Por Favor, Ingrese Número de hijos menores de 18!!");
    	theForm.Hijos.focus();
    	return (false);
  	}
	else 
	{
		if (isNaN(theForm.Hijos.value))
		{
			alert("Por Favor, el Número de hijos menores de 18 debe ser Numérico!!");
			theForm.Hijos.focus();
			return (false);	
		}
	}

}