function check_correo(email) {
if (email=="") return 0;
correo=email+"";
if (correo.indexOf("@")==-1)
   {
   alert("Email sin @");
   return -1;
   }
//dividimos en usuario y dominio
aux=correo.split("@");
usuario=aux[0];
dominio=aux[1];

if (usuario=="")
   {
   alert("No se indica usuario en email");
   return -1;
   }
if (dominio=="")
   {
   alert("No se indica dominio en email");
   return -1;
   }

//Verificamos que no hay caracteres prohibidos
var prohibidos=/\\|;|,|:|�|�|�|�|�|�|\"|\'|\(|\)|\s/gi;
if (correo.match(prohibidos))
   {
   alert("Caracteres prohibidos");
   return -1;
   }
var domi_fo=/^.{1,}\.[a-zA-Z]{2,3}$|(info)$/g;
if (!(dominio.match(domi_fo)))
   {
   alert("Dominio incorrecto");
   return -1;
   }


return 0;
}

function enbreve()
   {
    alert("Disponible en breve...");
   }

function contacta()
   {
    var c=new Window(
       {
        className: "alphacube",
        url: '/ayuda3.shtm',
        width: "710px",
        height: "400px",
        
        maximizable: false,
        minimizable: false,
        resizable: false,
        draggable: false,
        destroyOnClose: false,
        keepMultiModalWindow: true
       }
     );
     var id=c.getId();
     c.showCenter(true);

   }

function pasalo()
   {
    var c=new Window(
       {
        className: "alphacube",
        url: '/f_pasalo3.shtm',
        width: "710px",
        height: "400px",
        
        maximizable: false,
        minimizable: false,
        resizable: false,
        draggable: false,
        destroyOnClose: false,
        keepMultiModalWindow: true
       }
     );
     var id=c.getId();
     c.showCenter(true);

   }

function f_envia_login()
   {
       if (document.getElementById("entrada_s_usu").value=="")
          {
          alert("Debe indicar usuario");
          document.getElementById("entrada_s_usu").focus();
          return -1;
          }
       if (document.getElementById("entrada_s_pass").value=="")
          {
          alert("Debe indicar su contraseña");
          document.getElementById("entrada_s_pass").focus();
          return -1;
          }

       document.getElementById("entrada").submit();
   }  

function nologin()
   {
var contenido_login='<div id="capa_login" style="width: 270px;">'+
'<form name="entrada" id="entrada" method="post" action="/privado/index.shtm">'+
'<p class="win_tit">Acceso a tumeves.com</p>'+
'<p class="win_err">La cuenta no existe <br/>o no está activada</p>'+
'<p><span class="win_negrita">E-Mail</span>'+
'<input type="text" name="s_usu" id="entrada_s_usu" size="20"/>'+
'</p>'+
'<p><span class="win_negrita">Contraseña</span>'+
'<input type="password" name="s_pass" id="entrada_s_pass" size="20"/>'+
'</p>'+
'<p style="text-align: center">'+
'<input type="button" value="Entrar" name="b_login" '+
'		onclick="javascript: f_envia_login();"/>'+
' <br/><br/>'+
' <a href="javascript: recupera();">'+
' Recuperar contraseña</a>'+
'</p>'+
'</form>'+
'</div>';

    var a=new Window(
       {
        className: "alphacube",

        width: "280px",
        height: "290px",
        
        maximizable: false,
        minimizable: false,
        resizable: false,
        draggable: false,
        destroyOnClose: false,
        keepMultiModalWindow: true
       }
     );
     var id=a.getId();
     a.setHTMLContent(contenido_login);
     a.showCenter(true);
   }

function f_recupera()
   {
    if (check_correo(document.getElementById("correo").value)==0)
       {
       document.getElementById("frecu").action="./index.shtm?accion=recupera";
       document.getElementById("frecu").submit();
       }
    else
       alert("E-mail incorrecto");   
       
   }
function recupera()
   {
var contenido_login='<div id="capa_login" style="width: 270px;">'+
'<form name="frecu" id="frecu" method="post">'+
'<p class="win_tit">Recordar contraseña</p>'+
'<p><span class="win_negrita">E-Mail</span>'+
'<input type="text" name="correo" id="correo" size="20"/>'+
'</p>'+
'<p style="text-align: center">'+
'<input type="button" value="Enviar" name="b_login" '+
'		onclick="javascript: f_recupera();"/>'+
' <br/><br/>'+
' <a href="javascript: recupera();">'+
' Recuperar contraseña</a>'+
'</p>'+
'</form>'+
'</div>';

    var a=new Window(
       {
        className: "alphacube",

        width: "270px",
        height: "220px",
        
        maximizable: false,
        minimizable: false,
        resizable: false,
        draggable: false,
        destroyOnClose: false,
        keepMultiModalWindow: true
       }
     );
     var id=a.getId();
     a.setHTMLContent(contenido_login);
     a.showCenter(true);
   }


