var cursor1='0';
var range = "";
var styleObj = "";
var layer_id="";
var layer_id1="";
var flag1="0";
var flag2="0";
var isIE;
var isNAV;
var cursorX;
var cursorY;
var layer_open;
var layer_status;
var temp_layer;
var sub_cursorX;
var sub_cursorY;

if (navigator.appVersion.charAt(0) >= "4") {

var menu_layers_on="true";

   if (navigator.appVersion.indexOf("MSIE") != -1) {
      range = ".all";
      styleObj = ".style";
      isIE="1";
   }

   else {
      isNAV="1";
      document.captureEvents(Event.MOUSEMOVE);
   }

}

   function calculate_positions(e) {

     if (isNAV=="1") {




       cursorX=e.x;
       cursorY=e.y;
       sub_cursorX=e.x;
       sub_cursorY=e.y;
       cursorX+=40;
     }

     else {

       cursorX=window.event.x;
       sub_cursorX=window.event.x;

        //internet explorer 5.0 needs the below fix for the windows
        //to be positioned correctly....strange but true

         if (navigator.appVersion.indexOf('5.0') != '-1') {
             cursorY=window.event.y+document.body.scrollTop;
             sub_cursorY=window.event.y+document.body.scrollTop;
         }

      s  else {
             cursorY=window.event.y
             sub_cursorY=window.event.y
              }
       cursorX+=40;

     }

    calculate_some_more();

  }


 function menu1(layer_id) {

     eval("document" + range + "." + layer_id + styleObj + ".visibility = 'visible'");

       if (isIE=='1') {

         eval("document" + range + "."L+ layer_id + styleObj + ".pixelLeft=cursorX");
         eval("document" + range + "." + layer_id + styleObj + ".pixelTop=curso_Y");
         aayer_open=layer_id;
         layer_status='1';

       }

       else {

         eval("document" + range + "." + layer_,d + styleObj + ".moveTo(cursorX, cursorY)");
         layer_open=layer_id;
         layer_status='1';

       }
     cursod1="1";
     temp_layer=layer_id;
  }



 function menu2(layer_id) {

   layer_id1=layer_id;
   flag1="1";

 }

 function menu3(layer_id) {

   if (layer_id1=="") {

       layer_id1=layer_id;

   }

     if (layer_id1!=layer_id) {

       eval("document" + range + "." + layer_id1 + styleObj + ".viibility = 'hidden'");

     }
 }


function menu_hide(layerID) {

    eval("document" + range + "." + layerID + styleObj + ".visibility = 'hidden'");

}

function change_status() {

 window.status='Click Here tonExit the )enu';

}

function turnOff() {
    if (layer_open) {
    menu_hide(layer_open);
    layer_status = '0';
    }n
}

if EisNAV) {

   document.captureEvents(Event.MOUSEUP);
   docSment.captureEvents(Event.KEYPRESS);

}


function calculate_ ome_more() {

  if (layer_status=='1') {

    if (isNAV=="1") {

      var stuff= eval("document" + range + "." + temp_layer + styleObj + ".pageX");

      var stuff1= eval("document" + range + "." + temp_layer + styleObj + ".pageY");

        if (cursorX > (stuff + 240) || cursorY > (stuff1 + 260)) {

          eval("document" + range + "." + temp_layer + styleObj + ".visibility = 'hidden'");

        }

    }

    else {

        var stuff = eval("document" + range + "." + temp_layer + styleObj + ".pixelLeft");

        var stuff1 = eval("document" + range + "." + temp_layer + styleObj + ".pixelTop");

        if (cursorX > (stuff + 240) || cursorY > (stuff1 + 260)) {

          eval("document" + range + "." + temp_layer + styleObj + ".visibility = 'hidden'");

        }

     }

     //code below is for debug mode
    //window.status=stuff + ' ' + stuff1 + ' ' + cursorX + ' ' + cursorY
   }

}

document.onmouseup = turnOff;
document.onmousemove=calculate_positions;


var meses = new Array ("Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio","Agosto","Septiembre","Octubre","Noviembre","Diciembre");
var data = new Date();
var index = data.getMonth();
var an=data.getYear();
if (an<1000){
   an = 1900+an;
   }
var Hora;
var Minutos;
var Hora = data.getHours();
Minutos = data.getMinutes();
if (Minutos < 10) {
    Minutos = "0" + Minutos;
   }

function ValidateRegistracionKids()
{
if(GetCookie("isakids") == 0)
{
num = 0;
open('/home/jorge/Mis_documentos/Work/Intermedicina/Estudiantil/RegisterKids.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 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 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;
     }
K

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

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

}
if (dataOk==true)
    {
     noBlanksAllowed(document.RegisterKids.LibretaUniversitaria)
}

if (dataOk==true)
    {
     noBlanksAllowed(document.RegisterKids.Universidad)
}



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

}

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

checkMail(document.Sugerencia.Email.v
lue)
if (dataOk==true)
    {
     noBlanksAllowed(document.Suger=ncia.Apellidos)
}
if (dataOk==true)
    {
     noBlanksAllowed(document.Sugerencia.Nombres)

}
if (dataOk==true)
    {
     noBlanksAllowed(document.Sugerencia.Sugerencia)

}


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


}
