<!-- #Include file="mdb.inc" -->

<%
Ingreso = Request("Ingreso")
Usuario = Request("Usuario")
Pass = Request("Pass")
ApellidoNombre = Request("ApellidoNombre")
Empresa = Request("Empresa")
Email = Request("Email")

If Ingreso = "Agregar" then
	Set Dato = CreateObject("ADODB.RecordSet")
	SQL = "SELECT * FROM Mailing WHERE Usuario = '" & Usuario & "'"
	Dato.Open SQL,Base,1,3
	If Dato.Eof Then
		Dato.Close
		SQL = "SELECT * FROM Mailing WHERE Nombre = '" & ApellidoNombre & "'"
		Dato.Open SQL,Base,1,3
		If Dato.Eof then
			Dato.Close
			SQL = "INSERT INTO Mailing (Categoria, Nombre, Mail, Aprobado, Empresa, Usuario, Pass) VALUES ('Contacto WEB', '" & ApellidoNombre & "', '" & Email & "', -1, '" & Empresa & "', '" & Usuario & "', '" & Pass & "')"
			Base.execute SQL
			'response.Redirect("http://www.psicologiamistica.com.ar/richard_moss/0-intro.html" )
			Ingreso = ""
			Usuario = ""
			Pass = ""
			ApellidoNombre = ""
			Empresa = ""
			Email = ""
			%>
			<script language="javascript">
				window.open("http://www.psicologiamistica.com.ar/richard_moss/0-intro.html" , "ventana1" )
			</script>
			<%
			Estado="OK"
			
			
		Else
			%>
			<script language="javascript">
				alert("El Nombre y Apellido ingresado ya existe.");
			</script>
			<%
			Dato.Close
			Estado="NO"
		End If
	Else
		%>
		<script language="javascript">
			alert("El usuario ingresado ya existe. Por favor ingrese otro usuario.");
		</script>
		<%
		Dato.Close
		Estado="NO"
	End If


End If