function login()
   {
var contenido_login='<div id="capa_login" style="width: 270px;">'+
'<form name="entrada" id="entrada" method="post" action="/privado/index.shtm">'+
'<p class="win_tit">Acceso a tumeves.com</p>'+
'<p><span class="win_negrita">E-Mail</span>'+
'<input type="text" name="s_usu" id="entrada_s_usu" size="20"'+
'                onkeypress="if (window.event.keyCode == 13) document.getElementById(\'entrada_s_pass\').focus()"'+
'/>'+
'</p>'+
'<p><span class="win_negrita">Contraseña</span>'+
'<input type="password" name="s_pass" id="entrada_s_pass" size="20"'+
'                onkeypress="if (window.event.keyCode == 13) f_envia_login();"'+
'/>'+
'</p>'+
'<p style="text-align: center">'+
'<input type="button" value="Entrar" name="b_login" '+
'		 onclick="javascript:f_envia_login();"/>'+
' <br/><br/>'+
' <a href="javascript: recupera();">'+
' Recuperar contraseña</a>'+
'</p>'+
'</form>'+
'</div>';

    var a=new Window(
       {
        className: "alphacube",

        width: "270px",
        height: "220px",
        
        maximizable: false,
        minimizable: false,
        resizable: false,
        draggable: false,
        destroyOnClose: false,
        keepMultiModalWindow: true
       }
     );
     var id=a.getId();
     a.setHTMLContent(contenido_login);
     a.showCenter(true);
   }

function f_envia_registro()
   {
    if ($F("tipo1")=="candidato")
       window.location="f_candidatos3.shtm";
    else
    if ($F("tipo2")=="empresa")
       window.location="f_empresas3.shtm";
    else
       alert("Debe indicar si es empresa o candidato");   

   }  

function pre_registro()
   {
var contenido_pre_registro='<form name="f" id="f">'+
'<p class="win_tit">Regístrate</p>'+
'<p><span class="textorojo"><b>tumeves.com</b></span> es una plataforma digital basada en videopresentaciones\n\
 dirigida a titulad@s universitari@s y/o estudiantes de últimos cursos \n\
 que estén buscando trabajo y a empresas que busquen personal cualificado.</br> '+
'<p><input type="radio" name="tiporeg" id="tipo1" value="candidato"/>'+
'<b>Candidat@</b><br/>'+
'Publica tu videopresentación, adjunta tu currículum e \n\
 inscríbete en las ofertas que más te interesen.'+

//'Pueden publicar una videopresentación, adjuntar su currículum e '+
//'inscribirse en las ofertas de trabajo publicadas.</p>'+
'<p><input type="radio" name="tiporeg" id="tipo2" value="empresa"/>'+
'<b>Empresa</b><br/>'+
'Publique ofertas de trabajo y conozca a los candidat@s a través de sus videopresentaciones y currículums.'+
//'Pueden publicar ofertas de trabajo, ver las videopresentaciones '+
//'privadas, ver los currículum y acceder a toda la información de los '+
//'estudiantes/titulados.</p>'+
'<p style="text-align: center"><input type="button" value="Registrarse" name="b_registro" id="b_registro" '+
'onclick="javascript: f_envia_registro();" /></p></form>';

    var b=new Window(
       {
        className: "alphacube",
        width: "480px",
        height: "320px",
        recenterAuto: true,
        maximizable: false,
        minimizable: false,
        resizable: false,
        draggable: false,
        destroyOnClose: false,
        keepMultiModalWindow: true
       }
     );
     var id=b.getId();
     b.setHTMLContent(contenido_pre_registro);
     b.showCenter(true);
//     $(id).innerHTML=contenido_login;
   }

function mapasalicante()
            {
                var w=660;
                var h=530;
                var theURL="mapasalicante.php";
                var windowprops ="top=200,left=250,toolbar=no,titlebar=no,location=no,status=nos, menubar=no,scrollbars=no, resizable=no,width=" + w + ",height=" + h;
                window.open(theURL,'',windowprops);
            }

function mapaslaspalmas()
            {
                var w=660;
                var h=530;
                var theURL="mapaslaspalmas.php";
                var windowprops ="top=200,left=250,toolbar=no,titlebar=no,location=no,status=nos, menubar=no,scrollbars=no, resizable=no,width=" + w + ",height=" + h;
                window.open(theURL,'',windowprops);
            }




function mapastenerife()
            {
                var w=660;
                var h=530;
                var theURL="mapastenerife.php";
                var windowprops ="top=200,left=250,toolbar=no,titlebar=no,location=no,status=nos, menubar=no,scrollbars=no, resizable=no,width=" + w + ",height=" + h;
                window.open(theURL,'',windowprops);
            }

