
   function setCurrentDate(){
	   if(typeof( window.document.checka ) != "undefined"){
		checkin = new Date();
		checkout = new Date();
		checkin.setDate(checkin.getDate()+1);
		checkout.setDate(checkout.getDate()+2);
		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());
	}
  }
  function selectElement(param,testValue){
    for (var i = 0; i < param.length; i++) {
         if (param.options[i].value == testValue) {
            param.options[i].selected = true;
      }
    }
  }
  
  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;
  }


  function openW(){
    if (verifica()){
      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','scrollbars=yes,status=yes,menubar=no,toolbar=yes,resizable=yes,' + str);
      window.document.checka.submit();
    }else{
      return false;
    }
  }

 
