   var browName = navigator.appName;

   var browVersion = parseInt(navigator.appVersion);

   function setCurrentDate(){

      checkin = new Date();

      checkout = new Date();

      checkin.setDate(checkin.getDate()+1);

      checkout.setDate(checkout.getDate()+8);

      selectElement(window.document.checka.daysI,checkin.getDate());

      selectElement(window.document.checka.monthsI,checkin.getMonth()+1);

      selectElement(window.document.checka.yearI,checkin.getFullYear());

      selectElement(window.document.checka.daysS,checkout.getDate());

      selectElement(window.document.checka.monthsS,checkout.getMonth()+1);

      selectElement(window.document.checka.yearS,checkout.getFullYear());

      //setDateAvailCalendar();

   }



   function setDateAvailCalendar() {

      /*

      roomid = window.document.checka.typeRoom.options[window.document.checka.typeRoom.selectedIndex].value;

      selectedMonth =  window.document.checka.monthsI.options[window.document.checka.monthsI.selectedIndex].value;

      selectedYear =  window.document.checka.yearI.options[window.document.checka.yearI.selectedIndex].value;



      if (document.all){

         document.all("frameCalendar").src = "obm22/availabilitycalendars.php?id=1&roomid=" + roomid + "&month=" + selectedMonth + "&year=" + selectedYear;

      }else if (document.getElementsByTagName){

         document.getElementsByTagName("IFRAME")[0].src = "obm22/availabilitycalendars.php?id=1&roomid=" + roomid + "&month=" + selectedMonth + "&year=" + selectedYear;

      }else if (document.layers){

         document.layers["frameCalendar"].src = "obm22/availabilitycalendars.php?id=1&roomid=" + roomid + "&month=" + selectedMonth + "&year=" + selectedYear;

      }

      */

   }



   function selectElement(param,testValue){

      for (var i = 0; i < param.length; i++) {

         if (param.options[i].value == testValue) {

            param.options[i].selected = true;

         }

      }

   }



   function openMR(){

      var width = screen.Width - 50;

      var height = screen.Height - 200;

      var str = "height=" + height + ",innerHeight=" + height;

      str += ",width=" + width + ",innerWidth=" + width;

      if (window.screen) {

         var ah = screen.availHeight - 100;

         var aw = screen.availWidth - 10;

         var xc = (aw - width) / 2;

         var yc = (ah - height) / 2;

         str += ",left=" + xc + ",screenX=" + xc;

         str += ",top=" + yc + ",screenY=" + yc;

      }

      window.open('obm22/checkavail.php?ln=en','obm22','scrollbars=yes,status=yes,menubar=no,toolbar=yes,' + str);

   }



   function openCR(){

      var width = screen.Width - 50;

      var height = screen.Height - 200;

      var str = "height=" + height + ",innerHeight=" + height;

      str += ",width=" + width + ",innerWidth=" + width;

      if (window.screen) {

         var ah = screen.availHeight - 100;

         var aw = screen.availWidth - 10;

         var xc = (aw - width) / 2;

         var yc = (ah - height) / 2;

         str += ",left=" + xc + ",screenX=" + xc;

         str += ",top=" + yc + ",screenY=" + yc;

      }

      window.open('obm22/cancel_res.php?ln=en','obm22','scrollbars=yes,status=yes,menubar=no,toolbar=yes,' + str);

   }



   function verifica() {

      var data1,data2,d,dat1,dat2;

      data1 = new Date();

      data2 = new Date();

      if (window.document.checka.yearI.options[window.document.checka.yearI.selectedIndex].value == "0" ||

         window.document.checka.monthsI.options[window.document.checka.monthsI.selectedIndex].value == "0" ||

         window.document.checka.daysI.options[window.document.checka.daysI.selectedIndex] == "0" ||

         window.document.checka.yearS.options[window.document.checka.yearS.selectedIndex] == "0" ||

         window.document.checka.monthsS.options[window.document.checka.monthsS.selectedIndex] == "0" ||

         window.document.checka.daysS.options[window.document.checka.daysS.selectedIndex] == "0"){

         alert ("Invalid date! Please check.");

         return false;

      }

      d = new Date();

      dc = new Date(d.getFullYear(),d.getMonth(), d.getDate());

      dataC = Date.parse(dc.toUTCString());

      dat1 = new Date(window.document.checka.yearI.options[window.document.checka.yearI.selectedIndex].value, parseInt(window.document.checka.monthsI.options[window.document.checka.monthsI.selectedIndex].value) -1 ,window.document.checka.daysI.options[window.document.checka.daysI.selectedIndex].value);

      dat2 = new Date(window.document.checka.yearS.options[window.document.checka.yearS.selectedIndex].value, parseInt(window.document.checka.monthsS.options[window.document.checka.monthsS.selectedIndex].value) -1 ,window.document.checka.daysS.options[window.document.checka.daysS.selectedIndex].value);

      data1 = Date.parse(dat1.toUTCString());

      data2 = Date.parse(dat2.toUTCString());

      if(dataC > data1){

         alert("'Check-in' date cannot be earlier than current date!");

         return false;

      }

      if (data1 >= data2){

         alert ("'Check-in' date cannot be later than 'Check-out' date");

         return false;

      }

      return true;

   }



   // Checks if browser is Netscape 2.0x since the options array properties don't work with Netscape 2.0x

   function isBrowserSupp() {

      // Get the version of the browser

      version =  parseFloat( navigator.appVersion );

      if ( ( version >= 2.0 ) && ( version < 2.1 ) && ( navigator.appName.indexOf( "Netscape" ) != -1 ) ) {

         return false;

      }else {

         return true;

      }

      return true;

   }



   function isLeapYear( yrStr ) {

      var leapYear = false;

      var year = parseInt( yrStr, 10 );

      if ( year % 4 == 0 ) {

         leapYear = true;

         if( year % 100 == 0 ) {

            leapYear = false;

            if( year % 400 == 0 ) {

               leapYear=true;

            }

         }

      }

      return leapYear;

   }



   function getDaysInMonth( mthIdx, YrStr ) {

      var maxDays = 31

      if( mthIdx == 1 ) {

         if( isLeapYear( YrStr ) ) {

            maxDays=29;

         } else {

            maxDays=28;

         }

      }

      if( mthIdx == 3 || mthIdx == 5 || mthIdx == 8 || mthIdx == 10 ) {

         maxDays=30;

      }

      return maxDays;

   }



   function adjustDate( monthObj, dayObj, yearObj ) {

      var value = 0;

      var mthIdx = monthObj.options.selectedIndex;

      var Dt = dayObj;

      var theYear = yearObj.options[yearObj.options.selectedIndex].value;

      var numDays = getDaysInMonth( mthIdx, theYear );

      if( mthIdx == 1 ) {

         if( Dt.options.selectedIndex + 2 < numDays ) {

            return 0;

         } else {

            if( Dt.options.selectedIndex + 1 > numDays) {

               Dt.options.selectedIndex=numDays - 1;

            }

            if( (Dt.options.selectedIndex + 1) == numDays ) {

               return 1;

            } else {

               return 4;

            }

         }

      }

      if( Dt.options.selectedIndex + 2 < numDays ) {

         value = 0;

      } else {

         if ( Dt.options.selectedIndex + 1 > numDays ) {

            Dt.options.selectedIndex--;

            value = 3;

         } else if ( Dt.options.selectedIndex + 1 == numDays ) {

            value = 2;

         } else {

            value = 4;

         }

      }

      return value;

   }



   function amadChange( inM, inD, inY ) {

      if ( !isBrowserSupp() ) {

         return;

      }

      var res = adjustDate( inM.options.selectedIndex, inD, inY.options[inY.options.selectedIndex].value );

      return;

   }



   function dmddChange( outM, outD, outY ) {

      if ( !isBrowserSupp() ) {

         return;

      }

      adjustDate( outM.options.selectedIndex, outD, outY.options[outY.options.selectedIndex].value );

      return;

   }


