﻿$("#wrapper").corner();

$(document).ready(function () {
    //		    $(document).snowfall({ flakeCount: 200, maxSpeed: 5, flakeColor: '#DAF4FF' });

    function mainmenu() {
        // Oculto los submenus
        $(" #nav ul ").css({ display: "none" });
        // Defino que submenus deben estar visibles cuando se pasa el mouse por encima
        $(" #nav li").hover(function () {
            $(this).find('ul:first:hidden').css({ visibility: "visible", display: "none" }).slideDown(500);
        }, function () {
            $(this).find('ul:first').slideUp(500);
        });
    }
    mainmenu();


    $('#test').weatherfeed(['MXJO0047', 'MXJO0043']).ajaxStop(function () {
        $("div.scrollable").scrollable({
            vertical: true,
            size: 1
        }).circular().navigator().autoscroll({
            interval: 4000
        });
    });
});

function mueveReloj() {
    momentoActual = new Date()
    var momentoZulue = new Date(-1);
    hora = momentoActual.getHours()    
    minuto = momentoActual.getMinutes()
    segundo = momentoActual.getSeconds()

    str_segundo = new String(segundo)
    if (str_segundo.length == 1)
        segundo = "0" + segundo

    str_minuto = new String(minuto)
    if (str_minuto.length == 1)
        minuto = "0" + minuto

    str_hora = new String(hora)
//    if (str_hora.length == 1)
//        hora = "0" + hora

    horaImprimible = hora + " : " + minuto + " : " + segundo
    //Para Zulu
    horazule = hora + 6

    if (horazule > 23)
        horazule = horazule-24 

    horanew = horazule + " : " + minuto + " : "  + segundo

    document.form1.reloj.value = horaImprimible
    document.form1.zulu.value = horanew

    setTimeout("mueveReloj()", 1000)
}

//<!-- Clock in Java Script .. Cameron Gregory http://www.bloke.com/
// http://www.bloke.com/javascript/Clock/
speed=1000;
//len=28;
len=25;
tid = 0;
num=0;
clockA = new Array();
offsetA = new Array();
dd = new Date();

function doDate(x)
{
  for (i=0;i<num;i++) {
    dt = new Date();
  
    if (offsetA[i] != 0) {
      gt = dt.getTime();
      gt = gt + offsetA[i];
      dt.setTime(gt);
      }
  
    clockA[i].date.value = dt.toGMTString();
    }

  tid=window.setTimeout("doDate()",speed);
}

function start() {
  clockA[num] = document.forms["form"+num];
  //offsetA[num] = 0;
//window.alert( (new Date()).getTimezoneOffset());
d = new Date();
  if (navigator.appVersion.substring(0,3) == "2.0")
    offsetA[num] = (d.getTimezoneOffset()*60*1000);
  else
    offsetA[num] = -(d.getTimezoneOffset()*60*1000);
  if (num == 0)  
    tid=window.setTimeout("doDate()",speed);
  num++;
}

function startLong(diff) {
//window.alert("hay" + (new Date()).toGMTString());
  clockA[num] = document.forms["form"+num];
  //offsetA[num] = (diff - dd.getTimezoneOffset())*60*1000;
  offsetA[num] = (diff)*60*1000;
  //offsetA[num] = (-diff)* 60*1000;
  if (num == 0)  
    tid=window.setTimeout("doDate()",speed);
  num++;
}

function cleartid() {
  window.clearTimeout(tid);
}
 
// for some reason on some pages this crashes netscape
function Clock()
{
  document.write('<FORM name=form'+num+'><input name=date size=')
  document.write(len)
  document.write(' value="Clock: Requires Javascript"></FORM>')
  start();
}
 
// for some reason on some pages this crashes netscape
function ServerClock(diff)
{
  document.write('<FORM name=form'+num+'><input name=date size=')
  // we chop the end, because it would be the wrong timezone
  document.write(25);
  //document.write(19)
  document.write(' value="Clock: Javascript"></FORM>')
  startLong(diff);
}
// end-->

function checkDate(sender, args) {
    if (sender._selectedDate < new Date()) {
        alert("You cannot select a day earlier than today!");
        sender._selectedDate = new Date();
        // set the date back to the current date
        sender._textbox.set_Value(sender._selectedDate.format(sender._format))
    }
}



