var dataOk=false
var expdate = new Date();
var num;
var addreturn;
var message=" Copyright © 2000 - 2001 \n www.intermedicina.com \n Reservados todos los derechos.   ";

if (navigator.appVersion.lastIndexOf('Win') != -1)
   {
    addreturn = "\r\n";
    }
else
   {
    addreturn = "\n";
   }


function incluir_texto()
{
alert ('ˇˇATENCION!! La información que se brinda es una información de apoyo pero la responsablilidad de atención del paciente es exclusiva del medico tratante')
}

function rotulo_status(){
var txt="-  Pon aqui el texto que quieras, pon aqui el texto que quieras...  ";
var espera=120;
var refresco=null;
        window.status=txt;
        txt=txt.substring(1,txt.length)+txt.charAt(0);
        refresco=setTimeout("rotulo_status()",espera);
        }



function SetCookie (name, value) {
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : null;
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
document.cookie = name + "=" + escape (value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}

function ValidateRegistracion()
{
if(GetCookie("isacount") == 0)
{
num = 0;
open('Register.html',"a",'scrollbars=yes,resizable=no,width=670,height=490');
}

}

function getCookieVal (offset) {
var endstr = document.cookie.indexOf (";", offset);
if (endstr == -1)
endstr = document.cookie.length;
return unescape(document.cookie.substring(offset, endstr));
}
function GetCookie (name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i, j) == arg)
return getCookieVal (j);
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return 0; 
}


function ValidoColega1(Str)
{
var retorno
if ((document.Register.ComoNosConocio.options[document.Register.ComoNosConocio.selectedIndex].value =="Colega")
    &&( (document.Register.Pais.options[document.Register.Pais.selectedIndex].value =="AR")
   || (document.Register.Pais.options[document.Register.Pais.selectedIndex].value =="PY")
   || (document.Register.Pais.options[document.Register.Pais.selectedIndex].value =="UY")) )
      {   retorno=Str      }
   else
        {     retorno=''      }
return retorno
}

function ValidoColega2()
{
var retorno
if ((document.Register.ComoNosConocio.options[document.Register.ComoNosConocio.selectedIndex].value =="Colega")
    &&( (document.Register.Pais.options[document.Register.Pais.selectedIndex].value =="AR")
   || (document.Register.Pais.options[document.Register.Pais.selectedIndex].value =="PY")
   || (document.Register.Pais.options[document.Register.Pais.selectedIndex].value =="UY")) )
      {   retorno=''      }
   else
        {
         document.Register.ApellidosColega.value='';
         document.Register.NombreColega.value='';
         document.Register.EmailColega.value=''
       }

}

function checkMailColega()
{
if (document.Register.EmailColega.value!='')
   {
   if (contains("@",document.Register.EmailColega.value))
     {  dataOk=true   }
   else
       {
       alert("El e-mail del Colega es incorrecto");
       document.Register.EmailColega.setFocus;
        dataOk= false
       }
   }
else
     {    dataOk=true   }
}

function AbroBases()
{
open('Bases.html',"_blank",'scrollbars=yes,resizable=no,width=470,height=390')
}

function NovaFinestra(pagina)
{
window.open(pagina,"_blank",'scrollbars=yes,resizable=no,width=470,height=390');
     return;
}


function noBlanksAllowed(anyval){
if  (anyval.value == "")   {
      dataOk=false
     alert (anyval.name+" es Obligatorio")
     anyval.focus();
     }
else {
     dataOk=true
     }
}

function contains(onechar,lstring){
retval=false
for(var i=1;i<=lstring.length;i++){
     if (lstring.substring(i,i+1)==onechar){
         retval=true
         break
     }
}
return retval
}

function checkMail(anyval)
{
if (contains("@",anyval))
   {
   dataOk=true
    }
else
     {
    alert("El e-mail es incorrecto")
    dataOk= false;
     }
}

function validoFormRegister()
{
   var expdate = new Date();
   var num;

checkMail(document.Register.Email.value)
if (dataOk==true)
    {
     noBlanksAllowed(document.Register.Apellidos)
}
if (dataOk==true)
    {
     noBlanksAllowed(document.Register.Nombre)

}
if (dataOk==true)
    {
     noBlanksAllowed(document.Register.Matricula)
}


if (dataOk==true)
    {
        expdate.setTime(expdate.getTime() +  (24 * 60 * 60 * 1000 * 31));
        num = 1;
        SetCookie ("isacount", 1, expdate);
        document.Register.fecha.value=new Date()
        document.Register.submit()
}


}

function ValidoFormRegister()
{
   var expdate = new Date();
   var num;

checkMail(document.Register.sEmail.value)
if (dataOk==true)
    {
     noBlanksAllowed(document.Register.sApellido)
}
if (dataOk==true)
    {
     noBlanksAllowed(document.Register.sNombre)

}
if (dataOk==true)
    {
     noBlanksAllowed(document.Register.sMatricula)
}


if (dataOk==true)
    {
        expdate.setTime(expdate.getTime() +  (24 * 60 * 60 * 1000 * 31));
        num = 1;
        SetCookie ("isacount", 1, expdate);
        document.Register.dFecha.value=new Date()
        document.Register.submit()
}


}


