 var glob="";

 var hoy = new Date();
 var hoyDia = hoy.getDate();
 var hoyMes = hoy.getMonth();
 var hoyAno = hoy.getFullYear();

 var now = new Date(GetTime(hoyAno,hoyMes,hoyDia)+345600000);
 var nowDia = now.getDate();
 var nowMes = now.getMonth();
 var nowAno = now.getFullYear();

 var two = new Date(GetTime(nowAno,nowMes,nowDia)+691200000);
 var twoDia = two.getDate();
 var twoMes = two.getMonth();
 var twoAno = two.getFullYear();
 var weekdays = new Array(6);
 var months   = new Array(11);
 
 weekdays["0 1"] = "Domingo";    weekdays["0 2"] = "Sunday";       weekdays["0 3"] = "Domingo";
 weekdays["1 1"] = "Lunes";      weekdays["1 2"] = "Monday";       weekdays["1 3"] = "Segunda-feira";
 weekdays["2 1"] = "Martes";     weekdays["2 2"] = "Tuesday";      weekdays["2 3"] = "Terça-feira";
 weekdays["3 1"] = "Miércoles";  weekdays["3 2"] = "Wednesday";    weekdays["3 3"] = "Quarta-feira";
 weekdays["4 1"] = "Jueves";     weekdays["4 2"] = "Thursday";     weekdays["4 3"] = "Quinta-feira";
 weekdays["5 1"] = "Viernes";    weekdays["5 2"] = "Friday";       weekdays["5 3"] = "Sexta-feira";
 weekdays["6 1"] = "Sábado";     weekdays["6 2"] = "Saturday";     weekdays["6 3"] = "Sábado";

 months["0 1"]  = "Enero";       months["0 2"]  = "January";       months["0 3"] = "Janeiro";
 months["1 1"]  = "Febrero";     months["1 2"]  = "February";      months["1 3"] = "Fevereiro";
 months["2 1"]  = "Marzo";       months["2 2"]  = "March";         months["2 3"] = "Março";
 months["3 1"]  = "Abril";       months["3 2"]  = "April";         months["3 3"] = "Abril";
 months["4 1"]  = "Mayo";        months["4 2"]  = "May";           months["4 3"] = "Pode";
 months["5 1"]  = "Junio";       months["5 2"]  = "June";          months["5 3"] = "Junho";
 months["6 1"]  = "Julio";       months["6 2"]  = "July";          months["6 3"] = "Julho";
 months["7 1"]  = "Agosto";      months["7 2"]  = "August";        months["7 3"] = "Agosto";
 months["8 1"]  = "Septiembre";  months["8 2"]  = "September";     months["8 3"] = "Setembro";
 months["9 1"]  = "Octubre";     months["9 2"]  = "October";       months["9 3"] = "Outubro";
 months["10 1"] = "Noviembre";   months["10 2"] = "November";      months["10 3"] = "Novembro";
 months["11 1"] = "Diciembre";   months["11 2"] = "December";      months["11 3"] = "Dezembro";
 var formUsado = "";

 function recalcular() {

      var chr_codigo_descuento = document.fcodigo.chr_codigo_descuento.value;

      if ( !chr_codigo_descuento ) {
           alert('Debe ingresar un código');
           return false;
      }
 }








 function abrirPopup(url,nombre,Largo,Alto,leftPos,topPos,ampliar,scroll,menubar) {

     Alto = Math.abs(Alto)+20;
     Largo = Math.abs(Largo)+20;

     if ( !leftPos && !topPos ) {

          var w = screen.width;
          var h = screen.height;
          var popW = Largo, popH = Alto;
          var leftPos = (w-popW)/2, topPos = (h-popH)/2;
     }

     window.open(url,nombre,"resizable="+(ampliar ? "yes" : "no")+",status=no,menubar="+(menubar ? "yes" : "no")+",scrollbars="+(scroll ? "yes" : "no")+",width="+Largo+",height="+Alto+",left="+leftPos+",top="+topPos+",center=1");
 }

 

 /* Rutina utilizada para corregir las fechas en el panel de busqueda */
 function checkDates(fm) {


        var actual = new Date();

        if ( fm.elements["arrDate_mon"].options[fm.elements["arrDate_mon"].options.selectedIndex].value < actual.getMonth()+1   )
             fm.elements["arrDate_year"].value = actual.getFullYear() + 1;

        if ( fm.elements["arrDate_mon"].options[fm.elements["arrDate_mon"].options.selectedIndex].value >= actual.getMonth()+1   )
             fm.elements["arrDate_year"].value = actual.getFullYear();

        if ( fm.elements["deptDate_mon"].options[fm.elements["deptDate_mon"].options.selectedIndex].value < actual.getMonth()+1   )
             fm.elements["deptDate_year"].value = actual.getFullYear() + 1;

        if ( fm.elements["deptDate_mon"].options[fm.elements["deptDate_mon"].options.selectedIndex].value >= actual.getMonth()+1   )
             fm.elements["deptDate_year"].value = actual.getFullYear();

        var nuevo = new Date(
                fm.elements["arrDate_year"].value,
                fm.elements["arrDate_mon"].options[fm.elements["arrDate_mon"].options.selectedIndex].value-1,
                fm.elements["arrDate_day"].options[fm.elements["arrDate_day"].options.selectedIndex].value
                );

        var arrival = new Date(
                fm.elements["arrDate_year"].value,
                fm.elements["arrDate_mon"].options[fm.elements["arrDate_mon"].options.selectedIndex].value-1,
                fm.elements["arrDate_day"].options[fm.elements["arrDate_day"].options.selectedIndex].value
                );
        var departure = new Date(
                fm.elements["deptDate_year"].value,
                fm.elements["deptDate_mon"].options[fm.elements["deptDate_mon"].options.selectedIndex].value-1,
                fm.elements["deptDate_day"].options[fm.elements["deptDate_day"].options.selectedIndex].value
                );

        /* Cambio si hace falta */
        if (departure <= arrival) {

                var indexAnio = 0;
                with (nuevo) setDate(nuevo.getDate()+5); //Cambia a 5 dias hacia adelante

                /* Corrijo los indices */
                fm.elements["arrDate_year"].value = arrival.getFullYear();
                fm.elements["arrDate_mon"].options.selectedIndex = arrival.getMonth();
                fm.elements["arrDate_day"].options.selectedIndex = (arrival.getDate()-1);

                //fm.elements["deptDate_year"].options.selectedIndex = indexAnio;
                fm.elements["deptDate_year"].value = nuevo.getFullYear();
                fm.elements["deptDate_mon"].options.selectedIndex = nuevo.getMonth();
                fm.elements["deptDate_day"].options.selectedIndex = (nuevo.getDate()-1);

                /* Establezco las fechas correctas */
                fm.elements["arrDate"].value  = arrival.getDate()+"/"+(arrival.getMonth()+1)+"/"+arrival.getFullYear();
                fm.elements["deptDate"].value = nuevo.getDate()+"/"+(nuevo.getMonth()+1)+"/"+nuevo.getFullYear();

        } else {

                /* Establezco las fechas correctas */
                fm.elements["arrDate"].value  = arrival.getDate()+"/"+(arrival.getMonth()+1)+"/"+arrival.getFullYear();
                fm.elements["deptDate"].value = departure.getDate()+"/"+(departure.getMonth()+1)+"/"+departure.getFullYear();
        }
 }



 function winPopup(url,nombre,largo,alto) {

       var w = screen.width;
       var h = screen.height;

       var popW = largo, popH = alto;
       var leftPos = (w-popW)/2, topPos = (h-popH)/2;

       window.open( url , nombre ,"width="+largo+",height="+alto+",status=0,top="+topPos+",left="+leftPos);
 }

 function GetTime(Ano,Mes,Dia) {
       var dat = new Date(Ano,Mes,Dia,0,0,0);
       var timesp = convTimeEsp(dat);
       return timesp;
 }

 function convTimeEsp(d) {
       var tp = (d.getTime())-(d.getTimezoneOffset())*60;
       return tp;
 }




 function valForm(fm) {

       var arrDia = fm.elements["arrDate_day"].options.selectedIndex+1;
       var arrMes = fm.elements["arrDate_mon"].options.selectedIndex;
       var arrAno = fm.elements["arrDate_year"].value;

       var deptDia = fm.elements["deptDate_day"].options.selectedIndex+1;
       var deptMes = fm.elements["deptDate_mon"].options.selectedIndex;
       var deptAno = fm.elements["deptDate_year"].value;



       var timeArr = new Date(arrAno,arrMes,arrDia);
       var timeDept = new Date(deptAno,deptMes,deptDia);
       var ahora = new Date(); //No es lo mas prolijo pero ... es la salida rapida
       var timeNow = new Date(ahora.getFullYear(), ahora.getMonth(), ahora.getDate());

       if (timeDept <= timeArr) { //Actualizacion
            alert (lang['FechaMal1']);
            return false;

       } else if ((timeArr < timeNow) || (timeDept < timeNow)) {
            alert (lang['FechaMal2']);
            return false;
       }



       return true;
 }

 function setD(setDesde) {

       fm.desde.value = setDesde;
       fm.submit();
 }

  function setDS(setDesde) {

       formsiguiente.desde.value = setDesde;
       formsiguiente.submit();
 }

 function x() {}