function mapasmurcia()
            {
                var w=660;
                var h=530;
                var theURL="mapasmurcia.php";
                var windowprops ="top=200,left=250,toolbar=no,titlebar=no,location=no,status=nos, menubar=no,scrollbars=no, resizable=no,width=" + w + ",height=" + h;
                window.open(theURL,'',windowprops);
            }


function mapas()
            {
                var w=660;
                var h=530;
                var theURL="mapas.php";
                var windowprops ="top=200,left=250,toolbar=no,titlebar=no,location=no,status=nos, menubar=no,scrollbars=no, resizable=no,width=" + w + ",height=" + h;
                window.open(theURL,'',windowprops);
            }




function territorios()
   {
var contenido_pre_registro='<p class="win_tit"; style="text-align: center">'+
'Territorios tumeves.com</p>'+
'<a style="margin-left:120px; color:blue;" href="javascript:mapasalicante();">Ver mapa</a>'+
'<p style="margin-left:50px;"><a class="eslogan" style="text-decoration: none;" href="http://alicante.tumeves.com"><span style="color:#008FE8;">alicante</span>.tumeves.com</a></p>'+
'<a style="margin-left:120px; color:blue;" href="javascript:mapas();">Ver mapa</a>'+
'<p style="margin-left:50px;"><a class="eslogan" style="text-decoration: none;" href="http://castellon.tumeves.com"><span style="color:#CC0066;">castellon</span>.tumeves.com</a></p>'+
'<a style="margin-left:120px; color:blue;" href="javascript:mapaslaspalmas();">Ver mapa</a>'+
'<p style="margin-left:50px;"><a class="eslogan" style="text-decoration: none;" href="http://laspalmas.tumeves.com"><span style="color:#2D6190;">laspalmas</span>.tumeves.com</a></p>'+
'<a style="margin-left:120px; color:blue;" href="javascript:mapasmurcia();">Ver mapa</a><br/>'+
'<p style="margin-left:50px;"><a class="eslogan" style="text-decoration: none;" href="http://murcia.tumeves.com"><span style="color:#C33B29;">murcia</span>.tumeves.com</a></p>'+
'<a style="margin-left:120px; color:blue;" href="javascript:mapastenerife();">Ver mapa</a>'+
'<p style="margin-left:50px;"><a class="eslogan" style="text-decoration: none;" href="http://tenerife.tumeves.com"><span style="color:#FC9A04;">tenerife</span>.tumeves.com</a></p>';





    var b=new Window(
       {
        className: "alphacube",
        width: "320px",
        height: "320px",
        recenterAuto: true,
        maximizable: false,
        minimizable: false,
        resizable: false,
        draggable: false,
        destroyOnClose: false,
        keepMultiModalWindow: true
       }
     );
     var id=b.getId();
     b.setHTMLContent(contenido_pre_registro);
     b.showCenter(true);
//     $(id).innerHTML=contenido_login;
   }


function f_interesado(oferta_id)
   {
       var c=new Window(
       {
        className: "alphacube",

        width: "270px",
        height: "220px",
        
        maximizable: false,
        minimizable: false,
        resizable: false,
        draggable: false,
        destroyOnClose: false,
        keepMultiModalWindow: true
       }
     );
     var ventana_id=c.getId();
     c.setURL("/interesado3.shtm?id="+oferta_id);
     c.showCenter(true);
     c.setCloseCallback(act_menu)
   }

function f_interesado_envia_login()
   {
    if ($F('entrada_s_usu')==null) {alert("Debe especificar el email");return;}
    if ($F('entrada_s_pass')==null) {alert("Debe especificar su contraseña");return;}
    entrada.submit();
   }

function f_masinfo(candidato_id)
   {
       var c=new Window(
       {
        className: "alphacube",

        width: "270px",
        height: "220px",
        
        maximizable: false,
        minimizable: false,
        resizable: false,
        draggable: false,
        destroyOnClose: false,
        keepMultiModalWindow: true
       }
     );
     var ventana_id=c.getId();
     c.setURL("/masinfo3.shtm?id="+candidato_id);
     c.showCenter(true);
     c.setCloseCallback(act_menu)
   }

function f_masinfo_envia_login()
   {
    if ($F('entrada_s_usu')==null) {alert("Debe especificar el email");return;}
    if ($F('entrada_s_pass')==null) {alert("Debe especificar su contraseña");return;}
    entrada.submit();
   }

function act_menu()
   {
    new Ajax.Updater("menu","/menu3.php");
    return true; //asi se cierra la ventana
   }
/*
function fix_validator()
   {
    var headID = document.getElementsByTagName("head")[0];
    var cssNode = document.createElement('link');
    cssNode.type = 'text/css';
    cssNode.rel = 'stylesheet';
    cssNode.href = '/window.js/themes/trampa.css';
    cssNode.media = 'screen';
    headID.appendChild(cssNode);
   }
   
fix_validator();   
*/