function validoFormBusquedas()
{
checkMail(document.BusquedaBibliografica.ProfesionalEmail.value)

if (dataOk==true)
    {
     noBlanksAllowed(document.BusquedaBibliografica.ProfesionalNombre)
}
if (dataOk==true)
    {
     noBlanksAllowed(document.BusquedaBibliografica.ProfesionalApellido)
}

if (dataOk==true)
    {
     noBlanksAllowed(document.BusquedaBibliografica.TemaPrincipal)
}

if (dataOk==true)
    {
     noBlanksAllowed(document.BusquedaBibliografica.PalabrasClaves)
}

if (dataOk==true)
    {
     document.BusquedaBibliografica.fecha.value=new Date()
     document.BusquedaBibliografica.submit()
}


}

function validoFormInterConOpcion()
{
checkMail(document.Interconsultas.ProfesionalEmail.value)

if (dataOk==true)
    {
     noBlanksAllowed(document.Interconsultas.ProfesionalNombre)
}
if (dataOk==true)
    {
     noBlanksAllowed(document.Interconsultas.ProfesionalApellido)
}
if (dataOk==true)
    {
     noBlanksAllowed(document.Interconsultas.Comentario)
}

if (dataOk==true)
    {
     document.Interconsultas.fecha.value=new Date()
     document.Interconsultas.submit()
}


}

function validoFormEmail() 
{ 
checkMail(document.Concurso.Email.value) 
 
if (dataOk==true) 
    {
     noBlanksAllowed(document.Concurso.Nombre)
}
if (dataOk==true) 
    { 

     noBlanksAllowed(document.Concurso.Apellidos) 
} 

if (dataOk==true) 
    { 
     noBlanksAllowed(document.Concurso.Pais) 
} 
 
if (dataOk==true) 
    { 
     document.Concurso.submit() 
} 
 
 
}

function AbroRevista()
{
var retorno
if (document.Revistas.liste1.options[document.Revistas.liste1.selectedIndex].value =="" )
   {
   alert('Por favor seleccione una opción');
   retorno=false;
   }
else
   {
   open(document.Revistas.liste1.options[document.Revistas.liste1.selectedIndex].value,"_blank");
   retorno=true;
   }
return retorno
}


function SugerirPagina()
{
open('SugerirEstaPagina.html',"a",'scrollbars=yes,resizable=no,width=420,height=390');
}


function validoFormSugerirEstaPagina()
{
checkMail(document.SugerirEstaPagina.SuEmail.value)

if (dataOk==true)
    {
     noBlanksAllowed(document.SugerirEstaPagina.SuNombre)
}
if (dataOk==true)
    {
     noBlanksAllowed(document.SugerirEstaPagina.ColegaNombre)
}

if (dataOk==true)
    {
     checkMail(document.SugerirEstaPagina.ColegaEmail.value)
}

if (dataOk==true)
    {
document.SugerirEstaPagina.fecha.value=new Date()
document.SugerirEstaPagina.submit()

}


}


function click(e) {
    if (document.all) {
    if (event.button == 2) {
    alert(message);
    return false;
    }
    }
    if (document.layers) {
    if (e.which == 3) {
    alert(message);
    return false;
    }
    }
}
if (document.layers) {
    document.captureEvents(Event.MOUSEDOWN);
}
document.onmousedown=click;

function SugerirAvance(NamePage,LocationPage)
{
expdate.setTime(expdate.getTime() +  (24 * 60 * 60 * 1000 * 31));
var ejecutable=SetCookie("isapage",LocationPage,expdate,"")
var ejecutable1=SetCookie("isaname",NamePage,expdate,"")
eval(ejecutable)
eval(ejecutable1)
open('http://www.intermedicina.com/SugerirEsteAvance.html',"a",'scrollbars=yes,resizable=no,width=420,height=390');
}


function validoFormSugerirEsteAvance()
{
checkMail(document.SugerirEsteAvance.SuEmail.value)

if (dataOk==true)
    {
     noBlanksAllowed(document.SugerirEsteAvance.SuNombre)
}
if (dataOk==true)
    {
     noBlanksAllowed(document.SugerirEsteAvance.ColegaNombre)
}

if (dataOk==true)
    {
     checkMail(document.SugerirEsteAvance.ColegaEmail.value)
}

if (dataOk==true)
    {
document.SugerirEsteAvance.NameAvance.value=GetCookie("isaname")
document.SugerirEsteAvance.LocationAvance.value=GetCookie("isapage")
document.SugerirEsteAvance.fecha.value=new Date()
document.SugerirEsteAvance.submit()

}


}



