function setDateS(data,nform){

        var a = data.split("/");

        document.forms[nform].monthsS.options[a[1]-1].selected=true;

        document.forms[nform].daysS.options[a[0]-1].selected=true;

        for(var i=0;i< document.forms[nform].yearS.options.length;i++){

           if(document.forms[nform].yearS.options[i].value==a[2]){

              document.forms[nform].yearS.options[i].selected=true;

           }

        }

     }



     function setDateI(data,nform){

        var a = data.split("/");

        document.forms[nform].monthsI.options[a[1]-1].selected=true;

        document.forms[nform].daysI.options[a[0]-1].selected=true;

        for(var i=0;i< document.forms[nform].yearI.options.length;i++){

           if(document.forms[nform].yearI.options[i].value==a[2]){

              document.forms[nform].yearI.options[i].selected=true;

           }

        }

     }



     function openC(frm,nform) {

        window.open('calendar.php?frm=' + frm + '&nform=' + nform + '&ln=en','in','scrollbars=yes,status=yes,width=265,height=270,top=200,left=550,menubar=no');

        return false;

     }



     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 lower than current date!");

         return false;

       }

       if (data1 >= data2){

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

         return false;

      }

        return true;

     }