%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Fundaci&oacute;n Harmon&iacute;a Humanitas</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="estilo.css" rel="stylesheet" type="text/css">
<style type="text/css">
<!--
.style1 {
	font-size: 10px;
	font-family: Verdana, Arial, Helvetica, sans-serif;
	color: #666666;
}
.style3 {font-size: 10px; font-family: Verdana, Arial, Helvetica, sans-serif; color: #990000; font-weight: bold; }
.style4 {font-size: 24px}
-->
</style>
</head>

<body bgcolor="#CCCCCC" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<table width="760" height="100%" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
    <td width="760" height="90" valign="top"> <div align="left">
        <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="760" height="90">
          <param name="movie" value="imagenes/cabezal.swf">
          <param name="quality" value="high">
          <embed src="imagenes/cabezal.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="760" height="90"></embed></object>
      </div></td>
  </tr>
  <tr> 
    <td valign="top"><div align="center">
        <table width="760" height="100%" border="0" align="center" cellpadding="0" cellspacing="0" bordercolor="#FFFFFF">
          <tr valign="top"> 
            <td width="177" background="imagenes/lateral.jpg" bgcolor="#990000"> 
              <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="177" height="218">
                <param name="movie" value="imagenes/menu3.swf">
                <param name="quality" value="high">
                <embed src="imagenes/menu3.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="177" height="218"></embed></object> 
            </td>
            <td width="3" bgcolor="#FFFFFF"><img src="imagenes/separador.jpg" width="3" height="150"></td>
            <td width="580" bgcolor="#FFFFFF"><table width="580" height="100%" border="0" cellpadding="0" cellspacing="0">
                <tr> 
                  <td width="20">&nbsp;</td>
                  <td width="500" valign="top">
				  <form name="form2" action="" style="visibility:hidden">
					<table width="500" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td width="500" align="center" valign="top" class="linea1"><table border="0" cellspacing="5" cellpadding="0">
                          <tr>
                            <td align="right" class="style3 style4">Gracias por registrarse.</td>
                          </tr>
						  </table>
						  </td>
					    </tr>
					</table>
					</form>  
					<form name="form1" action="login_registro.asp?Ingreso=Agregar" method="post" onSubmit="return verificar()">
					<p><font color="#666666" size="1" face="Verdana, Arial, Helvetica, sans-serif"><font color="#990000" size="5"><strong>Registro</strong></font></font></p>
                    <table width="500" border="0" cellspacing="0" cellpadding="0">
                      <tr>
                        <td width="500" align="center" valign="top" class="linea1"><table border="0" cellspacing="5" cellpadding="0">
                          <tr>
                            <td class="style3">&nbsp;</td>
                            <td align="right">&nbsp;</td>
                          </tr>
                          <tr>
                            <td class="style3" align="right">Usuario</td>
                            <td align="left"><label>
                              <input name="Usuario" type="text" class="style1" id="Usuario" value="<%=Usuario%>">
                            </label></td>
                          </tr>
                          <tr>
                            <td class="style3" align="right">Contrase&ntilde;a</td>
                            <td align="left"><label>
                              <input name="Pass" type="password" class="style1" id="Pass" value="<%=Pass%>">
                            </label></td>
                          </tr>
                          <tr>
                            <td class="style3" align="right">Apellido y Nombre</td>
                            <td align="left"><label>
                              <input name="ApellidoNombre" type="text" class="style1" id="ApellidoNombre" value="<%=ApellidoNombre%>" size="40">
                            </label></td>
                          </tr>
                          <tr>
                            <td class="style3" align="right">Empresa</td>
                            <td align="left"><input name="Empresa" type="text" class="style1" id="Empresa" value="<%=Empresa%>" size="40"></td>
                          </tr>
                          <tr>
                            <td class="style3" align="right">e-Mail</td>
                            <td align="left"><input name="Email" type="text" class="style1" id="Email" value="<%=Email%>" size="50"></td>
                          </tr>
                          <tr>
                            <td class="style3">&nbsp;</td>
                            <td align="right">&nbsp;</td>
                          </tr>
                          <tr>
                            <td class="style3">&nbsp;</td>
                            <td align="right"><label>
                              <input name="Submit" type="submit" class="style1" value="ENVIAR">
                            </label></td>
                          </tr>
                          <tr>
                            <td class="style3">&nbsp;</td>
                            <td align="right">&nbsp;</td>
                          </tr>
                        </table></td>
                      </tr>
                    </table>
					</form>
					
					
					
					
					
					
					
                    <p><font color="#999999" size="1" face="Verdana, Arial, Helvetica, sans-serif"><br>
                      <br>
                      <br>
                      <br>
                      <br>
                      </font></p>
                  </td>
                  <td width="30">&nbsp;</td>
                  <td width="30" bgcolor="#990000">&nbsp;</td>
                </tr>
              </table> </td>
          </tr>
        </table>
      </div></td>
  </tr>
</table>
</body>
</html>

<%
if Estado="OK" then
%>
<script language="JavaScript">
	document.form1.style.visibility ='hidden';
	document.form2.style.visibility ='visible';
</script>
<%
End If
%>

<script language="JavaScript">

	

function verificar(){
	if(document.form1.Usuario.value==''){
		alert('Debe llenar el campo Usuario.')
		document.form1.Usuario.focus();
		return false;
	}
	if(document.form1.Pass.value==''){
		alert('Debe llenar el campo Contraseña.')
		document.form1.Pass.focus();
		return false;
	}
	if(document.form1.ApellidoNombre.value==''){
		alert('Debe llenar el campo Apellido y Nombre.')
		document.form1.ApellidoNombre.focus();
		return false;
	}
	if(document.form1.Email.value==''){
		alert('Debe llenar el campo e-Mail.')
		document.form1.Email.focus();
		return false;
	}else{
		var s = document.form1.Email.value;
		var filter=/^[A-Za-z.][A-Za-z0-9_.]*@[A-Za-z0-9_]+\.[A-Za-z0-9_.]+[A-za-z]$/;
		if (filter.test(s)){
		}else{
			alert("La dirección de e-Mail es incorrecta.");
			document.form1.Email.focus();
			return false;
		}
		
	}
}

</script>